lkml.org 
[lkml]   [2015]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 0/3] uio: add MSI/MSI-X support to uio_pci_generic driver
From
Date


On 10/06/15 17:30, Michael S. Tsirkin wrote:
> On Tue, Oct 06, 2015 at 11:37:59AM +0300, Vlad Zolotarov wrote:
>> Bus mastering is easily enabled from the user space (taken from DPDK code):
>>
>> static int
>> pci_uio_set_bus_master(int dev_fd)
>> {
>> uint16_t reg;
>> int ret;
>>
>> ret = pread(dev_fd, &reg, sizeof(reg), PCI_COMMAND);
>> if (ret != sizeof(reg)) {
>> RTE_LOG(ERR, EAL,
>> "Cannot read command from PCI config space!\n");
>> return -1;
>> }
>>
>> /* return if bus mastering is already on */
>> if (reg & PCI_COMMAND_MASTER)
>> return 0;
>>
>> reg |= PCI_COMMAND_MASTER;
>>
>> ret = pwrite(dev_fd, &reg, sizeof(reg), PCI_COMMAND);
>> if (ret != sizeof(reg)) {
>> RTE_LOG(ERR, EAL,
>> "Cannot write command to PCI config space!\n");
>> return -1;
>> }
>>
>> return 0;
>> }
>>
>> So, this is a non-issue. ;)
> There might be valid reasons for DPDK to do this, e.g. if using VFIO.

Michael, I'm afraid u are missing the main point here - the code above
destroys all your long arguments. U can't possibly prevent the root-user
from enabling the device bus mastering. And as me and other people on
this thread have already mentioned MSI and MSI-X device configuration is
controlled from the device BAR, thus may not be prevented too.


>
> I'm guessing it doesn't enable MSI though, does it?

Again, enabling MSI is a matter of a trivial patch configuring device
registers on the device BAR.

>



\
 
 \ /
  Last update: 2015-10-06 17:01    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog