Skip to content

Commit 901f8c3

Browse files
committed
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>
1 parent aa069a9 commit 901f8c3

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

Documentation/virtual/kvm/api.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,6 +2270,10 @@ The supported flags are:
22702270
The emulated MMU supports 1T segments in addition to the
22712271
standard 256M ones.
22722272

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+
22732277
The "slb_size" field indicates how many SLB entries are supported
22742278

22752279
The "sps" array contains 8 entries indicating the supported base

arch/powerpc/kvm/book3s_hv.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4257,6 +4257,10 @@ static int kvm_vm_ioctl_get_smmu_info_hv(struct kvm *kvm,
42574257
kvmppc_add_seg_page_size(&sps, 16, SLB_VSID_L | SLB_VSID_LP_01);
42584258
kvmppc_add_seg_page_size(&sps, 24, SLB_VSID_L);
42594259

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+
42604264
return 0;
42614265
}
42624266

include/uapi/linux/kvm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,7 @@ struct kvm_ppc_one_seg_page_size {
719719

720720
#define KVM_PPC_PAGE_SIZES_REAL 0x00000001
721721
#define KVM_PPC_1T_SEGMENTS 0x00000002
722+
#define KVM_PPC_NO_HASH 0x00000004
722723

723724
struct kvm_ppc_smmu_info {
724725
__u64 flags;

0 commit comments

Comments
 (0)