From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Subject: Re: [PATCH 17/19] KVM: PPC: Book3S HV: add get/set accessors for the VP XIVE state Date: Tue, 5 Feb 2019 16:33:31 +1100 Message-ID: <20190205053331.GH22661@umbus.fritz.box> References: <20190107184331.8429-1-clg@kaod.org> <20190107191006.10648-1-clg@kaod.org> <20190204052646.GJ1927@umbus.fritz.box> <5ebeb37b-623b-9b82-5628-fd6d78382064@kaod.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AqCDj3hiknadvR6t" Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, Paul Mackerras , linuxppc-dev@lists.ozlabs.org To: =?iso-8859-1?Q?C=E9dric?= Le Goater Return-path: Content-Disposition: inline In-Reply-To: <5ebeb37b-623b-9b82-5628-fd6d78382064@kaod.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane.org@lists.ozlabs.org Sender: "Linuxppc-dev" List-Id: kvm.vger.kernel.org --AqCDj3hiknadvR6t Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 04, 2019 at 07:57:26PM +0100, C=E9dric Le Goater wrote: > On 2/4/19 6:26 AM, David Gibson wrote: > > On Mon, Jan 07, 2019 at 08:10:04PM +0100, C=E9dric Le Goater wrote: > >> At a VCPU level, the state of the thread context interrupt management > >> registers needs to be collected. These registers are cached under the > >> 'xive_saved_state.w01' field of the VCPU when the VPCU context is > >> pulled from the HW thread. An OPAL call retrieves the backup of the > >> IPB register in the NVT structure and merges it in the KVM state. > >> > >> The structures of the interface between QEMU and KVM provisions some > >> extra room (two u64) for further extensions if more state needs to be > >> transferred back to QEMU. > >> > >> Signed-off-by: C=E9dric Le Goater > >> --- > >> arch/powerpc/include/asm/kvm_ppc.h | 5 ++ > >> arch/powerpc/include/uapi/asm/kvm.h | 2 + > >> arch/powerpc/kvm/book3s.c | 24 +++++++++ > >> arch/powerpc/kvm/book3s_xive_native.c | 78 +++++++++++++++++++++++++++ > >> 4 files changed, 109 insertions(+) > >> > >> diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include= /asm/kvm_ppc.h > >> index 4cc897039485..49c488af168c 100644 > >> --- a/arch/powerpc/include/asm/kvm_ppc.h > >> +++ b/arch/powerpc/include/asm/kvm_ppc.h > >> @@ -270,6 +270,7 @@ union kvmppc_one_reg { > >> u64 addr; > >> u64 length; > >> } vpaval; > >> + u64 xive_timaval[4]; > >> }; > >> =20 > >> struct kvmppc_ops { > >> @@ -603,6 +604,8 @@ extern void kvmppc_xive_native_cleanup_vcpu(struct= kvm_vcpu *vcpu); > >> extern void kvmppc_xive_native_init_module(void); > >> extern void kvmppc_xive_native_exit_module(void); > >> extern int kvmppc_xive_native_hcall(struct kvm_vcpu *vcpu, u32 cmd); > >> +extern int kvmppc_xive_native_get_vp(struct kvm_vcpu *vcpu, union kvm= ppc_one_reg *val); > >> +extern int kvmppc_xive_native_set_vp(struct kvm_vcpu *vcpu, union kvm= ppc_one_reg *val); > >> =20 > >> #else > >> static inline int kvmppc_xive_set_xive(struct kvm *kvm, u32 irq, u32 = server, > >> @@ -637,6 +640,8 @@ static inline void kvmppc_xive_native_init_module(= void) { } > >> static inline void kvmppc_xive_native_exit_module(void) { } > >> static inline int kvmppc_xive_native_hcall(struct kvm_vcpu *vcpu, u32= cmd) > >> { return 0; } > >> +static inline int kvmppc_xive_native_get_vp(struct kvm_vcpu *vcpu, un= ion kvmppc_one_reg *val) { return 0; } > >> +static inline int kvmppc_xive_native_set_vp(struct kvm_vcpu *vcpu, un= ion kvmppc_one_reg *val) { return -ENOENT; } > >=20 > > IIRC "VP" is the old name for "TCTX". Since we're using tctx in the > > rest of the XIVE code, can we use it here as well. >=20 > OK. The state we are getting or setting is indeed related to the thread= =20 > interrupt context registers.=20 >=20 > The name VP is related to an identifier to some interrupt context under= =20 > OPAL (NVT in HW to be precise). Oh, sorry, "NVT" was the name I was looking for, not "TCTX". But in any case, please lets standardize on one. --=20 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 --AqCDj3hiknadvR6t Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlxZICsACgkQbDjKyiDZ s5I6Gw/+Jhf+8FgV3C4z3rBV1SlzTyUmbVl6NM8toQjtkHFHoBGnKLP7i0kf4nxD 5T7QKmnX0jaGdQx9b2p9fMiS34Ic+If+hmYxWLCExTttCJeJYjy1YPX0zaes7Rvt 8XMsgCJw7ydfxprbmFWP4oehNGSu5vSIiOryiSWg5wlhAb3+ewlJVsJUiQ7/lzAk j3HHG62ntK6x5sk019kTBKm8w4BvFE4d8dM0Rc7SnjqjIlJfsLC5ivMWhJnQSylq CAzOXwoEMuiEK5E54aTN9/ZZSyjfq3V+a682FPXwRBKSWrVZlzmspob7LrIu5aVL vI8vB1qgSA2wD8BnffdNMNfPU2SFQsL+Mg9H0+1oCMk3Ghn/QK8Q5SCNFjkusO9k QBosRQl1h/gaJkGjsIQLzBzKTll2jZLCWhccdMCo22DmeonOAJzW6GdDMJCMaWQz /wrIOCui4OPVg4x1JD2xyVbU2CAl1MPV/P8dPmyGI5xZHIM4lsPaBCJ6MYhZSfNv pk2u/qSPmE7gnhRTAs7CYteD3aUvrxueLF7dRhOSZOhLwuhb64HV5VOeQlNFLDNk fN2i5U6IrKIAVq66jexwCOpiKelIytqcbbonP5S7xx+uwakNM/NkMV9C72bcF0fK ZbLaQ5wzvfTxZJotQUjAXgno9dsmXgRzB5NByo0CyPKFzQzSW0k= =N46W -----END PGP SIGNATURE----- --AqCDj3hiknadvR6t--