Skip to content

Commit 805dfc1

Browse files
paliLorenzo Pieralisi
authored andcommitted
PCI: aardvark: Fix reading MSI interrupt number
In advk_pcie_handle_msi() it is expected that when bit i in the W1C register PCIE_MSI_STATUS_REG is cleared, the PCIE_MSI_PAYLOAD_REG is updated to contain the MSI number corresponding to index i. Experiments show that this is not so, and instead PCIE_MSI_PAYLOAD_REG always contains the number of the last received MSI, overall. Do not read PCIE_MSI_PAYLOAD_REG register for determining MSI interrupt number. Since Aardvark already forbids more than 32 interrupts and uses own allocated hwirq numbers, the msi_idx already corresponds to the received MSI number. Link: https://lore.kernel.org/r/20220110015018.26359-3-kabel@kernel.org Fixes: 8c39d71 ("PCI: aardvark: Add Aardvark PCI host controller driver") Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
1 parent 1d86abf commit 805dfc1

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

drivers/pci/controller/pci-aardvark.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,6 @@ static void advk_pcie_remove_irq_domain(struct advk_pcie *pcie)
13841384
static void advk_pcie_handle_msi(struct advk_pcie *pcie)
13851385
{
13861386
u32 msi_val, msi_mask, msi_status, msi_idx;
1387-
u16 msi_data;
13881387

13891388
msi_mask = advk_readl(pcie, PCIE_MSI_MASK_REG);
13901389
msi_val = advk_readl(pcie, PCIE_MSI_STATUS_REG);
@@ -1394,13 +1393,9 @@ static void advk_pcie_handle_msi(struct advk_pcie *pcie)
13941393
if (!(BIT(msi_idx) & msi_status))
13951394
continue;
13961395

1397-
/*
1398-
* msi_idx contains bits [4:0] of the msi_data and msi_data
1399-
* contains 16bit MSI interrupt number
1400-
*/
14011396
advk_writel(pcie, BIT(msi_idx), PCIE_MSI_STATUS_REG);
1402-
msi_data = advk_readl(pcie, PCIE_MSI_PAYLOAD_REG) & PCIE_MSI_DATA_MASK;
1403-
generic_handle_irq(msi_data);
1397+
if (generic_handle_domain_irq(pcie->msi_inner_domain, msi_idx) == -EINVAL)
1398+
dev_err_ratelimited(&pcie->pdev->dev, "unexpected MSI 0x%02x\n", msi_idx);
14041399
}
14051400

14061401
advk_writel(pcie, PCIE_ISR0_MSI_INT_PENDING,

0 commit comments

Comments
 (0)