[PATCH v20 06/11] pcie_sriov: Do not manually unrealize

Akihiko Odaki posted 11 patches 1 year ago
[PATCH v20 06/11] pcie_sriov: Do not manually unrealize
Posted by Akihiko Odaki 1 year ago
A device gets automatically unrealized when being unparented.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 hw/pci/pcie_sriov.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c
index e9b23221d713..499becd5273f 100644
--- a/hw/pci/pcie_sriov.c
+++ b/hw/pci/pcie_sriov.c
@@ -204,11 +204,7 @@ static void unregister_vfs(PCIDevice *dev)
     trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn),
                                PCI_FUNC(dev->devfn), num_vfs);
     for (i = 0; i < num_vfs; i++) {
-        Error *err = NULL;
         PCIDevice *vf = dev->exp.sriov_pf.vf[i];
-        if (!object_property_set_bool(OBJECT(vf), "realized", false, &err)) {
-            error_reportf_err(err, "Failed to unplug: ");
-        }
         object_unparent(OBJECT(vf));
         object_unref(OBJECT(vf));
     }

-- 
2.47.1
Re: [PATCH v20 06/11] pcie_sriov: Do not manually unrealize
Posted by Philippe Mathieu-Daudé 11 months, 4 weeks ago
On 16/1/25 10:00, Akihiko Odaki wrote:
> A device gets automatically unrealized when being unparented.

Correct, so:

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

However this is totally undocumented, I was not even aware of that...

> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
>   hw/pci/pcie_sriov.c | 4 ----
>   1 file changed, 4 deletions(-)
> 
> diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c
> index e9b23221d713..499becd5273f 100644
> --- a/hw/pci/pcie_sriov.c
> +++ b/hw/pci/pcie_sriov.c
> @@ -204,11 +204,7 @@ static void unregister_vfs(PCIDevice *dev)
>       trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn),
>                                  PCI_FUNC(dev->devfn), num_vfs);
>       for (i = 0; i < num_vfs; i++) {
> -        Error *err = NULL;
>           PCIDevice *vf = dev->exp.sriov_pf.vf[i];
> -        if (!object_property_set_bool(OBJECT(vf), "realized", false, &err)) {
> -            error_reportf_err(err, "Failed to unplug: ");
> -        }
>           object_unparent(OBJECT(vf));
>           object_unref(OBJECT(vf));
>       }
>