Re: [REPOST][PATCH 1/2] driver core: Add new device_driver flag toallow binding via sysfs only

From: Scott Wood
Date: Thu Dec 19 2013 - 15:22:28 EST


On Wed, 2013-12-18 at 17:07 -0800, Greg Kroah-Hartman wrote:
> On Tue, Dec 03, 2013 at 12:34:46PM +0000, Kim Phillips wrote:
> > VFIO supports pass-through of devices to user space - for sake
> > of illustration, say a PCI e1000 device:
> >
> > - the e1000 is first unbound from the PCI e1000 driver via sysfs
> > - the vfio-pci driver is told via new_id that it now handles e1000 devices
> > - the e1000 is explicitly bound to vfio-pci through sysfs
> >
> > However, now we have two drivers in the system that both handle e1000
> > devices. A hotplug event could then occur and it is ambiguous as to which
> > driver will claim the device. The desired semantics is that vfio-pci is
> > only bound to devices by explicit request in sysfs. This patch makes this
> > possible by introducing a sysfs_bind_only flag in struct device_driver.
>
> Why deal with this at all and not just deal with the "bind" sysfs file
> instead? That way no driver core logic needs to be changed at all, and
> your userspace tools know _exactly_ which device is being bound to the
> new device.
>
> Don't mess with the "new_id" file for stuff like this, as you point out,
> it's "tricky"...

As discussed before, "bind" does not bypass the ID checks, and thus it
does not work without either "new_id" or a wildcard match.

Or are you proposing changing "bind" so that it does bypass the ID
checks? Or perhaps a new "force_bind" file that does?

-Scott


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/