Fix SR-IOV passthrough devices to allow ppt to attach
A late change to the SR-IOV infrastructure broke passthrough of VFs. device_set_devclass() was being used to try to force the ppt driver to attach to the device, but this didn't work because the DF_FIXEDCLASS flag wasn't being set on the device, so the ppt driver probe routine would not match when it returned BUS_NOWILDCARD. Fix this by adding a new device function that both sets the devclass and sets the DF_FIXEDCLASS flag, and use that to force the ppt driver to attach to VFs. Differential Revision: https://reviews.freebsd.org/D2041 Reviewed by: jhb MFC after: 3 weeks
This commit is contained in:
parent
3cb3567d7e
commit
1c229658b9
@ -586,7 +586,7 @@ pci_iov_enumerate_vfs(struct pci_devinfo *dinfo, const nvlist_t *config,
|
||||
* VFs.
|
||||
*/
|
||||
if (nvlist_get_bool(iov_config, "passthrough"))
|
||||
device_set_devclass(vf, "ppt");
|
||||
device_set_devclass_fixed(vf, "ppt");
|
||||
|
||||
vfinfo = device_get_ivars(vf);
|
||||
|
||||
|
@ -2682,6 +2682,25 @@ device_set_devclass(device_t dev, const char *classname)
|
||||
return (error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the devclass of a device and mark the devclass fixed.
|
||||
* @see device_set_devclass()
|
||||
*/
|
||||
int
|
||||
device_set_devclass_fixed(device_t dev, const char *classname)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (classname == NULL)
|
||||
return (EINVAL);
|
||||
|
||||
error = device_set_devclass(dev, classname);
|
||||
if (error)
|
||||
return (error);
|
||||
dev->flags |= DF_FIXEDCLASS;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the driver of a device
|
||||
*
|
||||
|
@ -522,6 +522,7 @@ void device_quiet(device_t dev);
|
||||
void device_set_desc(device_t dev, const char* desc);
|
||||
void device_set_desc_copy(device_t dev, const char* desc);
|
||||
int device_set_devclass(device_t dev, const char *classname);
|
||||
int device_set_devclass_fixed(device_t dev, const char *classname);
|
||||
int device_set_driver(device_t dev, driver_t *driver);
|
||||
void device_set_flags(device_t dev, u_int32_t flags);
|
||||
void device_set_softc(device_t dev, void *softc);
|
||||
|
Loading…
Reference in New Issue
Block a user