Skip to contentSkip to conversation

spapr: Don't allow unplug of NVLink2 devices

PATCH In review David Gibson 3 participants 4 messages Mar 31, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spapr: Don't allow unplug of NVLink2 devices

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.

---
 hw/ppc/spapr_pci.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/ppc/spapr_pci.c +4 -0
index 55ca9dee1e..61b84a392d 100644
@@ -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) {
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · David Gibson

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.

Quoted 20 lines
---
 hw/ppc/spapr_pci.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/ppc/spapr_pci.c +4 -0
index 55ca9dee1e..61b84a392d 100644
@@ -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) {
Signature · 1 line
Alexey
Reviewed-by on v1 1/1
#2 lore raw
In reply to David Gibson
Quoted 7 lines · David Gibson

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.

Safe for 5.0, right?

Quoted 22 lines
---
  hw/ppc/spapr_pci.c | 4 ++++
  1 file changed, 4 insertions(+)
hw/ppc/spapr_pci.c +4 -0
index 55ca9dee1e..61b84a392d 100644
@@ -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) {
#3 lore raw
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · David Gibson

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.

Safe for 5.0, right?

I'd say so, yes.

Quoted 26 lines
Quoted 23 lines

---
  hw/ppc/spapr_pci.c | 4 ++++

  1 file changed, 4 insertions(+)
hw/ppc/spapr_pci.c +0 -0
index 55ca9dee1e..61b84a392d 100644
@@ -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) {

Signature · 1 line
Alexey