Patch "PCI: microchip: Fix potential race in interrupt handling" has been added to the 5.18-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    PCI: microchip: Fix potential race in interrupt handling

to the 5.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pci-microchip-fix-potential-race-in-interrupt-handli.patch
and it can be found in the queue-5.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit e65a01903c012b9e131b0ca8694b5ca55006e9a2
Author: Daire McNamara <daire.mcnamara@xxxxxxxxxxxxx>
Date:   Tue May 17 15:16:22 2022 +0100

    PCI: microchip: Fix potential race in interrupt handling
    
    [ Upstream commit 7013654af694f6e1a2e699a6450ea50d309dd0e5 ]
    
    Clear the MSI bit in ISTATUS_LOCAL register after reading it, but
    before reading and handling individual MSI bits from the ISTATUS_MSI
    register. This avoids a potential race where new MSI bits may be set
    on the ISTATUS_MSI register after it was read and be missed when the
    MSI bit in the ISTATUS_LOCAL register is cleared.
    
    ISTATUS_LOCAL is a read/write/clear register; the register's bits
    are set when the corresponding interrupt source is activated. Each
    source is independent and thus multiple sources may be active
    simultaneously. The processor can monitor and clear status
    bits. If one or more ISTATUS_LOCAL interrupt sources are active,
    the RootPort issues an interrupt towards the processor (on
    the AXI domain). Bit 28 of this register reports an MSI has been
    received by the RootPort.
    
    ISTATUS_MSI is a read/write/clear register. Bits 31-0 are asserted
    when an MSI with message number 31-0 is received by the RootPort.
    The processor must monitor and clear these bits.
    
    Effectively, Bit 28 of ISTATUS_LOCAL informs the processor that
    an MSI has arrived at the RootPort and ISTATUS_MSI informs the
    processor which MSI (in the range 0 - 31) needs handling.
    
    Reported by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
    Link: https://lore.kernel.org/linux-pci/20220127202000.GA126335@bhelgaas/
    
    Link: https://lore.kernel.org/r/20220517141622.145581-1-daire.mcnamara@xxxxxxxxxxxxx
    Fixes: 6f15a9c9f941 ("PCI: microchip: Add Microchip PolarFire PCIe controller driver")
    Signed-off-by: Daire McNamara <daire.mcnamara@xxxxxxxxxxxxx>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/pci/controller/pcie-microchip-host.c b/drivers/pci/controller/pcie-microchip-host.c
index 8175abed0f05..2c52a8cef726 100644
--- a/drivers/pci/controller/pcie-microchip-host.c
+++ b/drivers/pci/controller/pcie-microchip-host.c
@@ -419,6 +419,7 @@ static void mc_handle_msi(struct irq_desc *desc)
 
 	status = readl_relaxed(bridge_base_addr + ISTATUS_LOCAL);
 	if (status & PM_MSI_INT_MSI_MASK) {
+		writel_relaxed(status & PM_MSI_INT_MSI_MASK, bridge_base_addr + ISTATUS_LOCAL);
 		status = readl_relaxed(bridge_base_addr + ISTATUS_MSI);
 		for_each_set_bit(bit, &status, msi->num_vectors) {
 			ret = generic_handle_domain_irq(msi->dev_domain, bit);
@@ -437,13 +438,8 @@ static void mc_msi_bottom_irq_ack(struct irq_data *data)
 	void __iomem *bridge_base_addr =
 		port->axi_base_addr + MC_PCIE_BRIDGE_ADDR;
 	u32 bitpos = data->hwirq;
-	unsigned long status;
 
 	writel_relaxed(BIT(bitpos), bridge_base_addr + ISTATUS_MSI);
-	status = readl_relaxed(bridge_base_addr + ISTATUS_MSI);
-	if (!status)
-		writel_relaxed(BIT(PM_MSI_INT_MSI_SHIFT),
-			       bridge_base_addr + ISTATUS_LOCAL);
 }
 
 static void mc_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux