From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Subject: Re: [PATCH v5 33/33] KVM: PPC: Book3S HV: Add NO_HASH flag to GET_SMMU_INFO ioctl result Date: Tue, 9 Oct 2018 10:34:51 +1100 Message-ID: <20181008233451.GD7004@umbus.fritz.box> References: <1538976679-1363-1-git-send-email-paulus@ozlabs.org> <1538976679-1363-34-git-send-email-paulus@ozlabs.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Lg8eXa+brxrbjAbR" 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: <1538976679-1363-34-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 --Lg8eXa+brxrbjAbR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 08, 2018 at 04:31:19PM +1100, Paul Mackerras wrote: > This adds a KVM_PPC_NO_HASH flag to the flags field of the > kvm_ppc_smmu_info struct, and arranges for it to be set when > running as a nested hypervisor, as an unambiguous indication > to userspace that HPT guests are not supported. Reporting the > KVM_CAP_PPC_MMU_HASH_V3 capability as false could be taken as > indicating only that the new HPT features in ISA V3.0 are not > supported, leaving it ambiguous whether pre-V3.0 HPT features > are supported. >=20 > Signed-off-by: Paul Mackerras Reviewed-by: David Gibson > --- > Documentation/virtual/kvm/api.txt | 4 ++++ > arch/powerpc/kvm/book3s_hv.c | 4 ++++ > include/uapi/linux/kvm.h | 1 + > 3 files changed, 9 insertions(+) >=20 > diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kv= m/api.txt > index fde48b6..df98b63 100644 > --- a/Documentation/virtual/kvm/api.txt > +++ b/Documentation/virtual/kvm/api.txt > @@ -2270,6 +2270,10 @@ The supported flags are: > The emulated MMU supports 1T segments in addition to the > standard 256M ones. > =20 > + - KVM_PPC_NO_HASH > + This flag indicates that HPT guests are not supported by KVM, > + thus all guests must use radix MMU mode. > + > The "slb_size" field indicates how many SLB entries are supported > =20 > The "sps" array contains 8 entries indicating the supported base > diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c > index fa61647..f565403 100644 > --- a/arch/powerpc/kvm/book3s_hv.c > +++ b/arch/powerpc/kvm/book3s_hv.c > @@ -4245,6 +4245,10 @@ static int kvm_vm_ioctl_get_smmu_info_hv(struct kv= m *kvm, > kvmppc_add_seg_page_size(&sps, 16, SLB_VSID_L | SLB_VSID_LP_01); > kvmppc_add_seg_page_size(&sps, 24, SLB_VSID_L); > =20 > + /* If running as a nested hypervisor, we don't support HPT guests */ > + if (kvmhv_on_pseries()) > + info->flags |=3D KVM_PPC_NO_HASH; > + > return 0; > } > =20 > diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h > index d9cec6b..7f2ff3a 100644 > --- a/include/uapi/linux/kvm.h > +++ b/include/uapi/linux/kvm.h > @@ -719,6 +719,7 @@ struct kvm_ppc_one_seg_page_size { > =20 > #define KVM_PPC_PAGE_SIZES_REAL 0x00000001 > #define KVM_PPC_1T_SEGMENTS 0x00000002 > +#define KVM_PPC_NO_HASH 0x00000004 > =20 > struct kvm_ppc_smmu_info { > __u64 flags; --=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 --Lg8eXa+brxrbjAbR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlu76ZsACgkQbDjKyiDZ s5KF3g//Yw4IoHHQ/GPCu14bes9e6jRCIqUc9CtoMw52sC+2KmV7JN3ilL8CkcT+ oggzpS07zJRKUl/KLIwXEMTIweeZ1lxyNDWcPBbIvsfBjbuajOko0xIP+CxAr5nH EMipgBREEIF7qCLP9t/kYh7Q32Ld/ufQSOCtIyvUg0cDoH+WHm/nXaqCDer/I2a3 JEpTD6u8spIrNTSvgw4BGNjFQNUYYucc1DBt8ybqZXm5YPrjmPPHht2XvPKtMvys OKkOqWujM1Rinys2RJ0zYf69UuMmXZ6yonh9LVEi1H+QgVRyahM9TQwmzxhjtTrg uBz+UiLcOQTH94Ov1w9yR2/JvI5M8MSBNpnT74bp0EQyK9Pm/MaWoCIH2kq0Guli 6PgtfJqoKqS08gl/WS0SzalyWkL64HGzNvLVxgjnW+VQ5HVbnD3lh4ULLK1oGGW0 dWrfRuY0TG9N2cCkcR7rFDIyawPIFQsvp3ZYpqGvo0WtnN+iLnPgHRdvPpar4Hs5 HT8fc5dzaHfH3Y7tHmt6Sv+JnaGDXlCMrC5lAwqyJCJh0+UJx3+BkGVLD4H4sF3t RiDD5TL/uFLbkVhDft+awGetHNbq86U4JtZ8vOGdFuakPCeT++28tq0r6Qw+oLvh B4WLBBVdJ3T+n5oRMOkCjspJjSiYiHggMM2RWnQWbjrijE5A1s0= =XFM3 -----END PGP SIGNATURE----- --Lg8eXa+brxrbjAbR--