Hi, I know pciutils (lspci, setpci, pcilib) has been ported to OpenSolaris. pcilib read/write pci configure spaces via direct port access which bypasses the OpenSolaris kernel. I don''t think this kind of implementation is good when security and race condition come to mind. Is there any plan to create a kernel path to let libpci utilize (something like /sys/bus/pci and /proc/bus/pci exist in Linux)? I also post this on xen-discuss list since when we try to implement Intel vt-d in xVM, qemu (a device simulator running in user space) will find a way to access pci configure space, which call for such kernel path. Thanks, -baolu
David Edmondson
2008-Jun-18 09:46 UTC
Re: [driver-discuss] pciutils support on OpenSolaris
On 18 Jun 2008, at 10:12am, Lu Baolu wrote:> I know pciutils (lspci, setpci, pcilib) has been ported to > OpenSolaris. pcilib read/write pci configure spaces via direct port > access which bypasses the OpenSolaris kernel. I don''t think this kind > of implementation is good when security and race condition come to > mind. Is there any plan to create a kernel path to let libpci utilize > (something like /sys/bus/pci and /proc/bus/pci exist in Linux)? > > I also post this on xen-discuss list since when we try to implement > Intel vt-d in xVM, qemu (a device simulator running in user space) > will find a way to access pci configure space, which call for such > kernel path.Given that the PCI backend driver for PV guests will need to provide similar functionality (config space get/set), it would make some sense to have the PCI backend driver provide the same interface to user level applications. What specific requirements does QEmu have? Is it limited to read/write config space?
On Wed, Jun 18, 2008 at 5:46 PM, David Edmondson <dme@sun.com> wrote:> > On 18 Jun 2008, at 10:12am, Lu Baolu wrote: >> >> I know pciutils (lspci, setpci, pcilib) has been ported to >> OpenSolaris. pcilib read/write pci configure spaces via direct port >> access which bypasses the OpenSolaris kernel. I don''t think this kind >> of implementation is good when security and race condition come to >> mind. Is there any plan to create a kernel path to let libpci utilize >> (something like /sys/bus/pci and /proc/bus/pci exist in Linux)? >> >> I also post this on xen-discuss list since when we try to implement >> Intel vt-d in xVM, qemu (a device simulator running in user space) >> will find a way to access pci configure space, which call for such >> kernel path. > > Given that the PCI backend driver for PV guests will need to provide similar > functionality (config space get/set), it would make some sense to have the > PCI backend driver provide the same interface to user level applications. > > What specific requirements does QEmu have? Is it limited to read/write > config space? > >Qemu need to read/write the configure space of the pci devices which are exported to HVM guest via vt-d. Current qemu implementation only exports CMD register and xen developers are finding ways to export as much as they can. PCI backend driver can provide such functionality to user level applications. But question here is does qemu-dm in xvm use libpci? If so, this will make libpci unportable since pci backend driver only exists in Solaris dom0. The maintainers of libpci may don''t want to see this. As I wrote above, Solaris doesn''t provide interface for user level application to access the pci configure spaces, so libpci uses direct port access (put bdf+offset to cf8 and get the result from cfc).
Good point. Let me check. On Wed, Jun 18, 2008 at 6:14 PM, Liu, Jiang <jiang.liu@intel.com> wrote:> Hi Baolu, > How about pcitool interface in Solaris kernel? You can access > pci configuration space/io space/memory space with pcitool if you have > permission. Please take a look at > usr/src/uts/sys/common/sys/pci_tools.h. > > Lu Baolu <> wrote: >> Hi, >> >> I know pciutils (lspci, setpci, pcilib) has been ported to >> OpenSolaris. pcilib read/write pci configure spaces via direct port >> access which bypasses the OpenSolaris kernel. I don''t think this kind >> of implementation is good when security and race condition come to >> mind. Is there any plan to create a kernel path to let libpci utilize >> (something like /sys/bus/pci and /proc/bus/pci exist in Linux)? >> >> I also post this on xen-discuss list since when we try to implement >> Intel vt-d in xVM, qemu (a device simulator running in user space) >> will find a way to access pci configure space, which call for such >> kernel path. >> >> Thanks, >> -baolu >> _______________________________________________ >> driver-discuss mailing list >> driver-discuss@opensolaris.org >> http://mail.opensolaris.org/mailman/listinfo/driver-discuss >
Hi David, The pcitools facility in Solaris kernel provides the functionality what we need. User level applications access via opening pci@0,0 device and issuing ioctl() against it. However, we still need to make some change in libpci. On Thu, Jun 19, 2008 at 10:43 AM, Lu Baolu <allen.virt@gmail.com> wrote:> On Wed, Jun 18, 2008 at 5:46 PM, David Edmondson <dme@sun.com> wrote: >> >> On 18 Jun 2008, at 10:12am, Lu Baolu wrote: >>> >>> I know pciutils (lspci, setpci, pcilib) has been ported to >>> OpenSolaris. pcilib read/write pci configure spaces via direct port >>> access which bypasses the OpenSolaris kernel. I don''t think this kind >>> of implementation is good when security and race condition come to >>> mind. Is there any plan to create a kernel path to let libpci utilize >>> (something like /sys/bus/pci and /proc/bus/pci exist in Linux)? >>> >>> I also post this on xen-discuss list since when we try to implement >>> Intel vt-d in xVM, qemu (a device simulator running in user space) >>> will find a way to access pci configure space, which call for such >>> kernel path. >> >> Given that the PCI backend driver for PV guests will need to provide similar >> functionality (config space get/set), it would make some sense to have the >> PCI backend driver provide the same interface to user level applications. >> >> What specific requirements does QEmu have? Is it limited to read/write >> config space? >> >> > > Qemu need to read/write the configure space of the pci devices which > are exported to > HVM guest via vt-d. Current qemu implementation only exports CMD > register and xen > developers are finding ways to export as much as they can. > > PCI backend driver can provide such functionality to user level > applications. But question > here is does qemu-dm in xvm use libpci? If so, this will make libpci > unportable since pci > backend driver only exists in Solaris dom0. The maintainers of libpci > may don''t want to > see this. As I wrote above, Solaris doesn''t provide interface for user > level application to > access the pci configure spaces, so libpci uses direct port access > (put bdf+offset to cf8 > and get the result from cfc). >
David Edmondson
2008-Jun-19 10:12 UTC
Re: [driver-discuss] pciutils support on OpenSolaris
On 19 Jun 2008, at 10:09am, Lu Baolu wrote:> The pcitools facility in Solaris kernel provides the functionality > what we need. User level applications access via opening pci@0,0 > device and issuing ioctl() against it. However, we still need to make > some change in libpci.Allen, that''s great. Will you pursue the libpci changes, or should I do that?
I''m glad to handle this. Do we need to push our change to the mainstream libpci code? On Thu, Jun 19, 2008 at 6:12 PM, David Edmondson <dme@sun.com> wrote:> > On 19 Jun 2008, at 10:09am, Lu Baolu wrote: >> >> The pcitools facility in Solaris kernel provides the functionality >> what we need. User level applications access via opening pci@0,0 >> device and issuing ioctl() against it. However, we still need to make >> some change in libpci. > > Allen, that''s great. Will you pursue the libpci changes, or should I do > that? > >