2022-05-09 06:14:02

by Isaku Yamahata

[permalink] [raw]
Subject: [RFC PATCH v6 026/104] KVM: TDX: Make KVM_CAP_SET_IDENTITY_MAP_ADDR unsupported for TDX

From: Isaku Yamahata <[email protected]>

Because TDX doesn't support KVM_SET_IDENTITY_MAP_ADDR. Return
KVM_CAP_SET_IDENTITY_MAP_ADDR as unsupported.

Signed-off-by: Isaku Yamahata <[email protected]>
---
arch/x86/kvm/x86.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 77e83e20180a..fd282e5efec1 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4236,7 +4236,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
case KVM_CAP_IOEVENTFD_NO_LENGTH:
case KVM_CAP_PIT2:
case KVM_CAP_PIT_STATE2:
- case KVM_CAP_SET_IDENTITY_MAP_ADDR:
case KVM_CAP_VCPU_EVENTS:
case KVM_CAP_HYPERV:
case KVM_CAP_HYPERV_VAPIC:
@@ -4389,6 +4388,12 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
case KVM_CAP_DISABLE_QUIRKS2:
r = KVM_X86_VALID_QUIRKS;
break;
+ case KVM_CAP_SET_IDENTITY_MAP_ADDR:
+ if (kvm && kvm->arch.vm_type == KVM_X86_TDX_VM)
+ r = 0;
+ else
+ r = 1;
+ break;
case KVM_CAP_VM_TYPES:
r = BIT(KVM_X86_DEFAULT_VM);
if (static_call(kvm_x86_is_vm_type_supported)(KVM_X86_TDX_VM))
--
2.25.1