[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230803143253.7817-2-nipun.gupta@amd.com>
Date: Thu, 3 Aug 2023 20:02:52 +0530
From: Nipun Gupta <nipun.gupta@....com>
To: <gregkh@...uxfoundation.org>, <alex.williamson@...hat.com>,
<linux-kernel@...r.kernel.org>
CC: <git@....com>, <pieter.jansen-van-vuuren@....com>,
<nikhil.agarwal@....com>, <michal.simek@....com>,
<abhijit.gangurde@....com>, Nipun Gupta <nipun.gupta@....com>,
Shubham Rohila <shubham.rohila@....com>
Subject: [PATCH v5 2/3] vfio: add bus master feature to device feature ioctl
add bus mastering control to VFIO_DEVICE_FEATURE IOCTL. The VFIO user
can use this feature to enable or disable the Bus Mastering of a
device bound to VFIO.
Co-developed-by: Shubham Rohila <shubham.rohila@....com>
Signed-off-by: Shubham Rohila <shubham.rohila@....com>
Signed-off-by: Nipun Gupta <nipun.gupta@....com>
Changes in v5:
- This patch is newly added which proposes a new flag
VFIO_DEVICE_FEATURE_BUS_MASTER in VFIO_DEVICE_FEATURE IOCTL.
---
include/uapi/linux/vfio.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index 20c804bdc09c..05350a2f1eab 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -1287,6 +1287,22 @@ struct vfio_device_feature_mig_data_size {
#define VFIO_DEVICE_FEATURE_MIG_DATA_SIZE 9
+/**
+ * Upon VFIO_DEVICE_FEATURE_SET, allow the BUS mastering for the device to be
+ * set or clear based on the operation specified in op flag.
+ *
+ * If the BUS MASTER of the device is configured to CLEAR,
+ * all the incoming DMA from the device will be blocked.
+ * If the BUS MASTER of the device is configured to SET (enable),
+ * device would be able to do DMA to host memory.
+ */
+struct vfio_device_feature_bus_master {
+ __u32 op;
+#define VFIO_DEVICE_FEATURE_SET_MASTER 0 /* Set Bus Master */
+#define VFIO_DEVICE_FEATURE_CLEAR_MASTER 1 /* Clear Bus Master */
+};
+#define VFIO_DEVICE_FEATURE_BUS_MASTER 9
+
/* -------- API for Type1 VFIO IOMMU -------- */
/**
--
2.17.1
Powered by blists - more mailing lists