[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] qemu-xen-traditional: Enable MSI after host sleep



On Thu, 10 May 2012, Jean Guyader wrote:
> After a host sleep MSI will be off on the host but qemu still thinks
> it's on because of some state that have been set previously.
> 
> If qemu thinks that the device has been configure already
> and the host MSI are disabled tell Xen to reconfigure the MSI.
> 
> Signed-off-by: Jean Guyader <jean.guyader@xxxxxxxxx>
> 
> 
> diff --git a/hw/pass-through.c b/hw/pass-through.c
> index f832c5a..5c32a2e 100644
> --- a/hw/pass-through.c
> +++ b/hw/pass-through.c
> @@ -3772,6 +3772,21 @@ static int pt_pmcsr_reg_write(struct pt_dev *ptdev,
>      return 0;
>  }
>  
> +static int msi_is_enable(struct pt_dev *dev)
> +{
> +    uint16_t val = 0;
> +    uint32_t address = 0;
> +    if (!dev->msi)
> +        return 0;
> +
> +    address = dev->msi->ctrl_offset;
> +    if (!address)
> +        return 0;
> +
> +    val = pci_read_word(dev->pci_dev, address);
> +    return val & PCI_MSI_FLAGS_ENABLE;
> +}
> +
>  /* write Message Control register */
>  static int pt_msgctrl_reg_write(struct pt_dev *ptdev,
>      struct pt_reg_tbl *cfg_entry,
> @@ -3835,6 +3850,14 @@ static int pt_msgctrl_reg_write(struct pt_dev *ptdev,
>              ptdev->msi->flags &= ~MSI_FLAG_UNINIT;
>              ptdev->msi->flags |= PT_MSI_MAPPED;
>          }
> +        else
> +        {
> +            if (!msi_is_enable(ptdev))
> +            {
> +                pt_msi_setup(ptdev);
> +                pt_msi_update(ptdev);
> +            }
> +        }
>          ptdev->msi->flags |= PCI_MSI_FLAGS_ENABLE;
>      }
>      else

Would it make sense to replace the condition above:

if (ptdev->msi->flags & MSI_FLAG_UNINIT)

with the new condition you wrote?

if (!msi_is_enable(ptdev))

It seems more reliable to me.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.