From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Subject: Re: [PATCH v3 17/33] KVM: PPC: Book3S HV: Framework and hcall stubs for nested virtualization Date: Wed, 3 Oct 2018 13:17:39 +1000 Message-ID: <20181003031739.GM1886@umbus.fritz.box> References: <1538479892-14835-1-git-send-email-paulus@ozlabs.org> <1538479892-14835-18-git-send-email-paulus@ozlabs.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="t5NgoZwlhlUmGr82" Cc: linuxppc-dev@ozlabs.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org To: Paul Mackerras Return-path: Content-Disposition: inline In-Reply-To: <1538479892-14835-18-git-send-email-paulus@ozlabs.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 --t5NgoZwlhlUmGr82 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 02, 2018 at 09:31:16PM +1000, Paul Mackerras wrote: > This starts the process of adding the code to support nested HV-style > virtualization. It defines a new H_SET_PARTITION_TABLE hypercall which > a nested hypervisor can use to set the base address and size of a > partition table in its memory (analogous to the PTCR register). > On the host (level 0 hypervisor) side, the H_SET_PARTITION_TABLE > hypercall from the guest is handled by code that saves the virtual > PTCR value for the guest. >=20 > This also adds code for creating and destroying nested guests and for > reading the partition table entry for a nested guest from L1 memory. > Each nested guest has its own shadow LPID value, different in general > from the LPID value used by the nested hypervisor to refer to it. The > shadow LPID value is allocated at nested guest creation time. >=20 > Nested hypervisor functionality is only available for a radix guest, > which therefore means a radix host on a POWER9 (or later) processor. >=20 > Signed-off-by: Paul Mackerras Reviewed-by: David Gibson Couple of nits noted below [snip] > +void kvmhv_set_ptbl_entry(unsigned int lpid, u64 dw0, u64 dw1) > +{ > + if (cpu_has_feature(CPU_FTR_HVMODE)) { > + mmu_partition_table_set_entry(lpid, dw0, dw1); > + } else { > + pseries_partition_tb[lpid].patb0 =3D cpu_to_be64(dw0); > + pseries_partition_tb[lpid].patb1 =3D cpu_to_be64(dw1); > + /* this will be emulated, L0 will do the necessary barriers */ > + asm volatile(PPC_TLBIE_5(%0, %1, 2, 0, 1) : : > + "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid)); It seems a bit odd to me to introduce this with a mechanism we never actually implement, then replace it. But I guess if refolding the series is painful.. > + } [snip] > +/* > + * Handle the H_SET_PARTITION_TABLE hcall. > + * r4 =3D guest real address of partition table + log_2(size) - 12 > + * (formatted as for the PTCR). > + */ > +long kvmhv_set_partition_table(struct kvm_vcpu *vcpu) > +{ > + struct kvm *kvm =3D vcpu->kvm; > + unsigned long ptcr =3D kvmppc_get_gpr(vcpu, 4); > + > + kvm->arch.l1_ptcr =3D ptcr; Still no validation here. > + return H_SUCCESS; > +} --=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 --t5NgoZwlhlUmGr82 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlu0NNEACgkQbDjKyiDZ s5LHGxAAzxiPF0oLCNfNU9DwmHch+2gdf69VU9tja4A83IMkdgjn8z0nzVvZQNxs mwt7UxxBIcrAV4mXojW71rT2C0IoJryJ/JwEL/j+0cBbbSzgApLhUmy72uN9XJCc 7PIhWNd0X1bMcUOtaX1gRrpwkZV5KrHQrbXqxdRy1IDM9dJiQ8/idMLjzDu5xK+M h4nY721KxkMHZsULaW78JGza6GdO+LQ7W5wWW4FLfs6Vnd+kKDQmAtzI0887DKNE nIOaht4OgTU5VXkRbmjx+735gBoNKulwQkDalDwSdk6QbSbXbzY4mjq0kH0ks0Ao h1e/sAl5JELZGzMK/CYmLv4T8Hh/YaCVRqAA+C5XqFiIchEP8V9A7v1kilbkW8rV Cd2bkCyyQBPWbgzveh5RlsGPTfoi6d0f0UFV1nu3MTxtop3CbFSG1qQqFYATJcYs BULYdR3pHYoKbeR64rZt31pM+hEXwCNVnwpx+f02VKJxISQBrr9aTXt0/JgMAhMh vflHaI8ZxX0S6Sd2opd21noVq1fzPvqJ0TGG6DhXdrzkZkchtok5UzcP9t2Ac2QX FjqKpvJjO34nPoNm+FeHetoQQ4Svwld1lstl1zWoBxImH6cvH4dxKhGciZMaG46W vbGsM1yrd3A4kWX0IlBVLOI4nXEGPTqGVBIe33LvY6lM4dyPRI8= =Pzfx -----END PGP SIGNATURE----- --t5NgoZwlhlUmGr82--