[PATCH v9 05/13] KVM: x86: define kvm_arch_gmem_supports_no_direct_map()
Ackerley Tng
ackerleytng at google.com
Thu Jan 15 13:48:08 PST 2026
"Kalyazin, Nikita" <kalyazin at amazon.co.uk> writes:
> From: Patrick Roy <patrick.roy at linux.dev>
>
> x86 supports GUEST_MEMFD_FLAG_NO_DIRECT_MAP whenever direct map
> modifications are possible (which is always the case).
>
> Signed-off-by: Patrick Roy <patrick.roy at linux.dev>
> Signed-off-by: Nikita Kalyazin <kalyazin at amazon.com>
> ---
> arch/x86/include/asm/kvm_host.h | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 5a3bfa293e8b..68bd29a52f24 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -28,6 +28,7 @@
> #include <linux/sched/vhost_task.h>
> #include <linux/call_once.h>
> #include <linux/atomic.h>
> +#include <linux/set_memory.h>
>
> #include <asm/apic.h>
> #include <asm/pvclock-abi.h>
> @@ -2481,4 +2482,12 @@ static inline bool kvm_arch_has_irq_bypass(void)
> return enable_device_posted_irqs;
> }
>
> +#ifdef CONFIG_KVM_GUEST_MEMFD
> +static inline bool kvm_arch_gmem_supports_no_direct_map(void)
> +{
> + return can_set_direct_map();
> +}
> +#define kvm_arch_gmem_supports_no_direct_map kvm_arch_gmem_supports_no_direct_map
> +#endif /* CONFIG_KVM_GUEST_MEMFD */
> +
> #endif /* _ASM_X86_KVM_HOST_H */
> --
> 2.50.1
Reviewed-by: Ackerley Tng <ackerleytng at google.com>
More information about the linux-riscv
mailing list