cmos_interrupt() can be called in a non-interrupt context, such as in
an ACPI event handler (which runs in an interrupt thread). Therefore,
usage of spin_lock(&rtc_lock) is insecure. Use spin_lock_irqsave() /
spin_unlock_irqrestore() instead.
Before a misguided
commit 6950d046eb6e ("rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ")
the cmos_interrupt() function used spin_lock_irqsave(). That commit
changed it to spin_lock() and broke locking, which was partially fixed in
commit 13be2efc390a ("rtc: cmos: Disable irq around direct invocation of cmos_interrupt()")
That second commit did not take account of the ACPI fixed event handler
pathway, however. It introduced local_irq_disable() workarounds in
cmos_check_wkalrm(), which can cause problems on PREEMPT_RT kernels
and are now unnecessary.
Add an explicit comment so that this change will not be reverted by
mistake.
Cc: <stable(a)vger.kernel.org>
Fixes: 6950d046eb6e ("rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ")
Signed-off-by: Mateusz Jończyk <mat.jonczyk(a)o2.pl>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy(a)linutronix.de>
Tested-by: Chris Bainbridge <chris.bainbridge(a)gmail.com>
Reported-by: Chris Bainbridge <chris.bainbridge(a)gmail.com>
Closes: https://lore.kernel.org/all/aDtJ92foPUYmGheF@debian.local/
---
Changes after DRAFT version of the patch:
- rewrite commit message,
- test this locally (also on top of 5.10.238 for the stable backport),
- fix a grammar mistake in the comment.
---
drivers/rtc/rtc-cmos.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 8172869bd3d7..0743c6acd6e2 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -692,8 +692,12 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
{
u8 irqstat;
u8 rtc_control;
+ unsigned long flags;
- spin_lock(&rtc_lock);
+ /* We cannot use spin_lock() here, as cmos_interrupt() is also called
+ * in a non-irq context.
+ */
+ spin_lock_irqsave(&rtc_lock, flags);
/* When the HPET interrupt handler calls us, the interrupt
* status is passed as arg1 instead of the irq number. But
@@ -727,7 +731,7 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
hpet_mask_rtc_irq_bit(RTC_AIE);
CMOS_READ(RTC_INTR_FLAGS);
}
- spin_unlock(&rtc_lock);
+ spin_unlock_irqrestore(&rtc_lock, flags);
if (is_intr(irqstat)) {
rtc_update_irq(p, 1, irqstat);
@@ -1295,9 +1299,7 @@ static void cmos_check_wkalrm(struct device *dev)
* ACK the rtc irq here
*/
if (t_now >= cmos->alarm_expires && cmos_use_acpi_alarm()) {
- local_irq_disable();
cmos_interrupt(0, (void *)cmos->rtc);
- local_irq_enable();
return;
}
--
2.25.1
This is the start of the stable review cycle for the 6.14.11 release.
There are 24 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Mon, 09 Jun 2025 10:07:05 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.14.11-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 6.14.11-rc1
Aurabindo Pillai <aurabindo.pillai(a)amd.com>
Revert "drm/amd/display: more liberal vmin/vmax update for freesync"
Xu Yang <xu.yang_2(a)nxp.com>
dt-bindings: phy: imx8mq-usb: fix fsl,phy-tx-vboost-level-microvolt property
Lukasz Czechowski <lukasz.czechowski(a)thaumatec.com>
dt-bindings: usb: cypress,hx3: Add support for all variants
David Lechner <dlechner(a)baylibre.com>
dt-bindings: pwm: adi,axi-pwmgen: Fix clocks
Sergey Senozhatsky <senozhatsky(a)chromium.org>
thunderbolt: Do not double dequeue a configuration request
Carlos Llamas <cmllamas(a)google.com>
binder: fix yet another UAF in binder_devices
Dmitry Antipov <dmantipov(a)yandex.ru>
binder: fix use-after-free in binderfs_evict_inode()
Dave Penkler <dpenkler(a)gmail.com>
usb: usbtmc: Fix timeout value in get_stb
Arnd Bergmann <arnd(a)arndb.de>
nvmem: rmem: select CONFIG_CRC32
Dustin Lundquist <dustin(a)null-ptr.net>
serial: jsm: fix NPE during jsm_uart_port_init
Bartosz Golaszewski <bartosz.golaszewski(a)linaro.org>
Bluetooth: hci_qca: move the SoC type check to the right place
Qasim Ijaz <qasdev00(a)gmail.com>
usb: typec: ucsi: fix Clang -Wsign-conversion warning
Charles Yeh <charlesyeh522(a)gmail.com>
USB: serial: pl2303: add new chip PL2303GC-Q20 and PL2303GT-2AB
Hongyu Xie <xiehongyu1(a)kylinos.cn>
usb: storage: Ignore UAS driver for SanDisk 3.2 Gen2 storage device
Jiayi Li <lijiayi(a)kylinos.cn>
usb: quirks: Add NO_LPM quirk for SanDisk Extreme 55AE
Mike Marshall <hubcap(a)omnibond.com>
orangefs: adjust counting code to recover from 665575cf
Alexandre Mergnat <amergnat(a)baylibre.com>
rtc: Fix offset calculation for .start_secs < 0
Alexandre Mergnat <amergnat(a)baylibre.com>
rtc: Make rtc_time64_to_tm() support dates before 1970
Sakari Ailus <sakari.ailus(a)linux.intel.com>
Documentation: ACPI: Use all-string data node references
Gautham R. Shenoy <gautham.shenoy(a)amd.com>
acpi-cpufreq: Fix nominal_freq units to KHz in get_max_boost_ratio()
Pritam Manohar Sutar <pritam.sutar(a)samsung.com>
clk: samsung: correct clock summary for hsi1 block
Gabor Juhos <j4g8y7(a)gmail.com>
pinctrl: armada-37xx: set GPIO output value before setting direction
Gabor Juhos <j4g8y7(a)gmail.com>
pinctrl: armada-37xx: use correct OUTPUT_VAL register for GPIOs > 31
Pan Taixi <pantaixi(a)huaweicloud.com>
tracing: Fix compilation warning on arm32
-------------
Diffstat:
.../bindings/phy/fsl,imx8mq-usb-phy.yaml | 3 +--
.../devicetree/bindings/pwm/adi,axi-pwmgen.yaml | 13 +++++++++--
.../devicetree/bindings/usb/cypress,hx3.yaml | 19 +++++++++++++---
.../acpi/dsd/data-node-references.rst | 26 ++++++++++------------
Documentation/firmware-guide/acpi/dsd/graph.rst | 11 ++++-----
Documentation/firmware-guide/acpi/dsd/leds.rst | 7 +-----
Makefile | 4 ++--
drivers/android/binder.c | 16 +++++++++++--
drivers/android/binder_internal.h | 8 +++++--
drivers/android/binderfs.c | 2 +-
drivers/bluetooth/hci_qca.c | 14 ++++++------
drivers/clk/samsung/clk-exynosautov920.c | 2 +-
drivers/cpufreq/acpi-cpufreq.c | 2 +-
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 16 +++++--------
drivers/nvmem/Kconfig | 1 +
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 14 +++++++-----
drivers/rtc/class.c | 2 +-
drivers/rtc/lib.c | 24 +++++++++++++++-----
drivers/thunderbolt/ctl.c | 5 +++++
drivers/tty/serial/jsm/jsm_tty.c | 1 +
drivers/usb/class/usbtmc.c | 4 +++-
drivers/usb/core/quirks.c | 3 +++
drivers/usb/serial/pl2303.c | 2 ++
drivers/usb/storage/unusual_uas.h | 7 ++++++
drivers/usb/typec/ucsi/ucsi.h | 2 +-
fs/orangefs/inode.c | 9 ++++----
kernel/trace/trace.c | 2 +-
27 files changed, 139 insertions(+), 80 deletions(-)
fxls8962af_fifo_flush() uses indio_dev->active_scan_mask (with
iio_for_each_active_channel()) without making sure the indio_dev
stays in buffer mode.
There is a race if indio_dev exits buffer mode in the middle of the
interrupt that flushes the fifo. Fix this by calling
synchronize_irq() to ensure that no interrupt is currently running when
disabling buffer mode.
Unable to handle kernel NULL pointer dereference at virtual address 00000000 when read
[...]
_find_first_bit_le from fxls8962af_fifo_flush+0x17c/0x290
fxls8962af_fifo_flush from fxls8962af_interrupt+0x80/0x178
fxls8962af_interrupt from irq_thread_fn+0x1c/0x7c
irq_thread_fn from irq_thread+0x110/0x1f4
irq_thread from kthread+0xe0/0xfc
kthread from ret_from_fork+0x14/0x2c
Fixes: 79e3a5bdd9ef ("iio: accel: fxls8962af: add hw buffered sampling")
Cc: stable(a)vger.kernel.org
Suggested-by: David Lechner <dlechner(a)baylibre.com>
Signed-off-by: Sean Nyekjaer <sean(a)geanix.com>
---
Changes in v2:
- As per David's suggestion; switched to use synchronize_irq() instead.
- Link to v1: https://lore.kernel.org/r/20250524-fxlsrace-v1-1-dec506dc87ae@geanix.com
---
drivers/iio/accel/fxls8962af-core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c
index 6d23da3e7aa22c61f2d9348bb91d70cc5719a732..f2558fba491dffa78b26d47d2cd9f1f4d9811f54 100644
--- a/drivers/iio/accel/fxls8962af-core.c
+++ b/drivers/iio/accel/fxls8962af-core.c
@@ -866,6 +866,8 @@ static int fxls8962af_buffer_predisable(struct iio_dev *indio_dev)
if (ret)
return ret;
+ synchronize_irq(data->irq);
+
ret = __fxls8962af_fifo_set_mode(data, false);
if (data->enable_event)
---
base-commit: 5c3fcb36c92443a9a037683626a2e43d8825f783
change-id: 20250524-fxlsrace-f4d20e29fb29
Best regards,
--
Sean Nyekjaer <sean(a)geanix.com>
This is the start of the stable review cycle for the 6.12.33 release.
There are 24 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Mon, 09 Jun 2025 10:07:05 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.33-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 6.12.33-rc1
Aurabindo Pillai <aurabindo.pillai(a)amd.com>
Revert "drm/amd/display: more liberal vmin/vmax update for freesync"
Xu Yang <xu.yang_2(a)nxp.com>
dt-bindings: phy: imx8mq-usb: fix fsl,phy-tx-vboost-level-microvolt property
Lukasz Czechowski <lukasz.czechowski(a)thaumatec.com>
dt-bindings: usb: cypress,hx3: Add support for all variants
Sergey Senozhatsky <senozhatsky(a)chromium.org>
thunderbolt: Do not double dequeue a configuration request
Dave Penkler <dpenkler(a)gmail.com>
usb: usbtmc: Fix timeout value in get_stb
Dustin Lundquist <dustin(a)null-ptr.net>
serial: jsm: fix NPE during jsm_uart_port_init
Bartosz Golaszewski <bartosz.golaszewski(a)linaro.org>
Bluetooth: hci_qca: move the SoC type check to the right place
Qasim Ijaz <qasdev00(a)gmail.com>
usb: typec: ucsi: fix Clang -Wsign-conversion warning
Charles Yeh <charlesyeh522(a)gmail.com>
USB: serial: pl2303: add new chip PL2303GC-Q20 and PL2303GT-2AB
Hongyu Xie <xiehongyu1(a)kylinos.cn>
usb: storage: Ignore UAS driver for SanDisk 3.2 Gen2 storage device
Jiayi Li <lijiayi(a)kylinos.cn>
usb: quirks: Add NO_LPM quirk for SanDisk Extreme 55AE
Jon Hunter <jonathanh(a)nvidia.com>
Revert "cpufreq: tegra186: Share policy per cluster"
Ming Lei <ming.lei(a)redhat.com>
block: fix adding folio to bio
Ajay Agarwal <ajayagarwal(a)google.com>
PCI/ASPM: Disable L1 before disabling L1 PM Substates
Karol Wachowski <karol.wachowski(a)intel.com>
accel/ivpu: Update power island delays
Maciej Falkowski <maciej.falkowski(a)linux.intel.com>
accel/ivpu: Add initial Panther Lake support
Alexandre Mergnat <amergnat(a)baylibre.com>
rtc: Fix offset calculation for .start_secs < 0
Alexandre Mergnat <amergnat(a)baylibre.com>
rtc: Make rtc_time64_to_tm() support dates before 1970
Sakari Ailus <sakari.ailus(a)linux.intel.com>
Documentation: ACPI: Use all-string data node references
Gautham R. Shenoy <gautham.shenoy(a)amd.com>
acpi-cpufreq: Fix nominal_freq units to KHz in get_max_boost_ratio()
Gabor Juhos <j4g8y7(a)gmail.com>
pinctrl: armada-37xx: set GPIO output value before setting direction
Gabor Juhos <j4g8y7(a)gmail.com>
pinctrl: armada-37xx: use correct OUTPUT_VAL register for GPIOs > 31
Chao Yu <chao(a)kernel.org>
f2fs: fix to avoid accessing uninitialized curseg
Pan Taixi <pantaixi(a)huaweicloud.com>
tracing: Fix compilation warning on arm32
-------------
Diffstat:
.../bindings/phy/fsl,imx8mq-usb-phy.yaml | 3 +-
.../devicetree/bindings/usb/cypress,hx3.yaml | 19 ++++-
.../acpi/dsd/data-node-references.rst | 26 +++---
Documentation/firmware-guide/acpi/dsd/graph.rst | 11 +--
Documentation/firmware-guide/acpi/dsd/leds.rst | 7 +-
Makefile | 4 +-
block/bio.c | 11 ++-
drivers/accel/ivpu/ivpu_drv.c | 1 +
drivers/accel/ivpu/ivpu_drv.h | 10 ++-
drivers/accel/ivpu/ivpu_fw.c | 3 +
drivers/accel/ivpu/ivpu_hw_40xx_reg.h | 2 +
drivers/accel/ivpu/ivpu_hw_ip.c | 49 +++++++----
drivers/bluetooth/hci_qca.c | 14 ++--
drivers/cpufreq/acpi-cpufreq.c | 2 +-
drivers/cpufreq/tegra186-cpufreq.c | 7 --
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 16 ++--
drivers/pci/pcie/aspm.c | 94 ++++++++++++----------
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 14 ++--
drivers/rtc/class.c | 2 +-
drivers/rtc/lib.c | 24 ++++--
drivers/thunderbolt/ctl.c | 5 ++
drivers/tty/serial/jsm/jsm_tty.c | 1 +
drivers/usb/class/usbtmc.c | 4 +-
drivers/usb/core/quirks.c | 3 +
drivers/usb/serial/pl2303.c | 2 +
drivers/usb/storage/unusual_uas.h | 7 ++
drivers/usb/typec/ucsi/ucsi.h | 2 +-
fs/f2fs/inode.c | 7 ++
fs/f2fs/segment.h | 9 ++-
kernel/trace/trace.c | 2 +-
30 files changed, 218 insertions(+), 143 deletions(-)
From: Pu Lehui <pulehui(a)huawei.com>
The backport mainly refers to the merge tag [0], and the corresponding patches are:
arm64: proton-pack: Add new CPUs 'k' values for branch mitigation
arm64: bpf: Only mitigate cBPF programs loaded by unprivileged users
arm64: bpf: Add BHB mitigation to the epilogue for cBPF programs
arm64: proton-pack: Expose whether the branchy loop k value
arm64: proton-pack: Expose whether the platform is mitigated by firmware
arm64: insn: Add support for encoding DSB
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?… [0]
Hou Tao (2):
arm64: move AARCH64_BREAK_FAULT into insn-def.h
arm64: insn: add encoders for atomic operations
James Morse (6):
arm64: insn: Add support for encoding DSB
arm64: proton-pack: Expose whether the platform is mitigated by
firmware
arm64: proton-pack: Expose whether the branchy loop k value
arm64: bpf: Add BHB mitigation to the epilogue for cBPF programs
arm64: bpf: Only mitigate cBPF programs loaded by unprivileged users
arm64: proton-pack: Add new CPUs 'k' values for branch mitigation
Liu Song (1):
arm64: spectre: increase parameters that can be used to turn off bhb
mitigation individually
.../admin-guide/kernel-parameters.txt | 5 +
arch/arm64/include/asm/cputype.h | 2 +
arch/arm64/include/asm/debug-monitors.h | 12 --
arch/arm64/include/asm/insn-def.h | 14 ++
arch/arm64/include/asm/insn.h | 81 ++++++-
arch/arm64/include/asm/spectre.h | 3 +
arch/arm64/kernel/proton-pack.c | 21 +-
arch/arm64/lib/insn.c | 199 ++++++++++++++++--
arch/arm64/net/bpf_jit.h | 11 +-
arch/arm64/net/bpf_jit_comp.c | 58 ++++-
10 files changed, 366 insertions(+), 40 deletions(-)
--
2.34.1
From: Pu Lehui <pulehui(a)huawei.com>
The backport mainly refers to the merge tag [0], and the corresponding patches are:
arm64: proton-pack: Add new CPUs 'k' values for branch mitigation
arm64: bpf: Only mitigate cBPF programs loaded by unprivileged users
arm64: bpf: Add BHB mitigation to the epilogue for cBPF programs
arm64: proton-pack: Expose whether the branchy loop k value
arm64: proton-pack: Expose whether the platform is mitigated by firmware
arm64: insn: Add support for encoding DSB
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?… [0]
Douglas Anderson (3):
arm64: errata: Assume that unknown CPUs _are_ vulnerable to Spectre
BHB
arm64: errata: Add KRYO 2XX/3XX/4XX silver cores to Spectre BHB safe
list
arm64: errata: Add newer ARM cores to the spectre_bhb_loop_affected()
lists
Hou Tao (2):
arm64: move AARCH64_BREAK_FAULT into insn-def.h
arm64: insn: add encoders for atomic operations
James Morse (6):
arm64: insn: Add support for encoding DSB
arm64: proton-pack: Expose whether the platform is mitigated by
firmware
arm64: proton-pack: Expose whether the branchy loop k value
arm64: bpf: Add BHB mitigation to the epilogue for cBPF programs
arm64: bpf: Only mitigate cBPF programs loaded by unprivileged users
arm64: proton-pack: Add new CPUs 'k' values for branch mitigation
Julien Thierry (1):
arm64: insn: Add barrier encodings
Liu Song (1):
arm64: spectre: increase parameters that can be used to turn off bhb
mitigation individually
Will Deacon (1):
arm64: errata: Add missing sentinels to Spectre-BHB MIDR arrays
.../admin-guide/kernel-parameters.txt | 5 +
arch/arm64/include/asm/cputype.h | 2 +
arch/arm64/include/asm/debug-monitors.h | 12 -
arch/arm64/include/asm/insn.h | 114 +++++++++-
arch/arm64/include/asm/spectre.h | 4 +-
arch/arm64/kernel/insn.c | 199 +++++++++++++++--
arch/arm64/kernel/proton-pack.c | 206 +++++++++++-------
arch/arm64/net/bpf_jit.h | 11 +-
arch/arm64/net/bpf_jit_comp.c | 58 ++++-
9 files changed, 488 insertions(+), 123 deletions(-)
--
2.34.1
From: Ajay Agarwal <ajayagarwal(a)google.com>
[ Upstream commit 7447990137bf06b2aeecad9c6081e01a9f47f2aa ]
PCIe r6.2, sec 5.5.4, requires that:
If setting either or both of the enable bits for ASPM L1 PM Substates,
both ports must be configured as described in this section while ASPM L1
is disabled.
Previously, pcie_config_aspm_l1ss() assumed that "setting enable bits"
meant "setting them to 1", and it configured L1SS as follows:
- Clear L1SS enable bits
- Disable L1
- Configure L1SS enable bits as required
- Enable L1 if required
With this sequence, when disabling L1SS on an ARM A-core with a Synopsys
DesignWare PCIe core, the CPU occasionally hangs when reading
PCI_L1SS_CTL1, leading to a reboot when the CPU watchdog expires.
Move the L1 disable to the caller (pcie_config_aspm_link(), where L1 was
already enabled) so L1 is always disabled while updating the L1SS bits:
- Disable L1
- Clear L1SS enable bits
- Configure L1SS enable bits as required
- Enable L1 if required
Change pcie_aspm_cap_init() similarly.
Link: https://lore.kernel.org/r/20241007032917.872262-1-ajayagarwal@google.com
Signed-off-by: Ajay Agarwal <ajayagarwal(a)google.com>
[bhelgaas: comments, commit log, compute L1SS setting before config access]
Signed-off-by: Bjorn Helgaas <bhelgaas(a)google.com>
Tested-by: Johnny-CC Chang <Johnny-CC.Chang(a)mediatek.com>
Signed-off-by: Macpaul Lin <macpaul.lin(a)mediatek.com>
---
drivers/pci/pcie/aspm.c | 92 ++++++++++++++++++++++-------------------
1 file changed, 50 insertions(+), 42 deletions(-)
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index cee2365e54b8..e943691bc931 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -805,6 +805,15 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &parent_lnkctl);
pcie_capability_read_word(child, PCI_EXP_LNKCTL, &child_lnkctl);
+ /* Disable L0s/L1 before updating L1SS config */
+ if (FIELD_GET(PCI_EXP_LNKCTL_ASPMC, child_lnkctl) ||
+ FIELD_GET(PCI_EXP_LNKCTL_ASPMC, parent_lnkctl)) {
+ pcie_capability_write_word(child, PCI_EXP_LNKCTL,
+ child_lnkctl & ~PCI_EXP_LNKCTL_ASPMC);
+ pcie_capability_write_word(parent, PCI_EXP_LNKCTL,
+ parent_lnkctl & ~PCI_EXP_LNKCTL_ASPMC);
+ }
+
/*
* Setup L0s state
*
@@ -829,6 +838,13 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
aspm_l1ss_init(link);
+ /* Restore L0s/L1 if they were enabled */
+ if (FIELD_GET(PCI_EXP_LNKCTL_ASPMC, child_lnkctl) ||
+ FIELD_GET(PCI_EXP_LNKCTL_ASPMC, parent_lnkctl)) {
+ pcie_capability_write_word(parent, PCI_EXP_LNKCTL, parent_lnkctl);
+ pcie_capability_write_word(child, PCI_EXP_LNKCTL, child_lnkctl);
+ }
+
/* Save default state */
link->aspm_default = link->aspm_enabled;
@@ -845,25 +861,28 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
}
}
-/* Configure the ASPM L1 substates */
+/* Configure the ASPM L1 substates. Caller must disable L1 first. */
static void pcie_config_aspm_l1ss(struct pcie_link_state *link, u32 state)
{
- u32 val, enable_req;
+ u32 val;
struct pci_dev *child = link->downstream, *parent = link->pdev;
- enable_req = (link->aspm_enabled ^ state) & state;
+ val = 0;
+ if (state & PCIE_LINK_STATE_L1_1)
+ val |= PCI_L1SS_CTL1_ASPM_L1_1;
+ if (state & PCIE_LINK_STATE_L1_2)
+ val |= PCI_L1SS_CTL1_ASPM_L1_2;
+ if (state & PCIE_LINK_STATE_L1_1_PCIPM)
+ val |= PCI_L1SS_CTL1_PCIPM_L1_1;
+ if (state & PCIE_LINK_STATE_L1_2_PCIPM)
+ val |= PCI_L1SS_CTL1_PCIPM_L1_2;
/*
- * Here are the rules specified in the PCIe spec for enabling L1SS:
- * - When enabling L1.x, enable bit at parent first, then at child
- * - When disabling L1.x, disable bit at child first, then at parent
- * - When enabling ASPM L1.x, need to disable L1
- * (at child followed by parent).
- * - The ASPM/PCIPM L1.2 must be disabled while programming timing
+ * PCIe r6.2, sec 5.5.4, rules for enabling L1 PM Substates:
+ * - Clear L1.x enable bits at child first, then at parent
+ * - Set L1.x enable bits at parent first, then at child
+ * - ASPM/PCIPM L1.2 must be disabled while programming timing
* parameters
- *
- * To keep it simple, disable all L1SS bits first, and later enable
- * what is needed.
*/
/* Disable all L1 substates */
@@ -871,26 +890,6 @@ static void pcie_config_aspm_l1ss(struct pcie_link_state *link, u32 state)
PCI_L1SS_CTL1_L1SS_MASK, 0);
pci_clear_and_set_config_dword(parent, parent->l1ss + PCI_L1SS_CTL1,
PCI_L1SS_CTL1_L1SS_MASK, 0);
- /*
- * If needed, disable L1, and it gets enabled later
- * in pcie_config_aspm_link().
- */
- if (enable_req & (PCIE_LINK_STATE_L1_1 | PCIE_LINK_STATE_L1_2)) {
- pcie_capability_clear_word(child, PCI_EXP_LNKCTL,
- PCI_EXP_LNKCTL_ASPM_L1);
- pcie_capability_clear_word(parent, PCI_EXP_LNKCTL,
- PCI_EXP_LNKCTL_ASPM_L1);
- }
-
- val = 0;
- if (state & PCIE_LINK_STATE_L1_1)
- val |= PCI_L1SS_CTL1_ASPM_L1_1;
- if (state & PCIE_LINK_STATE_L1_2)
- val |= PCI_L1SS_CTL1_ASPM_L1_2;
- if (state & PCIE_LINK_STATE_L1_1_PCIPM)
- val |= PCI_L1SS_CTL1_PCIPM_L1_1;
- if (state & PCIE_LINK_STATE_L1_2_PCIPM)
- val |= PCI_L1SS_CTL1_PCIPM_L1_2;
/* Enable what we need to enable */
pci_clear_and_set_config_dword(parent, parent->l1ss + PCI_L1SS_CTL1,
@@ -937,21 +936,30 @@ static void pcie_config_aspm_link(struct pcie_link_state *link, u32 state)
dwstream |= PCI_EXP_LNKCTL_ASPM_L1;
}
+ /*
+ * Per PCIe r6.2, sec 5.5.4, setting either or both of the enable
+ * bits for ASPM L1 PM Substates must be done while ASPM L1 is
+ * disabled. Disable L1 here and apply new configuration after L1SS
+ * configuration has been completed.
+ *
+ * Per sec 7.5.3.7, when disabling ASPM L1, software must disable
+ * it in the Downstream component prior to disabling it in the
+ * Upstream component, and ASPM L1 must be enabled in the Upstream
+ * component prior to enabling it in the Downstream component.
+ *
+ * Sec 7.5.3.7 also recommends programming the same ASPM Control
+ * value for all functions of a multi-function device.
+ */
+ list_for_each_entry(child, &linkbus->devices, bus_list)
+ pcie_config_aspm_dev(child, 0);
+ pcie_config_aspm_dev(parent, 0);
+
if (link->aspm_capable & PCIE_LINK_STATE_L1SS)
pcie_config_aspm_l1ss(link, state);
- /*
- * Spec 2.0 suggests all functions should be configured the
- * same setting for ASPM. Enabling ASPM L1 should be done in
- * upstream component first and then downstream, and vice
- * versa for disabling ASPM L1. Spec doesn't mention L0S.
- */
- if (state & PCIE_LINK_STATE_L1)
- pcie_config_aspm_dev(parent, upstream);
+ pcie_config_aspm_dev(parent, upstream);
list_for_each_entry(child, &linkbus->devices, bus_list)
pcie_config_aspm_dev(child, dwstream);
- if (!(state & PCIE_LINK_STATE_L1))
- pcie_config_aspm_dev(parent, upstream);
link->aspm_enabled = state;
--
2.45.2
The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x e683131e64f71e957ca77743cb3d313646157329
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable(a)vger.kernel.org>' --in-reply-to '2025060734-elated-juvenile-da5c@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e683131e64f71e957ca77743cb3d313646157329 Mon Sep 17 00:00:00 2001
From: David Lechner <dlechner(a)baylibre.com>
Date: Thu, 29 May 2025 11:53:19 -0500
Subject: [PATCH] dt-bindings: pwm: adi,axi-pwmgen: Fix clocks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fix a shortcoming in the bindings that doesn't allow for a separate
external clock.
The AXI PWMGEN IP block has a compile option ASYNC_CLK_EN that allows
the use of an external clock for the PWM output separate from the AXI
clock that runs the peripheral.
This was missed in the original bindings and so users were writing dts
files where the one and only clock specified would be the external
clock, if there was one, incorrectly missing the separate AXI clock.
The correct bindings are that the AXI clock is always required and the
external clock is optional (must be given only when HDL compile option
ASYNC_CLK_EN=1).
Fixes: 1edf2c2a2841 ("dt-bindings: pwm: Add AXI PWM generator")
Cc: stable(a)vger.kernel.org
Signed-off-by: David Lechner <dlechner(a)baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)linaro.org>
Link: https://lore.kernel.org/r/20250529-pwm-axi-pwmgen-add-external-clock-v3-2-5…
Signed-off-by: Uwe Kleine-König <ukleinek(a)kernel.org>
diff --git a/Documentation/devicetree/bindings/pwm/adi,axi-pwmgen.yaml b/Documentation/devicetree/bindings/pwm/adi,axi-pwmgen.yaml
index 45e112d0efb4..5575c58357d6 100644
--- a/Documentation/devicetree/bindings/pwm/adi,axi-pwmgen.yaml
+++ b/Documentation/devicetree/bindings/pwm/adi,axi-pwmgen.yaml
@@ -30,11 +30,19 @@ properties:
const: 3
clocks:
- maxItems: 1
+ minItems: 1
+ maxItems: 2
+
+ clock-names:
+ minItems: 1
+ items:
+ - const: axi
+ - const: ext
required:
- reg
- clocks
+ - clock-names
unevaluatedProperties: false
@@ -43,6 +51,7 @@ examples:
pwm@44b00000 {
compatible = "adi,axi-pwmgen-2.00.a";
reg = <0x44b00000 0x1000>;
- clocks = <&spi_clk>;
+ clocks = <&fpga_clk>, <&spi_clk>;
+ clock-names = "axi", "ext";
#pwm-cells = <3>;
};