All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: peter.maydell@linaro.org
Cc: aik@ozlabs.ru, qemu-devel@nongnu.org, npiggin@gmail.com,
	groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [PULL 05/18] spapr: Simplify selection of radix/hash during CAS
Date: Thu,  7 May 2020 15:02:15 +1000	[thread overview]
Message-ID: <20200507050228.802395-6-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20200507050228.802395-1-david@gibson.dropbear.id.au>

From: Greg Kurz <groug@kaod.org>

The guest can select the MMU mode by setting bits 0-1 of byte 24
in OV5 to to 0b00 for hash or 0b01 for radix. As required by the
architecture, we terminate the boot process if any other value
is found there.

The usual way to negotiate features in OV5 is basically ANDing
the bitfield provided by the guest and the bitfield of features
supported by QEMU, previously populated at machine init.

For some not documented reason, MMU is treated differently : bit 1
of byte 24 (the radix/hash bit) is cleared from the guest OV5 and
explicitely set in the final negotiated OV5 if radix was requested.

Since the only expected input from the guest is the radix/hash bit
being set or not, it seems more appropriate to handle this like we
do for XIVE.

Set the radix bit in spapr->ov5 at machine init if it has a chance
to work (ie. power9, either TCG or a radix capable KVM) and rely
exclusively on spapr_ovec_intersect() to set the radix bit in
spapr->ov5_cas.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <158514993621.478799.4204740354545734293.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc/spapr.c       | 1 +
 hw/ppc/spapr_hcall.c | 6 +-----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 785c41d205..167b1216ba 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2837,6 +2837,7 @@ static void spapr_machine_init(MachineState *machine)
     if ((!kvm_enabled() || kvmppc_has_cap_mmu_radix()) &&
         ppc_type_check_compat(machine->cpu_type, CPU_POWERPC_LOGICAL_3_00, 0,
                               spapr->max_compat_pvr)) {
+        spapr_ovec_set(spapr->ov5, OV5_MMU_RADIX_300);
         /* KVM and TCG always allow GTSE with radix... */
         spapr_ovec_set(spapr->ov5, OV5_MMU_RADIX_GTSE);
     }
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index e8ee447537..fb4fdd4a0c 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -1739,9 +1739,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,
         exit(EXIT_FAILURE);
     }
 
-    /* The radix/hash bit in byte 24 requires special handling: */
     guest_radix = spapr_ovec_test(ov5_guest, OV5_MMU_RADIX_300);
-    spapr_ovec_clear(ov5_guest, OV5_MMU_RADIX_300);
 
     guest_xive = spapr_ovec_test(ov5_guest, OV5_XIVE_EXPLOIT);
 
@@ -1786,14 +1784,12 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,
     /* full range of negotiated ov5 capabilities */
     spapr_ovec_intersect(spapr->ov5_cas, spapr->ov5, ov5_guest);
     spapr_ovec_cleanup(ov5_guest);
-    /* Now that processing is finished, set the radix/hash bit for the
-     * guest if it requested a valid mode; otherwise terminate the boot. */
+
     if (guest_radix) {
         if (kvm_enabled() && !kvmppc_has_cap_mmu_radix()) {
             error_report("Guest requested unavailable MMU mode (radix).");
             exit(EXIT_FAILURE);
         }
-        spapr_ovec_set(spapr->ov5_cas, OV5_MMU_RADIX_300);
     } else {
         if (kvm_enabled() && kvmppc_has_cap_mmu_radix()
             && !kvmppc_has_cap_mmu_hash_v3()) {
-- 
2.26.2



  parent reply	other threads:[~2020-05-07  5:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07  5:02 [PULL 00/18] ppc-for-5.1 queue 20200507 David Gibson
2020-05-07  5:02 ` [PULL 01/18] target/ppc: Improve syscall exception logging David Gibson
2020-05-07  5:02 ` [PULL 02/18] spapr: Don't check capabilities removed between CAS calls David Gibson
2020-05-07  5:02 ` [PULL 03/18] ppc/spapr: tweak change system reset helper David Gibson
2020-05-07  5:02 ` [PULL 04/18] ppc/pnv: Add support for NMI interface David Gibson
2020-05-07  5:02 ` David Gibson [this message]
2020-05-07  5:02 ` [PULL 06/18] spapr/cas: Separate CAS handling from rebuilding the FDT David Gibson
2020-05-07  5:02 ` [PULL 07/18] spapr: Drop CAS reboot flag David Gibson
2020-05-07  5:02 ` [PULL 08/18] target/ppc: Enforce that the root page directory size must be at least 5 David Gibson
2020-05-07  5:02 ` [PULL 09/18] target/ppc: Introduce a relocation bool in ppc_radix64_handle_mmu_fault() David Gibson
2020-05-07  5:02 ` [PULL 10/18] target/ppc: Assert if HV mode is set when running under a pseries machine David Gibson
2020-05-07  5:02 ` [PULL 11/18] spapr: Don't allow unplug of NVLink2 devices David Gibson
2020-05-07  5:02 ` [PULL 12/18] target/ppc: Introduce ppc_radix64_xlate() for Radix tree translation David Gibson
2020-05-07  5:02 ` [PULL 13/18] target/ppc: Extend ppc_radix64_check_prot() with a 'partition_scoped' bool David Gibson
2020-05-07  5:02 ` [PULL 14/18] target/ppc: Rework ppc_radix64_walk_tree() for partition-scoped translation David Gibson
2020-05-07  5:02 ` [PULL 15/18] target/ppc: Add support for Radix " David Gibson
2020-05-07  5:02 ` [PULL 16/18] spapr_nvdimm.c: make 'label-size' mandatory David Gibson
2020-05-07  5:02 ` [PULL 17/18] spapr_nvdimm: Tweak error messages David Gibson
2020-05-07  5:02 ` [PULL 18/18] target-ppc: fix rlwimi, rlwinm, rlwnm for Clang-9 David Gibson
2020-05-07  6:00 ` [PULL 00/18] ppc-for-5.1 queue 20200507 no-reply
2020-05-07 13:29 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200507050228.802395-6-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=aik@ozlabs.ru \
    --cc=clg@kaod.org \
    --cc=groug@kaod.org \
    --cc=npiggin@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.