diff mbox series

[RFC,kvmtool,v1,27/32] Track the memfd in the bank

Message ID 20221202174417.1310826-28-tabba@google.com (mailing list archive)
State New, archived
Headers show
Series Add support for restricted guest memory in kvmtool | expand

Commit Message

Fuad Tabba Dec. 2, 2022, 5:44 p.m. UTC
Guest memory is canonically represented by the fd, so use it to
refer to guest memory in the kvmtool guest memory banks.

Signed-off-by: Fuad Tabba <tabba@google.com>
---
 include/kvm/kvm.h | 2 ++
 kvm.c             | 2 ++
 2 files changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/include/kvm/kvm.h b/include/kvm/kvm.h
index 33cae9d..6192f6c 100644
--- a/include/kvm/kvm.h
+++ b/include/kvm/kvm.h
@@ -80,6 +80,8 @@  struct kvm_mem_bank {
 	u64			size;
 	enum kvm_mem_type	type;
 	u32			slot;
+	int			memfd;
+	u64			memfd_offset;
 };
 
 struct kvm {
diff --git a/kvm.c b/kvm.c
index bde6708..a0bddf4 100644
--- a/kvm.c
+++ b/kvm.c
@@ -374,6 +374,8 @@  int kvm__register_mem(struct kvm *kvm, u64 guest_phys, u64 size,
 	bank->size			= size;
 	bank->type			= type;
 	bank->slot			= slot;
+	bank->memfd			= memfd;
+	bank->memfd_offset		= offset;
 
 	if (type & KVM_MEM_TYPE_READONLY)
 		flags |= KVM_MEM_READONLY;