From: Maulik Shah maulik.shah@oss.qualcomm.com
[ Upstream commit 84684c57c9cd47b86c883a7170dd68222d97ef13 ]
Register offsets for v3 and v4 versions are backward compatible. Assign v3 offsets for v4 and all higher versions to avoid end up using v2 offsets.
Signed-off-by: Maulik Shah maulik.shah@oss.qualcomm.com Reviewed-by: Konrad Dybcio konrad.dybcio@oss.qualcomm.com Reviewed-by: Neil Armstrong neil.armstrong@linaro.org Link: https://lore.kernel.org/r/20250623-rsc_v4-v1-1-275b27bc5e3c@oss.qualcomm.com Signed-off-by: Bjorn Andersson andersson@kernel.org Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
Based on my analysis of the commit, here is my assessment:
**Backport Status: YES**
This commit should be backported to stable kernel trees for the following reasons:
1. **Bug Fix Nature**: The commit fixes a real bug where RSC version 4 devices would incorrectly use version 2.7 register offsets instead of version 3.0 offsets. The code change shows that before this fix, only `drv->ver.major == 3` would select v3 offsets, meaning version 4 (and any higher versions) would fall through to use v2.7 offsets, which are incompatible.
2. **Clear Register Offset Incompatibility**: Looking at the register offset arrays in drivers/soc/qcom/rpmh-rsc.c: - v2.7 offsets: RSC_DRV_CMD_OFFSET = 20, RSC_DRV_CMD_WAIT_FOR_CMPL = 0x10 - v3.0 offsets: RSC_DRV_CMD_OFFSET = 24, RSC_DRV_CMD_WAIT_FOR_CMPL = 0x20
These are significantly different offsets that would cause incorrect hardware register access on v4 devices.
3. **Small and Contained Fix**: The change is minimal - just changing `if (drv->ver.major == 3)` to `if (drv->ver.major >= 3)`. This is a one-line logic fix that ensures v4 and higher versions use the correct v3.0-compatible register offsets.
4. **Hardware Enablement for Existing Devices**: This is not adding new features but fixing broken support for hardware that already exists. Without this fix, any Qualcomm SoC with RSC v4 would malfunction when trying to use RPMH (Resource Power Manager Hardened) functionality.
5. **Low Risk**: The change only affects devices with RSC version 4 or higher. It doesn't modify behavior for existing v2 or v3 devices. The commit message explicitly states that "Register offsets for v3 and v4 versions are backward compatible."
6. **Critical Subsystem**: RPMH-RSC is a critical component for power management on Qualcomm SoCs. Incorrect register access could lead to system instability, power management failures, or complete inability to boot on affected devices.
The commit follows stable kernel rules by being a targeted bug fix that enables proper hardware support without architectural changes or new features.
drivers/soc/qcom/rpmh-rsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index cb82e887b51d..fdab2b1067db 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -1072,7 +1072,7 @@ static int rpmh_rsc_probe(struct platform_device *pdev) drv->ver.minor = rsc_id & (MINOR_VER_MASK << MINOR_VER_SHIFT); drv->ver.minor >>= MINOR_VER_SHIFT;
- if (drv->ver.major == 3) + if (drv->ver.major >= 3) drv->regs = rpmh_rsc_reg_offset_ver_3_0; else drv->regs = rpmh_rsc_reg_offset_ver_2_7;