The condition register PCI_RCV_INTX is used in irq_mask(), irq_unmask()
and irq_ack() callbacks. Accesses to register can occur at the same time
without a lock.
Add a lock into each callback to prevent the issue.
Fixes: 7e6d5cd88a6f ("PCI: uniphier: Add UniPhier PCIe host controller support")
Suggested-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
---
drivers/pci/controller/dwc/pcie-uniphier.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
The previous patch is as follows:
https://lore.kernel.org/linux-pci/1629370566-29984-1-git-send-email-hayashi.kunihiko@socionext.com/
Changes in the previous patch:
- Change the subject and commit message
+ Marc (who originally reported this issue)
On Monday 23 August 2021 20:18:20 Kunihiko Hayashi wrote:
The condition register PCI_RCV_INTX is used in irq_mask(), irq_unmask()
and irq_ack() callbacks. Accesses to register can occur at the same time
without a lock.
Add a lock into each callback to prevent the issue.
Fixes: 7e6d5cd88a6f ("PCI: uniphier: Add UniPhier PCIe host controller support")
Suggested-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
From: Marc Zyngier <maz@kernel.org> Date: 2021-08-23 16:57:13
On Mon, 23 Aug 2021 16:09:27 +0100,
Pali Rohár [off-list ref] wrote:
+ Marc (who originally reported this issue)
On Monday 23 August 2021 20:18:20 Kunihiko Hayashi wrote:
quoted
The condition register PCI_RCV_INTX is used in irq_mask(), irq_unmask()
and irq_ack() callbacks. Accesses to register can occur at the same time
without a lock.
Add a lock into each callback to prevent the issue.
Fixes: 7e6d5cd88a6f ("PCI: uniphier: Add UniPhier PCIe host controller support")
Suggested-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
And by the same token, this second line is totally useless.
I think masking/unmasking is broken in this driver, locking or not.
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On Mon, 23 Aug 2021 16:09:27 +0100,
Pali Rohár [off-list ref] wrote:
quoted
+ Marc (who originally reported this issue)
On Monday 23 August 2021 20:18:20 Kunihiko Hayashi wrote:
quoted
The condition register PCI_RCV_INTX is used in irq_mask(), irq_unmask()
and irq_ack() callbacks. Accesses to register can occur at the same time
without a lock.
Add a lock into each callback to prevent the issue.
Fixes: 7e6d5cd88a6f ("PCI: uniphier: Add UniPhier PCIe host controller support")
Suggested-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
And by the same token, this second line is totally useless.
I think masking/unmasking is broken in this driver, locking or not.
Yes, this second line should be removed, too.
I'll fix this bug and add mask locking.
Thank you,
---
Best Regards
Kunihiko Hayashi
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Marc Zyngier <maz@kernel.org> Date: 2021-08-25 09:07:13
On Wed, 25 Aug 2021 01:01:08 +0100,
Kunihiko Hayashi [off-list ref] wrote:
Hi Marc,
On 2021/08/24 1:57, Marc Zyngier wrote:
quoted
On Mon, 23 Aug 2021 16:09:27 +0100,
Pali Rohár [off-list ref] wrote:
quoted
+ Marc (who originally reported this issue)
On Monday 23 August 2021 20:18:20 Kunihiko Hayashi wrote:
quoted
The condition register PCI_RCV_INTX is used in irq_mask(), irq_unmask()
and irq_ack() callbacks. Accesses to register can occur at the same time
without a lock.
Add a lock into each callback to prevent the issue.
Fixes: 7e6d5cd88a6f ("PCI: uniphier: Add UniPhier PCIe host controller support")
Suggested-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
And by the same token, this second line is totally useless.
I think masking/unmasking is broken in this driver, locking or not.
Yes, this second line should be removed, too.
You mean the *first* line, right? The one clearing all the INTx
bits. If you remove the second line, you won't fix anything.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On Wed, 25 Aug 2021 01:01:08 +0100,
Kunihiko Hayashi [off-list ref] wrote:
quoted
Hi Marc,
On 2021/08/24 1:57, Marc Zyngier wrote:
quoted
On Mon, 23 Aug 2021 16:09:27 +0100,
Pali Rohár [off-list ref] wrote:
quoted
+ Marc (who originally reported this issue)
On Monday 23 August 2021 20:18:20 Kunihiko Hayashi wrote:
quoted
The condition register PCI_RCV_INTX is used in irq_mask(), irq_unmask()
and irq_ack() callbacks. Accesses to register can occur at the same time
without a lock.
Add a lock into each callback to prevent the issue.
Fixes: 7e6d5cd88a6f ("PCI: uniphier: Add UniPhier PCIe host controller support")
Suggested-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
And by the same token, this second line is totally useless.
I think masking/unmasking is broken in this driver, locking or not.
Yes, this second line should be removed, too.
You mean the *first* line, right? The one clearing all the INTx
bits. If you remove the second line, you won't fix anything.
This is ambiguous. I mean that I will remove the following line:
val &= ~PCL_RCV_INTX_ALL_MASK;
So the fixed unmasking code is as follows.
val = readl(priv->base + PCL_RCV_INTX);
val &= ~BIT(irqd_to_hwirq(d) + PCL_RCV_INTX_STATUS_SHIFT);
writel(val, priv->base + PCL_RCV_INTX);
Thank you,
---
Best Regards
Kunihiko Hayashi
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel