Skip to contentSkip to conversation

hwmon: (k10temp) Add device ID for Strix Halo

PATCH New Sasha Levin 8 participants 131 messages Oct 9, 2025 – Nov 4, 2025 Page 2 of 2

Subsystems (26)
lore
Share & tools
lore
author maintainer
#116 lore raw

PATCH 1/1 pwm: pca9685: Use bulk write to atomicially update registers

In reply to Sasha Levin

From: Uwe Kleine-König <[email protected]>

[ Upstream commit de5855613263b426ee697dd30224322f2e634dec ]

The output of a PWM channel is configured by four register values. Write them in a single i2c transaction to ensure glitch free updates.

---

LLM Generated explanations, may be completely bogus:

YES
- The driver currently programs each PCA9685 channel by four independent I²C writes, so the hardware latches intermediate ON/OFF values and the output glitches whenever duty/phase changes. The commit fixes that by introducing pca9685_write_4reg() and switching the two callsites in pca9685_pwm_set_duty() to a single regmap_bulk_write() transaction (drivers/pwm/pwm-pca9685.c:136-183), eliminating the observable glitch for both PWM and the GPIO shim users.
- To make the bulk write possible, the probe code now enables the device’s auto-increment bit and clears the OCH latch mode (MODE1_AI and rewrites of MODE2 in drivers/pwm/pwm-pca9685.c:557-586). This guarantees that the four-byte transfer is accepted as one atomic update and keeps the controller in its documented default signalling modes (invert/open-drain remain governed by the same DT properties).
- The reset path for the “all LED” channel is moved to the same helper (drivers/pwm/pwm-pca9685.c:584-586), so the fix also covers the initial state and any error paths that need to reinitialise the chip.
- The change is tightly scoped to drivers/pwm/pwm-pca9685.c, does not add features, and relies only on long-standing regmap APIs, so it backports cleanly without extra dependencies. The only behavioural change beyond glitch avoidance is that MODE2 is no longer inherited from firmware, but the new value matches the datasheet defaults; no existing in-kernel consumer depends on custom OUTNE/OCH bits, keeping regression risk low compared to the very visible glitch it resolves.

Given the real user-facing malfunction it corrects and the limited, well-understood impact area, this is a solid candidate for the stable trees.

 drivers/pwm/pwm-pca9685.c | 46 ++++++++++++++++++++++++---------------
 1 file changed, 29 insertions(+), 17 deletions(-)
drivers/pwm/pwm-pca9685.c +29 -17
index 9ce75704a15f8..91f96b28ce1b5 100644
@@ -61,6 +61,8 @@
 #define MODE1_SUB2		BIT(2)
 #define MODE1_SUB1		BIT(3)
 #define MODE1_SLEEP		BIT(4)
+#define MODE1_AI		BIT(5)
+
 #define MODE2_INVRT		BIT(4)
 #define MODE2_OUTDRV		BIT(2)
 
@@ -131,6 +133,19 @@ static int pca9685_write_reg(struct pwm_chip *chip, unsigned int reg, unsigned i
 	return err;
 }
 
+static int pca9685_write_4reg(struct pwm_chip *chip, unsigned int reg, u8 val[4])
+{
+	struct pca9685 *pca = to_pca(chip);
+	struct device *dev = pwmchip_parent(chip);
+	int err;
+
+	err = regmap_bulk_write(pca->regmap, reg, val, 4);
+	if (err)
+		dev_err(dev, "regmap_write to register 0x%x failed: %pe\n", reg, ERR_PTR(err));
+
+	return err;
+}
+
 /* Helper function to set the duty cycle ratio to duty/4096 (e.g. duty=2048 -> 50%) */
 static void pca9685_pwm_set_duty(struct pwm_chip *chip, int channel, unsigned int duty)
 {
@@ -143,12 +158,10 @@ static void pca9685_pwm_set_duty(struct pwm_chip *chip, int channel, unsigned in
 		return;
 	} else if (duty >= PCA9685_COUNTER_RANGE) {
 		/* Set the full ON bit and clear the full OFF bit */
-		pca9685_write_reg(chip, REG_ON_H(channel), LED_FULL);
-		pca9685_write_reg(chip, REG_OFF_H(channel), 0);
+		pca9685_write_4reg(chip, REG_ON_L(channel), (u8[4]){ 0, LED_FULL, 0, 0 });
 		return;
 	}
 
-
 	if (pwm->state.usage_power && channel < PCA9685_MAXCHAN) {
 		/*
 		 * If usage_power is set, the pca9685 driver will phase shift
@@ -163,12 +176,9 @@ static void pca9685_pwm_set_duty(struct pwm_chip *chip, int channel, unsigned in
 
 	off = (on + duty) % PCA9685_COUNTER_RANGE;
 
-	/* Set ON time (clears full ON bit) */
-	pca9685_write_reg(chip, REG_ON_L(channel), on & 0xff);
-	pca9685_write_reg(chip, REG_ON_H(channel), (on >> 8) & 0xf);
-	/* Set OFF time (clears full OFF bit) */
-	pca9685_write_reg(chip, REG_OFF_L(channel), off & 0xff);
-	pca9685_write_reg(chip, REG_OFF_H(channel), (off >> 8) & 0xf);
+	/* implicitly clear full ON and full OFF bit */
+	pca9685_write_4reg(chip, REG_ON_L(channel),
+			   (u8[4]){ on & 0xff, (on >> 8) & 0xf, off & 0xff, (off >> 8) & 0xf });
 }
 
 static unsigned int pca9685_pwm_get_duty(struct pwm_chip *chip, int channel)
@@ -544,9 +554,8 @@ static int pca9685_pwm_probe(struct i2c_client *client)
 
 	mutex_init(&pca->lock);
 
-	ret = pca9685_read_reg(chip, PCA9685_MODE2, &reg);
-	if (ret)
-		return ret;
+	/* clear MODE2_OCH */
+	reg = 0;
 
 	if (device_property_read_bool(&client->dev, "invert"))
 		reg |= MODE2_INVRT;
@@ -562,16 +571,19 @@ static int pca9685_pwm_probe(struct i2c_client *client)
 	if (ret)
 		return ret;
 
-	/* Disable all LED ALLCALL and SUBx addresses to avoid bus collisions */
+	/*
+	 * Disable all LED ALLCALL and SUBx addresses to avoid bus collisions,
+	 * enable Auto-Increment.
+	 */
 	pca9685_read_reg(chip, PCA9685_MODE1, &reg);
 	reg &= ~(MODE1_ALLCALL | MODE1_SUB1 | MODE1_SUB2 | MODE1_SUB3);
+	reg |= MODE1_AI;
 	pca9685_write_reg(chip, PCA9685_MODE1, reg);
 
 	/* Reset OFF/ON registers to POR default */
-	pca9685_write_reg(chip, PCA9685_ALL_LED_OFF_L, 0);
-	pca9685_write_reg(chip, PCA9685_ALL_LED_OFF_H, LED_FULL);
-	pca9685_write_reg(chip, PCA9685_ALL_LED_ON_L, 0);
-	pca9685_write_reg(chip, PCA9685_ALL_LED_ON_H, LED_FULL);
+	ret = pca9685_write_4reg(chip, PCA9685_ALL_LED_ON_L, (u8[]){ 0, LED_FULL, 0, LED_FULL });
+	if (ret < 0)
+		return dev_err_probe(&client->dev, ret, "Failed to reset ON/OFF registers\n");
 
 	chip->ops = &pca9685_pwm_ops;
 
Signature · 1 line
2.51.0
author maintainer
#117 lore raw

PATCH 1/1 hwmon: (k10temp) Add thermal support for AMD Family 1Ah-based models

In reply to Sasha Levin

From: Avadhut Naik <[email protected]>

[ Upstream commit f116af2eb51ed9df24911537fda32a033f1c58da ]

Add thermal info support for newer AMD Family 1Ah-based models.

---

LLM Generated explanations, may be completely bogus:

YES
- Adds missing device IDs for AMD Family 1Ah model 50h/90h locally in drivers/hwmon/k10temp.c:86 so the stable tree doesn’t need header updates, keeping the change self‑contained and under the “just add a device ID” rule.
- Extends k10temp_id_table to match those IDs (drivers/hwmon/k10temp.c:563 and drivers/hwmon/k10temp.c:565), letting the existing probe path bind on the new desktop parts; without it, users on those CPUs lose all k10temp temperature readouts.
- The runtime logic for Family 1Ah CPUs was already upstreamed earlier (see the 2023 support commit still present in this tree at drivers/hwmon/k10temp.c:482), so the new entries simply reuse a proven Zen5/1Ah code path with no behavioral changes for older systems.
- No collateral effects: no register programming changes, no new flows, and the driver keeps using the same SMN readouts, so regression risk is negligible while hardware coverage noticeably improves.

 drivers/hwmon/k10temp.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/hwmon/k10temp.c +9 -0
index babf2413d666f..2f90a2e9ad496 100644
@@ -84,6 +84,13 @@ static DEFINE_MUTEX(nb_smu_ind_mutex);
  */
 #define AMD_I3255_STR				"3255"
 
+/*
+ * PCI Device IDs for AMD's Family 1Ah-based SOCs.
+ * Defining locally as IDs are not shared.
+ */
+#define PCI_DEVICE_ID_AMD_1AH_M50H_DF_F3	0x12cb
+#define PCI_DEVICE_ID_AMD_1AH_M90H_DF_F3	0x127b
+
 struct k10temp_data {
 	struct pci_dev *pdev;
 	void (*read_htcreg)(struct pci_dev *pdev, u32 *regval);
@@ -556,7 +563,9 @@ static const struct pci_device_id k10temp_id_table[] = {
 	{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_19H_M78H_DF_F3) },
 	{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_1AH_M00H_DF_F3) },
 	{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_1AH_M20H_DF_F3) },
+	{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_1AH_M50H_DF_F3) },
 	{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_1AH_M60H_DF_F3) },
+	{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_1AH_M90H_DF_F3) },
 	{ PCI_VDEVICE(HYGON, PCI_DEVICE_ID_AMD_17H_DF_F3) },
 	{}
 };
Signature · 1 line
2.51.0
author maintainer
#118 lore raw

PATCH 1/1 mfd: stmpe-i2c: Add missing MODULE_LICENSE

In reply to Sasha Levin

From: Alexander Stein <[email protected]>

[ Upstream commit 00ea54f058cd4cb082302fe598cfe148e0aadf94 ]

This driver is licensed GPL-2.0-only, so add the corresponding module flag.

---

LLM Generated explanations, may be completely bogus:

YES

**What Changed**
- Adds missing module license declaration: MODULE_LICENSE("GPL"); in drivers/mfd/stmpe-i2c.c:129.

**Why It Matters**
- Without a MODULE_LICENSE, modules are treated as non‑GPL compatible, which taints the kernel and blocks access to GPL‑only exports:
- License compatibility check: include/linux/license.h:5 treats "GPL" as GPL‑compatible.
- Taint on unknown/non‑GPL licenses: kernel/module/main.c:1742 triggers TAINT_PROPRIETARY_MODULE when license isn’t GPL‑compatible.
- The driver carries the SPDX header GPL-2.0-only, so the module flag aligns metadata with the actual license.
- Avoids user‑visible nuisance: dmesg warning and kernel taint on load for this module when built as a module.

**Scope and Risk**
- One-line metadata-only change in a single file; no functional or architectural changes.
- Very low regression risk; does not modify probe/remove paths or data flows.

**Context and History**
- The driver is modular-capable: config STMPE_I2C is tristate (drivers/mfd/Kconfig:1600), so a module license tag is appropriate.
- Commit 9e646615df195 (2023) removed MODULE_LICENSE under the assumption the object was non‑modular, which was incorrect for this driver and led to the current regression (missing license).
- This commit corrects that regression.
- Affected stable series: In this tree, v6.6, v6.8, and v6.10 lack the license line (module taints if built as a module), while v6.1 still had MODULE_LICENSE("GPL v2"). Backport is beneficial to stable lines where the line is missing.

**Stable Criteria Fit**
- Fixes a real, user-visible regression (kernel taint and GPL‑only symbol ineligibility) with a minimal, contained change.
- No new features or API changes; confined to MFD stmpe I2C driver metadata.
- Clear alignment with stable rules for small, low-risk fixes.

 drivers/mfd/stmpe-i2c.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mfd/stmpe-i2c.c +1 -0
index fe018bedab983..7e2ca39758825 100644
@@ -137,3 +137,4 @@ module_exit(stmpe_exit);
 
 MODULE_DESCRIPTION("STMPE MFD I2C Interface Driver");
 MODULE_AUTHOR("Rabin Vincent <[email protected]>");
+MODULE_LICENSE("GPL");
Signature · 1 line
2.51.0
author maintainer
#119 lore raw

PATCH 1/1 ACPI: SPCR: Support Precise Baud Rate field

In reply to Sasha Levin

From: Chen Pei <[email protected]>

[ Upstream commit 4d330fe54145ecfbb657ac01a554fdedf3c1927e ]

The Microsoft Serial Port Console Redirection (SPCR) specification revision 1.09 comprises additional field: Precise Baud Rate [1].

It is used to describe non-traditional baud rates (such as those used by high-speed UARTs).

It contains a specific non-zero baud rate which overrides the value of the Configured Baud Rate field. If this field is zero or not present, Configured Baud Rate is used.

---

LLM Generated explanations, may be completely bogus:

YES

- What it changes and why it matters:
- Adds support for the SPCR “Precise Baud Rate” field so the kernel honors non‑standard/high‑speed UART baud rates from firmware. The new logic checks table->precise_baudrate and, if non‑zero, uses it; otherwise it falls back to the existing enumerated “Configured Baud Rate” mapping.
- Code reference: drivers/acpi/spcr.c:153 adds the explanatory comment

    and the override logic; drivers/acpi/spcr.c:158 uses `if
    (table->precise_baudrate) baud_rate = table->precise_baudrate; else
    switch (table->baud_rate) { ... }`.

- Without this, systems that publish a precise baud in SPCR (e.g., 1.5M, 3M, etc.) end up with an incorrect console configuration (typically 115200), breaking or garbling the serial console. This is a user-visible bug in environments that follow SPCR 1.09+.

- Scope and risk:
- Minimal, self‑contained change in one file (drivers/acpi/spcr.c). It does not alter console selection logic, I/O type decisions, or errata handling; it only sets baud_rate earlier when the field is present, leaving the long‑standing switch on table->baud_rate unchanged.
- No architectural or behavioral changes beyond honoring an existing spec field. No new features; this is a spec‑compliance fix.

- Dependencies and compatibility:
- Requires the ACPICA header update that introduced the field in struct acpi_table_spcr:
- Code reference: include/acpi/actbl3.h:124 defines u32 precise_baudrate; (added by “ACPICA: SPCR: Update the SPCR table to version 4”, present from v6.12 and newer).
- For stable trees older than v6.12, this commit will not compile unless that ACPICA update (and its related SPCR struct changes) is backported first. Backporting both together is straightforward and low‑risk, as the header change is additive and this code only reads the new field.

- Subtlety to be aware of:
- The SPCR spec says the precise field “overrides” when non‑zero; if zero or not present, use the configured enumerated value. The code implements this correctly by falling back to the existing switch when the field is zero (drivers/acpi/spcr.c:158).
- As upstream implemented, there is no explicit table-length check before reading precise_baudrate. This matches mainline, but when backporting to very old kernels and encountering very old SPCR revisions, maintainers may optionally add a guard using table->header.length to be extra defensive. Not required for v6.12+ where the header and field are in place.

- Stable backport criteria:
- Fixes a real, user‑visible issue (misconfigured or non‑functional serial console on systems using SPCR precise baud).
- Small and localized change with minimal regression risk.
- No architectural churn or new feature exposure.
- Touches the ACPI SPCR parsing path only; console setup remains unchanged aside from using the correct baud.

Conclusion: This is a good candidate for stable backport, provided the target stable series already contains (or is backported with) the SPCR v4 ACPICA header update that defines precise_baudrate.

 drivers/acpi/spcr.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/acpi/spcr.c +9 -1
index cd36a97b0ea2c..fa12e740386de 100644
@@ -146,7 +146,15 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
 		goto done;
 	}
 
-	switch (table->baud_rate) {
+	/*
+	 * SPCR 1.09 defines Precise Baud Rate Filed contains a specific
+	 * non-zero baud rate which overrides the value of the Configured
+	 * Baud Rate field. If this field is zero or not present, Configured
+	 * Baud Rate is used.
+	 */
+	if (table->precise_baudrate)
+		baud_rate = table->precise_baudrate;
+	else switch (table->baud_rate) {
 	case 0:
 		/*
 		 * SPCR 1.04 defines 0 as a preconfigured state of UART.
Signature · 1 line
2.51.0
author maintainer
#120 lore raw

PATCH 1/1 mmc: sdhci-msm: Enable tuning for SDR50 mode for SD card

In reply to Sasha Levin

From: Sarthak Garg <[email protected]>

[ Upstream commit 08b68ca543ee9d5a8d2dc406165e4887dd8f170b ]

For Qualcomm SoCs which needs level shifter for SD card, extra delay is seen on receiver data path.

To compensate this delay enable tuning for SDR50 mode for targets which has level shifter. SDHCI_SDR50_NEEDS_TUNING caps will be set for targets with level shifter on Qualcomm SOC's.

---

LLM Generated explanations, may be completely bogus:

YES. Enabling SDR50 tuning fixes a real bug that hits Qualcomm boards using SD card level shifters, where the RX delay makes SDR50 unreliable unless the DLL is tuned. Today sdhci_msm_is_tuning_needed() returns false for SDR50 because of the existing CORE_FREQ_100MHZ check, so the controller never tunes even when hardware advertises SDHCI_SDR50_NEEDS_TUNING; this means the extra propagation delay is never compensated. The patch adds an early SDR50+flag check (drivers/mmc/host/sdhci-msm.c:1119) so tuning runs whenever firmware sets that capability, and it programs the vendor “HC_SELECT_IN” field to the new SDR50 selector before the tuning loop (drivers/mmc/host/sdhci- msm.c:1210 together with the new CORE_HC_SELECT_IN_SDR50 definition at drivers/mmc/host/sdhci-msm.c:82). That matches how HS400 is already handled and lets the DLL pick the correct sampling point. The change is tiny, self-contained to the Qualcomm host driver, and only engages when hardware already flagged that SDR50 needs tuning, so it shouldn’t regress other users. No new APIs or structural work are introduced, making this an appropriate, low-risk stable backport that restores reliable SDR50 operation on the affected systems.

 drivers/mmc/host/sdhci-msm.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/mmc/host/sdhci-msm.c +15 -0
index 9d8e20dc8ca11..e7df864bdcaf6 100644
@@ -81,6 +81,7 @@
 #define CORE_IO_PAD_PWR_SWITCH_EN	BIT(15)
 #define CORE_IO_PAD_PWR_SWITCH	BIT(16)
 #define CORE_HC_SELECT_IN_EN	BIT(18)
+#define CORE_HC_SELECT_IN_SDR50	(4 << 19)
 #define CORE_HC_SELECT_IN_HS400	(6 << 19)
 #define CORE_HC_SELECT_IN_MASK	(7 << 19)
 
@@ -1133,6 +1134,10 @@ static bool sdhci_msm_is_tuning_needed(struct sdhci_host *host)
 {
 	struct mmc_ios *ios = &host->mmc->ios;
 
+	if (ios->timing == MMC_TIMING_UHS_SDR50 &&
+	    host->flags & SDHCI_SDR50_NEEDS_TUNING)
+		return true;
+
 	/*
 	 * Tuning is required for SDR104, HS200 and HS400 cards and
 	 * if clock frequency is greater than 100MHz in these modes.
@@ -1201,6 +1206,8 @@ static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode)
 	struct mmc_ios ios = host->mmc->ios;
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
+	const struct sdhci_msm_offset *msm_offset = msm_host->offset;
+	u32 config;
 
 	if (!sdhci_msm_is_tuning_needed(host)) {
 		msm_host->use_cdr = false;
@@ -1217,6 +1224,14 @@ static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode)
 	 */
 	msm_host->tuning_done = 0;
 
+	if (ios.timing == MMC_TIMING_UHS_SDR50 &&
+	    host->flags & SDHCI_SDR50_NEEDS_TUNING) {
+		config = readl_relaxed(host->ioaddr + msm_offset->core_vendor_spec);
+		config &= ~CORE_HC_SELECT_IN_MASK;
+		config |= CORE_HC_SELECT_IN_EN | CORE_HC_SELECT_IN_SDR50;
+		writel_relaxed(config, host->ioaddr + msm_offset->core_vendor_spec);
+	}
+
 	/*
 	 * For HS400 tuning in HS200 timing requires:
 	 * - select MCLK/2 in VENDOR_SPEC
Signature · 1 line
2.51.0
author maintainer
#121 lore raw

PATCH 1/1 clocksource/drivers/timer-rtl-otto: Do not interfere with interrupts

In reply to Sasha Levin

From: Markus Stockhausen <[email protected]>

[ Upstream commit c445bffbf28f721e05d0ce06895045fc62aaff7c ]

During normal operation the timers are reprogrammed including an interrupt acknowledgement. This has no effect as the whole timer is setup from scratch afterwards. Especially in an interrupt this has already been done by rttm_timer_interrupt().

Change the behaviour as follows:

- Use rttm_disable_timer() during reprogramming
- Keep rttm_stop_timer() for all other use cases.

Downstream has already tested and confirmed a patch. See
https://github.com/openwrt/openwrt/pull/19468
https://forum.openwrt.org/t/support-for-rtl838x-based-managed-switches/57875/3788

---

LLM Generated explanations, may be completely bogus:

YES

- What it fixes
- The driver was acknowledging the interrupt (“W1C” PENDING bit) as part of routine timer reprogramming, not just in the interrupt handler. That read-modify-write ack can race with new pending interrupts and clear them, leading to occasional lost timer interrupts. The change confines IRQ acknowledgement to the interrupt handler and explicit stop/shutdown paths, preventing interference with in-flight or newly arriving interrupts.

- Exact code changes
- In the reprogramming paths, rttm_stop_timer() (which disables the timer and acks the IRQ) is replaced with rttm_disable_timer() (disable only), so the PENDING bit is no longer touched during normal reprogramming:
- drivers/clocksource/timer-rtl-otto.c:141-146 changes reprogramming for oneshot next-event (now disable → set period → start, without ack).
- drivers/clocksource/timer-rtl-otto.c:153-159 changes rttm_state_oneshot() similarly.
- drivers/clocksource/timer-rtl-otto.c:166-172 changes rttm_state_periodic() similarly.
- IRQ acknowledgement remains where it belongs:
- Interrupt handler acks before invoking the event handler:
drivers/clocksource/timer-rtl-otto.c:97-106 and specifically the ack helper at drivers/clocksource/timer-rtl-otto.c:77-80.
- Stop/shutdown/init paths still ack via rttm_stop_timer():
- Shutdown: drivers/clocksource/timer-rtl-otto.c:175-182
- Setup: drivers/clocksource/timer-rtl-otto.c:185-190
- rttm_stop_timer() itself still does disable + ack:
drivers/clocksource/timer-rtl-otto.c:125-129.

- Why the original behavior is problematic
- The ack function is implemented as a read-modify-write to a W1C bit:
ioread32(base + RTTM_INT) | RTTM_INT_PENDING followed by a write (drivers/clocksource/timer-rtl-otto.c:77-80). If a new interrupt becomes pending between the read and the write, the write will still set the PENDING bit in the value and clear it on write, effectively dropping that freshly latched interrupt. Calling this sequence outside the ISR (e.g., during reprogramming) can therefore interfere with normal interrupt delivery.

- Why this change is safe
- In-ISR reprogramming: The handler already acknowledges the interrupt at entry (drivers/clocksource/timer-rtl-otto.c:102). Removing a second ack during reprogramming eliminates a window where a new pending interrupt could be inadvertently cleared.
- Non-ISR reprogramming: If a pending bit exists, not acking ensures it will be properly handled by the ISR when it fires, rather than being silently cleared by a stray reprogramming ack.
- Ack is still performed at shutdown/setup where it is appropriate to clear stale state (drivers/clocksource/timer-rtl-otto.c:175-190), so there is no accumulation of stale flags.

- Context and related fixes
- This change is part of a small, focused series addressing timer reliability on Realtek Otto platforms:
- “Work around dying timers” added rttm_bounce_timer() to avoid reprogramming in a critical ~5us window before expiry (hardware peculiarity) and is used directly before reprogramming in all the altered paths (drivers/clocksource/timer-rtl-otto.c:109-123 and calls at 141, 154, 167).
- “Drop set_counter” cleaned up a no-op write to the current counter.
- The series was tested downstream (OpenWrt) and carries multiple Tested-by tags; the commit under review also notes downstream confirmation.

- Backport considerations
- Scope: Single driver file; changes are three substitutions of rttm_stop_timer() with rttm_disable_timer() in reprogramming paths. No functional/ABI changes outside this driver.
- Dependencies: None strict. If a stable branch does not yet have rttm_bounce_timer(), the underlying correctness argument for using rttm_disable_timer() instead of rttm_stop_timer() during reprogramming still holds. For branches already including the bounce patch (as in newer stables), this applies cleanly.
- Risk: Low. Potential for an extra immediate interrupt if a PENDING bit remained set is mitigated because the ISR acks and the clockevents layer tolerates such re-entries; conversely, the change removes a race that could drop interrupts, which is more severe.

- Stable policy fit
- Fixes a real bug affecting users (lost or interfered interrupts on rtl-otto platforms).
- Small, contained, and without architectural changes.
- Confined to drivers/clocksource/timer-rtl-otto.c.
- Already tested downstream and reviewed/merged upstream (commit

    c445bffbf28f7).

- While there is no explicit “Cc: stable” in the commit message, the change meets stable backport criteria and aligns with the prior reliability fix series for this driver.

Conclusion: Backporting this patch reduces the risk of lost timer interrupts by avoiding unnecessary and racy IRQ acknowledgements during reprogramming, with minimal regression risk and limited scope.

 drivers/clocksource/timer-rtl-otto.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clocksource/timer-rtl-otto.c +3 -3
index 8be45a11fb8b6..24c4aa6a30131 100644
@@ -147,7 +147,7 @@ static int rttm_next_event(unsigned long delta, struct clock_event_device *clkev
 
 	RTTM_DEBUG(to->of_base.base);
 	rttm_bounce_timer(to->of_base.base, RTTM_CTRL_COUNTER);
-	rttm_stop_timer(to->of_base.base);
+	rttm_disable_timer(to->of_base.base);
 	rttm_set_period(to->of_base.base, delta);
 	rttm_start_timer(to, RTTM_CTRL_COUNTER);
 
@@ -160,7 +160,7 @@ static int rttm_state_oneshot(struct clock_event_device *clkevt)
 
 	RTTM_DEBUG(to->of_base.base);
 	rttm_bounce_timer(to->of_base.base, RTTM_CTRL_COUNTER);
-	rttm_stop_timer(to->of_base.base);
+	rttm_disable_timer(to->of_base.base);
 	rttm_set_period(to->of_base.base, RTTM_TICKS_PER_SEC / HZ);
 	rttm_start_timer(to, RTTM_CTRL_COUNTER);
 
@@ -173,7 +173,7 @@ static int rttm_state_periodic(struct clock_event_device *clkevt)
 
 	RTTM_DEBUG(to->of_base.base);
 	rttm_bounce_timer(to->of_base.base, RTTM_CTRL_TIMER);
-	rttm_stop_timer(to->of_base.base);
+	rttm_disable_timer(to->of_base.base);
 	rttm_set_period(to->of_base.base, RTTM_TICKS_PER_SEC / HZ);
 	rttm_start_timer(to, RTTM_CTRL_TIMER);
 
Signature · 1 line
2.51.0
author maintainer
#122 lore raw

PATCH 1/1 riscv: bpf: Fix uninitialized symbol 'retval_off'

In reply to Sasha Levin

From: Chenghao Duan <[email protected]>

[ Upstream commit d0bf7cd5df18466d969bb60e8890b74cf96081ca ]

In the __arch_prepare_bpf_trampoline() function, retval_off is only meaningful when save_ret is true, so the current logic is correct. However, in the original logic, retval_off is only initialized under certain conditions; for example, in the fmod_ret logic, the compiler is not aware that the flags of the fmod_ret program (prog) have set BPF_TRAMP_F_CALL_ORIG, which results in an uninitialized symbol compilation warning.

So initialize retval_off unconditionally to fix it.

---

LLM Generated explanations, may be completely bogus:

YES

- What changed: The patch moves retval_off = stack_size; out of the if (save_ret) block so it’s always initialized. Previously retval_off was only assigned when save_ret was true.
- Before: retval_off assigned only inside if (save_ret) { ... }
- After: retval_off assigned unconditionally immediately after the

    optional `stack_size += 16`

- Reference: arch/riscv/net/bpf_jit_comp64.c:1066

- Why it matters: retval_off is used in code paths not explicitly guarded by save_ret, which makes compilers think it can be used uninitialized and emit a warning (e.g., -Wmaybe-uninitialized), even though, logically, those paths only occur with flags that imply save_ret must be true.
- Unconditional uses in fmod_ret path:
- Zeroing return value slot: arch/riscv/net/bpf_jit_comp64.c:1157
- Loading return value: arch/riscv/net/bpf_jit_comp64.c:1163
- Unconditional uses in call-orig path:
- Store original function’s return in reserved slot:
arch/riscv/net/bpf_jit_comp64.c:1176
- Store BPF R0: arch/riscv/net/bpf_jit_comp64.c:1177
- Final restore guarded by save_ret, confirming the semantic intent:

    arch/riscv/net/bpf_jit_comp64.c:1209

- Bug scope and user impact:
- This is a build correctness fix that eliminates spurious “maybe- uninitialized” warnings that can be promoted to errors in some configurations or toolchains. It does not change runtime behavior because the only meaningful use of retval_off (e.g., restoring return values) is already guarded by save_ret. When save_ret is false, retval_off’s value is ignored by the logic that matters.
- The warning can affect users building with stricter warning settings or newer compilers; resolving it improves build reliability for RISC-V with BPF trampolines.

- Containment and risk:
- The change is tiny and contained to a single file/function in the RISC-V BPF JIT trampoline.
- No new features, APIs, or architectural changes; no functional logic changed for valid flag combinations.
- Safe even if misused flags were ever passed: retval_off now has a defined value, avoiding UB from uninitialized use.

- Applicability to stable trees:
- The affected pattern exists in stable series that have the RISC-V BPF trampoline (e.g., v6.6 shows the same conditional initialization, with unconditional uses later). See v6.6 code where retval_off is only set under if (save_ret) and is used in the fmod_ret block and call-orig sequence without an explicit save_ret guard, mirroring the warning scenario.
- Mainline commit: d0bf7cd5df184 (“riscv: bpf: Fix uninitialized symbol 'retval_off'”).
- Likely Fixes: 25ad10658dc10 (“riscv, bpf: Adapt bpf trampoline to optimized riscv ftrace framework”), which introduced the trampoline structure that uses retval_off this way.

- Stable criteria check:
- Fixes a real build issue (warnings that can become errors).
- Small, self-contained change in one function and one file.
- No functional side effects; does not alter behavior except removing undefined initialization state.
- Not a feature or refactor; low regression risk; localized to RISC-V BPF trampoline.

Conclusion: This is a good and safe candidate for backporting to all stable trees that include the RISC-V BPF trampoline code path (e.g., 6.6.y and newer where applicable).

 arch/riscv/net/bpf_jit_comp64.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/riscv/net/bpf_jit_comp64.c +2 -3
index 9883a55d61b5b..8475a8ab57151 100644
@@ -1079,10 +1079,9 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im,
 	stack_size += 16;
 
 	save_ret = flags & (BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_RET_FENTRY_RET);
-	if (save_ret) {
+	if (save_ret)
 		stack_size += 16; /* Save both A5 (BPF R0) and A0 */
-		retval_off = stack_size;
-	}
+	retval_off = stack_size;
 
 	stack_size += nr_arg_slots * 8;
 	args_off = stack_size;
Signature · 1 line
2.51.0
author maintainer
#123 lore raw

PATCH 1/1 irqchip/gic-v2m: Handle Multiple MSI base IRQ Alignment

In reply to Sasha Levin

From: Christian Bruel <[email protected]>

[ Upstream commit 2ef3886ce626dcdab0cbc452dbbebc19f57133d8 ]

The PCI Local Bus Specification 3.0 (section 6.8.1.6) allows modifying the low-order bits of the MSI Message DATA register to encode nr_irqs interrupt numbers in the log2(nr_irqs) bits for the domain.

The problem arises if the base vector (GICV2m base spi) is not aligned with nr_irqs; in this case, the low-order log2(nr_irqs) bits from the base vector conflict with the nr_irqs masking, causing the wrong MSI interrupt to be identified.

To fix this, use bitmap_find_next_zero_area_off() instead of bitmap_find_free_region() to align the initial base vector with nr_irqs.

---

LLM Generated explanations, may be completely bogus:

Based on my comprehensive analysis of this commit, the code changes, and the historical context of similar fixes across the kernel:

## **Backport Status: YES**

### Detailed Analysis:

#### **Nature of the Bug:**

This commit fixes a **critical correctness bug** in Multi-MSI interrupt allocation for GIC-v2m. The issue occurs when the base SPI (Shared Peripheral Interrupt) vector is not properly aligned with the number of requested interrupts (nr_irqs). According to the PCI Local Bus Specification 3.0 (section 6.8.1.6), Multi-MSI uses the low-order log2(nr_irqs) bits of the MSI DATA register to encode interrupt numbers. When the base vector isn't aligned, these low-order bits conflict with the hardware's interrupt encoding, causing **MSI interrupts to be delivered to the wrong interrupt numbers**.

#### **Code Changes - Line by Line Analysis:**

**Lines 156-157**: Changes offset from int to unsigned long and adds alignment mask calculation:

```c
- int hwirq, offset, i, err = 0;
+       int hwirq, i, err = 0;
+       unsigned long offset;
+       unsigned long align_mask = nr_irqs - 1;
```

The align_mask ensures power-of-2 alignment required by Multi-MSI (for 4 MSIs, align on 4-interrupt boundary).

**Lines 160-165**: Replaces bitmap_find_free_region() with bitmap_find_next_zero_area_off():

```c
- offset = bitmap_find_free_region(tmp->bm, tmp->nr_spis,
- get_count_order(nr_irqs));
- if (offset >= 0) {
+               unsigned long align_off = tmp->spi_start -
(tmp->spi_start & ~align_mask);
+
+               offset = bitmap_find_next_zero_area_off(tmp->bm,
tmp->nr_spis, 0,
+                                                       nr_irqs,
align_mask, align_off);
+               if (offset < tmp->nr_spis) {
                        v2m = tmp;
+                       bitmap_set(v2m->bm, offset, nr_irqs);
```

The critical change: bitmap_find_next_zero_area_off() allows specifying an alignment offset (align_off) that accounts for the spi_start base. This ensures the **final hardware IRQ number** (spi_start + offset) is properly aligned, not just the bitmap offset.

#### **Pattern of Similar Bugs:**

This is part of a **systematic class of Multi-MSI alignment bugs** across the kernel:

1. **irqchip/armada-370-xp** (d0a553502efd5, Nov 2021): Fixed identical issue, marked for stable with Cc: stable tag
2. **PCI: aardvark** (b0b0b8b897f8e, Jan 2022): Fixed alignment bug causing NVMe disks to freeze, backported to stable
3. **irqchip/gic-v3-its** (8208d1708b88b, Jan 2019): Fixed Multi-MSI allocation alignment with explicit Fixes: tag and Cc: stable
4. **PCI: hv**: Multiple stable backports for Multi-MSI interrupt mapping issues

All these commits fixed the same class of bug and were backported to stable trees.

#### **Why This Qualifies for Stable:**

1. **Fixes Important Bug**: Misrouted interrupts can cause device malfunction, timeouts, or system hangs
2. **Small and Contained**: Only 13 lines changed in a single function (drivers/irqchip/irq-gic-v2m.c:151-194)
3. **No Architectural Changes**: Pure bugfix, doesn't add features or change APIs
4. **Affects Real Hardware**: Impacts ARM SoCs using GIC-v2m (STM32MP25, potentially others)
5. **Minimal Regression Risk**: Change is localized to allocation logic with clear semantics
6. **Well Reviewed**: Reviewed by Marc Zyngier (GIC maintainer), signed off by Thomas Gleixner (irq maintainer)

#### **Notable Observations:**

- **Missing Fixes: tag**: The commit lacks a Fixes: tag and `Cc:
[email protected]`, which is unusual for this class of bug. However, this doesn't diminish the need for backporting - it may indicate the bug was newly discovered on recent hardware (STM32MP25) rather than affecting existing deployments.

- **Asymmetric bitmap operations**: The code now uses bitmap_find_next_zero_area_off() + bitmap_set() for allocation but keeps bitmap_release_region() for deallocation. This is intentional and correct - both approaches manipulate the same bitmap bits, just with different alignment guarantees.

- **Recent commit** (Sept 2, 2025): Very recent, but the fix is straightforward and follows established patterns from other drivers.

#### **Conclusion:**

This commit should be backported to stable kernel trees. It fixes a correctness bug that could cause serious issues on systems using Multi- MSI with GIC-v2m hardware, follows the same pattern as other successfully backported Multi-MSI alignment fixes, and has minimal risk of regression.

 drivers/irqchip/irq-gic-v2m.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/irqchip/irq-gic-v2m.c +9 -4
index 24ef5af569fe4..8a3410c2b7b57 100644
@@ -153,14 +153,19 @@ static int gicv2m_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
 {
 	msi_alloc_info_t *info = args;
 	struct v2m_data *v2m = NULL, *tmp;
-	int hwirq, offset, i, err = 0;
+	int hwirq, i, err = 0;
+	unsigned long offset;
+	unsigned long align_mask = nr_irqs - 1;
 
 	spin_lock(&v2m_lock);
 	list_for_each_entry(tmp, &v2m_nodes, entry) {
-		offset = bitmap_find_free_region(tmp->bm, tmp->nr_spis,
-						 get_count_order(nr_irqs));
-		if (offset >= 0) {
+		unsigned long align_off = tmp->spi_start - (tmp->spi_start & ~align_mask);
+
+		offset = bitmap_find_next_zero_area_off(tmp->bm, tmp->nr_spis, 0,
+							nr_irqs, align_mask, align_off);
+		if (offset < tmp->nr_spis) {
 			v2m = tmp;
+			bitmap_set(v2m->bm, offset, nr_irqs);
 			break;
 		}
 	}
Signature · 1 line
2.51.0
author maintainer
#124 lore raw

PATCH 1/1 hwmon: (dell-smm) Add support for Dell OptiPlex 7040

In reply to Sasha Levin

From: Armin Wolf <[email protected]>

[ Upstream commit 53d3bd48ef6ff1567a75ca77728968f5ab493cb4 ]

The Dell OptiPlex 7040 supports the legacy SMM interface for reading sensors and performing fan control. Whitelist this machine so that this driver loads automatically.

---

LLM Generated explanations, may be completely bogus:

YES

- Change scope and intent: The patch only adds a single DMI whitelist entry for “Dell OptiPlex 7040” to the legacy SMM allowlist used by the dell-smm hwmon driver. It adds a new block in i8k_dmi_table with explicit vendor and exact product matches, no other logic changes. See drivers/hwmon/dell-smm-hwmon.c:1334–1339.

- How it affects behavior: The i8k_dmi_table is consulted to decide if legacy SMM probing is permitted. If the system is not in this table, the driver refuses legacy SMM unless overridden by module params; with newer code it falls back to WMI. The gating is in dell_smm_legacy_check(), which returns -ENODEV when the DMI table doesn’t match and neither ignore_dmi nor force is set (drivers/hwmon/dell-smm-hwmon.c:1756–1761). Adding 7040 lets the driver load and use the legacy SMM path on that system automatically.

- Autoloading safety and containment: The driver exposes a DMI modalias and will auto-load only on machines matching this entry. The new match is guarded by both DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc.") and DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "OptiPlex 7040"), ensuring no unintended matches (drivers/hwmon/dell-smm-hwmon.c:1334–1338, 1378).

- Precedent and consistency: Neighboring entries for similar models, OptiPlex 7050 and 7060, already exist and were accepted (drivers/hwmon/dell-smm-hwmon.c:1320–1332). Extending coverage to the 7040 is consistent with established support for this platform family and the commit message notes the 7040 supports legacy SMM for sensors and fan control.

- Risk assessment:
- No architectural changes, no new interfaces; it’s a pure DMI whitelist addition in a single file.
- SMM-specific risks are mitigated by existing vendor/model blacklists

    for known-problematic systems (e.g., fan support freeze blacklist;
    drivers/hwmon/dell-smm-hwmon.c:1482–1512). 7040 is not on any
    blacklist.

- Security posture remains unchanged: fan control and serial number are already restricted by default to CAP_SYS_ADMIN (restricted default true; drivers/hwmon/dell-smm-hwmon.c:127–133).

- User impact: Fixes a real-world usability gap where the driver would not autoload on OptiPlex 7040 (previously requiring module parameters or leaving sensors/fan control unavailable). The commit references a user report (Closes: GitHub issue) and was accepted by the hwmon maintainer.

- Backport suitability:
- Change is small, localized, and low risk.
- It aligns with stable rules for adding device IDs to enable existing functionality.
- Applies cleanly conceptually to older stable trees which also use i8k_dmi_table and MODULE_DEVICE_TABLE(dmi, i8k_dmi_table) (e.g., v6.1, v6.6), even though line positions differ.

Given the minimal, well-scoped nature of the change and clear user benefit without broader side effects, this is a good candidate for stable backport.

 drivers/hwmon/dell-smm-hwmon.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/hwmon/dell-smm-hwmon.c +7 -0
index 3f61b2d7935e4..5801128e16c3c 100644
@@ -1280,6 +1280,13 @@ static const struct dmi_system_id i8k_dmi_table[] __initconst = {
 			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "OptiPlex 7050"),
 		},
 	},
+	{
+		.ident = "Dell OptiPlex 7040",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "OptiPlex 7040"),
+		},
+	},
 	{
 		.ident = "Dell Precision",
 		.matches = {
Signature · 1 line
2.51.0
author maintainer
#125 lore raw

PATCH 1/1 hwmon: (lenovo-ec-sensors) Update P8 supprt

In reply to Sasha Levin

From: David Ober <[email protected]>

[ Upstream commit 43c056ac85b60232861005765153707f1b0354b6 ]

This fixes differences for the P8 system that was initially set to the same thermal values as the P7, also adds in the PSU sensor for all of the supported systems

---

LLM Generated explanations, may be completely bogus:

YES
- Corrects the EC register map and labels so P8 machines stop reusing the P7 layout; the new p8_temp_map and dedicated label table at drivers/hwmon/lenovo-ec-sensors.c:91 feed the right offsets to lenovo_ec_do_read_temp, fixing the bogus readings and misnamed DIMM/PCI sensors that users currently see.
- Adds the missing PSU temperature channels by wiring the indices into every platform map (px_temp_map with PSU1/PSU2 at drivers/hwmon/lenovo-ec-sensors.c:69, and the generic PSU entry at drivers/hwmon/lenovo-ec-sensors.c:109), and exposes them through the hwmon descriptors (lenovo_ec_hwmon_info_* blocks beginning at drivers/hwmon/lenovo-ec-sensors.c:301). This closes the gap where the EC already provided data but the driver silently dropped it.
- Updates the P8 probe path to select the new map/labels (drivers/hwmon/lenovo-ec-sensors.c:571), so only that SKU sees the remapped channels while P5/P7 keep the shared generic table plus the newly exposed PSU sensor.
- I checked the driver’s short history (only the initial add in 70118f85e6538) and the surrounding hwmon subsystem; the change stays confined to this new platform driver, aligns array sizes, and avoids architectural churn, so regression risk is low. The only user-visible difference is the appearance/renaming of sensors to match the hardware, which is expected for a bug fix.

Given it fixes incorrect sensor data and restores missing thermal telemetry on shipping systems, while touching only this young driver, it fits the stable inclusion guidelines.

 drivers/hwmon/lenovo-ec-sensors.c | 34 +++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)
drivers/hwmon/lenovo-ec-sensors.c +30 -4
index 143fb79713f7d..8681bbf6665b1 100644
@@ -66,7 +66,7 @@ enum systems {
 	LENOVO_P8,
 };
 
-static int px_temp_map[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+static int px_temp_map[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 31, 32};
 
 static const char * const lenovo_px_ec_temp_label[] = {
 	"CPU1",
@@ -84,9 +84,29 @@ static const char * const lenovo_px_ec_temp_label[] = {
 	"PCI_Z3",
 	"PCI_Z4",
 	"AMB",
+	"PSU1",
+	"PSU2",
 };
 
-static int gen_temp_map[] = {0, 2, 3, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+static int p8_temp_map[] = {0, 1, 2, 8, 9, 13, 14, 15, 16, 17, 19, 20, 33};
+
+static const char * const lenovo_p8_ec_temp_label[] = {
+	"CPU1",
+	"CPU_DIMM_BANK1",
+	"CPU_DIMM_BANK2",
+	"M2_Z2R",
+	"M2_Z3R",
+	"DIMM_RIGHT",
+	"DIMM_LEFT",
+	"PCI_Z1",
+	"PCI_Z2",
+	"PCI_Z3",
+	"AMB",
+	"REAR_VR",
+	"PSU",
+};
+
+static int gen_temp_map[] = {0, 2, 3, 6, 7, 8, 9, 10, 11, 12, 13, 14, 31};
 
 static const char * const lenovo_gen_ec_temp_label[] = {
 	"CPU1",
@@ -101,6 +121,7 @@ static const char * const lenovo_gen_ec_temp_label[] = {
 	"PCI_Z3",
 	"PCI_Z4",
 	"AMB",
+	"PSU",
 };
 
 static int px_fan_map[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
@@ -293,6 +314,8 @@ static const struct hwmon_channel_info *lenovo_ec_hwmon_info_px[] = {
 			   HWMON_T_INPUT | HWMON_T_LABEL,
 			   HWMON_T_INPUT | HWMON_T_LABEL,
 			   HWMON_T_INPUT | HWMON_T_LABEL,
+			   HWMON_T_INPUT | HWMON_T_LABEL,
+			   HWMON_T_INPUT | HWMON_T_LABEL,
 			   HWMON_T_INPUT | HWMON_T_LABEL),
 	HWMON_CHANNEL_INFO(fan,
 			   HWMON_F_INPUT | HWMON_F_LABEL | HWMON_F_MAX,
@@ -327,6 +350,7 @@ static const struct hwmon_channel_info *lenovo_ec_hwmon_info_p8[] = {
 			   HWMON_T_INPUT | HWMON_T_LABEL,
 			   HWMON_T_INPUT | HWMON_T_LABEL,
 			   HWMON_T_INPUT | HWMON_T_LABEL,
+			   HWMON_T_INPUT | HWMON_T_LABEL,
 			   HWMON_T_INPUT | HWMON_T_LABEL),
 	HWMON_CHANNEL_INFO(fan,
 			   HWMON_F_INPUT | HWMON_F_LABEL | HWMON_F_MAX,
@@ -359,6 +383,7 @@ static const struct hwmon_channel_info *lenovo_ec_hwmon_info_p7[] = {
 			   HWMON_T_INPUT | HWMON_T_LABEL,
 			   HWMON_T_INPUT | HWMON_T_LABEL,
 			   HWMON_T_INPUT | HWMON_T_LABEL,
+			   HWMON_T_INPUT | HWMON_T_LABEL,
 			   HWMON_T_INPUT | HWMON_T_LABEL),
 	HWMON_CHANNEL_INFO(fan,
 			   HWMON_F_INPUT | HWMON_F_LABEL | HWMON_F_MAX,
@@ -388,6 +413,7 @@ static const struct hwmon_channel_info *lenovo_ec_hwmon_info_p5[] = {
 			   HWMON_T_INPUT | HWMON_T_LABEL,
 			   HWMON_T_INPUT | HWMON_T_LABEL,
 			   HWMON_T_INPUT | HWMON_T_LABEL,
+			   HWMON_T_INPUT | HWMON_T_LABEL,
 			   HWMON_T_INPUT | HWMON_T_LABEL),
 	HWMON_CHANNEL_INFO(fan,
 			   HWMON_F_INPUT | HWMON_F_LABEL | HWMON_F_MAX,
@@ -545,9 +571,9 @@ static int lenovo_ec_probe(struct platform_device *pdev)
 		break;
 	case 3:
 		ec_data->fan_labels = p8_ec_fan_label;
-		ec_data->temp_labels = lenovo_gen_ec_temp_label;
+		ec_data->temp_labels = lenovo_p8_ec_temp_label;
 		ec_data->fan_map = p8_fan_map;
-		ec_data->temp_map = gen_temp_map;
+		ec_data->temp_map = p8_temp_map;
 		lenovo_ec_chip_info.info = lenovo_ec_hwmon_info_p8;
 		break;
 	default:
Signature · 1 line
2.51.0
author maintainer
#126 lore raw

PATCH 1/1 mmc: host: renesas_sdhi: Fix the actual clock

In reply to Sasha Levin

From: Biju Das <[email protected]>

[ Upstream commit 9c174e4dacee9fb2014a4ffc953d79a5707b77e4 ]

Wrong actual clock reported, if the SD clock division ratio is other than 1:1(bits DIV[7:0] in SD_CLK_CTRL are set to 11111111).

On high speed mode, cat /sys/kernel/debug/mmc1/ios Without the patch:

clock:          50000000 Hz
actual clock:   200000000 Hz

After the fix:

clock:          50000000 Hz
actual clock:   50000000 Hz

---

LLM Generated explanations, may be completely bogus:

Based on my comprehensive analysis of this commit, here is my assessment:

## Backport Status: **YES**

### Extensive Analysis

#### Bug Description and Impact

The commit fixes an incorrect actual_clock reporting bug in the Renesas SDHI MMC driver that has existed since v5.4 (commit 75eaf49f5d3d8 from 2019).

**The Problem:**
When the SD clock division ratio is not 1:1 (i.e., DIV[7:0] bits in SD_CLK_CTRL register are not 0xff), the driver incorrectly reports actual_clock as the parent clock frequency instead of the divided frequency.

From the commit message example:
- Requested: 50 MHz
- Parent clock set to: 200 MHz
- Hardware divider: 1/4 (to get 50 MHz)
- **Bug**: actual_clock reports 200 MHz instead of 50 MHz

**Functional Impact Beyond Debugging:**

While this appears to be a debugfs reporting issue, it has **real functional consequences**. The actual_clock value is used in drivers/mmc/core/block.c:1056 (mmc_blk_clock_khz()) to calculate timeout values:

```c
if (data->timeout_clks) {
    khz = mmc_blk_clock_khz(host);  // Uses actual_clock
    ms += DIV_ROUND_UP(data->timeout_clks, khz);
}
```

With incorrect actual_clock (e.g., 200 MHz instead of 50 MHz), timeouts are calculated **4x too short**, potentially causing premature timeout errors and data transfer failures.

#### Code Analysis

**The Hardware Divider Mechanism:**

From commit 0196c8db8363f7 (2018), the SD_CLK_CTRL register DIV[7:0] bits work as follows:
- 0x80 (bit 7): 1/512 divider
- 0x40 (bit 6): 1/256 divider
- 0x20 (bit 5): 1/128 divider
- ... (each bit represents a power-of-2 division)
- 0x01 (bit 0): 1/4 divider
- 0x00 (all clear): 1/2 divider
- 0xff (Renesas extension): 1/1 (no division)

**The Fix - Mathematical Verification:**

The fix adds lines 224-226 in renesas_sdhi_core.c:205:

```c
clock = clk & CLK_CTL_DIV_MASK;
if (clock != 0xff)
    host->mmc->actual_clock /= (1 << (ffs(clock) + 1));
```

Formula verification for all divider values:
- clock=0x80: ffs(0x80)=8 → (1<<9)=512 → divides by 512 ✓
- clock=0x40: ffs(0x40)=7 → (1<<8)=256 → divides by 256 ✓
- clock=0x01: ffs(0x01)=1 → (1<<2)=4 → divides by 4 ✓
- clock=0x00: ffs(0x00)=0 → (1<<1)=2 → divides by 2 ✓
- clock=0xff: skips division (1:1 ratio) ✓

The formula is **mathematically correct** for all possible hardware divider configurations.

#### Backporting Criteria Assessment

**Positive Factors:**
1. ✅ **Fixes real functional bug**: Incorrect timeout calculations, not just cosmetic
2. ✅ **Small and contained**: Only 3 lines added, affecting one function
3. ✅ **No architectural changes**: Simple calculation fix
4. ✅ **Minimal regression risk**: Mathematically sound, verified formula
5. ✅ **Hardware-specific**: Limited to Renesas SDHI driver (contained blast radius)
6. ✅ **No known issues**: No reverts or subsequent fixes (only a cleanup commit 5d0702dc9c2f6 replacing magic number with macro)
7. ✅ **Stable in mainline**: Merged August 19, 2025, no problems reported

**Considerations:**
- ⚠️ **No explicit Fixes: tag** (though it clearly fixes commit 75eaf49f5d3d8)
- ⚠️ **No Cc: stable tag**
- ⚠️ **Author couldn't test HS400 mode** (mentioned in lore.kernel.org thread)
- ℹ️ **Long-standing bug** (since v5.4, 2019) without major reports suggests real-world impact may be limited

**Dependencies:**
- Requires actual_clock field (present since v5.4)
- Requires current renesas_sdhi_set_clock() structure (present since v4.19)
- Should apply cleanly to kernels v5.4+

#### Conclusion

This commit **should be backported** to stable trees (v5.4+) because:

1. It fixes a **functional bug with real-world consequences** (timeout calculation errors leading to potential data transfer failures)
2. The fix is **small, simple, and mathematically verified**
3. **Very low regression risk** - the formula correctly implements the hardware specification
4. **Confined scope** - only affects Renesas SDHI hardware
5. **Stable in mainline** - no issues found since merge

The absence of Fixes:/Cc:stable tags is not disqualifying given the clear functional impact and the quality of the fix. The commit already has been staged for backport (6693c63ffc49e in linux-autosel-6.17), which is appropriate.

 drivers/mmc/host/renesas_sdhi_core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/mmc/host/renesas_sdhi_core.c +5 -1
index fb8ca03f661d7..a41291a28e9bd 100644
@@ -222,7 +222,11 @@ static void renesas_sdhi_set_clock(struct tmio_mmc_host *host,
 			clk &= ~0xff;
 	}
 
-	sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk & CLK_CTL_DIV_MASK);
+	clock = clk & CLK_CTL_DIV_MASK;
+	if (clock != 0xff)
+		host->mmc->actual_clock /= (1 << (ffs(clock) + 1));
+
+	sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clock);
 	if (!(host->pdata->flags & TMIO_MMC_MIN_RCAR2))
 		usleep_range(10000, 11000);
 
Signature · 1 line
2.51.0
author maintainer
#127 lore raw

PATCH 1/1 hwmon: sy7636a: add alias

In reply to Sasha Levin

From: Andreas Kemnade <[email protected]>

[ Upstream commit 80038a758b7fc0cdb6987532cbbf3f75b13e0826 ]

Add module alias to have it autoloaded.

---

LLM Generated explanations, may be completely bogus:

YES
**Rationale**
- Adding MODULE_ALIAS("platform:sy7636a-temperature"); in drivers/hwmon/sy7636a-hwmon.c:105 ensures udev can auto-load the module when the MFD core registers the sy7636a-temperature platform device. Today the driver lacks any MODULE_ALIAS or MODULE_DEVICE_TABLE, so built-as-module systems never bind automatically and the hwmon sensor stays unavailable unless manually modprobed—an obvious functional bug.
- The platform child is created by drivers/mfd/simple-mfd-i2c.c:66-73, which exposes the sy7636a-temperature modalias; the regulator sibling already has a matching alias via its platform ID table (drivers/regulator/sy7636a-regulator.c:122-134), highlighting that the hwmon side simply missed the same piece.
- History (git log -- drivers/hwmon/sy7636a-hwmon.c) shows the driver has shipped without an alias since it was introduced in commit de34a40532507 (Jan 2022), so every stable kernel carrying this driver is affected.
- The fix is a one-line metadata change with no runtime impact beyond enabling the intended autoload path, so regression risk is negligible and it squarely fits stable rules.

**Next Steps**
1. Queue the patch for all supported stable trees that include drivers/hwmon/sy7636a-hwmon.c.

 drivers/hwmon/sy7636a-hwmon.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hwmon/sy7636a-hwmon.c +1 -0
index ed110884786b4..a12fc0ce70e76 100644
@@ -104,3 +104,4 @@ module_platform_driver(sy7636a_sensor_driver);
 
 MODULE_DESCRIPTION("SY7636A sensor driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:sy7636a-temperature");
Signature · 1 line
2.51.0
author maintainer
#128 lore raw

PATCH 1/1 futex: Don't leak robust_list pointer on exec race

In reply to Sasha Levin

From: Pranav Tyagi <[email protected]>

[ Upstream commit 6b54082c3ed4dc9821cdf0edb17302355cc5bb45 ]

sys_get_robust_list() and compat_get_robust_list() use ptrace_may_access() to check if the calling task is allowed to access another task's robust_list pointer. This check is racy against a concurrent exec() in the target process.

During exec(), a task may transition from a non-privileged binary to a privileged one (e.g., setuid binary) and its credentials/memory mappings may change. If get_robust_list() performs ptrace_may_access() before this transition, it may erroneously allow access to sensitive information after the target becomes privileged.

A racy access allows an attacker to exploit a window during which ptrace_may_access() passes before a target process transitions to a privileged state via exec().

For example, consider a non-privileged task T that is about to execute a setuid-root binary. An attacker task A calls get_robust_list(T) while T is still unprivileged. Since ptrace_may_access() checks permissions based on current credentials, it succeeds. However, if T begins exec immediately afterwards, it becomes privileged and may change its memory mappings. Because get_robust_list() proceeds to access T->robust_list without synchronizing with exec() it may read user-space pointers from a now-privileged process.

This violates the intended post-exec access restrictions and could expose sensitive memory addresses or be used as a primitive in a larger exploit chain. Consequently, the race can lead to unauthorized disclosure of information across privilege boundaries and poses a potential security risk.

Take a read lock on signal->exec_update_lock prior to invoking ptrace_may_access() and accessing the robust_list/compat_robust_list. This ensures that the target task's exec state remains stable during the check, allowing for consistent and synchronized validation of credentials.

---

LLM Generated explanations, may be completely bogus:

YES

Why this matters
- Fixes a real bug: A permission check vs. exec() race can leak a target task’s robust_list pointer across a privilege boundary. The old code checked permissions without synchronizing with a concurrent exec() and then returned the pointer, enabling an info-leak window.
- Security impact: Potential info disclosure across exec transitions (e.g., setuid). This is a hardening/security fix, not a feature.

What changed (key deltas)
- Introduces a shared helper and proper exec synchronization:
- Adds futex_task_robust_list() to pick native vs. compat robust

    list pointer (kernel/futex/syscalls.c:42-49).

- Adds futex_get_robust_list_common() that:
- Looks up the target task under RCU and pins it with get_task_struct() (kernel/futex/syscalls.c:57-64).
- Takes down_read_killable(&p->signal->exec_update_lock) to serialize with exec() (kernel/futex/syscalls.c:66-76).
- Performs ptrace_may_access(..., PTRACE_MODE_READ_REALCREDS) and, if allowed, returns the robust_list pointer (kernel/futex/syscalls.c:74-83).
- On error, drops the lock and task ref, returning an ERR_PTR (kernel/futex/syscalls.c:85-89).
- Refactors both syscalls to use the helper:
- sys_get_robust_list() now uses the common path and checks

    `IS_ERR()` (kernel/futex/syscalls.c:98-110).
  - `compat_get_robust_list()` does the same for compat
    (kernel/futex/syscalls.c:486-494).

- Removes racy patterns:
- The removed code only held rcu_read_lock() during ptrace_may_access() and the read of p->robust_list, with no exec() synchronization, creating the race window. See e.g., v6.1 code that still shows this pattern at v6.1:kernel/futex/syscalls.c:53..72 and :338..344.

Why this is correct
- Holding signal->exec_update_lock ensures the credentials and mappings checked by ptrace_may_access() remain stable across the exec boundary. This mirrors established patterns elsewhere, e.g., pidfd file access uses the same lock (kernel/pid.c:835-844).
- Taking a task ref under RCU then dropping RCU is standard and safe for later operations needing a stable task pointer.
- Only returns the user pointer after permission is validated under the lock, closing the leak.

Risk and side effects
- Behavior: May now return -EINTR if interrupted while waiting on exec_update_lock (via down_read_killable). This is consistent with similar code paths (e.g., kernel/pid.c:835-844) and acceptable for stable.
- Contention: Minimal; it uses the read side of a rwsem and only for a short critical section.
- Scope: Localized to futex robust-list syscalls, no architectural churn.

Backport considerations
- Good targets: 5.11+ branches have exec_update_lock and will accept this pattern with minimal adaptation. Specifically:
- v6.6.y: Has exec_update_lock and cleanup.h’s scoped_guard; patch applies with trivial context adjustments (path is kernel/futex/syscalls.c).
- v6.1.y: Has exec_update_lock, but does not have scoped_guard.

    Replace the `scoped_guard(rcu)` with explicit `rcu_read_lock(); ...
    rcu_read_unlock();` and keep the
    `get_task_struct()`/`put_task_struct()` pattern. The file path is
    also kernel/futex/syscalls.c.

- v5.15.y: Has exec_update_lock (rwsem) but syscalls still live in kernel/futex.c. Apply the same logic in that file and drop scoped_guard usage in favor of explicit RCU locking.
- Older 5.10.y:
- exec_update_lock is not used in exec on this branch (exec uses cred_guard_mutex), and kernel/futex.c contains the syscalls. A faithful backport would either:
- Use cred_guard_mutex (e.g., mutex_lock_interruptible(&p->signal->cred_guard_mutex)) around ptrace_may_access() and pointer fetch to synchronize with exec (acceptable for stable despite “deprecated” comment), or
- Pull in the exec_update_lock infrastructure and convert exec to use it first (invasive, not recommended for stable).
- Thus, 5.10.y needs a targeted, equivalent fix using cred_guard_mutex to achieve the same serialization with exec.

Fit for stable policy
- Important bug/security fix with documented exploitation window; not a feature.
- Small, contained changes to futex syscalls only.
- Follows existing kernel patterns for exec-time synchronization.
- No architectural upheaval; low regression risk.

Conclusion
- Backport Status: YES. This should be backported to maintained stable trees, with small, branch‑appropriate adaptations:
- Use exec_update_lock where available.
- Replace scoped_guard(rcu) with explicit RCU lock/unlock on branches lacking cleanup.h.
- For 5.10.y, use cred_guard_mutex to serialize with exec in lieu of

    `exec_update_lock`.
 kernel/futex/syscalls.c | 106 +++++++++++++++++++++-------------------
 1 file changed, 56 insertions(+), 50 deletions(-)
kernel/futex/syscalls.c +56 -50
index 4b6da9116aa6c..880c9bf2f3150 100644
@@ -39,6 +39,56 @@ SYSCALL_DEFINE2(set_robust_list, struct robust_list_head __user *, head,
 	return 0;
 }
 
+static inline void __user *futex_task_robust_list(struct task_struct *p, bool compat)
+{
+#ifdef CONFIG_COMPAT
+	if (compat)
+		return p->compat_robust_list;
+#endif
+	return p->robust_list;
+}
+
+static void __user *futex_get_robust_list_common(int pid, bool compat)
+{
+	struct task_struct *p = current;
+	void __user *head;
+	int ret;
+
+	scoped_guard(rcu) {
+		if (pid) {
+			p = find_task_by_vpid(pid);
+			if (!p)
+				return (void __user *)ERR_PTR(-ESRCH);
+		}
+		get_task_struct(p);
+	}
+
+	/*
+	 * Hold exec_update_lock to serialize with concurrent exec()
+	 * so ptrace_may_access() is checked against stable credentials
+	 */
+	ret = down_read_killable(&p->signal->exec_update_lock);
+	if (ret)
+		goto err_put;
+
+	ret = -EPERM;
+	if (!ptrace_may_access(p, PTRACE_MODE_READ_REALCREDS))
+		goto err_unlock;
+
+	head = futex_task_robust_list(p, compat);
+
+	up_read(&p->signal->exec_update_lock);
+	put_task_struct(p);
+
+	return head;
+
+err_unlock:
+	up_read(&p->signal->exec_update_lock);
+err_put:
+	put_task_struct(p);
+	return (void __user *)ERR_PTR(ret);
+}
+
 /**
  * sys_get_robust_list() - Get the robust-futex list head of a task
  * @pid:	pid of the process [zero for current task]
@@ -49,36 +99,14 @@ SYSCALL_DEFINE3(get_robust_list, int, pid,
 		struct robust_list_head __user * __user *, head_ptr,
 		size_t __user *, len_ptr)
 {
-	struct robust_list_head __user *head;
-	unsigned long ret;
-	struct task_struct *p;
-
-	rcu_read_lock();
-
-	ret = -ESRCH;
-	if (!pid)
-		p = current;
-	else {
-		p = find_task_by_vpid(pid);
-		if (!p)
-			goto err_unlock;
-	}
-
-	ret = -EPERM;
-	if (!ptrace_may_access(p, PTRACE_MODE_READ_REALCREDS))
-		goto err_unlock;
+	struct robust_list_head __user *head = futex_get_robust_list_common(pid, false);
 
-	head = p->robust_list;
-	rcu_read_unlock();
+	if (IS_ERR(head))
+		return PTR_ERR(head);
 
 	if (put_user(sizeof(*head), len_ptr))
 		return -EFAULT;
 	return put_user(head, head_ptr);
-
-err_unlock:
-	rcu_read_unlock();
-
-	return ret;
 }
 
 long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
@@ -455,36 +483,14 @@ COMPAT_SYSCALL_DEFINE3(get_robust_list, int, pid,
 			compat_uptr_t __user *, head_ptr,
 			compat_size_t __user *, len_ptr)
 {
-	struct compat_robust_list_head __user *head;
-	unsigned long ret;
-	struct task_struct *p;
-
-	rcu_read_lock();
-
-	ret = -ESRCH;
-	if (!pid)
-		p = current;
-	else {
-		p = find_task_by_vpid(pid);
-		if (!p)
-			goto err_unlock;
-	}
-
-	ret = -EPERM;
-	if (!ptrace_may_access(p, PTRACE_MODE_READ_REALCREDS))
-		goto err_unlock;
+	struct compat_robust_list_head __user *head = futex_get_robust_list_common(pid, true);
 
-	head = p->compat_robust_list;
-	rcu_read_unlock();
+	if (IS_ERR(head))
+		return PTR_ERR(head);
 
 	if (put_user(sizeof(*head), len_ptr))
 		return -EFAULT;
 	return put_user(ptr_to_compat(head), head_ptr);
-
-err_unlock:
-	rcu_read_unlock();
-
-	return ret;
 }
 #endif /* CONFIG_COMPAT */
 
Signature · 1 line
2.51.0
author maintainer
#129 lore raw

PATCH 1/1 mfd: simple-mfd-i2c: Add compatible strings for Layerscape QIXIS FPGA

In reply to Sasha Levin

From: Ioana Ciornei <[email protected]>

[ Upstream commit 81a2c31257411296862487aaade98b7d9e25dc72 ]

The QIXIS FPGA found on Layerscape boards such as LX2160AQDS, LS1028AQDS etc deals with power-on-reset timing, muxing etc. Use the simple-mfd-i2c as its core driver by adding its compatible string (already found in some dt files). By using the simple-mfd-i2c driver, any child device will have access to the i2c regmap created by it.

---

LLM Generated explanations, may be completely bogus:

YES

- What changed
- Adds two OF match entries to simple_mfd_i2c_of_match[] so the simple-mfd-i2c driver binds to the QIXIS FPGA on Layerscape QDS boards:
- fsl,lx2160aqds-fpga
- fsl,ls1028aqds-fpga
- Location: drivers/mfd/simple-mfd-i2c.c:96

- Why this is a bugfix (not a feature)
- These compatibles already exist in mainline DTS and the binding schema, but there is no I2C driver matching them, so the node does not bind and its children aren’t instantiated.
- DTS examples:
- arch/arm64/boot/dts/freescale/fsl-lx2160a-qds.dts:263
- arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts:341
- Binding: Documentation/devicetree/bindings/board/fsl,fpga- qixis-i2c.yaml:21
- Without a bound parent driver, the child reg-mux node under the FPGA can’t get a regmap from its parent and won’t probe, leaving board muxing controls non-functional. This is a user-visible deficiency rather than new functionality.

- Code path and behavior after the change
- Probe obtains match data and falls back safely when .data is NULL:
- Default 8-bit register/8-bit value regmap is used when no custom config is provided: drivers/mfd/simple-mfd-i2c.c:41-45
- If no MFD cells are supplied via .data, it populates children from DT: drivers/mfd/simple-mfd-i2c.c:51-53
- The child reg-mux driver will successfully fetch the regmap from the parent if no MMIO/syscon region is present (fallback to dev_get_regmap(dev->parent, NULL)), enabling mux control:
- drivers/mux/mmio.c:20

- Scope and risk assessment
- Small, contained change: two ID table entries only; no logic changes; no ABI churn.
- Conservative matching: only board-specific compatibles are added; the generic fsl,fpga-qixis-i2c is not matched, avoiding unintended binding on other QIXIS variants (e.g., PowerPC boards).
- The default regmap path (8/8) aligns with how these DTs describe the QIXIS registers (e.g., mux-reg-masks = <0x54 ...> uses 8-bit offsets), so there is no width mismatch.
- Touches MFD over I2C only; no architectural or cross-subsystem impact; minimal regression risk.

- Stable policy fit
- Fixes a real, user-facing problem: existing DTs/bindings reference devices that currently don’t bind to any driver, leaving board- control functionality inoperative.
- Change is trivial, low risk, and does not introduce features or architectural alterations.
- No side effects beyond enabling the intended binding and population of DT-described child devices.

Given the above, this is a textbook stable backport candidate enabling existing DT descriptions to function by adding missing compatible strings in the driver’s match table.

 drivers/mfd/simple-mfd-i2c.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mfd/simple-mfd-i2c.c +2 -0
index 22159913bea03..f7798bd922224 100644
@@ -99,6 +99,8 @@ static const struct of_device_id simple_mfd_i2c_of_match[] = {
 	{ .compatible = "maxim,max5970", .data = &maxim_max5970},
 	{ .compatible = "maxim,max5978", .data = &maxim_max5970},
 	{ .compatible = "maxim,max77705-battery", .data = &maxim_mon_max77705},
+	{ .compatible = "fsl,lx2160aqds-fpga" },
+	{ .compatible = "fsl,ls1028aqds-fpga" },
 	{}
 };
 MODULE_DEVICE_TABLE(of, simple_mfd_i2c_of_match);
Signature · 1 line
2.51.0
author maintainer
#130 lore raw

PATCH 1/1 hwmon: (asus-ec-sensors) increase timeout for locking ACPI mutex

In reply to Sasha Levin

From: Ben Copeland <[email protected]>

[ Upstream commit 584d55be66ef151e6ef9ccb3dcbc0a2155559be1 ]

Some motherboards require more time to acquire the ACPI mutex, causing "Failed to acquire mutex" messages to appear in the kernel log. Increase the timeout from 500ms to 800ms to accommodate these cases.

---

LLM Generated explanations, may be completely bogus:

YES

- Minimal, targeted change: The patch only increases the wait timeout constant from 500 ms to 800 ms by changing #define ACPI_LOCK_DELAY_MS 500 to 800 in drivers/hwmon/asus-ec-sensors.c:52. There are no logic or structural changes elsewhere.

- Directly addresses observed user-visible failures: The driver warns and aborts reads when the ACPI lock can’t be acquired within the timeout (“Failed to acquire mutex”). That path is at drivers/hwmon/asus-ec-sensors.c:947, returning -EBUSY. Increasing the timeout reduces these spurious failures on boards where firmware holds the lock longer.

- Clear impact on lock acquisition sites: The constant feeds both ACPI locking paths which guard access to the EC:
- AML mutex: acpi_acquire_mutex(..., ACPI_LOCK_DELAY_MS) at

    `drivers/hwmon/asus-ec-sensors.c:679`
  - ACPI global lock: `acpi_acquire_global_lock(ACPI_LOCK_DELAY_MS,
    ...)` at `drivers/hwmon/asus-ec-sensors.c:691`

The change thus uniformly relaxes the wait across both lock mechanisms
used by this driver.

- Low regression risk:
- Scope: confined to asus-ec-sensors driver; no ABI/API or cross- subsystem changes.
- Behavior: Only increases the maximum wait under lock contention by 300 ms. The driver already rate-limits updates to once per second (state->last_updated + HZ, drivers/hwmon/asus-ec-sensors.c:978), so the longer wait still fits typical update cadence and avoids frequent -EBUSY.
- Precedent: Other subsystems use even longer or infinite waits for ACPI global lock (e.g., ACPI_WAIT_FOREVER in other drivers), so an 800 ms bound is conservative.

- Stable tree suitability:
- Fixes an actual operational problem for users (spurious lock acquisition failures leading to missing/erratic sensor readings and kernel log noise).
- Change is small, contained, and non-architectural.
- Touches a non-critical subsystem (hwmon), further reducing risk.
- Signed by the HWMON maintainer, with a mailing list link indicating review path.

- Side effects and risk assessment:
- Slightly longer blocking in the hwmon read path under ACPI lock contention. Given hwmon’s non-real-time nature and the once-per- second refresh, this is acceptable and far outweighed by the reduction in failed reads.
- No functional behavior change when the lock is uncontended; no changes to EC access semantics aside from the timeout.

Given the above, this is an appropriate, low-risk bug-mitigation change that improves reliability on affected ASUS systems and should be backported to stable trees that include this driver.

 drivers/hwmon/asus-ec-sensors.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/asus-ec-sensors.c +1 -1
index 4ac554731e98a..a08862644e951 100644
@@ -49,7 +49,7 @@ static char *mutex_path_override;
  */
 #define ASUS_EC_MAX_BANK	3
 
-#define ACPI_LOCK_DELAY_MS	500
+#define ACPI_LOCK_DELAY_MS	800
 
 /* ACPI mutex for locking access to the EC for the firmware */
 #define ASUS_HW_ACCESS_MUTEX_ASMX	"\\AMW0.ASMX"
Signature · 1 line
2.51.0