* [PATCH AUTOSEL 6.16-5.4] pinctrl: stm32: Manage irq affinity settings
[not found] <20250805130945.471732-1-sashal@kernel.org>
@ 2025-08-05 13:08 ` Sasha Levin
2025-08-05 13:08 ` [PATCH AUTOSEL 6.16] PCI: dw-rockchip: Delay link training after hot reset in EP mode Sasha Levin
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2025-08-05 13:08 UTC (permalink / raw)
To: patches, stable
Cc: Cheick Traore, Antonio Borneo, Linus Walleij, Sasha Levin,
mcoquelin.stm32, alexandre.torgue, linux-stm32, linux-arm-kernel
From: Cheick Traore <cheick.traore@foss.st.com>
[ Upstream commit 4c5cc2f65386e22166ce006efe515c667aa075e4 ]
Trying to set the affinity of the interrupts associated to stm32
pinctrl results in a write error.
Fill struct irq_chip::irq_set_affinity to use the default helper
function.
Signed-off-by: Cheick Traore <cheick.traore@foss.st.com>
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
Link: https://lore.kernel.org/20250610143042.295376-3-antonio.borneo@foss.st.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
Based on my analysis, here's my assessment:
**Backport Status: YES**
This commit should be backported to stable kernel trees for the
following reasons:
1. **Fixes a real bug**: The commit message explicitly states "Trying to
set the affinity of the interrupts associated to stm32 pinctrl
results in a write error." This is a functional bug that affects
users trying to configure IRQ affinity on STM32 platforms.
2. **Small and contained fix**: The change is minimal - just adding a
single line:
```c
.irq_set_affinity = IS_ENABLED(CONFIG_SMP) ?
irq_chip_set_affinity_parent : NULL,
```
This is a one-line fix that adds the missing callback to the irq_chip
structure.
3. **Follows established patterns**: My analysis shows that other
GPIO/pinctrl drivers already implement this callback in the same way:
- `drivers/pinctrl/renesas/pinctrl-rzg2l.c`
- `drivers/gpio/gpio-thunderx.c`
- `drivers/gpio/gpio-msc313.c`
The STM32 driver was missing this standard callback that other
similar drivers have.
4. **No architectural changes**: This is purely a bug fix that enables
existing kernel functionality (IRQ affinity setting) to work
properly. It doesn't introduce new features or change any
architecture.
5. **Minimal regression risk**: The fix uses the standard
`irq_chip_set_affinity_parent` helper function that's already well-
tested in the kernel. The conditional compilation with
`IS_ENABLED(CONFIG_SMP)` ensures it's only enabled on SMP systems
where it's relevant.
6. **Related to known issues**: My search found related commits like
`3e17683ff4a8` ("irqchip/stm32-exti: Fix irq_set_affinity return
value") showing that the STM32 platform has had IRQ affinity issues
that needed fixing.
7. **Clear user impact**: Without this fix, users cannot set IRQ
affinity for GPIO interrupts on STM32 platforms, which can impact
system performance optimization and interrupt load balancing on
multi-core STM32 systems.
The commit meets all the stable tree criteria: it fixes an important
bug, is small and self-contained, has minimal risk, and doesn't
introduce new functionality. This is exactly the type of fix that should
be backported to ensure stable kernels have proper functionality.
drivers/pinctrl/stm32/pinctrl-stm32.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index ba49d48c3a1d..e6ad63df82b7 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -411,6 +411,7 @@ static struct irq_chip stm32_gpio_irq_chip = {
.irq_set_wake = irq_chip_set_wake_parent,
.irq_request_resources = stm32_gpio_irq_request_resources,
.irq_release_resources = stm32_gpio_irq_release_resources,
+ .irq_set_affinity = IS_ENABLED(CONFIG_SMP) ? irq_chip_set_affinity_parent : NULL,
};
static int stm32_gpio_domain_translate(struct irq_domain *d,
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 6.16] PCI: dw-rockchip: Delay link training after hot reset in EP mode
[not found] <20250805130945.471732-1-sashal@kernel.org>
2025-08-05 13:08 ` [PATCH AUTOSEL 6.16-5.4] pinctrl: stm32: Manage irq affinity settings Sasha Levin
@ 2025-08-05 13:08 ` Sasha Levin
2025-08-05 13:08 ` [PATCH AUTOSEL 6.16-6.6] phy: rockchip-pcie: Properly disable TEST_WRITE strobe signal Sasha Levin
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2025-08-05 13:08 UTC (permalink / raw)
To: patches, stable
Cc: Wilfred Mallawa, Niklas Cassel, Manivannan Sadhasivam,
Bjorn Helgaas, Sasha Levin, heiko, kwilczynski, shawn.lin,
18255117159, jirislaby, didi.debian, linux-arm-kernel,
linux-rockchip
From: Wilfred Mallawa <wilfred.mallawa@wdc.com>
[ Upstream commit c0b93754547dde16c8370b8fdad5f396e7786647 ]
RK3588 TRM, section "11.6.1.3.3 Hot Reset and Link-Down Reset" states that:
If you want to delay link re-establishment (after reset) so that you can
reprogram some registers through DBI, you must set app_ltssm_enable =0
immediately after core_rst_n as shown in above. This can be achieved by
enable the app_dly2_en, and end-up the delay by assert app_dly2_done.
I.e. setting app_dly2_en will automatically deassert app_ltssm_enable on
a hot reset, and setting app_dly2_done will re-assert app_ltssm_enable,
re-enabling link training.
When receiving a hot reset/link-down IRQ when running in EP mode, we will
call dw_pcie_ep_linkdown(), which may update registers through DBI. Unless
link training is inhibited, these register updates race with the link
training.
To avoid the race, set PCIE_LTSSM_APP_DLY2_EN so the controller never
automatically trains the link after a link-down or hot reset interrupt.
That way any DBI updates done in the dw_pcie_ep_linkdown() path will happen
while the link is still down. Then allow link training by setting
PCIE_LTSSM_APP_DLY2_DONE
Co-developed-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
[bhelgaas: commit log]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20250613101908.2182053-2-cassel@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
**Backport Status: YES**
This commit should be backported to stable kernel trees for the
following reasons:
## 1. Fixes a Clear Race Condition Bug
The commit fixes a race condition between link training and DBI register
updates after a hot reset in EP mode. As stated in the commit message
and evidenced by the code changes:
- **Line 485-487** (original): When `PCIE_LINK_REQ_RST_NOT_INT`
interrupt occurs, `dw_pcie_ep_linkdown()` is called which updates
registers through DBI
- Without this fix, these DBI updates race with automatic link re-
training after reset
- The RK3588 TRM explicitly documents this race condition and the proper
mitigation
## 2. Small and Contained Fix
The changes are minimal and well-contained:
- Adds only 2 new bit definitions (`PCIE_LTSSM_APP_DLY2_EN` and
`PCIE_LTSSM_APP_DLY2_DONE`)
- Modifies 3 locations with simple bit operations:
- **Line 477**: Changes variable declaration to add `val`
- **Lines 488-491**: Adds 3 lines to re-enable link training after DBI
updates
- **Lines 574-577**: Modifies initialization to enable automatic delay
## 3. Affects User-Visible Functionality
Without this fix, EP mode operation can experience:
- Corrupted register updates during hot reset scenarios
- Unpredictable behavior when the host performs hot reset
- Potential link training failures
## 4. Recent Feature with Active Bug Fixes
EP mode support was only added in commit e242f26f6320 (June 2024),
making this a relatively new feature that's still being stabilized. The
driver has seen multiple recent fixes:
- 286ed198b899: Fixed PHY function call sequence
- 7d9b5d611553: Fixed link up check
- 28b8d7793b85: Fixed PERST# GPIO value
## 5. Hardware-Documented Issue
This isn't a theoretical bug - it's explicitly documented in the RK3588
TRM section 11.6.1.3.3, providing clear hardware documentation that this
sequence is required for correct operation.
## 6. No Architectural Changes
The fix:
- Doesn't introduce new features
- Doesn't change APIs or interfaces
- Only ensures proper hardware sequencing per vendor documentation
- Has minimal risk of regression (only affects RK3588 EP mode operation)
The commit meets all criteria for stable backporting: it fixes a real
bug that affects users, is small and contained, doesn't introduce
features, and has minimal regression risk.
drivers/pci/controller/dwc/pcie-dw-rockchip.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
index 93171a392879..cd1e9352b21f 100644
--- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c
+++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
@@ -58,6 +58,8 @@
/* Hot Reset Control Register */
#define PCIE_CLIENT_HOT_RESET_CTRL 0x180
+#define PCIE_LTSSM_APP_DLY2_EN BIT(1)
+#define PCIE_LTSSM_APP_DLY2_DONE BIT(3)
#define PCIE_LTSSM_ENABLE_ENHANCE BIT(4)
/* LTSSM Status Register */
@@ -474,7 +476,7 @@ static irqreturn_t rockchip_pcie_ep_sys_irq_thread(int irq, void *arg)
struct rockchip_pcie *rockchip = arg;
struct dw_pcie *pci = &rockchip->pci;
struct device *dev = pci->dev;
- u32 reg;
+ u32 reg, val;
reg = rockchip_pcie_readl_apb(rockchip, PCIE_CLIENT_INTR_STATUS_MISC);
rockchip_pcie_writel_apb(rockchip, reg, PCIE_CLIENT_INTR_STATUS_MISC);
@@ -485,6 +487,10 @@ static irqreturn_t rockchip_pcie_ep_sys_irq_thread(int irq, void *arg)
if (reg & PCIE_LINK_REQ_RST_NOT_INT) {
dev_dbg(dev, "hot reset or link-down reset\n");
dw_pcie_ep_linkdown(&pci->ep);
+ /* Stop delaying link training. */
+ val = HIWORD_UPDATE_BIT(PCIE_LTSSM_APP_DLY2_DONE);
+ rockchip_pcie_writel_apb(rockchip, val,
+ PCIE_CLIENT_HOT_RESET_CTRL);
}
if (reg & PCIE_RDLH_LINK_UP_CHGED) {
@@ -566,8 +572,11 @@ static int rockchip_pcie_configure_ep(struct platform_device *pdev,
return ret;
}
- /* LTSSM enable control mode */
- val = HIWORD_UPDATE_BIT(PCIE_LTSSM_ENABLE_ENHANCE);
+ /*
+ * LTSSM enable control mode, and automatically delay link training on
+ * hot reset/link-down reset.
+ */
+ val = HIWORD_UPDATE_BIT(PCIE_LTSSM_ENABLE_ENHANCE | PCIE_LTSSM_APP_DLY2_EN);
rockchip_pcie_writel_apb(rockchip, val, PCIE_CLIENT_HOT_RESET_CTRL);
rockchip_pcie_writel_apb(rockchip, PCIE_CLIENT_EP_MODE,
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 6.16-6.6] phy: rockchip-pcie: Properly disable TEST_WRITE strobe signal
[not found] <20250805130945.471732-1-sashal@kernel.org>
2025-08-05 13:08 ` [PATCH AUTOSEL 6.16-5.4] pinctrl: stm32: Manage irq affinity settings Sasha Levin
2025-08-05 13:08 ` [PATCH AUTOSEL 6.16] PCI: dw-rockchip: Delay link training after hot reset in EP mode Sasha Levin
@ 2025-08-05 13:08 ` Sasha Levin
2025-08-05 13:08 ` [PATCH AUTOSEL 6.16-6.15] media: raspberrypi: cfe: Fix min_reqbufs_allocation Sasha Levin
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2025-08-05 13:08 UTC (permalink / raw)
To: patches, stable
Cc: Geraldo Nascimento, Neil Armstrong, Vinod Koul, Sasha Levin,
heiko, linux-arm-kernel, linux-rockchip
From: Geraldo Nascimento <geraldogabriel@gmail.com>
[ Upstream commit 25facbabc3fc33c794ad09d73f73268c0f8cbc7d ]
pcie_conf is used to touch TEST_WRITE strobe signal. This signal should
be enabled, a little time waited, and then disabled. Current code clearly
was copy-pasted and never disables the strobe signal. Adjust the define.
While at it, remove PHY_CFG_RD_MASK which has been unused since
64cdc0360811 ("phy: rockchip-pcie: remove unused phy_rd_cfg function").
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Geraldo Nascimento <geraldogabriel@gmail.com>
Link: https://lore.kernel.org/r/d514d5d5627680caafa8b7548cbdfee4307f5440.1751322015.git.geraldogabriel@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
## Backport Status: YES
This commit should be backported to stable kernel trees for the
following reasons:
### Bug Analysis
The commit fixes a clear programming bug where `PHY_CFG_WR_DISABLE` was
incorrectly defined as `1` instead of `0`. Looking at the code in
`phy_wr_cfg()` function (lines 100-120), the sequence is:
1. Write data and address to the configuration register
2. Wait 1 microsecond
3. Enable the TEST_WRITE strobe signal by writing `PHY_CFG_WR_ENABLE`
(value 1)
4. Wait 1 microsecond
5. Intended to disable the strobe signal with `PHY_CFG_WR_DISABLE`
However, since both `PHY_CFG_WR_ENABLE` and `PHY_CFG_WR_DISABLE` were
defined as `1`, the strobe signal was never actually disabled. This
means the PHY configuration writes were leaving the strobe signal
permanently enabled, which is incorrect hardware programming.
### Impact Assessment
1. **Real bug affecting users**: This is a functional bug that affects
all Rockchip PCIe PHY operations. The strobe signal being left
enabled could cause:
- Incorrect PHY configuration behavior
- Potential power consumption issues
- Possible hardware state corruption
- Unpredictable PCIe link behavior
2. **Small and contained fix**: The change is minimal - just changing
one define from `1` to `0`. This is exactly the type of targeted fix
suitable for stable.
3. **Clear correctness**: The fix is obviously correct - a disable
operation should use value `0`, not `1`. The bug appears to be a
copy-paste error from the initial driver introduction in 2016 (commit
fcffee3d54fca).
4. **Long-standing issue**: This bug has existed since the driver was
first introduced in 2016, affecting all kernel versions with this
driver.
5. **No architectural changes**: The fix doesn't introduce new features
or change the driver architecture - it simply corrects an incorrect
constant value.
6. **Low regression risk**: Changing the disable value from 1 to 0 is
the correct behavior according to typical hardware programming
patterns. The risk of regression is minimal since this fixes
incorrect behavior rather than changing working functionality.
### Additional Context
The commit also removes the unused `PHY_CFG_RD_MASK` define as cleanup,
which was left over from commit 64cdc0360811. This is harmless cleanup
that doesn't affect the backport decision.
The commit message clearly describes the issue: the TEST_WRITE strobe
signal should follow a pattern of enable→wait→disable, but the current
code never actually disables it due to the incorrect define value.
This meets all the criteria for stable backports: it fixes a real bug,
is small and self-contained, has minimal risk, and corrects clearly
incorrect behavior that has been present since driver introduction.
drivers/phy/rockchip/phy-rockchip-pcie.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-pcie.c b/drivers/phy/rockchip/phy-rockchip-pcie.c
index bd44af36c67a..63e88abc66c6 100644
--- a/drivers/phy/rockchip/phy-rockchip-pcie.c
+++ b/drivers/phy/rockchip/phy-rockchip-pcie.c
@@ -30,9 +30,8 @@
#define PHY_CFG_ADDR_SHIFT 1
#define PHY_CFG_DATA_MASK 0xf
#define PHY_CFG_ADDR_MASK 0x3f
-#define PHY_CFG_RD_MASK 0x3ff
#define PHY_CFG_WR_ENABLE 1
-#define PHY_CFG_WR_DISABLE 1
+#define PHY_CFG_WR_DISABLE 0
#define PHY_CFG_WR_SHIFT 0
#define PHY_CFG_WR_MASK 1
#define PHY_CFG_PLL_LOCK 0x10
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 6.16-6.15] media: raspberrypi: cfe: Fix min_reqbufs_allocation
[not found] <20250805130945.471732-1-sashal@kernel.org>
` (2 preceding siblings ...)
2025-08-05 13:08 ` [PATCH AUTOSEL 6.16-6.6] phy: rockchip-pcie: Properly disable TEST_WRITE strobe signal Sasha Levin
@ 2025-08-05 13:08 ` Sasha Levin
2025-08-05 13:09 ` [PATCH AUTOSEL 6.16-6.15] phy: rockchip-pcie: Enable all four lanes if required Sasha Levin
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2025-08-05 13:08 UTC (permalink / raw)
To: patches, stable
Cc: Tomi Valkeinen, Hans Verkuil, Sasha Levin, kernel-list,
florian.fainelli, linux-rpi-kernel, linux-arm-kernel
From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
[ Upstream commit 57b5a302b5d529db96ddc52fbccec005092ebb3d ]
The driver checks if "vq->max_num_buffers + *nbuffers < 3", but
vq->max_num_buffers is (by default) 32, so the check is never true. Nor
does the check make sense.
The original code in the BSP kernel was "vq->num_buffers + *nbuffers <
3", but got mangled along the way to upstream. The intention was to make
sure that at least 3 buffers are allocated.
Fix this by removing the bad lines and setting q->min_reqbufs_allocation
to three.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
**Backport Status: YES**
This commit should be backported to stable kernel trees for the
following reasons:
1. **Clear Bug Fix**: This fixes a logic bug where the condition
`vq->max_num_buffers + *nbuffers < 3` could never be true since
`vq->max_num_buffers` defaults to 32. The original BSP kernel code
was `vq->num_buffers + *nbuffers < 3`, which got incorrectly
translated during upstreaming.
2. **Functional Impact**: The bug prevents the driver from ensuring a
minimum of 3 buffers are allocated, which could lead to buffer
underruns or improper operation of the Raspberry Pi Camera Front End
(CFE) driver. This directly affects users of Raspberry Pi cameras.
3. **Simple and Contained Fix**: The fix is minimal - it removes 2
problematic lines and adds 1 line setting `q->min_reqbufs_allocation
= 3`. This is the proper V4L2 videobuf2 API way to ensure minimum
buffer allocation rather than manually adjusting buffer counts.
4. **Low Risk**: The change is confined to a single driver file
(`drivers/media/platform/raspberrypi/rp1-cfe/cfe.c`) and uses the
standard V4L2 framework mechanism (`min_reqbufs_allocation`)
properly. There's minimal risk of regression since it's replacing
broken code with the correct API usage.
5. **Recent Driver**: The rp1-cfe driver was added relatively recently
(commit 6edb685abb2a), and this bug was introduced during the
upstreaming process. Users running stable kernels with this driver
would benefit from having the correct behavior.
6. **Meets Stable Criteria**: This satisfies the stable kernel rules as
it:
- Fixes a real bug that affects users
- Is obviously correct (uses proper V4L2 API)
- Has been reviewed and signed-off by subsystem maintainers
- Is small and self-contained
The commit properly uses the videobuf2 framework's
`min_reqbufs_allocation` field which is designed specifically for this
purpose - ensuring a minimum number of buffers are allocated when
VIDIOC_REQBUFS is called.
drivers/media/platform/raspberrypi/rp1-cfe/cfe.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
index fcadb2143c88..62dca76b468d 100644
--- a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
+++ b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
@@ -1024,9 +1024,6 @@ static int cfe_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
cfe_dbg(cfe, "%s: [%s] type:%u\n", __func__, node_desc[node->id].name,
node->buffer_queue.type);
- if (vq->max_num_buffers + *nbuffers < 3)
- *nbuffers = 3 - vq->max_num_buffers;
-
if (*nplanes) {
if (sizes[0] < size) {
cfe_err(cfe, "sizes[0] %i < size %u\n", sizes[0], size);
@@ -1998,6 +1995,7 @@ static int cfe_register_node(struct cfe_device *cfe, int id)
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->lock = &node->lock;
q->min_queued_buffers = 1;
+ q->min_reqbufs_allocation = 3;
q->dev = &cfe->pdev->dev;
ret = vb2_queue_init(q);
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 6.16-6.15] phy: rockchip-pcie: Enable all four lanes if required
[not found] <20250805130945.471732-1-sashal@kernel.org>
` (3 preceding siblings ...)
2025-08-05 13:08 ` [PATCH AUTOSEL 6.16-6.15] media: raspberrypi: cfe: Fix min_reqbufs_allocation Sasha Levin
@ 2025-08-05 13:09 ` Sasha Levin
2025-08-05 13:09 ` [PATCH AUTOSEL 6.16-6.1] dmaengine: stm32-dma: configure next sg only if there are more than 2 sgs Sasha Levin
2025-08-05 13:09 ` [PATCH AUTOSEL 6.16-6.6] PCI: xgene-msi: Resend an MSI racing with itself on a different CPU Sasha Levin
6 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2025-08-05 13:09 UTC (permalink / raw)
To: patches, stable
Cc: Valmantas Paliksa, Neil Armstrong, Robin Murphy,
Geraldo Nascimento, Vinod Koul, Sasha Levin, heiko,
linux-arm-kernel, linux-rockchip
From: Valmantas Paliksa <walmis@gmail.com>
[ Upstream commit c3fe7071e196e25789ecf90dbc9e8491a98884d7 ]
Current code enables only Lane 0 because pwr_cnt will be incremented on
first call to the function. Let's reorder the enablement code to enable
all 4 lanes through GRF.
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Valmantas Paliksa <walmis@gmail.com>
Signed-off-by: Geraldo Nascimento <geraldogabriel@gmail.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/16b610aab34e069fd31d9f57260c10df2a968f80.1751322015.git.geraldogabriel@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
**Backport Status: YES**
This commit fixes a significant bug in the Rockchip PCIe PHY driver
where only Lane 0 was being enabled instead of all required lanes.
Here's my detailed analysis:
## Bug Description
The original code had a critical logic error in
`rockchip_pcie_phy_power_on()`. The lane enable operation (writing to
`pcie_laneoff` register) was placed AFTER the `pwr_cnt++` check at line
170. Since `pwr_cnt` is a reference counter that tracks how many times
the PHY has been powered on, the first call would increment it from 0 to
1 and continue with initialization. However, subsequent calls for other
lanes (Lane 1, 2, 3) would hit the early return at line 171 (`goto
err_out`), preventing those lanes from being enabled.
## The Fix
The commit moves the lane enable operation (lines 184-188 in original)
to BEFORE the `pwr_cnt++` check. This ensures that each lane gets
properly enabled through the GRF (General Register File) regardless of
the power reference count state.
## Why This Should Be Backported
1. **Fixes a Real Bug**: This fixes a functional bug where PCIe devices
requiring multiple lanes (x2, x4 configurations) would only have Lane
0 enabled, severely impacting performance or causing complete failure
to operate.
2. **Small and Contained Fix**: The change is minimal - just reordering
5 lines of code within a single function. No architectural changes or
new features are introduced.
3. **Low Risk**: The fix simply ensures the lane enable register write
happens for all lanes, which was clearly the original intent. The
moved code block remains identical.
4. **Hardware Functionality Impact**: PCIe lane configuration is
critical for proper hardware operation. Devices expecting x4 links
but only getting x1 would experience significant performance
degradation (75% bandwidth loss).
5. **Clear Root Cause**: The bug mechanism is straightforward - the
reference counter was preventing lanes 1-3 from being configured due
to early return.
6. **No Side Effects**: The change doesn't introduce new behavior, it
just fixes the existing broken behavior to work as originally
intended.
This is exactly the type of bug fix that stable kernels should receive -
it's a clear functional regression fix with minimal code changes and low
risk of introducing new issues.
drivers/phy/rockchip/phy-rockchip-pcie.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-pcie.c b/drivers/phy/rockchip/phy-rockchip-pcie.c
index 63e88abc66c6..4e2dfd01adf2 100644
--- a/drivers/phy/rockchip/phy-rockchip-pcie.c
+++ b/drivers/phy/rockchip/phy-rockchip-pcie.c
@@ -159,6 +159,12 @@ static int rockchip_pcie_phy_power_on(struct phy *phy)
guard(mutex)(&rk_phy->pcie_mutex);
+ regmap_write(rk_phy->reg_base,
+ rk_phy->phy_data->pcie_laneoff,
+ HIWORD_UPDATE(!PHY_LANE_IDLE_OFF,
+ PHY_LANE_IDLE_MASK,
+ PHY_LANE_IDLE_A_SHIFT + inst->index));
+
if (rk_phy->pwr_cnt++) {
return 0;
}
@@ -175,12 +181,6 @@ static int rockchip_pcie_phy_power_on(struct phy *phy)
PHY_CFG_ADDR_MASK,
PHY_CFG_ADDR_SHIFT));
- regmap_write(rk_phy->reg_base,
- rk_phy->phy_data->pcie_laneoff,
- HIWORD_UPDATE(!PHY_LANE_IDLE_OFF,
- PHY_LANE_IDLE_MASK,
- PHY_LANE_IDLE_A_SHIFT + inst->index));
-
/*
* No documented timeout value for phy operation below,
* so we make it large enough here. And we use loop-break
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 6.16-6.1] dmaengine: stm32-dma: configure next sg only if there are more than 2 sgs
[not found] <20250805130945.471732-1-sashal@kernel.org>
` (4 preceding siblings ...)
2025-08-05 13:09 ` [PATCH AUTOSEL 6.16-6.15] phy: rockchip-pcie: Enable all four lanes if required Sasha Levin
@ 2025-08-05 13:09 ` Sasha Levin
2025-08-05 13:09 ` [PATCH AUTOSEL 6.16-6.6] PCI: xgene-msi: Resend an MSI racing with itself on a different CPU Sasha Levin
6 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2025-08-05 13:09 UTC (permalink / raw)
To: patches, stable
Cc: Amelie Delaunay, Vinod Koul, Sasha Levin, mcoquelin.stm32,
alexandre.torgue, dmaengine, linux-stm32, linux-arm-kernel
From: Amelie Delaunay <amelie.delaunay@foss.st.com>
[ Upstream commit e19bdbaa31082b43dab1d936e20efcebc30aa73d ]
DMA operates in Double Buffer Mode (DBM) when the transfer is cyclic and
there are at least two periods.
When DBM is enabled, the DMA toggles between two memory targets (SxM0AR and
SxM1AR), indicated by the SxSCR.CT bit (Current Target).
There is no need to update the next memory address if two periods are
configured, as SxM0AR and SxM1AR are already properly set up before the
transfer begins in the stm32_dma_start_transfer() function.
This avoids unnecessary updates to SxM0AR/SxM1AR, thereby preventing
potential Transfer Errors. Specifically, when the channel is enabled,
SxM0AR and SxM1AR can only be written if SxSCR.CT=1 and SxSCR.CT=0,
respectively. Otherwise, a Transfer Error interrupt is triggered, and the
stream is automatically disabled.
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/r/20250624-stm32_dma_dbm_fix-v1-1-337c40d6c93e@foss.st.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
Based on my comprehensive analysis of the commit and the STM32 DMA
driver code, here's my assessment:
**Backport Status: YES**
This commit should be backported to stable kernel trees. Here's an
extensive explanation based on the code analysis:
## Bug Being Fixed
The commit fixes a **Transfer Error interrupt** issue in the STM32 DMA
driver when operating in Double Buffer Mode (DBM) with exactly two
periods. The bug manifests as follows:
1. **The Problem**: When DBM is enabled with exactly 2 scatter-gather
segments (periods), the driver was unnecessarily calling
`stm32_dma_configure_next_sg()` in the interrupt handler (line 748 of
stm32_dma_handle_chan_done).
2. **Hardware Constraint**: As explained in the commit message, when the
channel is enabled, the memory address registers (SxM0AR and SxM1AR)
can only be written when specific conditions are met:
- SxM0AR can only be written when CT (Current Target) = 1
- SxM1AR can only be written when CT = 0
- Writing at the wrong time triggers a Transfer Error interrupt
3. **The Fix**: The simple addition of `&& chan->desc->num_sgs > 2`
condition prevents unnecessary updates when there are exactly 2
periods, as the hardware automatically toggles between the two pre-
configured buffers.
## Why This Is a Good Backport Candidate
1. **Clear Bug Fix**: This fixes a specific hardware-related bug that
causes Transfer Error interrupts, which can disrupt DMA operations
and potentially cause system instability.
2. **Minimal and Safe Change**: The fix is a single-line conditional
check that adds `&& chan->desc->num_sgs > 2` to line 747. This is:
- Very small in scope (1 line change)
- Low risk of regression
- Only affects the specific case of DBM with 2 periods
3. **Hardware-Specific Fix**: The change addresses a specific STM32 DMA
hardware behavior documented in the reference manual, making it
necessary for proper operation on affected hardware.
4. **No Architectural Changes**: The commit doesn't introduce new
features or change the driver's architecture - it simply prevents an
unnecessary operation that violates hardware constraints.
5. **Production Impact**: Transfer Error interrupts can cause DMA
streams to be automatically disabled (as mentioned in the commit
message), leading to data transfer failures in production systems
using cyclic DMA with 2 periods.
6. **Clear Error Path**: Looking at the interrupt handler (lines
804-809), unhandled status bits including TEI (Transfer Error
Interrupt) result in error messages and potential channel disabling,
which this fix prevents.
## Code Analysis Confirms the Fix
From the code analysis:
- Line 1207 shows DBM is enabled for multi-period cyclic transfers
- Lines 593-595 show initial setup correctly configures both SM0AR and
SM1AR
- Line 606 shows `stm32_dma_configure_next_sg()` is called during
initial transfer setup
- The problematic line 748 (now 747) was updating memory addresses
unnecessarily for 2-period DBM transfers
The fix ensures that for 2-period DBM transfers, the hardware's
automatic toggling mechanism is used without software intervention,
preventing Transfer Error interrupts while maintaining correct operation
for transfers with more than 2 periods.
drivers/dma/stm32/stm32-dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/stm32/stm32-dma.c b/drivers/dma/stm32/stm32-dma.c
index 917f8e922373..0e39f99bce8b 100644
--- a/drivers/dma/stm32/stm32-dma.c
+++ b/drivers/dma/stm32/stm32-dma.c
@@ -744,7 +744,7 @@ static void stm32_dma_handle_chan_done(struct stm32_dma_chan *chan, u32 scr)
/* cyclic while CIRC/DBM disable => post resume reconfiguration needed */
if (!(scr & (STM32_DMA_SCR_CIRC | STM32_DMA_SCR_DBM)))
stm32_dma_post_resume_reconfigure(chan);
- else if (scr & STM32_DMA_SCR_DBM)
+ else if (scr & STM32_DMA_SCR_DBM && chan->desc->num_sgs > 2)
stm32_dma_configure_next_sg(chan);
} else {
chan->busy = false;
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 6.16-6.6] PCI: xgene-msi: Resend an MSI racing with itself on a different CPU
[not found] <20250805130945.471732-1-sashal@kernel.org>
` (5 preceding siblings ...)
2025-08-05 13:09 ` [PATCH AUTOSEL 6.16-6.1] dmaengine: stm32-dma: configure next sg only if there are more than 2 sgs Sasha Levin
@ 2025-08-05 13:09 ` Sasha Levin
2025-08-05 13:20 ` Marc Zyngier
6 siblings, 1 reply; 10+ messages in thread
From: Sasha Levin @ 2025-08-05 13:09 UTC (permalink / raw)
To: patches, stable
Cc: Marc Zyngier, Lorenzo Pieralisi, Bjorn Helgaas, Sasha Levin, toan,
kwilczynski, mani, linux-pci, linux-arm-kernel
From: Marc Zyngier <maz@kernel.org>
[ Upstream commit 3cc8f625e4c6a0e9f936da6b94166e62e387fe1d ]
Since changing the affinity of an MSI really is about changing
the target address and that it isn't possible to mask an individual
MSI, it is completely possible for an interrupt to race with itself,
usually resulting in a lost interrupt.
Paper over the design blunder by informing the core code of this
sad state of affairs.
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20250708173404.1278635-11-maz@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
**Backport Status: YES**
This commit should be backported to stable kernel trees. Here's my
detailed analysis:
## Key Evidence for Backporting:
1. **Fixes a Real Bug - Lost Interrupts**: The commit addresses a race
condition where MSI interrupts can be lost when CPU affinity changes
occur. The commit message explicitly states this results in "a lost
interrupt" which is a serious issue that can cause system malfunction
or hangs.
2. **Minimal and Contained Change**: The fix consists of a single line
addition:
```c
irqd_set_resend_when_in_progress(irq_get_irq_data(virq));
```
This is an extremely small, targeted fix that only affects the xgene-
msi driver's interrupt allocation path.
3. **Part of a Broader Fix Pattern**: This commit follows the same
pattern established for other interrupt controllers:
- Commit 9c15eeb5362c4 introduced this mechanism for fasteoi handlers
in 2023
- Commit 2c9e7f857400 extended it to handle_simple_irq() flow
- This commit applies the same proven workaround to the xgene-msi
driver
4. **Addresses Hardware Design Limitation**: The commit message
describes this as papering over a "design blunder" - the hardware
inability to mask individual MSIs combined with affinity changes
creates an unavoidable race condition. This is not a new feature but
a critical workaround for existing hardware defects.
5. **History of Race Conditions in This Driver**: The xgene-msi driver
has had race condition issues before (commit a93c00e5f975 fixed a
different race in 2021), indicating this subsystem needs these types
of fixes for stability.
6. **No Architecture Changes**: The fix uses existing kernel
infrastructure (irqd_set_resend_when_in_progress) without introducing
new APIs or changing kernel architecture.
7. **Low Risk of Regression**: The change only affects the specific
xgene-msi driver and only adds a resend mechanism when interrupts are
already in progress - it doesn't change the normal interrupt handling
path.
## Stable Tree Criteria Met:
- ✅ Fixes a real bug (lost interrupts)
- ✅ Small change (1 line)
- ✅ Not a new feature
- ✅ Isolated to specific driver
- ✅ Uses established kernel mechanisms
- ✅ Addresses hardware limitation that affects deployed systems
The fix prevents interrupt loss during CPU affinity changes on X-Gene
MSI controllers, which is exactly the type of bug fix that stable
kernels should receive to maintain system reliability.
drivers/pci/controller/pci-xgene-msi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/controller/pci-xgene-msi.c b/drivers/pci/controller/pci-xgene-msi.c
index b05ec8b0bb93..50647fa14e69 100644
--- a/drivers/pci/controller/pci-xgene-msi.c
+++ b/drivers/pci/controller/pci-xgene-msi.c
@@ -200,6 +200,7 @@ static int xgene_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
irq_domain_set_info(domain, virq, msi_irq,
&xgene_msi_bottom_irq_chip, domain->host_data,
handle_simple_irq, NULL, NULL);
+ irqd_set_resend_when_in_progress(irq_get_irq_data(virq));
return 0;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH AUTOSEL 6.16-6.6] PCI: xgene-msi: Resend an MSI racing with itself on a different CPU
2025-08-05 13:09 ` [PATCH AUTOSEL 6.16-6.6] PCI: xgene-msi: Resend an MSI racing with itself on a different CPU Sasha Levin
@ 2025-08-05 13:20 ` Marc Zyngier
2025-08-05 13:59 ` Sasha Levin
0 siblings, 1 reply; 10+ messages in thread
From: Marc Zyngier @ 2025-08-05 13:20 UTC (permalink / raw)
To: Sasha Levin
Cc: patches, stable, Lorenzo Pieralisi, Bjorn Helgaas, toan,
kwilczynski, mani, linux-pci, linux-arm-kernel
On Tue, 05 Aug 2025 14:09:34 +0100,
Sasha Levin <sashal@kernel.org> wrote:
>
> From: Marc Zyngier <maz@kernel.org>
>
> [ Upstream commit 3cc8f625e4c6a0e9f936da6b94166e62e387fe1d ]
>
> Since changing the affinity of an MSI really is about changing
> the target address and that it isn't possible to mask an individual
> MSI, it is completely possible for an interrupt to race with itself,
> usually resulting in a lost interrupt.
>
> Paper over the design blunder by informing the core code of this
> sad state of affairs.
>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> Link: https://lore.kernel.org/r/20250708173404.1278635-11-maz@kernel.org
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>
> LLM Generated explanations, may be completely bogus:
s/may be//. It is an amusing read though, specially when quoting
totally unrelated patches, so thumbs up for the comical value.
But I'm not even going to entertain explaining *why* backporting this
patch on its own is nonsense. Reading the original series should be
enlightening enough.
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH AUTOSEL 6.16-6.6] PCI: xgene-msi: Resend an MSI racing with itself on a different CPU
2025-08-05 13:20 ` Marc Zyngier
@ 2025-08-05 13:59 ` Sasha Levin
2025-08-05 18:09 ` Marc Zyngier
0 siblings, 1 reply; 10+ messages in thread
From: Sasha Levin @ 2025-08-05 13:59 UTC (permalink / raw)
To: Marc Zyngier
Cc: patches, stable, Lorenzo Pieralisi, Bjorn Helgaas, toan,
kwilczynski, mani, linux-pci, linux-arm-kernel
On Tue, Aug 05, 2025 at 02:20:52PM +0100, Marc Zyngier wrote:
>On Tue, 05 Aug 2025 14:09:34 +0100,
>Sasha Levin <sashal@kernel.org> wrote:
>>
>> From: Marc Zyngier <maz@kernel.org>
>>
>> [ Upstream commit 3cc8f625e4c6a0e9f936da6b94166e62e387fe1d ]
>>
>> Since changing the affinity of an MSI really is about changing
>> the target address and that it isn't possible to mask an individual
>> MSI, it is completely possible for an interrupt to race with itself,
>> usually resulting in a lost interrupt.
>>
>> Paper over the design blunder by informing the core code of this
>> sad state of affairs.
>>
>> Signed-off-by: Marc Zyngier <maz@kernel.org>
>> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
>> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>> Link: https://lore.kernel.org/r/20250708173404.1278635-11-maz@kernel.org
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>> ---
>>
>> LLM Generated explanations, may be completely bogus:
>
>s/may be//. It is an amusing read though, specially when quoting
>totally unrelated patches, so thumbs up for the comical value.
Yeah, it's still very much at the "junior engineer" level, but honestly
I think that just the boolean yes/no answers out of it provides a better
noise to signal ratio than the older AUTOSEL.
>But I'm not even going to entertain explaining *why* backporting this
>patch on its own is nonsense. Reading the original series should be
>enlightening enough.
Sadly it doesn't have the context to understand that that specific
conmit is part of a larger series. That information just disappears when
patches are applied into git.
I'll drop it, thanks!
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH AUTOSEL 6.16-6.6] PCI: xgene-msi: Resend an MSI racing with itself on a different CPU
2025-08-05 13:59 ` Sasha Levin
@ 2025-08-05 18:09 ` Marc Zyngier
0 siblings, 0 replies; 10+ messages in thread
From: Marc Zyngier @ 2025-08-05 18:09 UTC (permalink / raw)
To: Sasha Levin
Cc: patches, stable, Lorenzo Pieralisi, Bjorn Helgaas, toan,
kwilczynski, mani, linux-pci, linux-arm-kernel
On Tue, 05 Aug 2025 14:59:27 +0100,
Sasha Levin <sashal@kernel.org> wrote:
>
> On Tue, Aug 05, 2025 at 02:20:52PM +0100, Marc Zyngier wrote:
> > On Tue, 05 Aug 2025 14:09:34 +0100,
> > Sasha Levin <sashal@kernel.org> wrote:
> >>
> >> From: Marc Zyngier <maz@kernel.org>
> >>
> >> [ Upstream commit 3cc8f625e4c6a0e9f936da6b94166e62e387fe1d ]
> >>
> >> Since changing the affinity of an MSI really is about changing
> >> the target address and that it isn't possible to mask an individual
> >> MSI, it is completely possible for an interrupt to race with itself,
> >> usually resulting in a lost interrupt.
> >>
> >> Paper over the design blunder by informing the core code of this
> >> sad state of affairs.
> >>
> >> Signed-off-by: Marc Zyngier <maz@kernel.org>
> >> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
> >> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> >> Link: https://lore.kernel.org/r/20250708173404.1278635-11-maz@kernel.org
> >> Signed-off-by: Sasha Levin <sashal@kernel.org>
> >> ---
> >>
> >> LLM Generated explanations, may be completely bogus:
> >
> > s/may be//. It is an amusing read though, specially when quoting
> > totally unrelated patches, so thumbs up for the comical value.
>
> Yeah, it's still very much at the "junior engineer" level
It's not, and that's the main issue. A junior engineer would get into
the rabbit hole of backporting too much, as they would be unable to
separate the essential logic from the surrounding fluff. There would
be a lot of noise, but it would be OK.
Your "thing" is very much at the "Senior Marketroid" level, in the
sense that it manages to drag some semi-relevant information from
various sources, and condenses it into an advertisement for snake oil.
I think I know who which of the two I want to work with.
M.
--
Jazz isn't dead. It just smells funny.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-08-05 18:37 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20250805130945.471732-1-sashal@kernel.org>
2025-08-05 13:08 ` [PATCH AUTOSEL 6.16-5.4] pinctrl: stm32: Manage irq affinity settings Sasha Levin
2025-08-05 13:08 ` [PATCH AUTOSEL 6.16] PCI: dw-rockchip: Delay link training after hot reset in EP mode Sasha Levin
2025-08-05 13:08 ` [PATCH AUTOSEL 6.16-6.6] phy: rockchip-pcie: Properly disable TEST_WRITE strobe signal Sasha Levin
2025-08-05 13:08 ` [PATCH AUTOSEL 6.16-6.15] media: raspberrypi: cfe: Fix min_reqbufs_allocation Sasha Levin
2025-08-05 13:09 ` [PATCH AUTOSEL 6.16-6.15] phy: rockchip-pcie: Enable all four lanes if required Sasha Levin
2025-08-05 13:09 ` [PATCH AUTOSEL 6.16-6.1] dmaengine: stm32-dma: configure next sg only if there are more than 2 sgs Sasha Levin
2025-08-05 13:09 ` [PATCH AUTOSEL 6.16-6.6] PCI: xgene-msi: Resend an MSI racing with itself on a different CPU Sasha Levin
2025-08-05 13:20 ` Marc Zyngier
2025-08-05 13:59 ` Sasha Levin
2025-08-05 18:09 ` Marc Zyngier
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).