Message ID | 20250430165655.605595-12-tabba@google.com |
---|---|
State | Superseded |
Headers | show |
Series | KVM: Mapping guest_memfd backed memory at the host for software protected VMs | expand |
On Wed, Apr 30, 2025 at 9:57 AM Fuad Tabba <tabba@google.com> wrote: > +#ifdef CONFIG_KVM_GMEM > +static inline bool kvm_arch_supports_gmem(struct kvm *kvm) > +{ > + return IS_ENABLED(CONFIG_KVM_GMEM); How about just `return true;`? :)
On Fri, 9 May 2025 at 22:08, James Houghton <jthoughton@google.com> wrote: > > On Wed, Apr 30, 2025 at 9:57 AM Fuad Tabba <tabba@google.com> wrote: > > +#ifdef CONFIG_KVM_GMEM > > +static inline bool kvm_arch_supports_gmem(struct kvm *kvm) > > +{ > > + return IS_ENABLED(CONFIG_KVM_GMEM); > > How about just `return true;`? :) Ack. Thanks! /fuad
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 08ba91e6fb03..1b1753e8021a 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -1593,4 +1593,16 @@ static inline bool kvm_arch_has_irq_bypass(void) return true; } +#ifdef CONFIG_KVM_GMEM +static inline bool kvm_arch_supports_gmem(struct kvm *kvm) +{ + return IS_ENABLED(CONFIG_KVM_GMEM); +} + +static inline bool kvm_arch_gmem_supports_shared_mem(struct kvm *kvm) +{ + return IS_ENABLED(CONFIG_KVM_GMEM_SHARED_MEM); +} +#endif /* CONFIG_KVM_GMEM */ + #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.
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@google.com> --- arch/arm64/include/asm/kvm_host.h | 12 ++++++++++++ arch/arm64/kvm/Kconfig | 1 + 2 files changed, 13 insertions(+)