public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] arm64/kvm: Introduce feature extension for SMCCC filter
@ 2023-11-16 11:41 Jianyong Wu
  2023-11-16 13:08 ` Cornelia Huck
  2023-11-16 19:06 ` Russell King (Oracle)
  0 siblings, 2 replies; 9+ messages in thread
From: Jianyong Wu @ 2023-11-16 11:41 UTC (permalink / raw)
  To: maz, james.morse, will
  Cc: rmk, salil.mehta, suzuki.poulose, oliver.upton, linux-arm-kernel,
	kvmarm, linux-kernel, justin.he, jianyong.wu

821d935c87b introduces support for userspace SMCCC filtering, but lack
of a way to tell userspace if we have this feature. Add a corresponding
feature extension can resolve this issue.

For example, the incoming feature Vcpu Hotplug needs the SMCCC filter.
As there is no way to check this feature, VMM will run into error when
it calls this feature on an old kernel. It's bad for backward compatible.

Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
---
 Documentation/virt/kvm/api.rst | 3 ++-
 arch/arm64/kvm/arm.c           | 1 +
 include/uapi/linux/kvm.h       | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
index 7025b3751027..559c6c531bfd 100644
--- a/Documentation/virt/kvm/api.rst
+++ b/Documentation/virt/kvm/api.rst
@@ -6395,7 +6395,8 @@ For arm64:
 ----------
 
 SMCCC exits can be enabled depending on the configuration of the SMCCC
-filter. See the Documentation/virt/kvm/devices/vm.rst
+filter. This feature can be only available if KVM_CAP_ARM_VM_SMCCC is
+upported. See the Documentation/virt/kvm/devices/vm.rst
 ``KVM_ARM_SMCCC_FILTER`` for more details.
 
 ``nr`` contains the function ID of the guest's SMCCC call. Userspace is
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index e5f75f1f1085..44583da440ae 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -241,6 +241,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 	case KVM_CAP_ARM_SYSTEM_SUSPEND:
 	case KVM_CAP_IRQFD_RESAMPLE:
 	case KVM_CAP_COUNTER_OFFSET:
+	case KVM_CAP_ARM_VM_SMCCC:
 		r = 1;
 		break;
 	case KVM_CAP_SET_GUEST_DEBUG2:
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 211b86de35ac..e67fb1df508d 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -1201,6 +1201,7 @@ struct kvm_ppc_resize_hpt {
 #define KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE 228
 #define KVM_CAP_ARM_SUPPORTED_BLOCK_SIZES 229
 #define KVM_CAP_ARM_SUPPORTED_REG_MASK_RANGES 230
+#define KVM_CAP_ARM_VM_SMCCC 231
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-11-21 10:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-16 11:41 [PATCH] arm64/kvm: Introduce feature extension for SMCCC filter Jianyong Wu
2023-11-16 13:08 ` Cornelia Huck
2023-11-16 14:06   ` Salil Mehta
2023-11-21  1:58     ` Jianyong Wu
2023-11-16 14:21   ` Marc Zyngier
2023-11-21  2:01     ` Jianyong Wu
2023-11-16 19:06 ` Russell King (Oracle)
2023-11-16 23:22   ` Oliver Upton
2023-11-21 10:57     ` Salil Mehta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox