spapr: Don't allow unplug of NVLink2 devices
authorDavid Gibson <david@gibson.dropbear.id.au>
Thu, 26 Mar 2020 05:27:37 +0000 (16:27 +1100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Thu, 7 May 2020 01:10:50 +0000 (11:10 +1000)
Currently, we can't properly handle unplug of NVLink2 devices, because we
don't have code to tear down their special memory resources.  There's not
a lot of impetus to implement that: since hardware NVLink2 devices can't
be hot unplugged, the guest side drivers don't usually support unplug
anyway.

Therefore, simply prevent unplug of NVLink2 devices.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
hw/ppc/spapr_pci.c

index 55ca9dee1e5aeb7956ca983450b6e835003b9ba7..61b84a392d6535d9cbd4b0dca92ad82b1949f4c9 100644 (file)
@@ -1665,6 +1665,10 @@ static void spapr_pci_unplug_request(HotplugHandler *plug_handler,
             error_setg(errp, "PCI: Hot unplug of PCI bridges not supported");
             return;
         }
+        if (object_property_get_uint(OBJECT(pdev), "nvlink2-tgt", NULL)) {
+            error_setg(errp, "PCI: Cannot unplug NVLink2 devices");
+            return;
+        }
 
         /* ensure any other present functions are pending unplug */
         if (PCI_FUNC(pdev->devfn) == 0) {