[RFC PATCH v1 12/34] KVM: introspection: extend struct kvmi_features with the EPT views status support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ștefan Șicleru <ssicleru@xxxxxxxxxxxxxxx>

The introspection tool will use these new fields to check
the hardware support before using the related introspection commands.

Signed-off-by: Ștefan Șicleru <ssicleru@xxxxxxxxxxxxxxx>
Signed-off-by: Adalbert Lazăr <alazar@xxxxxxxxxxxxxxx>
---
 Documentation/virt/kvm/kvmi.rst                | 6 ++++--
 arch/x86/include/uapi/asm/kvmi.h               | 4 +++-
 arch/x86/kvm/kvmi.c                            | 4 ++++
 tools/testing/selftests/kvm/x86_64/kvmi_test.c | 2 ++
 4 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/Documentation/virt/kvm/kvmi.rst b/Documentation/virt/kvm/kvmi.rst
index 62138fa4b65c..234eacec4db1 100644
--- a/Documentation/virt/kvm/kvmi.rst
+++ b/Documentation/virt/kvm/kvmi.rst
@@ -263,11 +263,13 @@ For x86
 
 	struct kvmi_features {
 		__u8 singlestep;
-		__u8 padding[7];
+		__u8 vmfunc;
+		__u8 eptp;
+		__u8 padding[5];
 	};
 
 Returns the introspection API version and some of the features supported
-by the hardware.
+by the hardware (eg. alternate EPT views).
 
 This command is always allowed and successful.
 
diff --git a/arch/x86/include/uapi/asm/kvmi.h b/arch/x86/include/uapi/asm/kvmi.h
index 32af803f1d70..51b399d50a2a 100644
--- a/arch/x86/include/uapi/asm/kvmi.h
+++ b/arch/x86/include/uapi/asm/kvmi.h
@@ -147,7 +147,9 @@ struct kvmi_event_msr_reply {
 
 struct kvmi_features {
 	__u8 singlestep;
-	__u8 padding[7];
+	__u8 vmfunc;
+	__u8 eptp;
+	__u8 padding[5];
 };
 
 #endif /* _UAPI_ASM_X86_KVMI_H */
diff --git a/arch/x86/kvm/kvmi.c b/arch/x86/kvm/kvmi.c
index 7b3b64d27d18..25c1f8f2e221 100644
--- a/arch/x86/kvm/kvmi.c
+++ b/arch/x86/kvm/kvmi.c
@@ -1356,6 +1356,10 @@ static void kvmi_track_flush_slot(struct kvm *kvm, struct kvm_memory_slot *slot,
 void kvmi_arch_features(struct kvmi_features *feat)
 {
 	feat->singlestep = !!kvm_x86_ops.control_singlestep;
+	feat->vmfunc = kvm_x86_ops.get_vmfunc_status &&
+			kvm_x86_ops.get_vmfunc_status();
+	feat->eptp = kvm_x86_ops.get_eptp_switching_status &&
+			kvm_x86_ops.get_eptp_switching_status();
 }
 
 bool kvmi_arch_start_singlestep(struct kvm_vcpu *vcpu)
diff --git a/tools/testing/selftests/kvm/x86_64/kvmi_test.c b/tools/testing/selftests/kvm/x86_64/kvmi_test.c
index e968b1a6f969..33fffcb3a171 100644
--- a/tools/testing/selftests/kvm/x86_64/kvmi_test.c
+++ b/tools/testing/selftests/kvm/x86_64/kvmi_test.c
@@ -443,6 +443,8 @@ static void test_cmd_get_version(void)
 
 	pr_info("KVMI version: %u\n", rpl.version);
 	pr_info("\tsinglestep: %u\n", features.singlestep);
+	pr_info("\tvmfunc: %u\n", features.vmfunc);
+	pr_info("\teptp: %u\n", features.eptp);
 }
 
 static void cmd_vm_check_command(__u16 id, __u16 padding, int expected_err)




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux