[PATCH RFC 3/4] KVM: Define KVM_USER_MEM_SLOTS in arch-neutral include/linux/kvm_host.h

Vitaly Kuznetsov
2021-01-15T13:21:16Z

Memory slots are allocated dynamically when added so the only real
limitation in KVM is 'id_to_index' array which is 'short'. Define
KVM_USER_MEM_SLOTS to the maximum possible value in the arch-neutral
include/linux/kvm_host.h, architectures can still overtide the setting
if needed.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
include/linux/kvm_host.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index f3b1013fb22c..ab83a20a52ca 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -425,6 +425,10 @@ struct kvm_irq_routing_table {
#define KVM_PRIVATE_MEM_SLOTS 0
#endif

+#ifndef KVM_USER_MEM_SLOTS
+#define KVM_USER_MEM_SLOTS (SHRT_MAX - KVM_PRIVATE_MEM_SLOTS)
+#endif
+
#ifndef KVM_MEM_SLOTS_NUM
#define KVM_MEM_SLOTS_NUM (KVM_USER_MEM_SLOTS + KVM_PRIVATE_MEM_SLOTS)
#endif
--
2.29.2