commit fcacdfbef5a1 ("PCI/MSI: Provide a new set of mask and unmask functions") introduce functions pci_msi_update_mask() and pci_msix_write_vector_ctrl() that is missing checks for pci_msi_ignore_mask that exists in commit 446a98b19fd6 ("PCI/MSI: Use new mask/unmask functions"). The checks are in place at the high level __pci_msi_mask_desc()/__pci_msi_unmask_desc(), but some functions call directly to the helpers. Push the pci_msi_ignore_mask check down to the functions that make the actual writes. This keeps the logic local to the writes that need to be bypassed. With Xen PV, the hypervisor is responsible for masking and unmasking the interrupts, which pci_msi_ignore_mask is used to indicate. This change avoids lockups in amdgpu drivers under Xen during boot. Fixes: commit 446a98b19fd6 ("PCI/MSI: Use new mask/unmask functions") Reported-by: Josef Johansson <josef@xxxxxxxxxxx> Signed-off-by: Jason Andryuk <jandryuk@xxxxxxxxx> --- drivers/pci/msi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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) -- 2.30.2