KVM: PPC: Introduce KVM_CAP_PPC_HTM
authorSam Bobroff <sam.bobroff@au1.ibm.com>
Wed, 20 Jul 2016 03:41:36 +0000 (13:41 +1000)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 1 Aug 2016 17:42:06 +0000 (19:42 +0200)
Introduce a new KVM capability, KVM_CAP_PPC_HTM, that can be queried to
determine if a PowerPC KVM guest should use HTM (Hardware Transactional
Memory).

This will be used by QEMU to populate the pa-features bits in the
guest's device tree.

Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/powerpc/kvm/powerpc.c
include/uapi/linux/kvm.h

index 1ac036e45ed4f8255e0fb1f05a3bfe6ce165af04..6ce40dd6fe51a1d8701020bfc8257ba3c4ea6c85 100644 (file)
@@ -588,6 +588,10 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
                r = 1;
                break;
 #endif
+       case KVM_CAP_PPC_HTM:
+               r = cpu_has_feature(CPU_FTR_TM_COMP) &&
+                   is_kvmppc_hv_enabled(kvm);
+               break;
        default:
                r = 0;
                break;
index 8f2756c263d47529110d27e89dc96fcdaa98d1ec..e98bb4cce6391ce7fe8b1defc8d8a59a61975c49 100644 (file)
@@ -869,6 +869,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_X2APIC_API 129
 #define KVM_CAP_S390_USER_INSTR0 130
 #define KVM_CAP_MSI_DEVID 131
+#define KVM_CAP_PPC_HTM 132
 
 #ifdef KVM_CAP_IRQ_ROUTING