s390/pci: re-introduce zpci_remove_device()
For fixing the PF to VF link removal we need to perform some action on every removal of a zdev from the common PCI subsystem. So in preparation re-introduce zpci_remove_device() and use that instead of directly calling the common code functions. This was actually still declared from earlier code but no longer implemented. Reviewed-by: Pierre Morel <pmorel@linux.ibm.com> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
3cddb79afc
commit
2f0230b2f2
@ -672,6 +672,16 @@ int zpci_disable_device(struct zpci_dev *zdev)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(zpci_disable_device);
|
EXPORT_SYMBOL_GPL(zpci_disable_device);
|
||||||
|
|
||||||
|
void zpci_remove_device(struct zpci_dev *zdev)
|
||||||
|
{
|
||||||
|
struct zpci_bus *zbus = zdev->zbus;
|
||||||
|
struct pci_dev *pdev;
|
||||||
|
|
||||||
|
pdev = pci_get_slot(zbus->bus, zdev->devfn);
|
||||||
|
if (pdev)
|
||||||
|
pci_stop_and_remove_bus_device_locked(pdev);
|
||||||
|
}
|
||||||
|
|
||||||
int zpci_create_device(struct zpci_dev *zdev)
|
int zpci_create_device(struct zpci_dev *zdev)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
@ -716,13 +726,8 @@ void zpci_release_device(struct kref *kref)
|
|||||||
{
|
{
|
||||||
struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref);
|
struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref);
|
||||||
|
|
||||||
if (zdev->zbus->bus) {
|
if (zdev->zbus->bus)
|
||||||
struct pci_dev *pdev;
|
zpci_remove_device(zdev);
|
||||||
|
|
||||||
pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn);
|
|
||||||
if (pdev)
|
|
||||||
pci_stop_and_remove_bus_device_locked(pdev);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (zdev->state) {
|
switch (zdev->state) {
|
||||||
case ZPCI_FN_STATE_ONLINE:
|
case ZPCI_FN_STATE_ONLINE:
|
||||||
|
@ -121,7 +121,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
|
|||||||
if (!zdev)
|
if (!zdev)
|
||||||
break;
|
break;
|
||||||
if (pdev)
|
if (pdev)
|
||||||
pci_stop_and_remove_bus_device_locked(pdev);
|
zpci_remove_device(zdev);
|
||||||
|
|
||||||
ret = zpci_disable_device(zdev);
|
ret = zpci_disable_device(zdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
@ -140,7 +140,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
|
|||||||
/* Give the driver a hint that the function is
|
/* Give the driver a hint that the function is
|
||||||
* already unusable. */
|
* already unusable. */
|
||||||
pdev->error_state = pci_channel_io_perm_failure;
|
pdev->error_state = pci_channel_io_perm_failure;
|
||||||
pci_stop_and_remove_bus_device_locked(pdev);
|
zpci_remove_device(zdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
zdev->state = ZPCI_FN_STATE_STANDBY;
|
zdev->state = ZPCI_FN_STATE_STANDBY;
|
||||||
|
@ -83,21 +83,19 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
|
|||||||
struct zpci_dev *zdev = container_of(hotplug_slot, struct zpci_dev,
|
struct zpci_dev *zdev = container_of(hotplug_slot, struct zpci_dev,
|
||||||
hotplug_slot);
|
hotplug_slot);
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev;
|
||||||
struct zpci_bus *zbus = zdev->zbus;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (!zpci_fn_configured(zdev->state))
|
if (!zpci_fn_configured(zdev->state))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
pdev = pci_get_slot(zbus->bus, zdev->devfn);
|
pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn);
|
||||||
if (pdev) {
|
if (pdev && pci_num_vf(pdev)) {
|
||||||
if (pci_num_vf(pdev))
|
|
||||||
return -EBUSY;
|
|
||||||
|
|
||||||
pci_stop_and_remove_bus_device_locked(pdev);
|
|
||||||
pci_dev_put(pdev);
|
pci_dev_put(pdev);
|
||||||
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
zpci_remove_device(zdev);
|
||||||
|
|
||||||
rc = zpci_disable_device(zdev);
|
rc = zpci_disable_device(zdev);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
Loading…
Reference in New Issue
Block a user