Re: [PATCH v9 14/17] KVM: arm64: Enable mapping guest_memfd in arm64

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

 



On 21.05.25 12:12, Fuad Tabba wrote:
Hi David,

On Wed, 21 May 2025 at 09:05, David Hildenbrand <david@xxxxxxxxxx> wrote:

On 13.05.25 18:34, Fuad Tabba wrote:
Enable mapping guest_memfd in arm64. For now, it applies to all
VMs in arm64 that use guest_memfd. In the future, new VM types
can restrict this via kvm_arch_gmem_supports_shared_mem().

Signed-off-by: Fuad Tabba <tabba@xxxxxxxxxx>
---
   arch/arm64/include/asm/kvm_host.h | 10 ++++++++++
   arch/arm64/kvm/Kconfig            |  1 +
   2 files changed, 11 insertions(+)

diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 08ba91e6fb03..2514779f5131 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -1593,4 +1593,14 @@ static inline bool kvm_arch_has_irq_bypass(void)
       return true;
   }

+static inline bool kvm_arch_supports_gmem(struct kvm *kvm)
+{
+     return IS_ENABLED(CONFIG_KVM_GMEM);
+}
+
+static inline bool kvm_arch_vm_supports_gmem_shared_mem(struct kvm *kvm)
+{
+     return IS_ENABLED(CONFIG_KVM_GMEM_SHARED_MEM);
+}
+
   #endif /* __ARM64_KVM_HOST_H__ */
diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
index 096e45acadb2..8c1e1964b46a 100644
--- a/arch/arm64/kvm/Kconfig
+++ b/arch/arm64/kvm/Kconfig
@@ -38,6 +38,7 @@ menuconfig KVM
       select HAVE_KVM_VCPU_RUN_PID_CHANGE
       select SCHED_INFO
       select GUEST_PERF_EVENTS if PERF_EVENTS
+     select KVM_GMEM_SHARED_MEM
       help
         Support hosting virtualized guest machines.


Do we have to reject somewhere if we are given a guest_memfd that was
*not* created using the SHARED flag? Or will existing checks already
reject that?

We don't reject, but I don't think we need to. A user can create a
guest_memfd that's private in arm64, it would just be useless.

But the arm64 fault routine would not be able to handle that properly, no?

--
Cheers,

David / dhildenb





[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