PCI: aardvark: Read all 16-bits from PCIE_MSI_PAYLOAD_REG
authorMarek Behún <kabel@kernel.org>
Thu, 28 Oct 2021 18:56:55 +0000 (20:56 +0200)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Fri, 29 Oct 2021 09:25:31 +0000 (10:25 +0100)
The PCIE_MSI_PAYLOAD_REG contains 16-bit MSI number, not only lower
8 bits. Fix reading content of this register and add a comment
describing the access to this register.

Link: https://lore.kernel.org/r/20211028185659.20329-4-kabel@kernel.org
Fixes: 8c39d710363c ("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>
Cc: stable@vger.kernel.org
drivers/pci/controller/pci-aardvark.c

index b45ff2911c80078ccf0cb4170f5c5a190bb13b58..389ebba1dd9bccab9097d63311a9639e4f7ee0eb 100644 (file)
 #define PCIE_MSI_STATUS_REG                    (CONTROL_BASE_ADDR + 0x58)
 #define PCIE_MSI_MASK_REG                      (CONTROL_BASE_ADDR + 0x5C)
 #define PCIE_MSI_PAYLOAD_REG                   (CONTROL_BASE_ADDR + 0x9C)
+#define     PCIE_MSI_DATA_MASK                 GENMASK(15, 0)
 
 /* PCIe window configuration */
 #define OB_WIN_BASE_ADDR                       0x4c00
@@ -1319,8 +1320,12 @@ static void advk_pcie_handle_msi(struct advk_pcie *pcie)
                if (!(BIT(msi_idx) & msi_status))
                        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);
-               msi_data = advk_readl(pcie, PCIE_MSI_PAYLOAD_REG) & 0xFF;
+               msi_data = advk_readl(pcie, PCIE_MSI_PAYLOAD_REG) & PCIE_MSI_DATA_MASK;
                generic_handle_irq(msi_data);
        }