From: David Gibson Date: Thu, 27 Sep 2018 04:56:11 +0000 Subject: Re: [RFC PATCH 29/32] KVM: PPC: Book3S HV: Add one-reg interface to virtual PTCR register Message-Id: <20180927045611.GP30868@umbus.fritz.box> MIME-Version: 1 Content-Type: multipart/mixed; boundary="ZLWVP+qAHA0w8Mq4" List-Id: References: <1537524123-9578-30-git-send-email-paulus@ozlabs.org> In-Reply-To: <1537524123-9578-30-git-send-email-paulus@ozlabs.org> To: kvm-ppc@vger.kernel.org --ZLWVP+qAHA0w8Mq4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 21, 2018 at 08:02:00PM +1000, Paul Mackerras wrote: > This adds a one-reg register identifier which can be used to read and > set the virtual PTCR for the guest. This register identifies the > address and size of the virtual partition table for the guest, which > contains information about the nested guests under this guest. >=20 > Migrating this value is the only extra requirement for migrating a > guest which has nested guests (assuming of course that the destination > host supports nested virtualization in the kvm-hv module). >=20 > Signed-off-by: Paul Mackerras Reviewed-by: David Gibson > --- > Documentation/virtual/kvm/api.txt | 1 + > arch/powerpc/include/uapi/asm/kvm.h | 1 + > arch/powerpc/kvm/book3s_hv.c | 6 ++++++ > 3 files changed, 8 insertions(+) >=20 > diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kv= m/api.txt > index c664064..017d851 100644 > --- a/Documentation/virtual/kvm/api.txt > +++ b/Documentation/virtual/kvm/api.txt > @@ -1922,6 +1922,7 @@ registers, find a list below: > PPC | KVM_REG_PPC_TIDR | 64 > PPC | KVM_REG_PPC_PSSCR | 64 > PPC | KVM_REG_PPC_DEC_EXPIRY | 64 > + PPC | KVM_REG_PPC_PTCR | 64 > PPC | KVM_REG_PPC_TM_GPR0 | 64 > ... > PPC | KVM_REG_PPC_TM_GPR31 | 64 > diff --git a/arch/powerpc/include/uapi/asm/kvm.h b/arch/powerpc/include/u= api/asm/kvm.h > index 1b32b56..8c876c1 100644 > --- a/arch/powerpc/include/uapi/asm/kvm.h > +++ b/arch/powerpc/include/uapi/asm/kvm.h > @@ -634,6 +634,7 @@ struct kvm_ppc_cpu_char { > =20 > #define KVM_REG_PPC_DEC_EXPIRY (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbe) > #define KVM_REG_PPC_ONLINE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbf) > +#define KVM_REG_PPC_PTCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc0) > =20 > /* Transactional Memory checkpointed state: > * This is all GPRs, all VSX regs and a subset of SPRs > diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c > index 71ed0cd..dcb922b 100644 > --- a/arch/powerpc/kvm/book3s_hv.c > +++ b/arch/powerpc/kvm/book3s_hv.c > @@ -1727,6 +1727,9 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *v= cpu, u64 id, > case KVM_REG_PPC_ONLINE: > *val =3D get_reg_val(id, vcpu->arch.online); > break; > + case KVM_REG_PPC_PTCR: > + *val =3D get_reg_val(id, vcpu->kvm->arch.l1_ptcr); > + break; > default: > r =3D -EINVAL; > break; > @@ -1958,6 +1961,9 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *v= cpu, u64 id, > atomic_dec(&vcpu->arch.vcore->online_count); > vcpu->arch.online =3D i; > break; > + case KVM_REG_PPC_PTCR: > + vcpu->kvm->arch.l1_ptcr =3D set_reg_val(id, *val); > + break; > default: > r =3D -EINVAL; > break; --=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 --ZLWVP+qAHA0w8Mq4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlusYukACgkQbDjKyiDZ s5LSug/+LpmLjUyIBVbNVfpeXHdRoVdVgckeP0kpFqf0E8XtC1zZXnIqxlXH+z6t V94tSZh9Ii4KOh/rcLuoJs1RjTZ1jwAvSD79k1pkbXW+sqs9H1WqQO3f/OMUe/wA BbDJTQ6nC0RDjQy/HoZS+acHtas7CYhs0HgsiKXLKyn24AS7pfFBwFFQc3TA/sGm fo9yrsyNJ2l4JuY23JdNxYpG/kP02L1gO4k2nINhGexdU+jffkU2kOF/BxCesp7q ZYt/ws3V3oz+RIRHU9OnmrJX6GEzuM2gukgG62ypdDPQVJ7TKWDJwH7F2kyJdGmQ fanHKY4Fg5LkiUcFSqurGDwHR6ZoZjKrm5N0JzS6cqx93NfYxAV6OToneuGfUMYV +yfU25BcXCwcEQIYuLNDt6jZVM6w24aVyJAlVjCkwCAoAKG11Z8qKeYDS2ASoohf o84QiXKV6nxwyBSgehenEfpOFdu93DuYZ3La4n4eAl+wa2nwZNKuFKG4REWenQnu bg68srGmEut1A7ReRy/tTRAug36cZ+QDgjv1F346ezilkRBOYXvwt0ZOUZtck4Oo lPf7QZ+GfrvXtqUKrPOm3NfeLIO38lkWVcdgTzQERZelkYqcpMRviNNwjG1FF37I xRthooe4907Yo7ix8fZB7Po4IPIvAatOdEf2nRR/gV/1DZoBows= =MWET -----END PGP SIGNATURE----- --ZLWVP+qAHA0w8Mq4--