提交 67bec456 编写于 作者: P Pali Rohár 提交者: Zheng Zengkai

PCI: aardvark: Fix reading MSI interrupt number

stable inclusion
from stable-v5.10.115
commit e1ab92302b4460416edbe473064a3dc1b5e0ec4f
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5IZ9C

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e1ab92302b4460416edbe473064a3dc1b5e0ec4f

--------------------------------

commit 805dfc18 upstream.

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: 8c39d710 ("PCI: aardvark: Add Aardvark PCI host controller driver")
Signed-off-by: NPali Rohár <pali@kernel.org>
Signed-off-by: NMarek Behún <kabel@kernel.org>
Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: NMarek Behún <kabel@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 45639129
...@@ -1388,7 +1388,7 @@ static void advk_pcie_remove_irq_domain(struct advk_pcie *pcie) ...@@ -1388,7 +1388,7 @@ static void advk_pcie_remove_irq_domain(struct advk_pcie *pcie)
static void advk_pcie_handle_msi(struct advk_pcie *pcie) static void advk_pcie_handle_msi(struct advk_pcie *pcie)
{ {
u32 msi_val, msi_mask, msi_status, msi_idx; u32 msi_val, msi_mask, msi_status, msi_idx;
u16 msi_data; int virq;
msi_mask = advk_readl(pcie, PCIE_MSI_MASK_REG); msi_mask = advk_readl(pcie, PCIE_MSI_MASK_REG);
msi_val = advk_readl(pcie, PCIE_MSI_STATUS_REG); msi_val = advk_readl(pcie, PCIE_MSI_STATUS_REG);
...@@ -1398,13 +1398,9 @@ static void advk_pcie_handle_msi(struct advk_pcie *pcie) ...@@ -1398,13 +1398,9 @@ static void advk_pcie_handle_msi(struct advk_pcie *pcie)
if (!(BIT(msi_idx) & msi_status)) if (!(BIT(msi_idx) & msi_status))
continue; continue;
/*
* msi_idx contains bits [4:0] of the msi_data and msi_data
* contains 16bit MSI interrupt number
*/
advk_writel(pcie, BIT(msi_idx), PCIE_MSI_STATUS_REG); advk_writel(pcie, BIT(msi_idx), PCIE_MSI_STATUS_REG);
msi_data = advk_readl(pcie, PCIE_MSI_PAYLOAD_REG) & PCIE_MSI_DATA_MASK; virq = irq_find_mapping(pcie->msi_inner_domain, msi_idx);
generic_handle_irq(msi_data); generic_handle_irq(virq);
} }
advk_writel(pcie, PCIE_ISR0_MSI_INT_PENDING, advk_writel(pcie, PCIE_ISR0_MSI_INT_PENDING,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册