Skip to content

Commit 2bb89c7

Browse files
iavigorpecovnik
authored andcommitted
mvebu/pcie: fix DEVCTL change detection and trim RTCTL handling
Compute the relevant PCI_EXP_DEVCTL change mask before clearing the RC-mode forbidden bits from the local write value. Otherwise a change in DEVCTL.{CERE,NFERE,FERE} may be missed and the corresponding IRQ mask update deferred until some later config-space write. Also restrict the PCI_EXP_RTCTL-triggered IRQ mask update to PMEIE. mvebu_pcie_handle_irq_change() only uses rootctl.PMEIE, so reacting to SECEE/SENFEE/SEFEE changes only reruns the helper without affecting the hardware interrupt mask. Assisted-by: Claude:claude-opus-4-7
1 parent d79ad1f commit 2bb89c7

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Igor Velkov <325961+iav@users.noreply.github.com>
3+
Date: Tue, 22 Apr 2026 00:00:00 +0000
4+
Subject: mvebu/pcie: fix DEVCTL change detection and trim RTCTL handling
5+
6+
Compute the relevant PCI_EXP_DEVCTL change mask before clearing the
7+
RC-mode forbidden bits from the local write value. Otherwise a change in
8+
DEVCTL.{CERE,NFERE,FERE} may be missed and the corresponding IRQ mask
9+
update deferred until some later config-space write.
10+
11+
Also restrict the PCI_EXP_RTCTL-triggered IRQ mask update to PMEIE.
12+
mvebu_pcie_handle_irq_change() only uses rootctl.PMEIE, so reacting to
13+
SECEE/SENFEE/SEFEE changes only reruns the helper without affecting the
14+
hardware interrupt mask.
15+
16+
---
17+
drivers/pci/controller/pci-mvebu.c | 13 ++++++++-----
18+
1 file changed, 8 insertions(+), 5 deletions(-)
19+
20+
diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c
21+
--- a/drivers/pci/controller/pci-mvebu.c
22+
+++ b/drivers/pci/controller/pci-mvebu.c
23+
@@ -865,7 +865,11 @@
24+
struct mvebu_pcie_port *port = bridge->data;
25+
26+
switch (reg) {
27+
- case PCI_EXP_DEVCTL:
28+
+ case PCI_EXP_DEVCTL: {
29+
+ bool aer_changed = (new ^ old) &
30+
+ (PCI_EXP_DEVCTL_FERE | PCI_EXP_DEVCTL_NFERE |
31+
+ PCI_EXP_DEVCTL_CERE | PCI_EXP_DEVCTL_URRE);
32+
+
33+
/*
34+
* Armada370 data says these bits must always
35+
* be zero when in root complex mode.
36+
@@ -875,10 +879,10 @@
37+
38+
mvebu_writel(port, new, PCIE_CAP_PCIEXP + PCI_EXP_DEVCTL);
39+
40+
- if ((new ^ old) & (PCI_EXP_DEVCTL_FERE | PCI_EXP_DEVCTL_NFERE |
41+
- PCI_EXP_DEVCTL_CERE | PCI_EXP_DEVCTL_URRE))
42+
+ if (aer_changed)
43+
mvebu_pcie_handle_irq_change(port);
44+
break;
45+
+ }
46+
47+
case PCI_EXP_LNKCTL:
48+
/*
49+
@@ -941,8 +945,7 @@
50+
break;
51+
52+
case PCI_EXP_RTCTL:
53+
- if ((new ^ old) & (PCI_EXP_RTCTL_SECEE | PCI_EXP_RTCTL_SENFEE |
54+
- PCI_EXP_RTCTL_SEFEE | PCI_EXP_RTCTL_PMEIE))
55+
+ if ((new ^ old) & PCI_EXP_RTCTL_PMEIE)
56+
mvebu_pcie_handle_irq_change(port);
57+
break;
58+
}
59+
--
60+
Armbian
61+

0 commit comments

Comments
 (0)