[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250924141018.80202-5-mngyadam@amazon.de>
Date: Wed, 24 Sep 2025 16:09:55 +0200
From: Mahmoud Adam <mngyadam@...zon.de>
To: <kvm@...r.kernel.org>
CC: <alex.williamson@...hat.com>, <jgg@...pe.ca>, <kbusch@...nel.org>,
<benh@...nel.crashing.org>, David Woodhouse <dwmw@...zon.co.uk>,
<pravkmr@...zon.de>, <nagy@...aternagy.com>, <linux-kernel@...r.kernel.org>
Subject: [RFC PATCH 4/7] vfio: add FEATURE_ALIAS_REGION uapi
Add a new uapi DEVICE_FEATURE uapi, which allows users to create
region aliases. The main usage is allowing user to request alias
region with different attributes set, Like WC etc.
This could be used create alias for current regions with WC or similar
attributes set. Which is helpful for mmap-ing a region with WC. User
can use PROBE to get the supported flags by the specified region index.
Signed-off-by: Mahmoud Adam <mngyadam@...zon.de>
---
include/uapi/linux/vfio.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index 75100bf009baf..1584409ba2fb9 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -275,6 +275,8 @@ struct vfio_region_info {
#define VFIO_REGION_INFO_FLAG_WRITE (1 << 1) /* Region supports write */
#define VFIO_REGION_INFO_FLAG_MMAP (1 << 2) /* Region supports mmap */
#define VFIO_REGION_INFO_FLAG_CAPS (1 << 3) /* Info supports caps */
+#define VFIO_REGION_INFO_FLAG_ALIAS (1 << 4) /* This is an Alias Region */
+#define VFIO_REGION_INFO_FLAG_WC (1 << 5) /* Region supports write combine */
__u32 index; /* Region index */
__u32 cap_offset; /* Offset within info struct of first cap */
__aligned_u64 size; /* Region size (bytes) */
@@ -1478,6 +1480,28 @@ struct vfio_device_feature_bus_master {
};
#define VFIO_DEVICE_FEATURE_BUS_MASTER 10
+
+/**
+ * Upon VFIO_DEVICE_FEATURE_SET, creates a new region with the specified flags set.
+ * VFIO_DEVICE_FEATURE_PROBE can be used to return the supported flags for this region.
+ *
+ * Alias a region with certain region flags set. For example this
+ * could be used to alias a region with Write Combine or similar
+ * attributes set for mmap. The new region index is returned on
+ * alias_index with the flags specified set. GET_REGION_INFO could then
+ * be used with the new index. By probing a region index the supported
+ * region flags are returned.
+ * Region flags follows the same flags from REGION_GET_REGION_INFO.
+ */
+struct vfio_device_feature_alias_region {
+ __u32 flags; /* Region flags to be used */
+ __u32 index; /* Region index */
+ __u32 alias_index; /* New region index */
+ __u32 _resv1;
+ __u64 _resv2;
+};
+
+#define VFIO_DEVICE_FEATURE_ALIAS_REGION 11
/* -------- API for Type1 VFIO IOMMU -------- */
/**
--
2.47.3
Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christian Schlaeger
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597
Powered by blists - more mailing lists