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

Re: [PATCH] PCI/MSI: Fix masking MSI/MSI-X on Xen PV



On Sun, Oct 24 2021 at 21:25, Jason Andryuk wrote:
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 4b4792940e86..478536bafc39 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -148,6 +148,9 @@ static noinline void pci_msi_update_mask(struct msi_desc 
> *desc, u32 clear, u32 s
>       raw_spinlock_t *lock = &desc->dev->msi_lock;
>       unsigned long flags;
>  
> +     if (pci_msi_ignore_mask)
> +             return;
> +
>       raw_spin_lock_irqsave(lock, flags);
>       desc->msi_mask &= ~clear;
>       desc->msi_mask |= set;
> @@ -181,6 +184,9 @@ static void pci_msix_write_vector_ctrl(struct msi_desc 
> *desc, u32 ctrl)
>  {
>       void __iomem *desc_addr = pci_msix_desc_addr(desc);
>  
> +     if (pci_msi_ignore_mask)
> +             return;
> +
>       writel(ctrl, desc_addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
>  }
>  
> @@ -200,7 +206,7 @@ static inline void pci_msix_unmask(struct msi_desc *desc)
>  
>  static void __pci_msi_mask_desc(struct msi_desc *desc, u32 mask)
>  {
> -     if (pci_msi_ignore_mask || desc->msi_attrib.is_virtual)
> +     if (desc->msi_attrib.is_virtual)
>               return;
>  
>       if (desc->msi_attrib.is_msix)
> @@ -211,7 +217,7 @@ static void __pci_msi_mask_desc(struct msi_desc *desc, 
> u32 mask)
>  
>  static void __pci_msi_unmask_desc(struct msi_desc *desc, u32 mask)
>  {
> -     if (pci_msi_ignore_mask || desc->msi_attrib.is_virtual)
> +     if (desc->msi_attrib.is_virtual)
>               return;
>  
>       if (desc->msi_attrib.is_msix)

No, really. This is horrible and incomplete. The right thing to do is to
move the check back into the low level accessors and remove it from the
call sites simply because the low level accessors can be reached not
only from the mask/unmask functions. But the above also fails to respect
msi_attrib.maskbit... I'll send out a proper fix in a few.

Thanks,

        tglx



 


Rackspace

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