[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231108111806.92604-26-nsaenz@amazon.com>
Date: Wed, 8 Nov 2023 11:17:58 +0000
From: Nicolas Saenz Julienne <nsaenz@...zon.com>
To: <kvm@...r.kernel.org>
CC: <linux-kernel@...r.kernel.org>, <linux-hyperv@...r.kernel.org>,
<pbonzini@...hat.com>, <seanjc@...gle.com>, <vkuznets@...hat.com>,
<anelkz@...zon.com>, <graf@...zon.com>, <dwmw@...zon.co.uk>,
<jgowans@...zon.com>, <corbert@....net>, <kys@...rosoft.com>,
<haiyangz@...rosoft.com>, <decui@...rosoft.com>, <x86@...nel.org>,
<linux-doc@...r.kernel.org>,
Nicolas Saenz Julienne <nsaenz@...zon.com>
Subject: [RFC 25/33] KVM: Introduce a set of new memory attributes
Introduce the following memory attributes:
- KVM_MEMORY_ATTRIBUTE_READ
- KVM_MEMORY_ATTRIBUTE_WRITE
- KVM_MEMORY_ATTRIBUTE_EXECUTE
- KVM_MEMORY_ATTRIBUTE_NO_ACCESS
Note that NO_ACCESS is necessary in order to make a distinction between
the lack of attributes for a gfn, which defaults to the memory
protections of the backing memory, versus explicitly prohibiting any
access to that gfn.
These new memory attributes will, for now, only made be available
through the VSM KVM device (which we introduce in subsequent patches).
Signed-off-by: Nicolas Saenz Julienne <nsaenz@...zon.com>
---
include/uapi/linux/kvm.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index bd97c9852142..6b875c1040eb 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -2314,7 +2314,11 @@ struct kvm_memory_attributes {
__u64 flags;
};
+#define KVM_MEMORY_ATTRIBUTE_READ (1ULL << 0)
+#define KVM_MEMORY_ATTRIBUTE_WRITE (1ULL << 1)
+#define KVM_MEMORY_ATTRIBUTE_EXECUTE (1ULL << 2)
#define KVM_MEMORY_ATTRIBUTE_PRIVATE (1ULL << 3)
+#define KVM_MEMORY_ATTRIBUTE_NO_ACCESS (1ULL << 4)
#define KVM_CREATE_GUEST_MEMFD _IOWR(KVMIO, 0xd4, struct kvm_create_guest_memfd)
--
2.40.1
Powered by blists - more mailing lists