From: "Nicholas Piggin" <npiggin@gmail.com>
To: "Harsh Prateek Bora" <harshpb@linux.ibm.com>, <qemu-ppc@nongnu.org>
Cc: <qemu-devel@nongnu.org>,
"Daniel Henrique Barboza" <dbarboza@ventanamicro.com>
Subject: Re: [PATCH 4/4] ppc/spapr: Move spapr nested HV to a new file
Date: Thu, 15 Jun 2023 21:51:22 +1000 [thread overview]
Message-ID: <CTD7AE00VYIP.2IPHRORV44U1P@wheely> (raw)
In-Reply-To: <497ec7c7-2f8e-fb79-92dd-077fa12957af@linux.ibm.com>
On Thu Jun 15, 2023 at 4:30 PM AEST, Harsh Prateek Bora wrote:
>
>
> On 6/8/23 14:43, Nicholas Piggin wrote:
> > Create spapr_nested.c for most of the nested HV implementation.
> >
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> > hw/ppc/meson.build | 1 +
> > hw/ppc/spapr_hcall.c | 415 +---------------------------------
> > hw/ppc/spapr_nested.c | 496 +++++++++++++++++++++++++++++++++++++++++
> > include/hw/ppc/spapr.h | 61 +----
> > 4 files changed, 499 insertions(+), 474 deletions(-)
> > create mode 100644 hw/ppc/spapr_nested.c
[snip]
> > diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c
> > new file mode 100644
> > index 0000000000..c06dd8903c
> > --- /dev/null
> > +++ b/hw/ppc/spapr_nested.c
> > @@ -0,0 +1,496 @@
> > +#include "qemu/osdep.h"
> > +#include "qemu/cutils.h"
> > +#include "exec/exec-all.h"
> > +#include "helper_regs.h"
> > +#include "hw/ppc/ppc.h"
> > +#include "hw/ppc/spapr.h"
> > +#include "hw/ppc/spapr_cpu_core.h"
> > +
> > +/*
> > + * Register state for entering a nested guest with H_ENTER_NESTED.
> > + * New member must be added at the end.
> > + */
> > +struct kvmppc_hv_guest_state {
> > + uint64_t version; /* version of this structure layout, must be first */
> > + uint32_t lpid;
> > + uint32_t vcpu_token;
> > + /* These registers are hypervisor privileged (at least for writing) */
> > + uint64_t lpcr;
> > + uint64_t pcr;
> > + uint64_t amor;
> > + uint64_t dpdes;
> > + uint64_t hfscr;
> > + int64_t tb_offset;
> > + uint64_t dawr0;
> > + uint64_t dawrx0;
> > + uint64_t ciabr;
> > + uint64_t hdec_expiry;
> > + uint64_t purr;
> > + uint64_t spurr;
> > + uint64_t ic;
> > + uint64_t vtb;
> > + uint64_t hdar;
> > + uint64_t hdsisr;
> > + uint64_t heir;
> > + uint64_t asdr;
> > + /* These are OS privileged but need to be set late in guest entry */
> > + uint64_t srr0;
> > + uint64_t srr1;
> > + uint64_t sprg[4];
> > + uint64_t pidr;
> > + uint64_t cfar;
> > + uint64_t ppr;
> > + /* Version 1 ends here */
> > + uint64_t dawr1;
> > + uint64_t dawrx1;
> > + /* Version 2 ends here */
> > +};
> > +
> > +/* Latest version of hv_guest_state structure */
> > +#define HV_GUEST_STATE_VERSION 2
> > +
> > +/* Linux 64-bit powerpc pt_regs struct, used by nested HV */
> > +struct kvmppc_pt_regs {
> > + uint64_t gpr[32];
> > + uint64_t nip;
> > + uint64_t msr;
> > + uint64_t orig_gpr3; /* Used for restarting system calls */
> > + uint64_t ctr;
> > + uint64_t link;
> > + uint64_t xer;
> > + uint64_t ccr;
> > + uint64_t softe; /* Soft enabled/disabled */
> > + uint64_t trap; /* Reason for being here */
> > + uint64_t dar; /* Fault registers */
> > + uint64_t dsisr; /* on 4xx/Book-E used for ESR */
> > + uint64_t result; /* Result of a system call */
> > +};
>
> Now that we have a separated spapr_nested.c for nested related code,
> Can above definitions and other nested related defines (like struct
> nested_ppc_state below) be moved to a new spapr_nested.h as well?
> Otherwise, looks good to me.
They're private to this file, so do we need to? I'm on the fence about
it, maybe because they're hcall ABI. I don't object to adding a new
spapr_nested.h for nested related things in general though.
Thanks,
Nick
next prev parent reply other threads:[~2023-06-15 11:52 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-08 9:13 [PATCH 0/4] ppc/spapr: Nested HV fix and tidying Nicholas Piggin
2023-06-08 9:13 ` [PATCH 1/4] ppc/spapr: H_ENTER_NESTED should restore host XER ca field Nicholas Piggin
2023-06-09 7:05 ` Harsh Prateek Bora
2023-06-14 11:53 ` Nicholas Piggin
2023-06-08 9:13 ` [PATCH 2/4] ppc/spapr: Add a nested state struct Nicholas Piggin
2023-06-09 7:09 ` Harsh Prateek Bora
2023-06-14 11:56 ` Nicholas Piggin
2023-06-15 4:51 ` Harsh Prateek Bora
2023-06-15 5:36 ` Nicholas Piggin
2023-06-08 9:13 ` [PATCH 3/4] ppc/spapr: load and store l2 state with helper functions Nicholas Piggin
2023-06-09 8:00 ` Harsh Prateek Bora
2023-06-14 12:02 ` Nicholas Piggin
2023-06-15 4:53 ` Harsh Prateek Bora
2023-06-08 9:13 ` [PATCH 4/4] ppc/spapr: Move spapr nested HV to a new file Nicholas Piggin
2023-06-15 6:30 ` Harsh Prateek Bora
2023-06-15 11:51 ` Nicholas Piggin [this message]
2023-06-16 4:57 ` Harsh Prateek Bora
2023-06-18 9:53 ` Daniel Henrique Barboza
2023-06-20 3:41 ` Nicholas Piggin
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=CTD7AE00VYIP.2IPHRORV44U1P@wheely \
--to=npiggin@gmail.com \
--cc=dbarboza@ventanamicro.com \
--cc=harshpb@linux.ibm.com \
--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 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).