Skip to content

Commit f59a7b6

Browse files
nipung87Alex Williamson
authored andcommitted
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@amd.com> Signed-off-by: Shubham Rohila <shubham.rohila@amd.com> Signed-off-by: Nipun Gupta <nipun.gupta@amd.com> Link: https://lore.kernel.org/r/20230915045423.31630-2-nipun.gupta@amd.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent a941b78 commit f59a7b6

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

include/uapi/linux/vfio.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,6 +1434,27 @@ struct vfio_device_feature_mig_data_size {
14341434

14351435
#define VFIO_DEVICE_FEATURE_MIG_DATA_SIZE 9
14361436

1437+
/**
1438+
* Upon VFIO_DEVICE_FEATURE_SET, set or clear the BUS mastering for the device
1439+
* based on the operation specified in op flag.
1440+
*
1441+
* The functionality is incorporated for devices that needs bus master control,
1442+
* but the in-band device interface lacks the support. Consequently, it is not
1443+
* applicable to PCI devices, as bus master control for PCI devices is managed
1444+
* in-band through the configuration space. At present, this feature is supported
1445+
* only for CDX devices.
1446+
* When the device's BUS MASTER setting is configured as CLEAR, it will result in
1447+
* blocking all incoming DMA requests from the device. On the other hand, configuring
1448+
* the device's BUS MASTER setting as SET (enable) will grant the device the
1449+
* capability to perform DMA to the host memory.
1450+
*/
1451+
struct vfio_device_feature_bus_master {
1452+
__u32 op;
1453+
#define VFIO_DEVICE_FEATURE_CLEAR_MASTER 0 /* Clear Bus Master */
1454+
#define VFIO_DEVICE_FEATURE_SET_MASTER 1 /* Set Bus Master */
1455+
};
1456+
#define VFIO_DEVICE_FEATURE_BUS_MASTER 10
1457+
14371458
/* -------- API for Type1 VFIO IOMMU -------- */
14381459

14391460
/**

0 commit comments

Comments
 (0)