From: David Gibson <david@gibson.dropbear.id.au>
To: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Cc: qemu-ppc@nongnu.org, agraf@suse.de, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH 08/17] target/ppc/POWER9: Add external partition table pointer to cpu state
Date: Fri, 10 Feb 2017 11:11:54 +1100 [thread overview]
Message-ID: <20170210001154.GL27610@umbus.fritz.box> (raw)
In-Reply-To: <1486609108.2498.73.camel@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 5196 bytes --]
On Thu, Feb 09, 2017 at 01:58:28PM +1100, Suraj Jitindar Singh wrote:
> On Wed, 2017-02-01 at 15:09 +1100, David Gibson wrote:
> > On Fri, Jan 13, 2017 at 05:28:14PM +1100, Suraj Jitindar Singh wrote:
> > >
> > > Similarly to how we have an external hpt pointer in the cpu state,
> > > add
> > > an external partition table pointer and update it to point to the
> > > partition table entry in the machine state struct on cpu reset.
> > >
> > > Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
> > As with the previous patch, I don't quite follow what's going on
> > here. It seems to me that if the external HPT is set, that should
> > make the softmmu logic bypass *both* an HPT set by SDR1 (<= POWER8)
> > or
> > an HPT set by the partition table (POWER9). So I'm not sure why we
> > need the dummy partition table entry.
> >
> > To look at it another way, the external HPT is special because it
> > lies
> > outside the guest's address space, but we need its state because the
> > guest can manipulate it via hypercall. For the partition table
> > entry,
> > even if we're minimally modelling the HV parts of the POWER9 MMU,
> > isn't the partition table entry just fixed at startup?
> Similarly this patch will be dropped from the series.
Ok.
> >
> > >
> > > ---
> > > hw/ppc/spapr_cpu_core.c | 12 ++++++++++--
> > > target/ppc/cpu.h | 3 +++
> > > target/ppc/mmu.h | 6 ++++++
> > > target/ppc/mmu_helper.c | 12 ++++++++++++
> > > 4 files changed, 31 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
> > > index 8cc7058..72a7f90 100644
> > > --- a/hw/ppc/spapr_cpu_core.c
> > > +++ b/hw/ppc/spapr_cpu_core.c
> > > @@ -17,6 +17,7 @@
> > > #include "hw/ppc/ppc.h"
> > > #include "target/ppc/mmu-hash64.h"
> > > #include "sysemu/numa.h"
> > > +#include "mmu.h"
> > >
> > > static void spapr_cpu_reset(void *opaque)
> > > {
> > > @@ -34,8 +35,15 @@ static void spapr_cpu_reset(void *opaque)
> > >
> > > env->spr[SPR_HIOR] = 0;
> > >
> > > - ppc_hash64_set_external_hpt(cpu, spapr->htab, spapr-
> > > >htab_shift,
> > > - &error_fatal);
> > > + switch (env->mmu_model) {
> > > + case POWERPC_MMU_3_00:
> > > + ppc64_set_external_patb(cpu, spapr->patb, &error_fatal);
> > > + default:
> > > + /* We assume legacy until told otherwise, thus set HPT
> > > irrespective */
> > > + ppc_hash64_set_external_hpt(cpu, spapr->htab, spapr-
> > > >htab_shift,
> > > + &error_fatal);
> > > + break;
> > > + }
> > > }
> > >
> > > static void spapr_cpu_destroy(PowerPCCPU *cpu)
> > > diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> > > index 0ab49b3..e8b7c06 100644
> > > --- a/target/ppc/cpu.h
> > > +++ b/target/ppc/cpu.h
> > > @@ -77,6 +77,7 @@
> > > #include "exec/cpu-defs.h"
> > > #include "cpu-qom.h"
> > > #include "fpu/softfloat.h"
> > > +#include "mmu.h"
> > >
> > > #if defined (TARGET_PPC64)
> > > #define PPC_ELF_MACHINE EM_PPC64
> > > @@ -1009,6 +1010,8 @@ struct CPUPPCState {
> > > target_ulong sr[32];
> > > /* externally stored hash table */
> > > uint8_t *external_htab;
> > > + /* externally stored partition table entry */
> > > + struct patb_entry *external_patbe;
> > > /* BATs */
> > > uint32_t nb_BATs;
> > > target_ulong DBAT[2][8];
> > > diff --git a/target/ppc/mmu.h b/target/ppc/mmu.h
> > > index 67b9707..c7967c3 100644
> > > --- a/target/ppc/mmu.h
> > > +++ b/target/ppc/mmu.h
> > > @@ -8,6 +8,12 @@ struct patb_entry {
> > > uint64_t patbe0, patbe1;
> > > };
> > >
> > > +#ifdef TARGET_PPC64
> > > +
> > > +void ppc64_set_external_patb(PowerPCCPU *cpu, void *patb, Error
> > > **errp);
> > > +
> > > +#endif /* TARGET_PPC64 */
> > > +
> > > #endif /* CONFIG_USER_ONLY */
> > >
> > > #endif /* MMU_H */
> > > diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
> > > index 2ab4562..bc6c117 100644
> > > --- a/target/ppc/mmu_helper.c
> > > +++ b/target/ppc/mmu_helper.c
> > > @@ -28,6 +28,7 @@
> > > #include "exec/cpu_ldst.h"
> > > #include "exec/log.h"
> > > #include "helper_regs.h"
> > > +#include "mmu.h"
> > >
> > > //#define DEBUG_MMU
> > > //#define DEBUG_BATS
> > > @@ -2907,3 +2908,14 @@ void tlb_fill(CPUState *cs, target_ulong
> > > addr, MMUAccessType access_type,
> > > retaddr);
> > > }
> > > }
> > > +
> > > +/*****************************************************************
> > > *************/
> > > +
> > > +/* ISA v3.00 (POWER9) Generic MMU Helpers */
> > > +
> > > +void ppc64_set_external_patb(PowerPCCPU *cpu, void *patb, Error
> > > **errp)
> > > +{
> > > + CPUPPCState *env = &cpu->env;
> > > +
> > > + env->external_patbe = (struct patb_entry *) patb;
> > > +}
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2017-02-10 0:39 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-13 6:28 [Qemu-devel] [RFC PATCH 00/17] target/ppc: Implement POWER9 pseries tcg legacy kernel support Suraj Jitindar Singh
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 01/17] powerpc/cpu-models: rename ISAv3.00 logical PVR definition Suraj Jitindar Singh
2017-01-16 2:16 ` David Gibson
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 02/17] hw/ppc/spapr: Add POWER9 to pseries cpu models Suraj Jitindar Singh
2017-01-16 12:11 ` David Gibson
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 03/17] target/ppc: Add pcr_supported to POWER9 cpu class definition Suraj Jitindar Singh
2017-01-16 21:21 ` David Gibson
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 04/17] target/ppc/POWER9: Add ISAv3.00 MMU definition Suraj Jitindar Singh
2017-01-16 21:36 ` David Gibson
2017-01-17 0:33 ` Suraj Jitindar Singh
2017-01-23 5:01 ` Suraj Jitindar Singh
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 05/17] target/ppc/POWER9: Adapt LPCR handling for POWER9 Suraj Jitindar Singh
2017-01-16 21:40 ` David Gibson
2017-01-17 0:48 ` Suraj Jitindar Singh
2017-01-17 4:37 ` David Gibson
2017-01-23 4:19 ` Suraj Jitindar Singh
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 06/17] target/ppc/POWER9: Direct all instr and data storage interrupts to the hypv Suraj Jitindar Singh
2017-02-01 0:50 ` David Gibson
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 07/17] target/ppc/POWER9: Add partition table pointer to sPAPRMachineState Suraj Jitindar Singh
2017-02-01 4:04 ` David Gibson
2017-02-09 2:57 ` Suraj Jitindar Singh
2017-02-10 0:11 ` David Gibson
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 08/17] target/ppc/POWER9: Add external partition table pointer to cpu state Suraj Jitindar Singh
2017-02-01 4:09 ` David Gibson
2017-02-09 2:58 ` Suraj Jitindar Singh
2017-02-10 0:11 ` David Gibson [this message]
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 09/17] target/ppc/POWER9: Remove SDR1 register Suraj Jitindar Singh
2017-02-01 4:16 ` David Gibson
2017-02-09 3:00 ` Suraj Jitindar Singh
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 10/17] target/ppc/POWER9: Add POWER9 mmu fault handler Suraj Jitindar Singh
2017-02-01 4:23 ` David Gibson
2017-02-09 3:04 ` Suraj Jitindar Singh
2017-02-10 0:16 ` David Gibson
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 11/17] target/ppc/POWER9: Update to new pte format for POWER9 accesses Suraj Jitindar Singh
2017-02-01 4:28 ` David Gibson
2017-02-09 3:08 ` Suraj Jitindar Singh
2017-02-09 23:47 ` Suraj Jitindar Singh
2017-02-10 0:21 ` David Gibson
2017-02-10 1:05 ` Suraj Jitindar Singh
2017-02-10 2:24 ` David Gibson
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 12/17] target/ppc/POWER9: Add POWER9 pa-features definition Suraj Jitindar Singh
2017-02-01 4:29 ` David Gibson
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 13/17] target/ppc/POWER9: Add cpu_has_work function for POWER9 Suraj Jitindar Singh
2017-02-01 4:34 ` David Gibson
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 14/17] target/ppc/debug: Print LPCR register value if register exists Suraj Jitindar Singh
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 15/17] tcg/POWER9: NOOP the cp_abort instruction Suraj Jitindar Singh
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 16/17] target/ppc/mmu_hash64: Fix printing unsigned as signed int Suraj Jitindar Singh
2017-01-13 6:28 ` [Qemu-devel] [RFC PATCH 17/17] target/ppc/mmu_hash64: Fix incorrect shift value in amr calculation Suraj Jitindar Singh
2017-01-13 6:55 ` [Qemu-devel] [RFC PATCH 00/17] target/ppc: Implement POWER9 pseries tcg legacy kernel support no-reply
2017-02-01 1:04 ` David Gibson
2017-02-09 3:09 ` Suraj Jitindar Singh
2017-02-01 2:16 ` David Gibson
2017-02-01 2:22 ` David Gibson
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=20170210001154.GL27610@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=sjitindarsingh@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).