[Qemu-devel] [PATCH] pci: deassert intx when pci device unrealize

Herongguang (Stephen) posted 1 patch 6 years, 11 months ago
Failed in applying to current master (apply log)
hw/pci/pci.c | 1 +
1 file changed, 1 insertion(+)
[Qemu-devel] [PATCH] pci: deassert intx when pci device unrealize
Posted by Herongguang (Stephen) 6 years, 11 months ago
If a pci device is not reset by VM (by writing into config space)
and unplugged by VM, after that when VM reboots, qemu may assert:
pcibus_reset: Assertion `bus->irq_count[i] == 0' failed

Signed-off-by: herongguang <herongguang.he@huawei.com>
---
  hw/pci/pci.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 259483b..98ccc27 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1083,6 +1083,7 @@ static void pci_qdev_unrealize(DeviceState *dev, Error **errp)
          pc->exit(pci_dev);
      }

+    pci_device_deassert_intx(pci_dev);
      do_pci_unregister_device(pci_dev);
  }

--
1.7.12.4

Re: [Qemu-devel] [PATCH] pci: deassert intx when pci device unrealize
Posted by Marcel Apfelbaum 6 years, 11 months ago
On 04/25/2017 05:29 AM, Herongguang (Stephen) wrote:
> If a pci device is not reset by VM (by writing into config space)
> and unplugged by VM, after that when VM reboots, qemu may assert:
> pcibus_reset: Assertion `bus->irq_count[i] == 0' failed
>
> Signed-off-by: herongguang <herongguang.he@huawei.com>
> ---
>  hw/pci/pci.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 259483b..98ccc27 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -1083,6 +1083,7 @@ static void pci_qdev_unrealize(DeviceState *dev, Error **errp)
>          pc->exit(pci_dev);
>      }
>
> +    pci_device_deassert_intx(pci_dev);
>      do_pci_unregister_device(pci_dev);
>  }
>
> --
> 1.7.12.4



Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>

Thanks,
Marcel