Re: [RFC PATCH] vfio/pci: Use kernel VPD access functions

2015-09-14 Thread Rustad, Mark D
> On Sep 11, 2015, at 6:11 PM, Rustad, Mark D  wrote:
> 
> Superficially this looks pretty good. I need to think harder to be sure of 
> the details.

This is the first time I've looked at all at any of the vfio code, but this is 
still looking good to me. Thanks for taking this on and exposing the vfio code 
to me. I hope more devices will be able to take advantage of the quirk and get 
their VPD issues resolved.

I did run this on a host with a device with VPD assigned to a guest and did not 
see any trouble when accessing it concurrently from both the guest and the host 
on the same and different functions. I don't think my particular environment is 
ideal to fully reproduce the problem (no writable VPD area), but my initial 
testing looks good.

Acked-by: Mark Rustad 

--
Mark Rustad, Networking Division, Intel Corporation



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [RFC PATCH] vfio/pci: Use kernel VPD access functions

2015-09-14 Thread Alex Williamson
On Sat, 2015-09-12 at 01:11 +, Rustad, Mark D wrote:
> Alex,
> 
> > On Sep 11, 2015, at 11:16 AM, Alex Williamson  
> > wrote:
> > 
> > RFC - Is this something we should do?
> 
> Superficially this looks pretty good. I need to think harder to be sure of 
> the details.
> 
> > Should we consider providing
> > similar emulation through PCI sysfs to allow lspci to also make use
> > of the vpd interfaces?
> 
> It looks to me like lspci already uses the vpd attribute in sysfs to access 
> VPD, so maybe nothing more than this is needed. No doubt lspci can be coerced 
> into accessing VPD directly, but is that really worth going after? I'm not so 
> sure.
> 
> An strace of lspci accessing a device with VPD shows me:
> 
> write(1, "\tCapabilities: [e0] Vital Produc"..., 39   Capabilities: [e0] 
> Vital Product Data
> ) = 39
> open("/sys/bus/pci/devices/:02:00.0/vpd", O_RDONLY) = 4
> ^^^ accesses to this should be safe, 
> I think
> 
> pread(4, "\202", 1, 0)  = 1
> pread(4, "\10\0", 2, 1) = 2
> pread(4, "PVL Dell", 8, 3)  = 8
> write(1, "\t\tProduct Name: PVL Dell\n", 25   Product Name: PVL Dell
> ) = 25
> 
> and so forth.

Oh good, so aside from some rouge admin poking around with setpci access
through pci-sysfs is hopefully not an issue.  Thanks for looking into
it.

Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH] vfio/pci: Use kernel VPD access functions

2015-09-11 Thread Rustad, Mark D
Alex,

> On Sep 11, 2015, at 11:16 AM, Alex Williamson  
> wrote:
> 
> RFC - Is this something we should do?

Superficially this looks pretty good. I need to think harder to be sure of the 
details.

> Should we consider providing
> similar emulation through PCI sysfs to allow lspci to also make use
> of the vpd interfaces?

It looks to me like lspci already uses the vpd attribute in sysfs to access 
VPD, so maybe nothing more than this is needed. No doubt lspci can be coerced 
into accessing VPD directly, but is that really worth going after? I'm not so 
sure.

An strace of lspci accessing a device with VPD shows me:

write(1, "\tCapabilities: [e0] Vital Produc"..., 39 Capabilities: [e0] 
Vital Product Data
) = 39
open("/sys/bus/pci/devices/:02:00.0/vpd", O_RDONLY) = 4
^^^ accesses to this should be safe, I 
think

pread(4, "\202", 1, 0)  = 1
pread(4, "\10\0", 2, 1) = 2
pread(4, "PVL Dell", 8, 3)  = 8
write(1, "\t\tProduct Name: PVL Dell\n", 25 Product Name: PVL Dell
) = 25

and so forth.

--
Mark Rustad, Networking Division, Intel Corporation



signature.asc
Description: Message signed with OpenPGP using GPGMail