[PATCH v5 3/5] kvm: arm64: New memslot flag to indicate cacheable mapping
ankita at nvidia.com
ankita at nvidia.com
Fri May 23 08:44:43 PDT 2025
From: Ankit Agrawal <ankita at nvidia.com>
Introduce a new memslot flag KVM_MEM_ENABLE_CACHEABLE_PFNMAP
as a tool for userspace to indicate that it expects a particular
PFN range to be mapped cacheable.
This will serve as a guide for the KVM to activate the code that
allows cacheable PFNMAP.
CC: Oliver Upton <oliver.upton at linux.dev>
CC: Catalin Marinas <catalin.marinas at arm.com>
CC: Jason Gunthorpe <jgg at nvidia.com>
Suggested-by: Marc Zyngier <maz at kernel.org>
Signed-off-by: Ankit Agrawal <ankita at nvidia.com>
---
include/uapi/linux/kvm.h | 1 +
virt/kvm/kvm_main.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index b6ae8ad8934b..9defefe7bdf0 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -51,6 +51,7 @@ struct kvm_userspace_memory_region2 {
#define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0)
#define KVM_MEM_READONLY (1UL << 1)
#define KVM_MEM_GUEST_MEMFD (1UL << 2)
+#define KVM_MEM_ENABLE_CACHEABLE_PFNMAP (1UL << 3)
/* for KVM_IRQ_LINE */
struct kvm_irq_level {
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e85b33a92624..5e0532c3abc2 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1524,7 +1524,8 @@ static void kvm_replace_memslot(struct kvm *kvm,
* only allows these.
*/
#define KVM_SET_USER_MEMORY_REGION_V1_FLAGS \
- (KVM_MEM_LOG_DIRTY_PAGES | KVM_MEM_READONLY)
+ (KVM_MEM_LOG_DIRTY_PAGES | KVM_MEM_READONLY | \
+ KVM_MEM_ENABLE_CACHEABLE_PFNMAP)
static int check_memory_region_flags(struct kvm *kvm,
const struct kvm_userspace_memory_region2 *mem)
--
2.34.1
More information about the linux-arm-kernel
mailing list