aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@ozlabs.org>2018-10-07 23:24:30 -0400
committerPaul Mackerras <paulus@ozlabs.org>2018-10-09 01:14:54 -0400
commit901f8c3f6feb0225c14b3bc6237850fb921d2f2d (patch)
treed9f4edd5ed3899d8270b329990292ba5b52079d4
parentaa069a996951f3e2e38437ef0316685a5893fc7e (diff)
KVM: PPC: Book3S HV: Add NO_HASH flag to GET_SMMU_INFO ioctl result
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. Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
-rw-r--r--Documentation/virtual/kvm/api.txt4
-rw-r--r--arch/powerpc/kvm/book3s_hv.c4
-rw-r--r--include/uapi/linux/kvm.h1
3 files changed, 9 insertions, 0 deletions
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index fde48b6708f1..df98b6304769 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -2270,6 +2270,10 @@ The supported flags are:
2270 The emulated MMU supports 1T segments in addition to the 2270 The emulated MMU supports 1T segments in addition to the
2271 standard 256M ones. 2271 standard 256M ones.
2272 2272
2273 - KVM_PPC_NO_HASH
2274 This flag indicates that HPT guests are not supported by KVM,
2275 thus all guests must use radix MMU mode.
2276
2273The "slb_size" field indicates how many SLB entries are supported 2277The "slb_size" field indicates how many SLB entries are supported
2274 2278
2275The "sps" array contains 8 entries indicating the supported base 2279The "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 89bcf923d542..788bc61bd08c 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -4257,6 +4257,10 @@ static int kvm_vm_ioctl_get_smmu_info_hv(struct kvm *kvm,
4257 kvmppc_add_seg_page_size(&sps, 16, SLB_VSID_L | SLB_VSID_LP_01); 4257 kvmppc_add_seg_page_size(&sps, 16, SLB_VSID_L | SLB_VSID_LP_01);
4258 kvmppc_add_seg_page_size(&sps, 24, SLB_VSID_L); 4258 kvmppc_add_seg_page_size(&sps, 24, SLB_VSID_L);
4259 4259
4260 /* If running as a nested hypervisor, we don't support HPT guests */
4261 if (kvmhv_on_pseries())
4262 info->flags |= KVM_PPC_NO_HASH;
4263
4260 return 0; 4264 return 0;
4261} 4265}
4262 4266
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index d9cec6b5cb37..7f2ff3a76995 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -719,6 +719,7 @@ struct kvm_ppc_one_seg_page_size {
719 719
720#define KVM_PPC_PAGE_SIZES_REAL 0x00000001 720#define KVM_PPC_PAGE_SIZES_REAL 0x00000001
721#define KVM_PPC_1T_SEGMENTS 0x00000002 721#define KVM_PPC_1T_SEGMENTS 0x00000002
722#define KVM_PPC_NO_HASH 0x00000004
722 723
723struct kvm_ppc_smmu_info { 724struct kvm_ppc_smmu_info {
724 __u64 flags; 725 __u64 flags;