On Sat, 19 Jan 2019 18:05:09 +0530
Steevan Rodrigues <steevanxpe...@gmail.com> wrote:

> Hello,
> I am trying to port kernel mode driver for PCIe device to user space with
> the help of VFIO.
> I am wondering how to enable and disable pci bus mastering for the device ?
> 
> In  Kerenel mode we call pci_set_master() and pci_clear_master() .

>From the vfio device file descriptor call the
VFIO_DEVICE_GET_REGION_INFO ioctl with the VFIO_PCI_CONFIG_REGION_INDEX
as the index field to get the offset of PCI config space for the device.
Bus master is in the command register, which is a word register at
offset 0x4 into PCI config space, so you'd do a read, modify, write
using pread/pwrite or equivalent of the word at config space offset +
0x4, setting the but master bit within that word.  Thanks,

Alex

_______________________________________________
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users

Reply via email to