spapr: Don't allow unplug of NVLink2 devices
diff mbox series

Message ID 20200331032709.112476-1-david@gibson.dropbear.id.au
State New
Headers show
Series
  • spapr: Don't allow unplug of NVLink2 devices
Related show

Commit Message

David Gibson March 31, 2020, 3:27 a.m. UTC
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>
---
 hw/ppc/spapr_pci.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Alexey Kardashevskiy March 31, 2020, 5:11 a.m. UTC | #1
On 31/03/2020 14:27, David Gibson wrote:
> 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 | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index 55ca9dee1e..61b84a392d 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -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) {
>
Philippe Mathieu-Daudé March 31, 2020, 7:56 a.m. UTC | #2
On 3/31/20 5:27 AM, David Gibson wrote:
> 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?

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>   hw/ppc/spapr_pci.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index 55ca9dee1e..61b84a392d 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -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) {
>
Alexey Kardashevskiy March 31, 2020, 10:30 a.m. UTC | #3
On 31/03/2020 18:56, Philippe Mathieu-Daudé wrote:
> On 3/31/20 5:27 AM, David Gibson wrote:
>> 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.


> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
>>
>> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
>> ---
>>   hw/ppc/spapr_pci.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
>> index 55ca9dee1e..61b84a392d 100644
>> --- a/hw/ppc/spapr_pci.c
>> +++ b/hw/ppc/spapr_pci.c
>> @@ -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) {

Patch
diff mbox series

diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 55ca9dee1e..61b84a392d 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -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) {