[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH 2/3] spapr: compute default value of "hpt-max-page
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-ppc] [PATCH 2/3] spapr: compute default value of "hpt-max-page-size" later |
Date: |
Fri, 29 Jun 2018 16:08:22 -0300 |
User-agent: |
Mutt/1.9.2 (2017-12-15) |
On Thu, Jun 28, 2018 at 12:15:14PM +0200, Greg Kurz wrote:
[...]
> @@ -2527,6 +2527,18 @@ static void spapr_machine_init(MachineState *machine)
> QLIST_INIT(&spapr->phbs);
> QTAILQ_INIT(&spapr->pending_dimm_unplugs);
>
> + /* This is for pseries-2.12 and older machine types */
> + if (!smc->default_caps.caps[SPAPR_CAP_HPT_MAXPAGESIZE]) {
> + uint8_t mps;
> +
> + if (kvmppc_hpt_needs_host_contiguous_pages()) {
> + mps = ctz64(qemu_getrampagesize());
> + } else {
> + mps = 34; /* allow everything up to 16GiB, i.e. everything */
> + }
> + smc->default_caps.caps[SPAPR_CAP_HPT_MAXPAGESIZE] = mps;
Initializing class fields on instance init functions is a sign
that the information doesn't belong to the class struct. Can't
this be handled at default_caps_with_cpu()?
> + }
> +
> /* Determine capabilities to run with */
> spapr_caps_init(spapr);
>
> @@ -4103,17 +4115,16 @@ static void
> spapr_machine_2_12_instance_options(MachineState *machine)
> static void spapr_machine_2_12_class_options(MachineClass *mc)
> {
> sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
> - uint8_t mps;
>
> spapr_machine_3_0_class_options(mc);
> SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_12);
>
> - if (kvmppc_hpt_needs_host_contiguous_pages()) {
> - mps = ctz64(qemu_getrampagesize());
> - } else {
> - mps = 34; /* allow everything up to 16GiB, i.e. everything */
> - }
> - smc->default_caps.caps[SPAPR_CAP_HPT_MAXPAGESIZE] = mps;
> + /* We depend on kvm_enabled() to choose a default value for the
> + * hpt-max-page-size capability. Of course we can't do it here
> + * because this is too early and the HW accelerator isn't initialzed
> + * yet. Postpone this to spapr_machine_init().
> + */
> + smc->default_caps.caps[SPAPR_CAP_HPT_MAXPAGESIZE] = 0;
> }
>
> DEFINE_SPAPR_MACHINE(2_12, "2.12", false);
>
--
Eduardo