linux/virt/kvm/guest_memfd.h
Sean Christopherson f8479adb28 KVM: guest_memfd: Move gmem function declarations to dedicated guest_memfd.h
Extract the gmem function declarations out of kvm_mm.h and into a dedicated
header, guest_memfd.h.  This will allow creating a MAINTAINERS entry for
guest_memfd without having to rely on content pattern matching.

Reviewed-by: Ackerley Tng <ackerleytng@google.com>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Link: https://patch.msgid.link/20260731173842.2649391-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-08-05 10:00:53 -07:00

35 lines
900 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef __KVM_GUEST_MEMFD_H__
#define __KVM_GUEST_MEMFD_H__
#include <linux/kvm_types.h>
#ifdef CONFIG_KVM_GUEST_MEMFD
int kvm_gmem_init(struct module *module);
void kvm_gmem_exit(void);
int kvm_gmem_create(struct kvm *kvm, struct kvm_create_guest_memfd *args);
int kvm_gmem_bind(struct kvm *kvm, struct kvm_memory_slot *slot,
unsigned int fd, uoff_t offset);
void kvm_gmem_unbind(struct kvm_memory_slot *slot);
#else
static inline int kvm_gmem_init(struct module *module)
{
return 0;
}
static inline void kvm_gmem_exit(void) {};
static inline int kvm_gmem_bind(struct kvm *kvm,
struct kvm_memory_slot *slot,
unsigned int fd, uoff_t offset)
{
WARN_ON_ONCE(1);
return -EIO;
}
static inline void kvm_gmem_unbind(struct kvm_memory_slot *slot)
{
WARN_ON_ONCE(1);
}
#endif /* CONFIG_KVM_GUEST_MEMFD */
#endif /* __KVM_GUEST_MEMFD_H__ */