From: Sasha Levin Date: Sun, 7 Sep 2025 17:48:11 +0000 (-0400) Subject: Fixes for all trees X-Git-Tag: v5.4.299~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dd0c5c969e183af136579bfc56029cce2027cdf2;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for all trees Signed-off-by: Sasha Levin --- diff --git a/queue-5.10/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch b/queue-5.10/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch new file mode 100644 index 0000000000..c9c7d5c647 --- /dev/null +++ b/queue-5.10/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch @@ -0,0 +1,44 @@ +From 82c46d06e176d870eaeaa93fac11ad23dcc6cded Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Jun 2025 17:00:17 +0800 +Subject: dmaengine: mediatek: Fix a flag reuse error in mtk_cqdma_tx_status() + +From: Qiu-ji Chen + +[ Upstream commit 8eba2187391e5ab49940cd02d6bd45a5617f4daf ] + +Fixed a flag reuse bug in the mtk_cqdma_tx_status() function. + +Fixes: 157ae5ffd76a ("dmaengine: mediatek: Fix a possible deadlock error in mtk_cqdma_tx_status()") +Cc: stable@vger.kernel.org +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202505270641.MStzJUfU-lkp@intel.com/ +Signed-off-by: Qiu-ji Chen +Reviewed-by: Eugen Hristev +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20250606090017.5436-1-chenqiuji666@gmail.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/mediatek/mtk-cqdma.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/dma/mediatek/mtk-cqdma.c b/drivers/dma/mediatek/mtk-cqdma.c +index 39e902b279e64..60d1d56b98317 100644 +--- a/drivers/dma/mediatek/mtk-cqdma.c ++++ b/drivers/dma/mediatek/mtk-cqdma.c +@@ -450,9 +450,9 @@ static enum dma_status mtk_cqdma_tx_status(struct dma_chan *c, + return ret; + + spin_lock_irqsave(&cvc->pc->lock, flags); +- spin_lock_irqsave(&cvc->vc.lock, flags); ++ spin_lock(&cvc->vc.lock); + vd = mtk_cqdma_find_active_desc(c, cookie); +- spin_unlock_irqrestore(&cvc->vc.lock, flags); ++ spin_unlock(&cvc->vc.lock); + spin_unlock_irqrestore(&cvc->pc->lock, flags); + + if (vd) { +-- +2.51.0 + diff --git a/queue-5.10/series b/queue-5.10/series index 24db48e4c3..d3f18dc229 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -49,3 +49,4 @@ spi-spi-fsl-lpspi-set-correct-chip-select-polarity-b.patch spi-spi-fsl-lpspi-reset-fifo-and-disable-module-on-t.patch clk-qcom-gdsc-set-retain_ff-before-moving-to-hw-ctrl.patch cifs-fix-integer-overflow-in-match_server.patch +dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch diff --git a/queue-5.15/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch b/queue-5.15/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch new file mode 100644 index 0000000000..04b8215355 --- /dev/null +++ b/queue-5.15/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch @@ -0,0 +1,44 @@ +From daf1cda1015bb64888fbf83be137947012d1237a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Jun 2025 17:00:17 +0800 +Subject: dmaengine: mediatek: Fix a flag reuse error in mtk_cqdma_tx_status() + +From: Qiu-ji Chen + +[ Upstream commit 8eba2187391e5ab49940cd02d6bd45a5617f4daf ] + +Fixed a flag reuse bug in the mtk_cqdma_tx_status() function. + +Fixes: 157ae5ffd76a ("dmaengine: mediatek: Fix a possible deadlock error in mtk_cqdma_tx_status()") +Cc: stable@vger.kernel.org +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202505270641.MStzJUfU-lkp@intel.com/ +Signed-off-by: Qiu-ji Chen +Reviewed-by: Eugen Hristev +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20250606090017.5436-1-chenqiuji666@gmail.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/mediatek/mtk-cqdma.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/dma/mediatek/mtk-cqdma.c b/drivers/dma/mediatek/mtk-cqdma.c +index 39e902b279e64..60d1d56b98317 100644 +--- a/drivers/dma/mediatek/mtk-cqdma.c ++++ b/drivers/dma/mediatek/mtk-cqdma.c +@@ -450,9 +450,9 @@ static enum dma_status mtk_cqdma_tx_status(struct dma_chan *c, + return ret; + + spin_lock_irqsave(&cvc->pc->lock, flags); +- spin_lock_irqsave(&cvc->vc.lock, flags); ++ spin_lock(&cvc->vc.lock); + vd = mtk_cqdma_find_active_desc(c, cookie); +- spin_unlock_irqrestore(&cvc->vc.lock, flags); ++ spin_unlock(&cvc->vc.lock); + spin_unlock_irqrestore(&cvc->pc->lock, flags); + + if (vd) { +-- +2.51.0 + diff --git a/queue-5.15/series b/queue-5.15/series index e4d504168e..a47994fb3b 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -60,3 +60,5 @@ spi-spi-fsl-lpspi-reset-fifo-and-disable-module-on-t.patch drm-bridge-ti-sn65dsi86-fix-refclk-setting.patch perf-bpf-event-fix-use-after-free-in-synthesis.patch clk-qcom-gdsc-set-retain_ff-before-moving-to-hw-ctrl.patch +spi-tegra114-use-value-to-check-for-invalid-delays.patch +dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch diff --git a/queue-5.15/spi-tegra114-use-value-to-check-for-invalid-delays.patch b/queue-5.15/spi-tegra114-use-value-to-check-for-invalid-delays.patch new file mode 100644 index 0000000000..ecade9ea07 --- /dev/null +++ b/queue-5.15/spi-tegra114-use-value-to-check-for-invalid-delays.patch @@ -0,0 +1,44 @@ +From d150454d90d06fc61cd6a733efb01d9443cc57db Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 6 May 2025 13:36:59 -0500 +Subject: spi: tegra114: Use value to check for invalid delays + +From: Aaron Kling + +[ Upstream commit e979a7c79fbc706f6dac913af379ef4caa04d3d5 ] + +A delay unit of 0 is a valid entry, thus it is not valid to check for +unused delays. Instead, check the value field; if that is zero, the +given delay is unset. + +Fixes: 4426e6b4ecf6 ("spi: tegra114: Don't fail set_cs_timing when delays are zero") +Cc: stable@vger.kernel.org +Signed-off-by: Aaron Kling +Reviewed-by: Jon Hunter +Link: https://patch.msgid.link/20250506-spi-tegra114-fixup-v1-1-136dc2f732f3@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-tegra114.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c +index af9ed52445fe6..30a699ba9b4c2 100644 +--- a/drivers/spi/spi-tegra114.c ++++ b/drivers/spi/spi-tegra114.c +@@ -729,9 +729,9 @@ static int tegra_spi_set_hw_cs_timing(struct spi_device *spi) + u32 inactive_cycles; + u8 cs_state; + +- if ((setup->unit && setup->unit != SPI_DELAY_UNIT_SCK) || +- (hold->unit && hold->unit != SPI_DELAY_UNIT_SCK) || +- (inactive->unit && inactive->unit != SPI_DELAY_UNIT_SCK)) { ++ if ((setup->value && setup->unit != SPI_DELAY_UNIT_SCK) || ++ (hold->value && hold->unit != SPI_DELAY_UNIT_SCK) || ++ (inactive->value && inactive->unit != SPI_DELAY_UNIT_SCK)) { + dev_err(&spi->dev, + "Invalid delay unit %d, should be SPI_DELAY_UNIT_SCK\n", + SPI_DELAY_UNIT_SCK); +-- +2.51.0 + diff --git a/queue-5.4/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch b/queue-5.4/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch new file mode 100644 index 0000000000..94447b6b80 --- /dev/null +++ b/queue-5.4/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch @@ -0,0 +1,44 @@ +From 2b90b66180d7e65d74b88eab6379d40e620b6774 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Jun 2025 17:00:17 +0800 +Subject: dmaengine: mediatek: Fix a flag reuse error in mtk_cqdma_tx_status() + +From: Qiu-ji Chen + +[ Upstream commit 8eba2187391e5ab49940cd02d6bd45a5617f4daf ] + +Fixed a flag reuse bug in the mtk_cqdma_tx_status() function. + +Fixes: 157ae5ffd76a ("dmaengine: mediatek: Fix a possible deadlock error in mtk_cqdma_tx_status()") +Cc: stable@vger.kernel.org +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202505270641.MStzJUfU-lkp@intel.com/ +Signed-off-by: Qiu-ji Chen +Reviewed-by: Eugen Hristev +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20250606090017.5436-1-chenqiuji666@gmail.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/mediatek/mtk-cqdma.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/dma/mediatek/mtk-cqdma.c b/drivers/dma/mediatek/mtk-cqdma.c +index 11ec5734a816e..175b27b66b045 100644 +--- a/drivers/dma/mediatek/mtk-cqdma.c ++++ b/drivers/dma/mediatek/mtk-cqdma.c +@@ -450,9 +450,9 @@ static enum dma_status mtk_cqdma_tx_status(struct dma_chan *c, + return ret; + + spin_lock_irqsave(&cvc->pc->lock, flags); +- spin_lock_irqsave(&cvc->vc.lock, flags); ++ spin_lock(&cvc->vc.lock); + vd = mtk_cqdma_find_active_desc(c, cookie); +- spin_unlock_irqrestore(&cvc->vc.lock, flags); ++ spin_unlock(&cvc->vc.lock); + spin_unlock_irqrestore(&cvc->pc->lock, flags); + + if (vd) { +-- +2.51.0 + diff --git a/queue-5.4/series b/queue-5.4/series index 643e257284..1a2483f2a4 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -42,3 +42,4 @@ spi-spi-fsl-lpspi-fix-transmissions-when-using-cont.patch spi-spi-fsl-lpspi-set-correct-chip-select-polarity-b.patch spi-spi-fsl-lpspi-reset-fifo-and-disable-module-on-t.patch cifs-fix-integer-overflow-in-match_server.patch +dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch diff --git a/queue-6.1/cpufreq-intel_pstate-check-turbo_is_disabled-in-stor.patch b/queue-6.1/cpufreq-intel_pstate-check-turbo_is_disabled-in-stor.patch new file mode 100644 index 0000000000..a2c0677d8b --- /dev/null +++ b/queue-6.1/cpufreq-intel_pstate-check-turbo_is_disabled-in-stor.patch @@ -0,0 +1,88 @@ +From b0adb7930652377739a6f191ceb4f14a42e27cf8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Jun 2024 16:53:06 +0200 +Subject: cpufreq: intel_pstate: Check turbo_is_disabled() in store_no_turbo() + +From: Rafael J. Wysocki + +[ Upstream commit 350cbb5d2f676bff22c49e5e81764c3b8da342a9 ] + +After recent changes in intel_pstate, global.turbo_disabled is only set +at the initialization time and never changed. However, it turns out +that on some systems the "turbo disabled" bit in MSR_IA32_MISC_ENABLE, +the initial state of which is reflected by global.turbo_disabled, can be +flipped later and there should be a way to take that into account (other +than checking that MSR every time the driver runs which is costly and +useless overhead on the vast majority of systems). + +For this purpose, notice that before the changes in question, +store_no_turbo() contained a turbo_is_disabled() check that was used +for updating global.turbo_disabled if the "turbo disabled" bit in +MSR_IA32_MISC_ENABLE had been flipped and that functionality can be +restored. Then, users will be able to reset global.turbo_disabled +by writing 0 to no_turbo which used to work before on systems with +flipping "turbo disabled" bit. + +This guarantees the driver state to remain in sync, but READ_ONCE() +annotations need to be added in two places where global.turbo_disabled +is accessed locklessly, so modify the driver to make that happen. + +Fixes: 0940f1a8011f ("cpufreq: intel_pstate: Do not update global.turbo_disabled after initialization") +Closes: https://lore.kernel.org/linux-pm/bf3ebf1571a4788e97daf861eb493c12d42639a3.camel@xry111.site +Suggested-by: Srinivas Pandruvada +Reported-by: Xi Ruoyao +Tested-by: Xi Ruoyao +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/intel_pstate.c | 19 ++++++++++++------- + 1 file changed, 12 insertions(+), 7 deletions(-) + +diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c +index 7570d6d1ca8c0..3ded51db833d7 100644 +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -1255,12 +1255,17 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b, + + no_turbo = !!clamp_t(int, input, 0, 1); + +- if (no_turbo == global.no_turbo) +- goto unlock_driver; +- +- if (global.turbo_disabled) { +- pr_notice_once("Turbo disabled by BIOS or unavailable on processor\n"); ++ WRITE_ONCE(global.turbo_disabled, turbo_is_disabled()); ++ if (global.turbo_disabled && !no_turbo) { ++ pr_notice("Turbo disabled by BIOS or unavailable on processor\n"); + count = -EPERM; ++ if (global.no_turbo) ++ goto unlock_driver; ++ else ++ no_turbo = 1; ++ } ++ ++ if (no_turbo == global.no_turbo) { + goto unlock_driver; + } + +@@ -1730,7 +1735,7 @@ static u64 atom_get_val(struct cpudata *cpudata, int pstate) + u32 vid; + + val = (u64)pstate << 8; +- if (READ_ONCE(global.no_turbo) && !global.turbo_disabled) ++ if (READ_ONCE(global.no_turbo) && !READ_ONCE(global.turbo_disabled)) + val |= (u64)1 << 32; + + vid_fp = cpudata->vid.min + mul_fp( +@@ -1900,7 +1905,7 @@ static u64 core_get_val(struct cpudata *cpudata, int pstate) + u64 val; + + val = (u64)pstate << 8; +- if (READ_ONCE(global.no_turbo) && !global.turbo_disabled) ++ if (READ_ONCE(global.no_turbo) && !READ_ONCE(global.turbo_disabled)) + val |= (u64)1 << 32; + + return val; +-- +2.51.0 + diff --git a/queue-6.1/cpufreq-intel_pstate-read-global.no_turbo-under-read.patch b/queue-6.1/cpufreq-intel_pstate-read-global.no_turbo-under-read.patch new file mode 100644 index 0000000000..7951fe06b4 --- /dev/null +++ b/queue-6.1/cpufreq-intel_pstate-read-global.no_turbo-under-read.patch @@ -0,0 +1,87 @@ +From a384200db147a14a79bc8594c141a9dc4934d5ca Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 25 Mar 2024 18:04:24 +0100 +Subject: cpufreq: intel_pstate: Read global.no_turbo under READ_ONCE() + +From: Rafael J. Wysocki + +[ Upstream commit 9558fae8ce97b3b320b387dd7c88309df2c36d4d ] + +Because global.no_turbo is generally not read under intel_pstate_driver_lock +make store_no_turbo() use WRITE_ONCE() for updating it (this is the only +place at which it is updated except for the initialization) and make the +majority of places reading it use READ_ONCE(). + +Also remove redundant global.turbo_disabled checks from places that +depend on the 'true' value of global.no_turbo because it can only be +'true' if global.turbo_disabled is also 'true'. + +Signed-off-by: Rafael J. Wysocki +Acked-by: Srinivas Pandruvada +Stable-dep-of: 350cbb5d2f67 ("cpufreq: intel_pstate: Check turbo_is_disabled() in store_no_turbo()") +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/intel_pstate.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c +index 0395bc0317a18..7570d6d1ca8c0 100644 +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -1264,7 +1264,7 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b, + goto unlock_driver; + } + +- global.no_turbo = no_turbo; ++ WRITE_ONCE(global.no_turbo, no_turbo); + + mutex_lock(&intel_pstate_limits_lock); + +@@ -1730,7 +1730,7 @@ static u64 atom_get_val(struct cpudata *cpudata, int pstate) + u32 vid; + + val = (u64)pstate << 8; +- if (global.no_turbo && !global.turbo_disabled) ++ if (READ_ONCE(global.no_turbo) && !global.turbo_disabled) + val |= (u64)1 << 32; + + vid_fp = cpudata->vid.min + mul_fp( +@@ -1900,7 +1900,7 @@ static u64 core_get_val(struct cpudata *cpudata, int pstate) + u64 val; + + val = (u64)pstate << 8; +- if (global.no_turbo && !global.turbo_disabled) ++ if (READ_ONCE(global.no_turbo) && !global.turbo_disabled) + val |= (u64)1 << 32; + + return val; +@@ -2186,7 +2186,7 @@ static inline int32_t get_target_pstate(struct cpudata *cpu) + + sample->busy_scaled = busy_frac * 100; + +- target = global.no_turbo || global.turbo_disabled ? ++ target = READ_ONCE(global.no_turbo) ? + cpu->pstate.max_pstate : cpu->pstate.turbo_pstate; + target += target >> 2; + target = mul_fp(target, busy_frac); +@@ -2455,7 +2455,7 @@ static void intel_pstate_clear_update_util_hook(unsigned int cpu) + + static int intel_pstate_get_max_freq(struct cpudata *cpu) + { +- return global.turbo_disabled || global.no_turbo ? ++ return READ_ONCE(global.no_turbo) ? + cpu->pstate.max_freq : cpu->pstate.turbo_freq; + } + +@@ -2592,7 +2592,7 @@ static void intel_pstate_verify_cpu_policy(struct cpudata *cpu, + + if (hwp_active) { + intel_pstate_get_hwp_cap(cpu); +- max_freq = global.no_turbo || global.turbo_disabled ? ++ max_freq = READ_ONCE(global.no_turbo) ? + cpu->pstate.max_freq : cpu->pstate.turbo_freq; + } else { + max_freq = intel_pstate_get_max_freq(cpu); +-- +2.51.0 + diff --git a/queue-6.1/cpufreq-intel_pstate-rearrange-show_no_turbo-and-sto.patch b/queue-6.1/cpufreq-intel_pstate-rearrange-show_no_turbo-and-sto.patch new file mode 100644 index 0000000000..4960391eb1 --- /dev/null +++ b/queue-6.1/cpufreq-intel_pstate-rearrange-show_no_turbo-and-sto.patch @@ -0,0 +1,116 @@ +From ca58262b898f2ab784a70caca71bc27329e1f23a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 25 Mar 2024 18:03:25 +0100 +Subject: cpufreq: intel_pstate: Rearrange show_no_turbo() and store_no_turbo() + +From: Rafael J. Wysocki + +[ Upstream commit c626a438452079824139f97137f17af47b1a8989 ] + +Now that global.turbo_disabled can only change at the cpufreq driver +registration time, initialize global.no_turbo at that time too so they +are in sync to start with (if the former is set, the latter cannot be +updated later anyway). + +That allows show_no_turbo() to be simlified because it does not need +to check global.turbo_disabled and store_no_turbo() can be rearranged +to avoid doing anything if the new value of global.no_turbo is equal +to the current one and only return an error on attempts to clear +global.no_turbo when global.turbo_disabled. + +While at it, eliminate the redundant ret variable from store_no_turbo(). + +No intentional functional impact. + +Signed-off-by: Rafael J. Wysocki +Acked-by: Srinivas Pandruvada +Stable-dep-of: 350cbb5d2f67 ("cpufreq: intel_pstate: Check turbo_is_disabled() in store_no_turbo()") +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/intel_pstate.c | 34 ++++++++++++++++++---------------- + 1 file changed, 18 insertions(+), 16 deletions(-) + +diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c +index 7d28bf7548cfa..0395bc0317a18 100644 +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -1230,10 +1230,7 @@ static ssize_t show_no_turbo(struct kobject *kobj, + return -EAGAIN; + } + +- if (global.turbo_disabled) +- ret = sprintf(buf, "%u\n", global.turbo_disabled); +- else +- ret = sprintf(buf, "%u\n", global.no_turbo); ++ ret = sprintf(buf, "%u\n", global.no_turbo); + + mutex_unlock(&intel_pstate_driver_lock); + +@@ -1244,31 +1241,34 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b, + const char *buf, size_t count) + { + unsigned int input; +- int ret; ++ bool no_turbo; + +- ret = sscanf(buf, "%u", &input); +- if (ret != 1) ++ if (sscanf(buf, "%u", &input) != 1) + return -EINVAL; + + mutex_lock(&intel_pstate_driver_lock); + + if (!intel_pstate_driver) { +- mutex_unlock(&intel_pstate_driver_lock); +- return -EAGAIN; ++ count = -EAGAIN; ++ goto unlock_driver; + } + +- mutex_lock(&intel_pstate_limits_lock); ++ no_turbo = !!clamp_t(int, input, 0, 1); ++ ++ if (no_turbo == global.no_turbo) ++ goto unlock_driver; + + if (global.turbo_disabled) { + pr_notice_once("Turbo disabled by BIOS or unavailable on processor\n"); +- mutex_unlock(&intel_pstate_limits_lock); +- mutex_unlock(&intel_pstate_driver_lock); +- return -EPERM; ++ count = -EPERM; ++ goto unlock_driver; + } + +- global.no_turbo = clamp_t(int, input, 0, 1); ++ global.no_turbo = no_turbo; ++ ++ mutex_lock(&intel_pstate_limits_lock); + +- if (global.no_turbo) { ++ if (no_turbo) { + struct cpudata *cpu = all_cpu_data[0]; + int pct = cpu->pstate.max_pstate * 100 / cpu->pstate.turbo_pstate; + +@@ -1280,8 +1280,9 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b, + mutex_unlock(&intel_pstate_limits_lock); + + intel_pstate_update_policies(); +- arch_set_max_freq_ratio(global.no_turbo); ++ arch_set_max_freq_ratio(no_turbo); + ++unlock_driver: + mutex_unlock(&intel_pstate_driver_lock); + + return count; +@@ -3078,6 +3079,7 @@ static int intel_pstate_register_driver(struct cpufreq_driver *driver) + memset(&global, 0, sizeof(global)); + global.max_perf_pct = 100; + global.turbo_disabled = turbo_is_disabled(); ++ global.no_turbo = global.turbo_disabled; + + arch_set_max_freq_ratio(global.turbo_disabled); + +-- +2.51.0 + diff --git a/queue-6.1/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch b/queue-6.1/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch new file mode 100644 index 0000000000..80b01b422d --- /dev/null +++ b/queue-6.1/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch @@ -0,0 +1,44 @@ +From 6e7a68540ad1b5b118f6cb6be7795b625b34c8ae Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Jun 2025 17:00:17 +0800 +Subject: dmaengine: mediatek: Fix a flag reuse error in mtk_cqdma_tx_status() + +From: Qiu-ji Chen + +[ Upstream commit 8eba2187391e5ab49940cd02d6bd45a5617f4daf ] + +Fixed a flag reuse bug in the mtk_cqdma_tx_status() function. + +Fixes: 157ae5ffd76a ("dmaengine: mediatek: Fix a possible deadlock error in mtk_cqdma_tx_status()") +Cc: stable@vger.kernel.org +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202505270641.MStzJUfU-lkp@intel.com/ +Signed-off-by: Qiu-ji Chen +Reviewed-by: Eugen Hristev +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20250606090017.5436-1-chenqiuji666@gmail.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/mediatek/mtk-cqdma.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/dma/mediatek/mtk-cqdma.c b/drivers/dma/mediatek/mtk-cqdma.c +index be0c5db57d9de..661521064c347 100644 +--- a/drivers/dma/mediatek/mtk-cqdma.c ++++ b/drivers/dma/mediatek/mtk-cqdma.c +@@ -450,9 +450,9 @@ static enum dma_status mtk_cqdma_tx_status(struct dma_chan *c, + return ret; + + spin_lock_irqsave(&cvc->pc->lock, flags); +- spin_lock_irqsave(&cvc->vc.lock, flags); ++ spin_lock(&cvc->vc.lock); + vd = mtk_cqdma_find_active_desc(c, cookie); +- spin_unlock_irqrestore(&cvc->vc.lock, flags); ++ spin_unlock(&cvc->vc.lock); + spin_unlock_irqrestore(&cvc->pc->lock, flags); + + if (vd) { +-- +2.51.0 + diff --git a/queue-6.1/series b/queue-6.1/series index c6dc63fab4..dee7dc6db9 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -97,3 +97,8 @@ tools-gpio-remove-the-include-directory-on-make-clea.patch mm-slub-refactor-free-debug-processing.patch slub-reflow-___slab_alloc.patch mm-slub-avoid-wake-up-kswapd-in-set_track_prepare.patch +dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch +spi-tegra114-use-value-to-check-for-invalid-delays.patch +cpufreq-intel_pstate-rearrange-show_no_turbo-and-sto.patch +cpufreq-intel_pstate-read-global.no_turbo-under-read.patch +cpufreq-intel_pstate-check-turbo_is_disabled-in-stor.patch diff --git a/queue-6.1/spi-tegra114-use-value-to-check-for-invalid-delays.patch b/queue-6.1/spi-tegra114-use-value-to-check-for-invalid-delays.patch new file mode 100644 index 0000000000..d903335e5f --- /dev/null +++ b/queue-6.1/spi-tegra114-use-value-to-check-for-invalid-delays.patch @@ -0,0 +1,44 @@ +From 8e50dcce60b868229fe075113f5efea333ef610e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 6 May 2025 13:36:59 -0500 +Subject: spi: tegra114: Use value to check for invalid delays + +From: Aaron Kling + +[ Upstream commit e979a7c79fbc706f6dac913af379ef4caa04d3d5 ] + +A delay unit of 0 is a valid entry, thus it is not valid to check for +unused delays. Instead, check the value field; if that is zero, the +given delay is unset. + +Fixes: 4426e6b4ecf6 ("spi: tegra114: Don't fail set_cs_timing when delays are zero") +Cc: stable@vger.kernel.org +Signed-off-by: Aaron Kling +Reviewed-by: Jon Hunter +Link: https://patch.msgid.link/20250506-spi-tegra114-fixup-v1-1-136dc2f732f3@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-tegra114.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c +index 60799ab60eb45..12085f4621a0c 100644 +--- a/drivers/spi/spi-tegra114.c ++++ b/drivers/spi/spi-tegra114.c +@@ -729,9 +729,9 @@ static int tegra_spi_set_hw_cs_timing(struct spi_device *spi) + u32 inactive_cycles; + u8 cs_state; + +- if ((setup->unit && setup->unit != SPI_DELAY_UNIT_SCK) || +- (hold->unit && hold->unit != SPI_DELAY_UNIT_SCK) || +- (inactive->unit && inactive->unit != SPI_DELAY_UNIT_SCK)) { ++ if ((setup->value && setup->unit != SPI_DELAY_UNIT_SCK) || ++ (hold->value && hold->unit != SPI_DELAY_UNIT_SCK) || ++ (inactive->value && inactive->unit != SPI_DELAY_UNIT_SCK)) { + dev_err(&spi->dev, + "Invalid delay unit %d, should be SPI_DELAY_UNIT_SCK\n", + SPI_DELAY_UNIT_SCK); +-- +2.51.0 + diff --git a/queue-6.12/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch b/queue-6.12/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch new file mode 100644 index 0000000000..68e81a7bf4 --- /dev/null +++ b/queue-6.12/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch @@ -0,0 +1,44 @@ +From 7d4f8dede5c99d0d00ccffd307444764abf97380 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Jun 2025 17:00:17 +0800 +Subject: dmaengine: mediatek: Fix a flag reuse error in mtk_cqdma_tx_status() + +From: Qiu-ji Chen + +[ Upstream commit 8eba2187391e5ab49940cd02d6bd45a5617f4daf ] + +Fixed a flag reuse bug in the mtk_cqdma_tx_status() function. + +Fixes: 157ae5ffd76a ("dmaengine: mediatek: Fix a possible deadlock error in mtk_cqdma_tx_status()") +Cc: stable@vger.kernel.org +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202505270641.MStzJUfU-lkp@intel.com/ +Signed-off-by: Qiu-ji Chen +Reviewed-by: Eugen Hristev +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20250606090017.5436-1-chenqiuji666@gmail.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/mediatek/mtk-cqdma.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/dma/mediatek/mtk-cqdma.c b/drivers/dma/mediatek/mtk-cqdma.c +index e3c887148987b..1bf4fc461a8cc 100644 +--- a/drivers/dma/mediatek/mtk-cqdma.c ++++ b/drivers/dma/mediatek/mtk-cqdma.c +@@ -449,9 +449,9 @@ static enum dma_status mtk_cqdma_tx_status(struct dma_chan *c, + return ret; + + spin_lock_irqsave(&cvc->pc->lock, flags); +- spin_lock_irqsave(&cvc->vc.lock, flags); ++ spin_lock(&cvc->vc.lock); + vd = mtk_cqdma_find_active_desc(c, cookie); +- spin_unlock_irqrestore(&cvc->vc.lock, flags); ++ spin_unlock(&cvc->vc.lock); + spin_unlock_irqrestore(&cvc->pc->lock, flags); + + if (vd) { +-- +2.51.0 + diff --git a/queue-6.12/md-raid1-fix-data-lost-for-writemostly-rdev.patch b/queue-6.12/md-raid1-fix-data-lost-for-writemostly-rdev.patch new file mode 100644 index 0000000000..3093f78718 --- /dev/null +++ b/queue-6.12/md-raid1-fix-data-lost-for-writemostly-rdev.patch @@ -0,0 +1,44 @@ +From 32d4ba26814cfbef8c7dd7f8183e246681ecacea Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 Sep 2025 09:41:40 +0800 +Subject: md/raid1: fix data lost for writemostly rdev + +From: Yu Kuai + +[ Upstream commit 93dec51e716db88f32d770dc9ab268964fff320b ] + +If writemostly is enabled, alloc_behind_master_bio() will allocate a new +bio for rdev, with bi_opf set to 0. Later, raid1_write_request() will +clone from this bio, hence bi_opf is still 0 for the cloned bio. Submit +this cloned bio will end up to be read, causing write data lost. + +Fix this problem by inheriting bi_opf from original bio for +behind_mast_bio. + +Fixes: e879a0d9cb08 ("md/raid1,raid10: don't ignore IO flags") +Reported-and-tested-by: Ian Dall +Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220507 +Link: https://lore.kernel.org/linux-raid/20250903014140.3690499-1-yukuai1@huaweicloud.com +Signed-off-by: Yu Kuai +Reviewed-by: Li Nan +Signed-off-by: Sasha Levin +--- + drivers/md/raid1.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c +index 772486d707181..faccf7344ef93 100644 +--- a/drivers/md/raid1.c ++++ b/drivers/md/raid1.c +@@ -1224,7 +1224,7 @@ static void alloc_behind_master_bio(struct r1bio *r1_bio, + int i = 0; + struct bio *behind_bio = NULL; + +- behind_bio = bio_alloc_bioset(NULL, vcnt, 0, GFP_NOIO, ++ behind_bio = bio_alloc_bioset(NULL, vcnt, bio->bi_opf, GFP_NOIO, + &r1_bio->mddev->bio_set); + + /* discard op, we don't support writezero/writesame yet */ +-- +2.51.0 + diff --git a/queue-6.12/series b/queue-6.12/series index dcbecdd3f8..4e87189871 100644 --- a/queue-6.12/series +++ b/queue-6.12/series @@ -171,3 +171,5 @@ riscv-use-lw-when-reading-int-cpu-in-new_vmalloc_check.patch riscv-use-lw-when-reading-int-cpu-in-asm_per_cpu.patch riscv-bpf-use-lw-when-reading-int-cpu-in-bpf_mov64_percpu_reg.patch riscv-bpf-use-lw-when-reading-int-cpu-in-bpf_get_smp_processor_id.patch +md-raid1-fix-data-lost-for-writemostly-rdev.patch +dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch diff --git a/queue-6.16/revert-drm-i915-gem-allow-exec_capture-on-recoverabl.patch b/queue-6.16/revert-drm-i915-gem-allow-exec_capture-on-recoverabl.patch new file mode 100644 index 0000000000..316fc9a7ab --- /dev/null +++ b/queue-6.16/revert-drm-i915-gem-allow-exec_capture-on-recoverabl.patch @@ -0,0 +1,56 @@ +From 21176f5a5311ac259f8946f62b56b0a5fb952eb1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 22 May 2025 09:41:27 +0300 +Subject: Revert "drm/i915/gem: Allow EXEC_CAPTURE on recoverable contexts on + DG1" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Joonas Lahtinen + +[ Upstream commit d2dc30e0aa252830f908c8e793d3139d51321370 ] + +This reverts commit d6e020819612a4a06207af858e0978be4d3e3140. + +The IS_DGFX check was put in place because error capture of buffer +objects is expected to be broken on devices with VRAM. + +Userspace fix[1] to the impacted media driver has been submitted, merged +and a new driver release is out as 25.2.3 where the capture flag is +dropped on DG1 thus unblocking the usage of media driver on DG1. + +[1] https://github.com/intel/media-driver/commit/93c07d9b4b96a78bab21f6acd4eb863f4313ea4a + +Cc: stable@vger.kernel.org # v6.0+ +Cc: Ville Syrjälä +Cc: Andi Shyti +Cc: Matthew Auld +Cc: Thomas Hellström +Cc: Tvrtko Ursulin +Acked-by: Tvrtko Ursulin +Reviewed-by: Andi Shyti +Link: https://lore.kernel.org/r/20250522064127.24293-1-joonas.lahtinen@linux.intel.com +[Joonas: Update message to point out the merged userspace fix] +Signed-off-by: Joonas Lahtinen +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +index ea9d5063ce78c..ca7e9216934a7 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +@@ -2013,7 +2013,7 @@ static int eb_capture_stage(struct i915_execbuffer *eb) + continue; + + if (i915_gem_context_is_recoverable(eb->gem_context) && +- GRAPHICS_VER_FULL(eb->i915) > IP_VER(12, 10)) ++ (IS_DGFX(eb->i915) || GRAPHICS_VER_FULL(eb->i915) > IP_VER(12, 0))) + return -EINVAL; + + for_each_batch_create_order(eb, j) { +-- +2.51.0 + diff --git a/queue-6.16/series b/queue-6.16/series index 1254926532..86fe340b83 100644 --- a/queue-6.16/series +++ b/queue-6.16/series @@ -180,3 +180,4 @@ riscv-bpf-use-lw-when-reading-int-cpu-in-bpf_get_smp_processor_id.patch riscv-kexec-initialize-kexec_buf-struct.patch riscv-fix-sparse-warning-in-__get_user_error.patch riscv-fix-sparse-warning-about-different-address-spaces.patch +revert-drm-i915-gem-allow-exec_capture-on-recoverabl.patch diff --git a/queue-6.6/cpufreq-intel_pstate-check-turbo_is_disabled-in-stor.patch b/queue-6.6/cpufreq-intel_pstate-check-turbo_is_disabled-in-stor.patch new file mode 100644 index 0000000000..99cc64920c --- /dev/null +++ b/queue-6.6/cpufreq-intel_pstate-check-turbo_is_disabled-in-stor.patch @@ -0,0 +1,88 @@ +From 3d909a091c45f2c3b91ed14f2a56a7cf9d7ebcff Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Jun 2024 16:53:06 +0200 +Subject: cpufreq: intel_pstate: Check turbo_is_disabled() in store_no_turbo() + +From: Rafael J. Wysocki + +[ Upstream commit 350cbb5d2f676bff22c49e5e81764c3b8da342a9 ] + +After recent changes in intel_pstate, global.turbo_disabled is only set +at the initialization time and never changed. However, it turns out +that on some systems the "turbo disabled" bit in MSR_IA32_MISC_ENABLE, +the initial state of which is reflected by global.turbo_disabled, can be +flipped later and there should be a way to take that into account (other +than checking that MSR every time the driver runs which is costly and +useless overhead on the vast majority of systems). + +For this purpose, notice that before the changes in question, +store_no_turbo() contained a turbo_is_disabled() check that was used +for updating global.turbo_disabled if the "turbo disabled" bit in +MSR_IA32_MISC_ENABLE had been flipped and that functionality can be +restored. Then, users will be able to reset global.turbo_disabled +by writing 0 to no_turbo which used to work before on systems with +flipping "turbo disabled" bit. + +This guarantees the driver state to remain in sync, but READ_ONCE() +annotations need to be added in two places where global.turbo_disabled +is accessed locklessly, so modify the driver to make that happen. + +Fixes: 0940f1a8011f ("cpufreq: intel_pstate: Do not update global.turbo_disabled after initialization") +Closes: https://lore.kernel.org/linux-pm/bf3ebf1571a4788e97daf861eb493c12d42639a3.camel@xry111.site +Suggested-by: Srinivas Pandruvada +Reported-by: Xi Ruoyao +Tested-by: Xi Ruoyao +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/intel_pstate.c | 19 ++++++++++++------- + 1 file changed, 12 insertions(+), 7 deletions(-) + +diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c +index 05aae7e6da157..ed782c0b48af2 100644 +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -1288,12 +1288,17 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b, + + no_turbo = !!clamp_t(int, input, 0, 1); + +- if (no_turbo == global.no_turbo) +- goto unlock_driver; +- +- if (global.turbo_disabled) { +- pr_notice_once("Turbo disabled by BIOS or unavailable on processor\n"); ++ WRITE_ONCE(global.turbo_disabled, turbo_is_disabled()); ++ if (global.turbo_disabled && !no_turbo) { ++ pr_notice("Turbo disabled by BIOS or unavailable on processor\n"); + count = -EPERM; ++ if (global.no_turbo) ++ goto unlock_driver; ++ else ++ no_turbo = 1; ++ } ++ ++ if (no_turbo == global.no_turbo) { + goto unlock_driver; + } + +@@ -1766,7 +1771,7 @@ static u64 atom_get_val(struct cpudata *cpudata, int pstate) + u32 vid; + + val = (u64)pstate << 8; +- if (READ_ONCE(global.no_turbo) && !global.turbo_disabled) ++ if (READ_ONCE(global.no_turbo) && !READ_ONCE(global.turbo_disabled)) + val |= (u64)1 << 32; + + vid_fp = cpudata->vid.min + mul_fp( +@@ -1931,7 +1936,7 @@ static u64 core_get_val(struct cpudata *cpudata, int pstate) + u64 val; + + val = (u64)pstate << 8; +- if (READ_ONCE(global.no_turbo) && !global.turbo_disabled) ++ if (READ_ONCE(global.no_turbo) && !READ_ONCE(global.turbo_disabled)) + val |= (u64)1 << 32; + + return val; +-- +2.51.0 + diff --git a/queue-6.6/cpufreq-intel_pstate-read-global.no_turbo-under-read.patch b/queue-6.6/cpufreq-intel_pstate-read-global.no_turbo-under-read.patch new file mode 100644 index 0000000000..6b2d32b1d2 --- /dev/null +++ b/queue-6.6/cpufreq-intel_pstate-read-global.no_turbo-under-read.patch @@ -0,0 +1,87 @@ +From 5723b4a011300182009d1d530276e89c29296859 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 25 Mar 2024 18:04:24 +0100 +Subject: cpufreq: intel_pstate: Read global.no_turbo under READ_ONCE() + +From: Rafael J. Wysocki + +[ Upstream commit 9558fae8ce97b3b320b387dd7c88309df2c36d4d ] + +Because global.no_turbo is generally not read under intel_pstate_driver_lock +make store_no_turbo() use WRITE_ONCE() for updating it (this is the only +place at which it is updated except for the initialization) and make the +majority of places reading it use READ_ONCE(). + +Also remove redundant global.turbo_disabled checks from places that +depend on the 'true' value of global.no_turbo because it can only be +'true' if global.turbo_disabled is also 'true'. + +Signed-off-by: Rafael J. Wysocki +Acked-by: Srinivas Pandruvada +Stable-dep-of: 350cbb5d2f67 ("cpufreq: intel_pstate: Check turbo_is_disabled() in store_no_turbo()") +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/intel_pstate.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c +index 8bac7afb13a3d..05aae7e6da157 100644 +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -1297,7 +1297,7 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b, + goto unlock_driver; + } + +- global.no_turbo = no_turbo; ++ WRITE_ONCE(global.no_turbo, no_turbo); + + mutex_lock(&intel_pstate_limits_lock); + +@@ -1766,7 +1766,7 @@ static u64 atom_get_val(struct cpudata *cpudata, int pstate) + u32 vid; + + val = (u64)pstate << 8; +- if (global.no_turbo && !global.turbo_disabled) ++ if (READ_ONCE(global.no_turbo) && !global.turbo_disabled) + val |= (u64)1 << 32; + + vid_fp = cpudata->vid.min + mul_fp( +@@ -1931,7 +1931,7 @@ static u64 core_get_val(struct cpudata *cpudata, int pstate) + u64 val; + + val = (u64)pstate << 8; +- if (global.no_turbo && !global.turbo_disabled) ++ if (READ_ONCE(global.no_turbo) && !global.turbo_disabled) + val |= (u64)1 << 32; + + return val; +@@ -2229,7 +2229,7 @@ static inline int32_t get_target_pstate(struct cpudata *cpu) + + sample->busy_scaled = busy_frac * 100; + +- target = global.no_turbo || global.turbo_disabled ? ++ target = READ_ONCE(global.no_turbo) ? + cpu->pstate.max_pstate : cpu->pstate.turbo_pstate; + target += target >> 2; + target = mul_fp(target, busy_frac); +@@ -2490,7 +2490,7 @@ static void intel_pstate_clear_update_util_hook(unsigned int cpu) + + static int intel_pstate_get_max_freq(struct cpudata *cpu) + { +- return global.turbo_disabled || global.no_turbo ? ++ return READ_ONCE(global.no_turbo) ? + cpu->pstate.max_freq : cpu->pstate.turbo_freq; + } + +@@ -2627,7 +2627,7 @@ static void intel_pstate_verify_cpu_policy(struct cpudata *cpu, + + if (hwp_active) { + intel_pstate_get_hwp_cap(cpu); +- max_freq = global.no_turbo || global.turbo_disabled ? ++ max_freq = READ_ONCE(global.no_turbo) ? + cpu->pstate.max_freq : cpu->pstate.turbo_freq; + } else { + max_freq = intel_pstate_get_max_freq(cpu); +-- +2.51.0 + diff --git a/queue-6.6/cpufreq-intel_pstate-rearrange-show_no_turbo-and-sto.patch b/queue-6.6/cpufreq-intel_pstate-rearrange-show_no_turbo-and-sto.patch new file mode 100644 index 0000000000..fd9d4c7fed --- /dev/null +++ b/queue-6.6/cpufreq-intel_pstate-rearrange-show_no_turbo-and-sto.patch @@ -0,0 +1,116 @@ +From b333179f95c8355785b74c7cbdc7d07f8c1fd13b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 25 Mar 2024 18:03:25 +0100 +Subject: cpufreq: intel_pstate: Rearrange show_no_turbo() and store_no_turbo() + +From: Rafael J. Wysocki + +[ Upstream commit c626a438452079824139f97137f17af47b1a8989 ] + +Now that global.turbo_disabled can only change at the cpufreq driver +registration time, initialize global.no_turbo at that time too so they +are in sync to start with (if the former is set, the latter cannot be +updated later anyway). + +That allows show_no_turbo() to be simlified because it does not need +to check global.turbo_disabled and store_no_turbo() can be rearranged +to avoid doing anything if the new value of global.no_turbo is equal +to the current one and only return an error on attempts to clear +global.no_turbo when global.turbo_disabled. + +While at it, eliminate the redundant ret variable from store_no_turbo(). + +No intentional functional impact. + +Signed-off-by: Rafael J. Wysocki +Acked-by: Srinivas Pandruvada +Stable-dep-of: 350cbb5d2f67 ("cpufreq: intel_pstate: Check turbo_is_disabled() in store_no_turbo()") +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/intel_pstate.c | 34 ++++++++++++++++++---------------- + 1 file changed, 18 insertions(+), 16 deletions(-) + +diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c +index abba45b1bcf2b..8bac7afb13a3d 100644 +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -1263,10 +1263,7 @@ static ssize_t show_no_turbo(struct kobject *kobj, + return -EAGAIN; + } + +- if (global.turbo_disabled) +- ret = sprintf(buf, "%u\n", global.turbo_disabled); +- else +- ret = sprintf(buf, "%u\n", global.no_turbo); ++ ret = sprintf(buf, "%u\n", global.no_turbo); + + mutex_unlock(&intel_pstate_driver_lock); + +@@ -1277,31 +1274,34 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b, + const char *buf, size_t count) + { + unsigned int input; +- int ret; ++ bool no_turbo; + +- ret = sscanf(buf, "%u", &input); +- if (ret != 1) ++ if (sscanf(buf, "%u", &input) != 1) + return -EINVAL; + + mutex_lock(&intel_pstate_driver_lock); + + if (!intel_pstate_driver) { +- mutex_unlock(&intel_pstate_driver_lock); +- return -EAGAIN; ++ count = -EAGAIN; ++ goto unlock_driver; + } + +- mutex_lock(&intel_pstate_limits_lock); ++ no_turbo = !!clamp_t(int, input, 0, 1); ++ ++ if (no_turbo == global.no_turbo) ++ goto unlock_driver; + + if (global.turbo_disabled) { + pr_notice_once("Turbo disabled by BIOS or unavailable on processor\n"); +- mutex_unlock(&intel_pstate_limits_lock); +- mutex_unlock(&intel_pstate_driver_lock); +- return -EPERM; ++ count = -EPERM; ++ goto unlock_driver; + } + +- global.no_turbo = clamp_t(int, input, 0, 1); ++ global.no_turbo = no_turbo; ++ ++ mutex_lock(&intel_pstate_limits_lock); + +- if (global.no_turbo) { ++ if (no_turbo) { + struct cpudata *cpu = all_cpu_data[0]; + int pct = cpu->pstate.max_pstate * 100 / cpu->pstate.turbo_pstate; + +@@ -1313,8 +1313,9 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b, + mutex_unlock(&intel_pstate_limits_lock); + + intel_pstate_update_policies(); +- arch_set_max_freq_ratio(global.no_turbo); ++ arch_set_max_freq_ratio(no_turbo); + ++unlock_driver: + mutex_unlock(&intel_pstate_driver_lock); + + return count; +@@ -3113,6 +3114,7 @@ static int intel_pstate_register_driver(struct cpufreq_driver *driver) + memset(&global, 0, sizeof(global)); + global.max_perf_pct = 100; + global.turbo_disabled = turbo_is_disabled(); ++ global.no_turbo = global.turbo_disabled; + + arch_set_max_freq_ratio(global.turbo_disabled); + +-- +2.51.0 + diff --git a/queue-6.6/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch b/queue-6.6/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch new file mode 100644 index 0000000000..788c9f83ef --- /dev/null +++ b/queue-6.6/dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch @@ -0,0 +1,44 @@ +From e6884aae0ad319c9ae47e9918d3b721035c03d7a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Jun 2025 17:00:17 +0800 +Subject: dmaengine: mediatek: Fix a flag reuse error in mtk_cqdma_tx_status() + +From: Qiu-ji Chen + +[ Upstream commit 8eba2187391e5ab49940cd02d6bd45a5617f4daf ] + +Fixed a flag reuse bug in the mtk_cqdma_tx_status() function. + +Fixes: 157ae5ffd76a ("dmaengine: mediatek: Fix a possible deadlock error in mtk_cqdma_tx_status()") +Cc: stable@vger.kernel.org +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202505270641.MStzJUfU-lkp@intel.com/ +Signed-off-by: Qiu-ji Chen +Reviewed-by: Eugen Hristev +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20250606090017.5436-1-chenqiuji666@gmail.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/mediatek/mtk-cqdma.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/dma/mediatek/mtk-cqdma.c b/drivers/dma/mediatek/mtk-cqdma.c +index 385eee4fd4e11..525bb92ced8f8 100644 +--- a/drivers/dma/mediatek/mtk-cqdma.c ++++ b/drivers/dma/mediatek/mtk-cqdma.c +@@ -449,9 +449,9 @@ static enum dma_status mtk_cqdma_tx_status(struct dma_chan *c, + return ret; + + spin_lock_irqsave(&cvc->pc->lock, flags); +- spin_lock_irqsave(&cvc->vc.lock, flags); ++ spin_lock(&cvc->vc.lock); + vd = mtk_cqdma_find_active_desc(c, cookie); +- spin_unlock_irqrestore(&cvc->vc.lock, flags); ++ spin_unlock(&cvc->vc.lock); + spin_unlock_irqrestore(&cvc->pc->lock, flags); + + if (vd) { +-- +2.51.0 + diff --git a/queue-6.6/series b/queue-6.6/series index de861598f5..192b436ce6 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -114,3 +114,7 @@ tools-gpio-remove-the-include-directory-on-make-clea.patch slub-reflow-___slab_alloc.patch mm-slub-avoid-wake-up-kswapd-in-set_track_prepare.patch riscv-use-lw-when-reading-int-cpu-in-asm_per_cpu.patch +cpufreq-intel_pstate-rearrange-show_no_turbo-and-sto.patch +cpufreq-intel_pstate-read-global.no_turbo-under-read.patch +cpufreq-intel_pstate-check-turbo_is_disabled-in-stor.patch +dmaengine-mediatek-fix-a-flag-reuse-error-in-mtk_cqd.patch