mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
xen-pciback: reconfigure also from backend watch handler
commit c81d3d2460 upstream.
When multiple PCI devices get assigned to a guest right at boot, libxl
incrementally populates the backend tree. The writes for the first of
the devices trigger the backend watch. In turn xen_pcibk_setup_backend()
will set the XenBus state to Initialised, at which point no further
reconfigures would happen unless a device got hotplugged. Arrange for
reconfigure to also get triggered from the backend watch handler.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: stable@vger.kernel.org
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Link: https://lore.kernel.org/r/2337cbd6-94b9-4187-9862-c03ea12e0c61@suse.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c196031f4f
commit
63a5b38447
|
|
@ -359,7 +359,8 @@ static int xen_pcibk_publish_pci_root(struct xen_pcibk_device *pdev,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev)
|
static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev,
|
||||||
|
enum xenbus_state state)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
int num_devs;
|
int num_devs;
|
||||||
|
|
@ -373,9 +374,7 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev)
|
||||||
dev_dbg(&pdev->xdev->dev, "Reconfiguring device ...\n");
|
dev_dbg(&pdev->xdev->dev, "Reconfiguring device ...\n");
|
||||||
|
|
||||||
mutex_lock(&pdev->dev_lock);
|
mutex_lock(&pdev->dev_lock);
|
||||||
/* Make sure we only reconfigure once */
|
if (xenbus_read_driver_state(pdev->xdev->nodename) != state)
|
||||||
if (xenbus_read_driver_state(pdev->xdev->nodename) !=
|
|
||||||
XenbusStateReconfiguring)
|
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, "num_devs", "%d",
|
err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, "num_devs", "%d",
|
||||||
|
|
@ -500,6 +499,10 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state != XenbusStateReconfiguring)
|
||||||
|
/* Make sure we only reconfigure once. */
|
||||||
|
goto out;
|
||||||
|
|
||||||
err = xenbus_switch_state(pdev->xdev, XenbusStateReconfigured);
|
err = xenbus_switch_state(pdev->xdev, XenbusStateReconfigured);
|
||||||
if (err) {
|
if (err) {
|
||||||
xenbus_dev_fatal(pdev->xdev, err,
|
xenbus_dev_fatal(pdev->xdev, err,
|
||||||
|
|
@ -525,7 +528,7 @@ static void xen_pcibk_frontend_changed(struct xenbus_device *xdev,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XenbusStateReconfiguring:
|
case XenbusStateReconfiguring:
|
||||||
xen_pcibk_reconfigure(pdev);
|
xen_pcibk_reconfigure(pdev, XenbusStateReconfiguring);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XenbusStateConnected:
|
case XenbusStateConnected:
|
||||||
|
|
@ -664,6 +667,15 @@ static void xen_pcibk_be_watch(struct xenbus_watch *watch,
|
||||||
xen_pcibk_setup_backend(pdev);
|
xen_pcibk_setup_backend(pdev);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case XenbusStateInitialised:
|
||||||
|
/*
|
||||||
|
* We typically move to Initialised when the first device was
|
||||||
|
* added. Hence subsequent devices getting added may need
|
||||||
|
* reconfiguring.
|
||||||
|
*/
|
||||||
|
xen_pcibk_reconfigure(pdev, XenbusStateInitialised);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user