LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] PCI: aardvark: Fix masking and unmasking legacy INTx interrupts
@ 2021-08-20 15:50 Pali Rohár
2021-08-20 15:56 ` Marc Zyngier
2021-08-26 12:42 ` Lorenzo Pieralisi
0 siblings, 2 replies; 3+ messages in thread
From: Pali Rohár @ 2021-08-20 15:50 UTC (permalink / raw)
To: Lorenzo Pieralisi, Rob Herring, Thomas Petazzoni, Bjorn Helgaas,
Marc Zyngier, Marek Behún
Cc: linux-pci, linux-arm-kernel, linux-kernel
irq_mask and irq_unmask callbacks need to be properly guarded by raw spin
locks as masking/unmasking procedure needs atomic read-modify-write
operation on hardware register.
Signed-off-by: Pali Rohár <pali@kernel.org>
Reported-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
---
drivers/pci/controller/pci-aardvark.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
index fb8060160251..a49e8bad9f4f 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -234,6 +234,7 @@ struct advk_pcie {
u8 wins_count;
struct irq_domain *irq_domain;
struct irq_chip irq_chip;
+ raw_spinlock_t irq_lock;
struct irq_domain *msi_domain;
struct irq_domain *msi_inner_domain;
struct irq_chip msi_bottom_irq_chip;
@@ -1087,22 +1088,28 @@ static void advk_pcie_irq_mask(struct irq_data *d)
{
struct advk_pcie *pcie = d->domain->host_data;
irq_hw_number_t hwirq = irqd_to_hwirq(d);
+ unsigned long flags;
u32 mask;
+ raw_spin_lock_irqsave(&pcie->irq_lock, flags);
mask = advk_readl(pcie, PCIE_ISR1_MASK_REG);
mask |= PCIE_ISR1_INTX_ASSERT(hwirq);
advk_writel(pcie, mask, PCIE_ISR1_MASK_REG);
+ raw_spin_unlock_irqrestore(&pcie->irq_lock, flags);
}
static void advk_pcie_irq_unmask(struct irq_data *d)
{
struct advk_pcie *pcie = d->domain->host_data;
irq_hw_number_t hwirq = irqd_to_hwirq(d);
+ unsigned long flags;
u32 mask;
+ raw_spin_lock_irqsave(&pcie->irq_lock, flags);
mask = advk_readl(pcie, PCIE_ISR1_MASK_REG);
mask &= ~PCIE_ISR1_INTX_ASSERT(hwirq);
advk_writel(pcie, mask, PCIE_ISR1_MASK_REG);
+ raw_spin_unlock_irqrestore(&pcie->irq_lock, flags);
}
static int advk_pcie_irq_map(struct irq_domain *h,
@@ -1186,6 +1193,8 @@ static int advk_pcie_init_irq_domain(struct advk_pcie *pcie)
struct irq_chip *irq_chip;
int ret = 0;
+ raw_spin_lock_init(&pcie->irq_lock);
+
pcie_intc_node = of_get_next_child(node, NULL);
if (!pcie_intc_node) {
dev_err(dev, "No PCIe Intc node found\n");
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: aardvark: Fix masking and unmasking legacy INTx interrupts
2021-08-20 15:50 [PATCH] PCI: aardvark: Fix masking and unmasking legacy INTx interrupts Pali Rohár
@ 2021-08-20 15:56 ` Marc Zyngier
2021-08-26 12:42 ` Lorenzo Pieralisi
1 sibling, 0 replies; 3+ messages in thread
From: Marc Zyngier @ 2021-08-20 15:56 UTC (permalink / raw)
To: Pali Rohár
Cc: Lorenzo Pieralisi, Rob Herring, Thomas Petazzoni, Bjorn Helgaas,
Marek Behún, linux-pci, linux-arm-kernel, linux-kernel
On Fri, 20 Aug 2021 16:50:20 +0100,
Pali Rohár <pali@kernel.org> wrote:
>
> irq_mask and irq_unmask callbacks need to be properly guarded by raw spin
> locks as masking/unmasking procedure needs atomic read-modify-write
> operation on hardware register.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Reported-by: Marc Zyngier <maz@kernel.org>
> Cc: stable@vger.kernel.org
Acked-by: Marc Zyngier <maz@kernel.org>
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: aardvark: Fix masking and unmasking legacy INTx interrupts
2021-08-20 15:50 [PATCH] PCI: aardvark: Fix masking and unmasking legacy INTx interrupts Pali Rohár
2021-08-20 15:56 ` Marc Zyngier
@ 2021-08-26 12:42 ` Lorenzo Pieralisi
1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Pieralisi @ 2021-08-26 12:42 UTC (permalink / raw)
To: Bjorn Helgaas, Thomas Petazzoni, Pali Rohár, Marc Zyngier,
Marek Behún, Rob Herring
Cc: Lorenzo Pieralisi, linux-kernel, linux-arm-kernel, linux-pci
On Fri, 20 Aug 2021 17:50:20 +0200, Pali Rohár wrote:
> irq_mask and irq_unmask callbacks need to be properly guarded by raw spin
> locks as masking/unmasking procedure needs atomic read-modify-write
> operation on hardware register.
Applied to pci/aardvark, thanks!
[1/1] PCI: aardvark: Fix masking and unmasking legacy INTx interrupts
https://git.kernel.org/lpieralisi/pci/c/d212dcee27
Thanks,
Lorenzo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-26 12:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20 15:50 [PATCH] PCI: aardvark: Fix masking and unmasking legacy INTx interrupts Pali Rohár
2021-08-20 15:56 ` Marc Zyngier
2021-08-26 12:42 ` Lorenzo Pieralisi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).