On Wed, Jun 20, 2018 at 04:42:29PM +0200, Roger Pau Monne wrote:
> So that interrupts are properly freed.
> 
> Signed-off-by: Roger Pau Monné <roger....@citrix.com>
> ---
> Cc: Andrew Cooper <andrew.coop...@citrix.com>
> Cc: George Dunlap <george.dun...@eu.citrix.com>
> Cc: Ian Jackson <ian.jack...@eu.citrix.com>
> Cc: Jan Beulich <jbeul...@suse.com>
> Cc: Julien Grall <julien.gr...@arm.com>
> Cc: Konrad Rzeszutek Wilk <konrad.w...@oracle.com>
> Cc: Stefano Stabellini <sstabell...@kernel.org>
> Cc: Tim Deegan <t...@xen.org>
> Cc: Wei Liu <wei.l...@citrix.com>
> ---
>  xen/drivers/vpci/msi.c | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/drivers/vpci/msi.c b/xen/drivers/vpci/msi.c
> index 5bb505c864..e8cd1238df 100644
> --- a/xen/drivers/vpci/msi.c
> +++ b/xen/drivers/vpci/msi.c
> @@ -266,7 +266,28 @@ static int init_msi(struct pci_dev *pdev)
>  
>      return 0;
>  }
> -REGISTER_VPCI_INIT(init_msi, NULL, VPCI_PRIORITY_LOW);
> +
> +static void teardown_msi(struct pci_dev *pdev)
> +{
> +    unsigned int pos = pci_find_cap_offset(pdev->seg, pdev->bus,
> +                                           PCI_SLOT(pdev->devfn),
> +                                           PCI_FUNC(pdev->devfn),
> +                                           PCI_CAP_ID_MSI);
> +    struct vpci_msi *msi = pdev->vpci->msi;
> +    uint16_t control;
> +
> +    if ( !msi || !msi->enabled )
> +        return;
> +
> +    control = pci_conf_read16(pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
> +                              PCI_FUNC(pdev->devfn), msi_control_reg(pos));
> +    pci_conf_write16(pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
> +                     PCI_FUNC(pdev->devfn), msi_control_reg(pos),
> +                     (control & ~PCI_MSI_FLAGS_ENABLE));
> +
> +    vpci_msi_arch_disable(msi, pdev);

Missing xfree(msi)?

Wei.

> +}
> +REGISTER_VPCI_INIT(init_msi, teardown_msi, VPCI_PRIORITY_LOW);
>  
>  void vpci_dump_msi(void)
>  {
> -- 
> 2.17.1
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to