From: Sasha Levin Date: Tue, 8 Oct 2024 06:02:21 +0000 (-0400) Subject: Fixes for 6.1 X-Git-Tag: v6.6.55~44 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f371c95f78cc07be9ee0ce1808d698dd06568ee;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.1 Signed-off-by: Sasha Levin --- diff --git a/queue-6.1/acpi-battery-fix-possible-crash-when-unregistering-a.patch b/queue-6.1/acpi-battery-fix-possible-crash-when-unregistering-a.patch new file mode 100644 index 00000000000..f976bd16eba --- /dev/null +++ b/queue-6.1/acpi-battery-fix-possible-crash-when-unregistering-a.patch @@ -0,0 +1,69 @@ +From cbee14156b0c677125c14b5efc5db955e5e1b2f5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Oct 2024 23:28:34 +0200 +Subject: ACPI: battery: Fix possible crash when unregistering a battery hook + +From: Armin Wolf + +[ Upstream commit 76959aff14a0012ad6b984ec7686d163deccdc16 ] + +When a battery hook returns an error when adding a new battery, then +the battery hook is automatically unregistered. +However the battery hook provider cannot know that, so it will later +call battery_hook_unregister() on the already unregistered battery +hook, resulting in a crash. + +Fix this by using the list head to mark already unregistered battery +hooks as already being unregistered so that they can be ignored by +battery_hook_unregister(). + +Fixes: fa93854f7a7e ("battery: Add the battery hooking API") +Signed-off-by: Armin Wolf +Link: https://patch.msgid.link/20241001212835.341788-3-W_Armin@gmx.de +Cc: All applicable +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/acpi/battery.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c +index 59d38c6e45d83..5a4e022662417 100644 +--- a/drivers/acpi/battery.c ++++ b/drivers/acpi/battery.c +@@ -703,7 +703,7 @@ static void battery_hook_unregister_unlocked(struct acpi_battery_hook *hook) + list_for_each_entry(battery, &acpi_battery_list, list) { + hook->remove_battery(battery->bat); + } +- list_del(&hook->list); ++ list_del_init(&hook->list); + + pr_info("extension unregistered: %s\n", hook->name); + } +@@ -711,7 +711,14 @@ static void battery_hook_unregister_unlocked(struct acpi_battery_hook *hook) + void battery_hook_unregister(struct acpi_battery_hook *hook) + { + mutex_lock(&hook_mutex); +- battery_hook_unregister_unlocked(hook); ++ /* ++ * Ignore already unregistered battery hooks. This might happen ++ * if a battery hook was previously unloaded due to an error when ++ * adding a new battery. ++ */ ++ if (!list_empty(&hook->list)) ++ battery_hook_unregister_unlocked(hook); ++ + mutex_unlock(&hook_mutex); + } + EXPORT_SYMBOL_GPL(battery_hook_unregister); +@@ -721,7 +728,6 @@ void battery_hook_register(struct acpi_battery_hook *hook) + struct acpi_battery *battery; + + mutex_lock(&hook_mutex); +- INIT_LIST_HEAD(&hook->list); + list_add(&hook->list, &battery_hook_list); + /* + * Now that the driver is registered, we need +-- +2.43.0 + diff --git a/queue-6.1/acpi-battery-simplify-battery-hook-locking.patch b/queue-6.1/acpi-battery-simplify-battery-hook-locking.patch new file mode 100644 index 00000000000..738cbcd9e89 --- /dev/null +++ b/queue-6.1/acpi-battery-simplify-battery-hook-locking.patch @@ -0,0 +1,95 @@ +From 9f7c3b123c749e882bd9727d986f3d558144a084 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Oct 2024 23:28:33 +0200 +Subject: ACPI: battery: Simplify battery hook locking +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Armin Wolf + +[ Upstream commit 86309cbed26139e1caae7629dcca1027d9a28e75 ] + +Move the conditional locking from __battery_hook_unregister() +into battery_hook_unregister() and rename the low-level function +to simplify the locking during battery hook removal. + +Reviewed-by: Ilpo Järvinen +Reviewed-by: Pali Rohár +Signed-off-by: Armin Wolf +Link: https://patch.msgid.link/20241001212835.341788-2-W_Armin@gmx.de +Signed-off-by: Rafael J. Wysocki +Stable-dep-of: 76959aff14a0 ("ACPI: battery: Fix possible crash when unregistering a battery hook") +Signed-off-by: Sasha Levin +--- + drivers/acpi/battery.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c +index 088740fdea355..59d38c6e45d83 100644 +--- a/drivers/acpi/battery.c ++++ b/drivers/acpi/battery.c +@@ -692,27 +692,27 @@ static LIST_HEAD(acpi_battery_list); + static LIST_HEAD(battery_hook_list); + static DEFINE_MUTEX(hook_mutex); + +-static void __battery_hook_unregister(struct acpi_battery_hook *hook, int lock) ++static void battery_hook_unregister_unlocked(struct acpi_battery_hook *hook) + { + struct acpi_battery *battery; ++ + /* + * In order to remove a hook, we first need to + * de-register all the batteries that are registered. + */ +- if (lock) +- mutex_lock(&hook_mutex); + list_for_each_entry(battery, &acpi_battery_list, list) { + hook->remove_battery(battery->bat); + } + list_del(&hook->list); +- if (lock) +- mutex_unlock(&hook_mutex); ++ + pr_info("extension unregistered: %s\n", hook->name); + } + + void battery_hook_unregister(struct acpi_battery_hook *hook) + { +- __battery_hook_unregister(hook, 1); ++ mutex_lock(&hook_mutex); ++ battery_hook_unregister_unlocked(hook); ++ mutex_unlock(&hook_mutex); + } + EXPORT_SYMBOL_GPL(battery_hook_unregister); + +@@ -738,7 +738,7 @@ void battery_hook_register(struct acpi_battery_hook *hook) + * hooks. + */ + pr_err("extension failed to load: %s", hook->name); +- __battery_hook_unregister(hook, 0); ++ battery_hook_unregister_unlocked(hook); + goto end; + } + } +@@ -775,7 +775,7 @@ static void battery_hook_add_battery(struct acpi_battery *battery) + */ + pr_err("error in extension, unloading: %s", + hook_node->name); +- __battery_hook_unregister(hook_node, 0); ++ battery_hook_unregister_unlocked(hook_node); + } + } + mutex_unlock(&hook_mutex); +@@ -808,7 +808,7 @@ static void __exit battery_hook_exit(void) + * need to remove the hooks. + */ + list_for_each_entry_safe(hook, ptr, &battery_hook_list, list) { +- __battery_hook_unregister(hook, 1); ++ battery_hook_unregister(hook); + } + mutex_destroy(&hook_mutex); + } +-- +2.43.0 + diff --git a/queue-6.1/arm64-add-cortex-715-cpu-part-definition.patch b/queue-6.1/arm64-add-cortex-715-cpu-part-definition.patch new file mode 100644 index 00000000000..6656544b832 --- /dev/null +++ b/queue-6.1/arm64-add-cortex-715-cpu-part-definition.patch @@ -0,0 +1,51 @@ +From 9a617146468a3e68d9001d3be4c85673025d3919 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Oct 2024 13:12:47 +0100 +Subject: arm64: Add Cortex-715 CPU part definition + +From: Anshuman Khandual + +[ Upstream commit 07e39e60bbf0ccd5f895568e1afca032193705c0 ] + +Add the CPU Partnumbers for the new Arm designs. + +Cc: Catalin Marinas +Cc: Will Deacon +Cc: Suzuki K Poulose +Cc: James Morse +Cc: linux-arm-kernel@lists.infradead.org +Cc: linux-kernel@vger.kernel.org +Acked-by: Catalin Marinas +Signed-off-by: Anshuman Khandual +Link: https://lore.kernel.org/r/20221116140915.356601-2-anshuman.khandual@arm.com +Signed-off-by: Will Deacon +[ Mark: Trivial backport ] +Signed-off-by: Mark Rutland +Signed-off-by: Sasha Levin +--- + arch/arm64/include/asm/cputype.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h +index a0a028a6b9670..9916346948ba2 100644 +--- a/arch/arm64/include/asm/cputype.h ++++ b/arch/arm64/include/asm/cputype.h +@@ -82,6 +82,7 @@ + #define ARM_CPU_PART_CORTEX_A510 0xD46 + #define ARM_CPU_PART_CORTEX_A520 0xD80 + #define ARM_CPU_PART_CORTEX_A710 0xD47 ++#define ARM_CPU_PART_CORTEX_A715 0xD4D + #define ARM_CPU_PART_CORTEX_X2 0xD48 + #define ARM_CPU_PART_NEOVERSE_N2 0xD49 + #define ARM_CPU_PART_CORTEX_A78C 0xD4B +@@ -156,6 +157,7 @@ + #define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510) + #define MIDR_CORTEX_A520 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A520) + #define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710) ++#define MIDR_CORTEX_A715 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A715) + #define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2) + #define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N2) + #define MIDR_CORTEX_A78C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78C) +-- +2.43.0 + diff --git a/queue-6.1/arm64-cputype-add-neoverse-n3-definitions.patch b/queue-6.1/arm64-cputype-add-neoverse-n3-definitions.patch new file mode 100644 index 00000000000..bc7927a168d --- /dev/null +++ b/queue-6.1/arm64-cputype-add-neoverse-n3-definitions.patch @@ -0,0 +1,52 @@ +From f408e76474049e883af293aab99829ac95d8479a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Oct 2024 13:12:48 +0100 +Subject: arm64: cputype: Add Neoverse-N3 definitions + +From: Mark Rutland + +[ Upstream commit 924725707d80bc2588cefafef76ff3f164d299bc ] + +Add cputype definitions for Neoverse-N3. These will be used for errata +detection in subsequent patches. + +These values can be found in Table A-261 ("MIDR_EL1 bit descriptions") +in issue 02 of the Neoverse-N3 TRM, which can be found at: + + https://developer.arm.com/documentation/107997/0000/?lang=en + +Signed-off-by: Mark Rutland +Cc: James Morse +Cc: Will Deacon +Link: https://lore.kernel.org/r/20240930111705.3352047-2-mark.rutland@arm.com +Signed-off-by: Catalin Marinas +[ Mark: trivial backport ] +Signed-off-by: Mark Rutland +Signed-off-by: Sasha Levin +--- + arch/arm64/include/asm/cputype.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h +index 9916346948ba2..8efc3302bf96b 100644 +--- a/arch/arm64/include/asm/cputype.h ++++ b/arch/arm64/include/asm/cputype.h +@@ -94,6 +94,7 @@ + #define ARM_CPU_PART_NEOVERSE_V3 0xD84 + #define ARM_CPU_PART_CORTEX_X925 0xD85 + #define ARM_CPU_PART_CORTEX_A725 0xD87 ++#define ARM_CPU_PART_NEOVERSE_N3 0xD8E + + #define APM_CPU_PART_XGENE 0x000 + #define APM_CPU_VAR_POTENZA 0x00 +@@ -169,6 +170,7 @@ + #define MIDR_NEOVERSE_V3 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V3) + #define MIDR_CORTEX_X925 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X925) + #define MIDR_CORTEX_A725 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A725) ++#define MIDR_NEOVERSE_N3 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N3) + #define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX) + #define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX) + #define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX) +-- +2.43.0 + diff --git a/queue-6.1/arm64-errata-expand-speculative-ssbs-workaround-once.patch b/queue-6.1/arm64-errata-expand-speculative-ssbs-workaround-once.patch new file mode 100644 index 00000000000..70360c95ae9 --- /dev/null +++ b/queue-6.1/arm64-errata-expand-speculative-ssbs-workaround-once.patch @@ -0,0 +1,114 @@ +From 0c982da88510ac635892712f63e6e488bfd4c64b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Oct 2024 13:12:49 +0100 +Subject: arm64: errata: Expand speculative SSBS workaround once more + +From: Mark Rutland + +[ Upstream commit 081eb7932c2b244f63317a982c5e3990e2c7fbdd ] + +A number of Arm Ltd CPUs suffer from errata whereby an MSR to the SSBS +special-purpose register does not affect subsequent speculative +instructions, permitting speculative store bypassing for a window of +time. + +We worked around this for a number of CPUs in commits: + +* 7187bb7d0b5c7dfa ("arm64: errata: Add workaround for Arm errata 3194386 and 3312417") +* 75b3c43eab594bfb ("arm64: errata: Expand speculative SSBS workaround") +* 145502cac7ea70b5 ("arm64: errata: Expand speculative SSBS workaround (again)") + +Since then, a (hopefully final) batch of updates have been published, +with two more affected CPUs. For the affected CPUs the existing +mitigation is sufficient, as described in their respective Software +Developer Errata Notice (SDEN) documents: + +* Cortex-A715 (MP148) SDEN v15.0, erratum 3456084 + https://developer.arm.com/documentation/SDEN-2148827/1500/ + +* Neoverse-N3 (MP195) SDEN v5.0, erratum 3456111 + https://developer.arm.com/documentation/SDEN-3050973/0500/ + +Enable the existing mitigation by adding the relevant MIDRs to +erratum_spec_ssbs_list, and update silicon-errata.rst and the +Kconfig text accordingly. + +Signed-off-by: Mark Rutland +Cc: James Morse +Cc: Will Deacon +Link: https://lore.kernel.org/r/20240930111705.3352047-3-mark.rutland@arm.com +Signed-off-by: Catalin Marinas +[ Mark: fix conflict in silicon-errata.rst, handle move ] +Signed-off-by: Mark Rutland +Signed-off-by: Sasha Levin +--- + Documentation/arm64/silicon-errata.rst | 4 ++++ + arch/arm64/Kconfig | 2 ++ + arch/arm64/kernel/cpu_errata.c | 2 ++ + 3 files changed, 8 insertions(+) + +diff --git a/Documentation/arm64/silicon-errata.rst b/Documentation/arm64/silicon-errata.rst +index 6451e9198fef7..e7b50babd0d5c 100644 +--- a/Documentation/arm64/silicon-errata.rst ++++ b/Documentation/arm64/silicon-errata.rst +@@ -135,6 +135,8 @@ stable kernels. + +----------------+-----------------+-----------------+-----------------------------+ + | ARM | Cortex-A710 | #3324338 | ARM64_ERRATUM_3194386 | + +----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Cortex-A715 | #3456084 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ + | ARM | Cortex-A720 | #3456091 | ARM64_ERRATUM_3194386 | + +----------------+-----------------+-----------------+-----------------------------+ + | ARM | Cortex-A725 | #3456106 | ARM64_ERRATUM_3194386 | +@@ -171,6 +173,8 @@ stable kernels. + +----------------+-----------------+-----------------+-----------------------------+ + | ARM | Neoverse-N2 | #3324339 | ARM64_ERRATUM_3194386 | + +----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Neoverse-N3 | #3456111 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ + | ARM | Neoverse-V1 | #3324341 | ARM64_ERRATUM_3194386 | + +----------------+-----------------+-----------------+-----------------------------+ + | ARM | Neoverse-V2 | #3324336 | ARM64_ERRATUM_3194386 | +diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig +index 2ef939075039d..1a62ef142a988 100644 +--- a/arch/arm64/Kconfig ++++ b/arch/arm64/Kconfig +@@ -1012,6 +1012,7 @@ config ARM64_ERRATUM_3194386 + * ARM Cortex-A78C erratum 3324346 + * ARM Cortex-A78C erratum 3324347 + * ARM Cortex-A710 erratam 3324338 ++ * ARM Cortex-A715 errartum 3456084 + * ARM Cortex-A720 erratum 3456091 + * ARM Cortex-A725 erratum 3456106 + * ARM Cortex-X1 erratum 3324344 +@@ -1022,6 +1023,7 @@ config ARM64_ERRATUM_3194386 + * ARM Cortex-X925 erratum 3324334 + * ARM Neoverse-N1 erratum 3324349 + * ARM Neoverse N2 erratum 3324339 ++ * ARM Neoverse-N3 erratum 3456111 + * ARM Neoverse-V1 erratum 3324341 + * ARM Neoverse V2 erratum 3324336 + * ARM Neoverse-V3 erratum 3312417 +diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c +index 7640031e1b845..78aea409b092b 100644 +--- a/arch/arm64/kernel/cpu_errata.c ++++ b/arch/arm64/kernel/cpu_errata.c +@@ -442,6 +442,7 @@ static const struct midr_range erratum_spec_ssbs_list[] = { + MIDR_ALL_VERSIONS(MIDR_CORTEX_A78), + MIDR_ALL_VERSIONS(MIDR_CORTEX_A78C), + MIDR_ALL_VERSIONS(MIDR_CORTEX_A710), ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_A715), + MIDR_ALL_VERSIONS(MIDR_CORTEX_A720), + MIDR_ALL_VERSIONS(MIDR_CORTEX_A725), + MIDR_ALL_VERSIONS(MIDR_CORTEX_X1), +@@ -452,6 +453,7 @@ static const struct midr_range erratum_spec_ssbs_list[] = { + MIDR_ALL_VERSIONS(MIDR_CORTEX_X925), + MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1), + MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2), ++ MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N3), + MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V1), + MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V2), + MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V3), +-- +2.43.0 + diff --git a/queue-6.1/build-id-require-program-headers-to-be-right-after-e.patch b/queue-6.1/build-id-require-program-headers-to-be-right-after-e.patch new file mode 100644 index 00000000000..ed18062168e --- /dev/null +++ b/queue-6.1/build-id-require-program-headers-to-be-right-after-e.patch @@ -0,0 +1,66 @@ +From 6edee31ac84298407eabf5d0d01c24dd1aa51de3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jun 2024 21:39:33 +0300 +Subject: build-id: require program headers to be right after ELF header + +From: Alexey Dobriyan + +[ Upstream commit 961a2851324561caed579764ffbee3db82b32829 ] + +Neither ELF spec not ELF loader require program header to be placed right +after ELF header, but build-id code very much assumes such placement: + +See + + find_get_page(vma->vm_file->f_mapping, 0); + +line and checks against PAGE_SIZE. + +Returns errors for now until someone rewrites build-id parser +to be more inline with load_elf_binary(). + +Link: https://lkml.kernel.org/r/d58bc281-6ca7-467a-9a64-40fa214bd63e@p183 +Signed-off-by: Alexey Dobriyan +Reviewed-by: Jiri Olsa +Signed-off-by: Andrew Morton +Stable-dep-of: 905415ff3ffb ("lib/buildid: harden build ID parsing logic") +Signed-off-by: Sasha Levin +--- + lib/buildid.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/lib/buildid.c b/lib/buildid.c +index dfc62625cae4e..493537344fc81 100644 +--- a/lib/buildid.c ++++ b/lib/buildid.c +@@ -73,6 +73,13 @@ static int get_build_id_32(const void *page_addr, unsigned char *build_id, + Elf32_Phdr *phdr; + int i; + ++ /* ++ * FIXME ++ * Neither ELF spec nor ELF loader require that program headers ++ * start immediately after ELF header. ++ */ ++ if (ehdr->e_phoff != sizeof(Elf32_Ehdr)) ++ return -EINVAL; + /* only supports phdr that fits in one page */ + if (ehdr->e_phnum > + (PAGE_SIZE - sizeof(Elf32_Ehdr)) / sizeof(Elf32_Phdr)) +@@ -98,6 +105,13 @@ static int get_build_id_64(const void *page_addr, unsigned char *build_id, + Elf64_Phdr *phdr; + int i; + ++ /* ++ * FIXME ++ * Neither ELF spec nor ELF loader require that program headers ++ * start immediately after ELF header. ++ */ ++ if (ehdr->e_phoff != sizeof(Elf64_Ehdr)) ++ return -EINVAL; + /* only supports phdr that fits in one page */ + if (ehdr->e_phnum > + (PAGE_SIZE - sizeof(Elf64_Ehdr)) / sizeof(Elf64_Phdr)) +-- +2.43.0 + diff --git a/queue-6.1/clk-imx6ul-add-ethernet-refclock-mux-support.patch b/queue-6.1/clk-imx6ul-add-ethernet-refclock-mux-support.patch new file mode 100644 index 00000000000..fbd0d4bdf8f --- /dev/null +++ b/queue-6.1/clk-imx6ul-add-ethernet-refclock-mux-support.patch @@ -0,0 +1,134 @@ +From 0ad5a55ed36d39ce5f35ed3deadfdf440a3445bb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 31 Jan 2023 09:46:39 +0100 +Subject: clk: imx6ul: add ethernet refclock mux support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Oleksij Rempel + +[ Upstream commit 4e197ee880c24ecb63f7fe17449b3653bc64b03c ] + +Add ethernet refclock mux support and set it to internal clock by +default. This configuration will not affect existing boards. + +clock tree before this patch: +fec1 <- enet1_ref_125m (gate) <- enet1_ref (divider) <-, + |- pll6_enet +fec2 <- enet2_ref_125m (gate) <- enet2_ref (divider) <-´ + +after this patch: +fec1 <- enet1_ref_sel(mux) <- enet1_ref_125m (gate) <- ... + `--<> enet1_ref_pad |- pll6_enet +fec2 <- enet2_ref_sel(mux) <- enet2_ref_125m (gate) <- ... + `--<> enet2_ref_pad + +Signed-off-by: Oleksij Rempel +Acked-by: Lee Jones +Reviewed-by: Abel Vesa +Signed-off-by: Abel Vesa +Link: https://lore.kernel.org/r/20230131084642.709385-17-o.rempel@pengutronix.de +Stable-dep-of: 32c055ef563c ("clk: imx6ul: fix clock parent for IMX6UL_CLK_ENETx_REF_SEL") +Signed-off-by: Sasha Levin +--- + drivers/clk/imx/clk-imx6ul.c | 26 +++++++++++++++++++++ + include/dt-bindings/clock/imx6ul-clock.h | 6 ++++- + include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | 6 +++-- + 3 files changed, 35 insertions(+), 3 deletions(-) + +diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c +index 777c4d2b87b3f..3e802befa2d4d 100644 +--- a/drivers/clk/imx/clk-imx6ul.c ++++ b/drivers/clk/imx/clk-imx6ul.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -94,6 +95,17 @@ static const struct clk_div_table video_div_table[] = { + { } + }; + ++static const char * enet1_ref_sels[] = { "enet1_ref_125m", "enet1_ref_pad", }; ++static const u32 enet1_ref_sels_table[] = { IMX6UL_GPR1_ENET1_TX_CLK_DIR, ++ IMX6UL_GPR1_ENET1_CLK_SEL }; ++static const u32 enet1_ref_sels_table_mask = IMX6UL_GPR1_ENET1_TX_CLK_DIR | ++ IMX6UL_GPR1_ENET1_CLK_SEL; ++static const char * enet2_ref_sels[] = { "enet2_ref_125m", "enet2_ref_pad", }; ++static const u32 enet2_ref_sels_table[] = { IMX6UL_GPR1_ENET2_TX_CLK_DIR, ++ IMX6UL_GPR1_ENET2_CLK_SEL }; ++static const u32 enet2_ref_sels_table_mask = IMX6UL_GPR1_ENET2_TX_CLK_DIR | ++ IMX6UL_GPR1_ENET2_CLK_SEL; ++ + static u32 share_count_asrc; + static u32 share_count_audio; + static u32 share_count_sai1; +@@ -472,6 +484,17 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node) + /* mask handshake of mmdc */ + imx_mmdc_mask_handshake(base, 0); + ++ hws[IMX6UL_CLK_ENET1_REF_PAD] = imx_obtain_fixed_of_clock(ccm_node, "enet1_ref_pad", 0); ++ ++ hws[IMX6UL_CLK_ENET1_REF_SEL] = imx_clk_gpr_mux("enet1_ref_sel", "fsl,imx6ul-iomuxc-gpr", ++ IOMUXC_GPR1, enet1_ref_sels, ARRAY_SIZE(enet1_ref_sels), ++ enet1_ref_sels_table, enet1_ref_sels_table_mask); ++ hws[IMX6UL_CLK_ENET2_REF_PAD] = imx_obtain_fixed_of_clock(ccm_node, "enet2_ref_pad", 0); ++ ++ hws[IMX6UL_CLK_ENET2_REF_SEL] = imx_clk_gpr_mux("enet2_ref_sel", "fsl,imx6ul-iomuxc-gpr", ++ IOMUXC_GPR1, enet2_ref_sels, ARRAY_SIZE(enet2_ref_sels), ++ enet2_ref_sels_table, enet2_ref_sels_table_mask); ++ + imx_check_clk_hws(hws, IMX6UL_CLK_END); + + of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data); +@@ -516,6 +539,9 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node) + clk_set_parent(hws[IMX6ULL_CLK_EPDC_PRE_SEL]->clk, hws[IMX6UL_CLK_PLL3_PFD2]->clk); + + clk_set_parent(hws[IMX6UL_CLK_ENFC_SEL]->clk, hws[IMX6UL_CLK_PLL2_PFD2]->clk); ++ ++ clk_set_parent(hws[IMX6UL_CLK_ENET1_REF_SEL]->clk, hws[IMX6UL_CLK_ENET_REF]->clk); ++ clk_set_parent(hws[IMX6UL_CLK_ENET2_REF_SEL]->clk, hws[IMX6UL_CLK_ENET2_REF]->clk); + } + + CLK_OF_DECLARE(imx6ul, "fsl,imx6ul-ccm", imx6ul_clocks_init); +diff --git a/include/dt-bindings/clock/imx6ul-clock.h b/include/dt-bindings/clock/imx6ul-clock.h +index b44920f1edb0d..66239ebc0e233 100644 +--- a/include/dt-bindings/clock/imx6ul-clock.h ++++ b/include/dt-bindings/clock/imx6ul-clock.h +@@ -257,7 +257,11 @@ + #define IMX6UL_CLK_GPIO5 248 + #define IMX6UL_CLK_MMDC_P1_IPG 249 + #define IMX6UL_CLK_ENET1_REF_125M 250 ++#define IMX6UL_CLK_ENET1_REF_SEL 251 ++#define IMX6UL_CLK_ENET1_REF_PAD 252 ++#define IMX6UL_CLK_ENET2_REF_SEL 253 ++#define IMX6UL_CLK_ENET2_REF_PAD 254 + +-#define IMX6UL_CLK_END 251 ++#define IMX6UL_CLK_END 255 + + #endif /* __DT_BINDINGS_CLOCK_IMX6UL_H */ +diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h +index d4b5e527a7a3b..09c6b3184bb04 100644 +--- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h ++++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h +@@ -451,8 +451,10 @@ + #define IMX6SX_GPR12_PCIE_RX_EQ_2 (0x2 << 0) + + /* For imx6ul iomux gpr register field define */ +-#define IMX6UL_GPR1_ENET1_CLK_DIR (0x1 << 17) +-#define IMX6UL_GPR1_ENET2_CLK_DIR (0x1 << 18) ++#define IMX6UL_GPR1_ENET2_TX_CLK_DIR BIT(18) ++#define IMX6UL_GPR1_ENET1_TX_CLK_DIR BIT(17) ++#define IMX6UL_GPR1_ENET2_CLK_SEL BIT(14) ++#define IMX6UL_GPR1_ENET1_CLK_SEL BIT(13) + #define IMX6UL_GPR1_ENET1_CLK_OUTPUT (0x1 << 17) + #define IMX6UL_GPR1_ENET2_CLK_OUTPUT (0x1 << 18) + #define IMX6UL_GPR1_ENET_CLK_DIR (0x3 << 17) +-- +2.43.0 + diff --git a/queue-6.1/clk-imx6ul-fix-clock-parent-for-imx6ul_clk_enetx_ref.patch b/queue-6.1/clk-imx6ul-fix-clock-parent-for-imx6ul_clk_enetx_ref.patch new file mode 100644 index 00000000000..f685cc8d05e --- /dev/null +++ b/queue-6.1/clk-imx6ul-fix-clock-parent-for-imx6ul_clk_enetx_ref.patch @@ -0,0 +1,47 @@ +From 2658da8276610b018cf43d1315317d5d440900aa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Sep 2024 09:05:53 +0000 +Subject: clk: imx6ul: fix clock parent for IMX6UL_CLK_ENETx_REF_SEL + +From: Michel Alex + +[ Upstream commit 32c055ef563c3a4a73a477839f591b1b170bde8e ] + +Commit 4e197ee880c24ecb63f7fe17449b3653bc64b03c ("clk: imx6ul: add +ethernet refclock mux support") sets the internal clock as default +ethernet clock. + +Since IMX6UL_CLK_ENET_REF cannot be parent for IMX6UL_CLK_ENET1_REF_SEL, +the call to clk_set_parent() fails. IMX6UL_CLK_ENET1_REF_125M is the correct +parent and shall be used instead. +Same applies for IMX6UL_CLK_ENET2_REF_SEL, for which IMX6UL_CLK_ENET2_REF_125M +is the correct parent. + +Cc: stable@vger.kernel.org +Signed-off-by: Alex Michel +Reviewed-by: Oleksij Rempel +Link: https://lore.kernel.org/r/AS1P250MB0608F9CE4009DCE65C61EEDEA9922@AS1P250MB0608.EURP250.PROD.OUTLOOK.COM +Signed-off-by: Abel Vesa +Signed-off-by: Sasha Levin +--- + drivers/clk/imx/clk-imx6ul.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c +index ef6c94b732684..c4266d732f7c1 100644 +--- a/drivers/clk/imx/clk-imx6ul.c ++++ b/drivers/clk/imx/clk-imx6ul.c +@@ -540,8 +540,8 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node) + + clk_set_parent(hws[IMX6UL_CLK_ENFC_SEL]->clk, hws[IMX6UL_CLK_PLL2_PFD2]->clk); + +- clk_set_parent(hws[IMX6UL_CLK_ENET1_REF_SEL]->clk, hws[IMX6UL_CLK_ENET_REF]->clk); +- clk_set_parent(hws[IMX6UL_CLK_ENET2_REF_SEL]->clk, hws[IMX6UL_CLK_ENET2_REF]->clk); ++ clk_set_parent(hws[IMX6UL_CLK_ENET1_REF_SEL]->clk, hws[IMX6UL_CLK_ENET1_REF_125M]->clk); ++ clk_set_parent(hws[IMX6UL_CLK_ENET2_REF_SEL]->clk, hws[IMX6UL_CLK_ENET2_REF_125M]->clk); + + imx_register_uart_clocks(); + } +-- +2.43.0 + diff --git a/queue-6.1/clk-imx6ul-fix-enet1-gate-configuration.patch b/queue-6.1/clk-imx6ul-fix-enet1-gate-configuration.patch new file mode 100644 index 00000000000..450c532fb6b --- /dev/null +++ b/queue-6.1/clk-imx6ul-fix-enet1-gate-configuration.patch @@ -0,0 +1,88 @@ +From f35990348b9d51cb91121e2cb2220d0eb804e010 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 31 Jan 2023 09:46:38 +0100 +Subject: clk: imx6ul: fix enet1 gate configuration +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Oleksij Rempel + +[ Upstream commit 5f82bfced6118450cb9ea3f12316568f6fac10ab ] + +According to the "i.MX 6UltraLite Applications Processor Reference Manual, +Rev. 2, 03/2017", BIT(13) is ENET1_125M_EN which is not controlling root +of PLL6. It is controlling ENET1 separately. + +So, instead of this picture (implementation before this patch): +fec1 <- enet_ref (divider) <---------------------------, + |- pll6_enet (gate) +fec2 <- enet2_ref_125m (gate) <- enet2_ref (divider) <-´ + +we should have this one (after this patch): +fec1 <- enet1_ref_125m (gate) <- enet1_ref (divider) <-, + |- pll6_enet +fec2 <- enet2_ref_125m (gate) <- enet2_ref (divider) <-´ + +With this fix, the RMII reference clock will be turned off, after +setting network interface down on each separate interface +(ip l s dev eth0 down). Which was not working before, on system with both +FECs enabled. + +Signed-off-by: Oleksij Rempel +Reviewed-by: Abel Vesa +Signed-off-by: Abel Vesa +Link: https://lore.kernel.org/r/20230131084642.709385-16-o.rempel@pengutronix.de +Stable-dep-of: 32c055ef563c ("clk: imx6ul: fix clock parent for IMX6UL_CLK_ENETx_REF_SEL") +Signed-off-by: Sasha Levin +--- + drivers/clk/imx/clk-imx6ul.c | 7 ++++--- + include/dt-bindings/clock/imx6ul-clock.h | 3 ++- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c +index 520b100bff4bb..777c4d2b87b3f 100644 +--- a/drivers/clk/imx/clk-imx6ul.c ++++ b/drivers/clk/imx/clk-imx6ul.c +@@ -176,7 +176,7 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node) + hws[IMX6UL_CLK_PLL3_USB_OTG] = imx_clk_hw_gate("pll3_usb_otg", "pll3_bypass", base + 0x10, 13); + hws[IMX6UL_CLK_PLL4_AUDIO] = imx_clk_hw_gate("pll4_audio", "pll4_bypass", base + 0x70, 13); + hws[IMX6UL_CLK_PLL5_VIDEO] = imx_clk_hw_gate("pll5_video", "pll5_bypass", base + 0xa0, 13); +- hws[IMX6UL_CLK_PLL6_ENET] = imx_clk_hw_gate("pll6_enet", "pll6_bypass", base + 0xe0, 13); ++ hws[IMX6UL_CLK_PLL6_ENET] = imx_clk_hw_fixed_factor("pll6_enet", "pll6_bypass", 1, 1); + hws[IMX6UL_CLK_PLL7_USB_HOST] = imx_clk_hw_gate("pll7_usb_host", "pll7_bypass", base + 0x20, 13); + + /* +@@ -205,12 +205,13 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node) + hws[IMX6UL_CLK_PLL3_PFD2] = imx_clk_hw_pfd("pll3_pfd2_508m", "pll3_usb_otg", base + 0xf0, 2); + hws[IMX6UL_CLK_PLL3_PFD3] = imx_clk_hw_pfd("pll3_pfd3_454m", "pll3_usb_otg", base + 0xf0, 3); + +- hws[IMX6UL_CLK_ENET_REF] = clk_hw_register_divider_table(NULL, "enet_ref", "pll6_enet", 0, ++ hws[IMX6UL_CLK_ENET_REF] = clk_hw_register_divider_table(NULL, "enet1_ref", "pll6_enet", 0, + base + 0xe0, 0, 2, 0, clk_enet_ref_table, &imx_ccm_lock); + hws[IMX6UL_CLK_ENET2_REF] = clk_hw_register_divider_table(NULL, "enet2_ref", "pll6_enet", 0, + base + 0xe0, 2, 2, 0, clk_enet_ref_table, &imx_ccm_lock); + +- hws[IMX6UL_CLK_ENET2_REF_125M] = imx_clk_hw_gate("enet_ref_125m", "enet2_ref", base + 0xe0, 20); ++ hws[IMX6UL_CLK_ENET1_REF_125M] = imx_clk_hw_gate("enet1_ref_125m", "enet1_ref", base + 0xe0, 13); ++ hws[IMX6UL_CLK_ENET2_REF_125M] = imx_clk_hw_gate("enet2_ref_125m", "enet2_ref", base + 0xe0, 20); + hws[IMX6UL_CLK_ENET_PTP_REF] = imx_clk_hw_fixed_factor("enet_ptp_ref", "pll6_enet", 1, 20); + hws[IMX6UL_CLK_ENET_PTP] = imx_clk_hw_gate("enet_ptp", "enet_ptp_ref", base + 0xe0, 21); + +diff --git a/include/dt-bindings/clock/imx6ul-clock.h b/include/dt-bindings/clock/imx6ul-clock.h +index 79094338e6f1e..b44920f1edb0d 100644 +--- a/include/dt-bindings/clock/imx6ul-clock.h ++++ b/include/dt-bindings/clock/imx6ul-clock.h +@@ -256,7 +256,8 @@ + #define IMX6UL_CLK_GPIO4 247 + #define IMX6UL_CLK_GPIO5 248 + #define IMX6UL_CLK_MMDC_P1_IPG 249 ++#define IMX6UL_CLK_ENET1_REF_125M 250 + +-#define IMX6UL_CLK_END 250 ++#define IMX6UL_CLK_END 251 + + #endif /* __DT_BINDINGS_CLOCK_IMX6UL_H */ +-- +2.43.0 + diff --git a/queue-6.1/clk-imx6ul-retain-early-uart-clocks-during-kernel-in.patch b/queue-6.1/clk-imx6ul-retain-early-uart-clocks-during-kernel-in.patch new file mode 100644 index 00000000000..9b16887a37b --- /dev/null +++ b/queue-6.1/clk-imx6ul-retain-early-uart-clocks-during-kernel-in.patch @@ -0,0 +1,38 @@ +From cb9fb9964fe8b890c863dbdfb0c3b559977de75b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Apr 2023 13:55:17 +0200 +Subject: clk: imx6ul: retain early UART clocks during kernel init + +From: Alexander Stein + +[ Upstream commit 912d7af473f163ccdeb02aaabc3534177936b86c ] + +Make sure to keep UART clocks enabled during kernel init if +earlyprintk or earlycon are active. + +Signed-off-by: Alexander Stein +Reviewed-by: Peng Fan +Link: https://lore.kernel.org/r/20230421115517.1940990-1-alexander.stein@ew.tq-group.com +Signed-off-by: Abel Vesa +Stable-dep-of: 32c055ef563c ("clk: imx6ul: fix clock parent for IMX6UL_CLK_ENETx_REF_SEL") +Signed-off-by: Sasha Levin +--- + drivers/clk/imx/clk-imx6ul.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c +index 3e802befa2d4d..ef6c94b732684 100644 +--- a/drivers/clk/imx/clk-imx6ul.c ++++ b/drivers/clk/imx/clk-imx6ul.c +@@ -542,6 +542,8 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node) + + clk_set_parent(hws[IMX6UL_CLK_ENET1_REF_SEL]->clk, hws[IMX6UL_CLK_ENET_REF]->clk); + clk_set_parent(hws[IMX6UL_CLK_ENET2_REF_SEL]->clk, hws[IMX6UL_CLK_ENET2_REF]->clk); ++ ++ imx_register_uart_clocks(); + } + + CLK_OF_DECLARE(imx6ul, "fsl,imx6ul-ccm", imx6ul_clocks_init); +-- +2.43.0 + diff --git a/queue-6.1/clk-qcom-gcc-sc8180x-add-gpll9-support.patch b/queue-6.1/clk-qcom-gcc-sc8180x-add-gpll9-support.patch new file mode 100644 index 00000000000..18481ff4301 --- /dev/null +++ b/queue-6.1/clk-qcom-gcc-sc8180x-add-gpll9-support.patch @@ -0,0 +1,71 @@ +From 59aecf413b3add704fef7b455c67ec268d3ea1e5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 12 Aug 2024 10:43:03 +0530 +Subject: clk: qcom: gcc-sc8180x: Add GPLL9 support + +From: Satya Priya Kakitapalli + +[ Upstream commit 818a2f8d5e4ad2c1e39a4290158fe8e39a744c70 ] + +Add the missing GPLL9 pll and fix the gcc_parents_7 data to use +the correct pll hw. + +Fixes: 4433594bbe5d ("clk: qcom: gcc: Add global clock controller driver for SC8180x") +Cc: stable@vger.kernel.org +Reviewed-by: Dmitry Baryshkov +Signed-off-by: Satya Priya Kakitapalli +Link: https://lore.kernel.org/r/20240812-gcc-sc8180x-fixes-v2-3-8b3eaa5fb856@quicinc.com +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + drivers/clk/qcom/gcc-sc8180x.c | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/drivers/clk/qcom/gcc-sc8180x.c b/drivers/clk/qcom/gcc-sc8180x.c +index 8c986a60e62c7..ba004281f2944 100644 +--- a/drivers/clk/qcom/gcc-sc8180x.c ++++ b/drivers/clk/qcom/gcc-sc8180x.c +@@ -143,6 +143,23 @@ static struct clk_alpha_pll gpll7 = { + }, + }; + ++static struct clk_alpha_pll gpll9 = { ++ .offset = 0x1c000, ++ .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_TRION], ++ .clkr = { ++ .enable_reg = 0x52000, ++ .enable_mask = BIT(9), ++ .hw.init = &(const struct clk_init_data) { ++ .name = "gpll9", ++ .parent_data = &(const struct clk_parent_data) { ++ .fw_name = "bi_tcxo", ++ }, ++ .num_parents = 1, ++ .ops = &clk_alpha_pll_fixed_trion_ops, ++ }, ++ }, ++}; ++ + static const struct parent_map gcc_parent_map_0[] = { + { P_BI_TCXO, 0 }, + { P_GPLL0_OUT_MAIN, 1 }, +@@ -242,7 +259,7 @@ static const struct parent_map gcc_parent_map_7[] = { + static const struct clk_parent_data gcc_parents_7[] = { + { .fw_name = "bi_tcxo", }, + { .hw = &gpll0.clkr.hw }, +- { .name = "gppl9" }, ++ { .hw = &gpll9.clkr.hw }, + { .hw = &gpll4.clkr.hw }, + { .hw = &gpll0_out_even.clkr.hw }, + }; +@@ -4420,6 +4437,7 @@ static struct clk_regmap *gcc_sc8180x_clocks[] = { + [GPLL1] = &gpll1.clkr, + [GPLL4] = &gpll4.clkr, + [GPLL7] = &gpll7.clkr, ++ [GPLL9] = &gpll9.clkr, + }; + + static const struct qcom_reset_map gcc_sc8180x_resets[] = { +-- +2.43.0 + diff --git a/queue-6.1/clk-samsung-exynos7885-do-not-define-number-of-clock.patch b/queue-6.1/clk-samsung-exynos7885-do-not-define-number-of-clock.patch new file mode 100644 index 00000000000..93ef7e95818 --- /dev/null +++ b/queue-6.1/clk-samsung-exynos7885-do-not-define-number-of-clock.patch @@ -0,0 +1,82 @@ +From 844bc17d4b57b00df129ce9fbd0e20facd35ea85 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Aug 2023 10:27:35 +0200 +Subject: clk: samsung: exynos7885: do not define number of clocks in bindings + +From: Krzysztof Kozlowski + +[ Upstream commit ef4923c8e0523d83b7cd4918760e03b03b2b08ad ] + +Number of clocks supported by Linux drivers might vary - sometimes we +add new clocks, not exposed previously. Therefore these numbers of +clocks should not be in the bindings, as that prevents changing them. + +Define number of clocks per each clock controller inside the driver +directly. + +Reviewed-by: Alim Akhtar +Reviewed-by: Chanwoo Choi +Link: https://lore.kernel.org/r/20230808082738.122804-9-krzysztof.kozlowski@linaro.org +Signed-off-by: Krzysztof Kozlowski +Stable-dep-of: 217a5f23c290 ("clk: samsung: exynos7885: Update CLKS_NR_FSYS after bindings fix") +Signed-off-by: Sasha Levin +--- + drivers/clk/samsung/clk-exynos7885.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/drivers/clk/samsung/clk-exynos7885.c b/drivers/clk/samsung/clk-exynos7885.c +index 0d2a950ed1844..5d58879606eef 100644 +--- a/drivers/clk/samsung/clk-exynos7885.c ++++ b/drivers/clk/samsung/clk-exynos7885.c +@@ -17,6 +17,12 @@ + #include "clk.h" + #include "clk-exynos-arm64.h" + ++/* NOTE: Must be equal to the last clock ID increased by one */ ++#define CLKS_NR_TOP (CLK_GOUT_FSYS_USB30DRD + 1) ++#define CLKS_NR_CORE (CLK_GOUT_TREX_P_CORE_PCLK_P_CORE + 1) ++#define CLKS_NR_PERI (CLK_GOUT_WDT1_PCLK + 1) ++#define CLKS_NR_FSYS (CLK_GOUT_MMC_SDIO_SDCLKIN + 1) ++ + /* ---- CMU_TOP ------------------------------------------------------------- */ + + /* Register Offset definitions for CMU_TOP (0x12060000) */ +@@ -334,7 +340,7 @@ static const struct samsung_cmu_info top_cmu_info __initconst = { + .nr_div_clks = ARRAY_SIZE(top_div_clks), + .gate_clks = top_gate_clks, + .nr_gate_clks = ARRAY_SIZE(top_gate_clks), +- .nr_clk_ids = TOP_NR_CLK, ++ .nr_clk_ids = CLKS_NR_TOP, + .clk_regs = top_clk_regs, + .nr_clk_regs = ARRAY_SIZE(top_clk_regs), + }; +@@ -553,7 +559,7 @@ static const struct samsung_cmu_info peri_cmu_info __initconst = { + .nr_mux_clks = ARRAY_SIZE(peri_mux_clks), + .gate_clks = peri_gate_clks, + .nr_gate_clks = ARRAY_SIZE(peri_gate_clks), +- .nr_clk_ids = PERI_NR_CLK, ++ .nr_clk_ids = CLKS_NR_PERI, + .clk_regs = peri_clk_regs, + .nr_clk_regs = ARRAY_SIZE(peri_clk_regs), + .clk_name = "dout_peri_bus", +@@ -662,7 +668,7 @@ static const struct samsung_cmu_info core_cmu_info __initconst = { + .nr_div_clks = ARRAY_SIZE(core_div_clks), + .gate_clks = core_gate_clks, + .nr_gate_clks = ARRAY_SIZE(core_gate_clks), +- .nr_clk_ids = CORE_NR_CLK, ++ .nr_clk_ids = CLKS_NR_CORE, + .clk_regs = core_clk_regs, + .nr_clk_regs = ARRAY_SIZE(core_clk_regs), + .clk_name = "dout_core_bus", +@@ -744,7 +750,7 @@ static const struct samsung_cmu_info fsys_cmu_info __initconst = { + .nr_mux_clks = ARRAY_SIZE(fsys_mux_clks), + .gate_clks = fsys_gate_clks, + .nr_gate_clks = ARRAY_SIZE(fsys_gate_clks), +- .nr_clk_ids = FSYS_NR_CLK, ++ .nr_clk_ids = CLKS_NR_FSYS, + .clk_regs = fsys_clk_regs, + .nr_clk_regs = ARRAY_SIZE(fsys_clk_regs), + .clk_name = "dout_fsys_bus", +-- +2.43.0 + diff --git a/queue-6.1/clk-samsung-exynos7885-update-clks_nr_fsys-after-bin.patch b/queue-6.1/clk-samsung-exynos7885-update-clks_nr_fsys-after-bin.patch new file mode 100644 index 00000000000..68317315b70 --- /dev/null +++ b/queue-6.1/clk-samsung-exynos7885-update-clks_nr_fsys-after-bin.patch @@ -0,0 +1,38 @@ +From 39c0950a5800c8a23eb16c24bb9f540ca520e692 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 6 Aug 2024 14:11:47 +0200 +Subject: clk: samsung: exynos7885: Update CLKS_NR_FSYS after bindings fix + +From: David Virag + +[ Upstream commit 217a5f23c290c349ceaa37a6f2c014ad4c2d5759 ] + +Update CLKS_NR_FSYS to the proper value after a fix in DT bindings. +This should always be the last clock in a CMU + 1. + +Fixes: cd268e309c29 ("dt-bindings: clock: Add bindings for Exynos7885 CMU_FSYS") +Cc: stable@vger.kernel.org +Signed-off-by: David Virag +Link: https://lore.kernel.org/r/20240806121157.479212-5-virag.david003@gmail.com +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Sasha Levin +--- + drivers/clk/samsung/clk-exynos7885.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/clk/samsung/clk-exynos7885.c b/drivers/clk/samsung/clk-exynos7885.c +index 5d58879606eef..0f71fa6e8878b 100644 +--- a/drivers/clk/samsung/clk-exynos7885.c ++++ b/drivers/clk/samsung/clk-exynos7885.c +@@ -21,7 +21,7 @@ + #define CLKS_NR_TOP (CLK_GOUT_FSYS_USB30DRD + 1) + #define CLKS_NR_CORE (CLK_GOUT_TREX_P_CORE_PCLK_P_CORE + 1) + #define CLKS_NR_PERI (CLK_GOUT_WDT1_PCLK + 1) +-#define CLKS_NR_FSYS (CLK_GOUT_MMC_SDIO_SDCLKIN + 1) ++#define CLKS_NR_FSYS (CLK_MOUT_FSYS_USB30DRD_USER + 1) + + /* ---- CMU_TOP ------------------------------------------------------------- */ + +-- +2.43.0 + diff --git a/queue-6.1/cpufreq-intel_pstate-make-hwp_notify_lock-a-raw-spin.patch b/queue-6.1/cpufreq-intel_pstate-make-hwp_notify_lock-a-raw-spin.patch new file mode 100644 index 00000000000..39861fb9dc2 --- /dev/null +++ b/queue-6.1/cpufreq-intel_pstate-make-hwp_notify_lock-a-raw-spin.patch @@ -0,0 +1,113 @@ +From faf5e127d8da992afbbebc1af80a689bb57fa571 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 6 Oct 2024 22:51:07 +0200 +Subject: cpufreq: intel_pstate: Make hwp_notify_lock a raw spinlock +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +commit 8b4865cd904650cbed7f2407e653934c621b8127 upstream. + +notify_hwp_interrupt() is called via sysvec_thermal() -> +smp_thermal_vector() -> intel_thermal_interrupt() in hard irq context. +For this reason it must not use a simple spin_lock that sleeps with +PREEMPT_RT enabled. So convert it to a raw spinlock. + +Reported-by: xiao sheng wen +Link: https://bugs.debian.org/1076483 +Signed-off-by: Uwe Kleine-König +Acked-by: Srinivas Pandruvada +Acked-by: Sebastian Andrzej Siewior +Tested-by: xiao sheng wen +Link: https://patch.msgid.link/20240919081121.10784-2-ukleinek@debian.org +Cc: All applicable +Signed-off-by: Rafael J. Wysocki +[ukleinek: Backport to v6.6.y] +Signed-off-by: Uwe Kleine-König +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/intel_pstate.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c +index 4abda800c632d..d471d74df3bbb 100644 +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -1596,7 +1596,7 @@ static void intel_pstate_notify_work(struct work_struct *work) + wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_STATUS, 0); + } + +-static DEFINE_SPINLOCK(hwp_notify_lock); ++static DEFINE_RAW_SPINLOCK(hwp_notify_lock); + static cpumask_t hwp_intr_enable_mask; + + void notify_hwp_interrupt(void) +@@ -1613,7 +1613,7 @@ void notify_hwp_interrupt(void) + if (!(value & 0x01)) + return; + +- spin_lock_irqsave(&hwp_notify_lock, flags); ++ raw_spin_lock_irqsave(&hwp_notify_lock, flags); + + if (!cpumask_test_cpu(this_cpu, &hwp_intr_enable_mask)) + goto ack_intr; +@@ -1637,13 +1637,13 @@ void notify_hwp_interrupt(void) + + schedule_delayed_work(&cpudata->hwp_notify_work, msecs_to_jiffies(10)); + +- spin_unlock_irqrestore(&hwp_notify_lock, flags); ++ raw_spin_unlock_irqrestore(&hwp_notify_lock, flags); + + return; + + ack_intr: + wrmsrl_safe(MSR_HWP_STATUS, 0); +- spin_unlock_irqrestore(&hwp_notify_lock, flags); ++ raw_spin_unlock_irqrestore(&hwp_notify_lock, flags); + } + + static void intel_pstate_disable_hwp_interrupt(struct cpudata *cpudata) +@@ -1656,10 +1656,10 @@ static void intel_pstate_disable_hwp_interrupt(struct cpudata *cpudata) + /* wrmsrl_on_cpu has to be outside spinlock as this can result in IPC */ + wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x00); + +- spin_lock_irqsave(&hwp_notify_lock, flags); ++ raw_spin_lock_irqsave(&hwp_notify_lock, flags); + if (cpumask_test_and_clear_cpu(cpudata->cpu, &hwp_intr_enable_mask)) + cancel_delayed_work(&cpudata->hwp_notify_work); +- spin_unlock_irqrestore(&hwp_notify_lock, flags); ++ raw_spin_unlock_irqrestore(&hwp_notify_lock, flags); + } + + static void intel_pstate_enable_hwp_interrupt(struct cpudata *cpudata) +@@ -1668,10 +1668,10 @@ static void intel_pstate_enable_hwp_interrupt(struct cpudata *cpudata) + if (boot_cpu_has(X86_FEATURE_HWP_NOTIFY)) { + unsigned long flags; + +- spin_lock_irqsave(&hwp_notify_lock, flags); ++ raw_spin_lock_irqsave(&hwp_notify_lock, flags); + INIT_DELAYED_WORK(&cpudata->hwp_notify_work, intel_pstate_notify_work); + cpumask_set_cpu(cpudata->cpu, &hwp_intr_enable_mask); +- spin_unlock_irqrestore(&hwp_notify_lock, flags); ++ raw_spin_unlock_irqrestore(&hwp_notify_lock, flags); + + /* wrmsrl_on_cpu has to be outside spinlock as this can result in IPC */ + wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x01); +@@ -3101,10 +3101,10 @@ static void intel_pstate_driver_cleanup(void) + if (intel_pstate_driver == &intel_pstate) + intel_pstate_clear_update_util_hook(cpu); + +- spin_lock(&hwp_notify_lock); ++ raw_spin_lock(&hwp_notify_lock); + kfree(all_cpu_data[cpu]); + WRITE_ONCE(all_cpu_data[cpu], NULL); +- spin_unlock(&hwp_notify_lock); ++ raw_spin_unlock(&hwp_notify_lock); + } + } + cpus_read_unlock(); +-- +2.43.0 + diff --git a/queue-6.1/delayacct-improve-the-average-delay-precision-of-get.patch b/queue-6.1/delayacct-improve-the-average-delay-precision-of-get.patch new file mode 100644 index 00000000000..6e4f4170ed6 --- /dev/null +++ b/queue-6.1/delayacct-improve-the-average-delay-precision-of-get.patch @@ -0,0 +1,160 @@ +From 9c33ce1107312f987d77d5922ad75d78bb6c13af Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Feb 2023 14:08:08 +0800 +Subject: delayacct: improve the average delay precision of getdelay tool to + microsecond + +From: Wang Yong + +[ Upstream commit eca7de7cdc382eb6e0d344c07b1449ed75f5b435 ] + +Improve the average delay precision of getdelay tool to microsecond. When +using the getdelay tool, it is sometimes found that the average delay +except CPU is not 0, but display is 0, because the precison is too low. +For example, see delay average of SWAP below when using ZRAM. + +print delayacct stats ON +PID 32915 +CPU count real total virtual total delay total delay average + 339202 2793871936 9233585504 7951112 0.000ms +IO count delay total delay average + 41 419296904 10ms +SWAP count delay total delay average + 242589 1045792384 0ms + +This wrong display is misleading, so improve the millisecond precision of +the average delay to microsecond just like CPU. Then user would get more +accurate information of delay time. + +Link: https://lkml.kernel.org/r/202302131408087983857@zte.com.cn +Signed-off-by: Wang Yong +Reviewed-by: Yang Yang +Cc: David Hildenbrand +Signed-off-by: Andrew Morton +Stable-dep-of: 3840cbe24cf0 ("sched: psi: fix bogus pressure spikes from aggregation race") +Signed-off-by: Sasha Levin +--- + Documentation/accounting/delay-accounting.rst | 14 +++++------ + .../zh_CN/accounting/delay-accounting.rst | 10 ++++---- + tools/accounting/getdelays.c | 24 +++++++++---------- + 3 files changed, 24 insertions(+), 24 deletions(-) + +diff --git a/Documentation/accounting/delay-accounting.rst b/Documentation/accounting/delay-accounting.rst +index 7103b62ba6d7e..79f537c9f160b 100644 +--- a/Documentation/accounting/delay-accounting.rst ++++ b/Documentation/accounting/delay-accounting.rst +@@ -109,17 +109,17 @@ Get sum of delays, since system boot, for all pids with tgid 5:: + CPU count real total virtual total delay total delay average + 8 7000000 6872122 3382277 0.423ms + IO count delay total delay average +- 0 0 0ms ++ 0 0 0.000ms + SWAP count delay total delay average +- 0 0 0ms ++ 0 0 0.000ms + RECLAIM count delay total delay average +- 0 0 0ms ++ 0 0 0.000ms + THRASHING count delay total delay average +- 0 0 0ms ++ 0 0 0.000ms + COMPACT count delay total delay average +- 0 0 0ms +- WPCOPY count delay total delay average +- 0 0 0ms ++ 0 0 0.000ms ++ WPCOPY count delay total delay average ++ 0 0 0.000ms + + Get IO accounting for pid 1, it works only with -p:: + +diff --git a/Documentation/translations/zh_CN/accounting/delay-accounting.rst b/Documentation/translations/zh_CN/accounting/delay-accounting.rst +index a01dc3d5b0dbb..7b8693ccf80a9 100644 +--- a/Documentation/translations/zh_CN/accounting/delay-accounting.rst ++++ b/Documentation/translations/zh_CN/accounting/delay-accounting.rst +@@ -92,15 +92,15 @@ getdelays命令的一般格式:: + CPU count real total virtual total delay total delay average + 8 7000000 6872122 3382277 0.423ms + IO count delay total delay average +- 0 0 0ms ++ 0 0 0.000ms + SWAP count delay total delay average +- 0 0 0ms ++ 0 0 0.000ms + RECLAIM count delay total delay average +- 0 0 0ms ++ 0 0 0.000ms + THRASHING count delay total delay average +- 0 0 0ms ++ 0 0 0.000ms + COMPACT count delay total delay average +- 0 0 0ms ++ 0 0 0.000ms + WPCOPY count delay total delay average + 0 0 0ms + +diff --git a/tools/accounting/getdelays.c b/tools/accounting/getdelays.c +index 938dec0dfaad8..23a15d8f2bf4f 100644 +--- a/tools/accounting/getdelays.c ++++ b/tools/accounting/getdelays.c +@@ -198,17 +198,17 @@ static void print_delayacct(struct taskstats *t) + printf("\n\nCPU %15s%15s%15s%15s%15s\n" + " %15llu%15llu%15llu%15llu%15.3fms\n" + "IO %15s%15s%15s\n" +- " %15llu%15llu%15llums\n" ++ " %15llu%15llu%15.3fms\n" + "SWAP %15s%15s%15s\n" +- " %15llu%15llu%15llums\n" ++ " %15llu%15llu%15.3fms\n" + "RECLAIM %12s%15s%15s\n" +- " %15llu%15llu%15llums\n" ++ " %15llu%15llu%15.3fms\n" + "THRASHING%12s%15s%15s\n" +- " %15llu%15llu%15llums\n" ++ " %15llu%15llu%15.3fms\n" + "COMPACT %12s%15s%15s\n" +- " %15llu%15llu%15llums\n" ++ " %15llu%15llu%15.3fms\n" + "WPCOPY %12s%15s%15s\n" +- " %15llu%15llu%15llums\n", ++ " %15llu%15llu%15.3fms\n", + "count", "real total", "virtual total", + "delay total", "delay average", + (unsigned long long)t->cpu_count, +@@ -219,27 +219,27 @@ static void print_delayacct(struct taskstats *t) + "count", "delay total", "delay average", + (unsigned long long)t->blkio_count, + (unsigned long long)t->blkio_delay_total, +- average_ms(t->blkio_delay_total, t->blkio_count), ++ average_ms((double)t->blkio_delay_total, t->blkio_count), + "count", "delay total", "delay average", + (unsigned long long)t->swapin_count, + (unsigned long long)t->swapin_delay_total, +- average_ms(t->swapin_delay_total, t->swapin_count), ++ average_ms((double)t->swapin_delay_total, t->swapin_count), + "count", "delay total", "delay average", + (unsigned long long)t->freepages_count, + (unsigned long long)t->freepages_delay_total, +- average_ms(t->freepages_delay_total, t->freepages_count), ++ average_ms((double)t->freepages_delay_total, t->freepages_count), + "count", "delay total", "delay average", + (unsigned long long)t->thrashing_count, + (unsigned long long)t->thrashing_delay_total, +- average_ms(t->thrashing_delay_total, t->thrashing_count), ++ average_ms((double)t->thrashing_delay_total, t->thrashing_count), + "count", "delay total", "delay average", + (unsigned long long)t->compact_count, + (unsigned long long)t->compact_delay_total, +- average_ms(t->compact_delay_total, t->compact_count), ++ average_ms((double)t->compact_delay_total, t->compact_count), + "count", "delay total", "delay average", + (unsigned long long)t->wpcopy_count, + (unsigned long long)t->wpcopy_delay_total, +- average_ms(t->wpcopy_delay_total, t->wpcopy_count)); ++ average_ms((double)t->wpcopy_delay_total, t->wpcopy_count)); + } + + static void task_context_switch_counts(struct taskstats *t) +-- +2.43.0 + diff --git a/queue-6.1/docs-zh_cn-update-the-translation-of-delay-accountin.patch b/queue-6.1/docs-zh_cn-update-the-translation-of-delay-accountin.patch new file mode 100644 index 00000000000..9bcd5c3c399 --- /dev/null +++ b/queue-6.1/docs-zh_cn-update-the-translation-of-delay-accountin.patch @@ -0,0 +1,59 @@ +From 9bd8f800bd93ceab33873dd92a1b5ef05c5a6f21 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 10 Dec 2022 11:24:46 +0800 +Subject: docs/zh_CN: Update the translation of delay-accounting to 6.1-rc8 + +From: Yanteng Si + +[ Upstream commit 6ab587e8e8b434ffc2decdd6db17dff0ef2b13ab ] + +Update to commit f347c9d2697f ("filemap: make the accounting +of thrashing more consistent"). + +Commit 662ce1dc9caf ("delayacct: track delays from write-protect copy"). + +Signed-off-by: Yanteng Si +Link: https://lore.kernel.org/r/798990521e991697f9f2b75f4dc4a485d31c1311.1670642548.git.siyanteng@loongson.cn +Signed-off-by: Jonathan Corbet +Stable-dep-of: 3840cbe24cf0 ("sched: psi: fix bogus pressure spikes from aggregation race") +Signed-off-by: Sasha Levin +--- + .../translations/zh_CN/accounting/delay-accounting.rst | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/Documentation/translations/zh_CN/accounting/delay-accounting.rst b/Documentation/translations/zh_CN/accounting/delay-accounting.rst +index f1849411018e9..a01dc3d5b0dbb 100644 +--- a/Documentation/translations/zh_CN/accounting/delay-accounting.rst ++++ b/Documentation/translations/zh_CN/accounting/delay-accounting.rst +@@ -17,8 +17,9 @@ a) 等待一个CPU(任务为可运行) + b) 完成由该任务发起的块I/O同步请求 + c) 页面交换 + d) 内存回收 +-e) 页缓存抖动 ++e) 抖动 + f) 直接规整 ++g) 写保护复制 + + 并将这些统计信息通过taskstats接口提供给用户空间。 + +@@ -42,7 +43,7 @@ f) 直接规整 + include/uapi/linux/taskstats.h + + 其描述了延时计数相关字段。系统通常以计数器形式返回 CPU、同步块 I/O、交换、内存 +-回收、页缓存抖动、直接规整等的累积延时。 ++回收、页缓存抖动、直接规整、写保护复制等的累积延时。 + + 取任务某计数器两个连续读数的差值,将得到任务在该时间间隔内等待对应资源的总延时。 + +@@ -100,6 +101,8 @@ getdelays命令的一般格式:: + 0 0 0ms + COMPACT count delay total delay average + 0 0 0ms ++ WPCOPY count delay total delay average ++ 0 0 0ms + + 获取pid为1的IO计数,它只和-p一起使用:: + # ./getdelays -i -p 1 +-- +2.43.0 + diff --git a/queue-6.1/drm-amd-display-allow-backlight-to-go-below-amdgpu_d.patch b/queue-6.1/drm-amd-display-allow-backlight-to-go-below-amdgpu_d.patch new file mode 100644 index 00000000000..eb6cb271623 --- /dev/null +++ b/queue-6.1/drm-amd-display-allow-backlight-to-go-below-amdgpu_d.patch @@ -0,0 +1,47 @@ +From ba5c1284b440c72d6d97fd20e820bdbf022df97b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 15 Sep 2024 14:28:37 -0500 +Subject: drm/amd/display: Allow backlight to go below + `AMDGPU_DM_DEFAULT_MIN_BACKLIGHT` +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Mario Limonciello + +[ Upstream commit 87d749a6aab73d8069d0345afaa98297816cb220 ] + +The issue with panel power savings compatibility below +`AMDGPU_DM_DEFAULT_MIN_BACKLIGHT` happens at +`AMDGPU_DM_DEFAULT_MIN_BACKLIGHT` as well. + +That issue will be fixed separately, so don't prevent the backlight +brightness from going that low. + +Cc: Harry Wentland +Cc: Thomas Weißschuh +Link: https://lore.kernel.org/amd-gfx/be04226a-a9e3-4a45-a83b-6d263c6557d8@t-8ch.de/T/#m400dee4e2fc61fe9470334d20a7c8c89c9aef44f +Reviewed-by: Harry Wentland +Signed-off-by: Mario Limonciello +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +index 0625c4f075f2d..8f7130f7d8c69 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -4077,7 +4077,7 @@ static void amdgpu_dm_update_backlight_caps(struct amdgpu_display_manager *dm, + int spread = caps.max_input_signal - caps.min_input_signal; + + if (caps.max_input_signal > AMDGPU_DM_DEFAULT_MAX_BACKLIGHT || +- caps.min_input_signal < AMDGPU_DM_DEFAULT_MIN_BACKLIGHT || ++ caps.min_input_signal < 0 || + spread > AMDGPU_DM_DEFAULT_MAX_BACKLIGHT || + spread < AMDGPU_DM_MIN_SPREAD) { + DRM_DEBUG_KMS("DM: Invalid backlight caps: min=%d, max=%d\n", +-- +2.43.0 + diff --git a/queue-6.1/dt-bindings-clock-exynos7885-fix-duplicated-binding.patch b/queue-6.1/dt-bindings-clock-exynos7885-fix-duplicated-binding.patch new file mode 100644 index 00000000000..8c1465792b8 --- /dev/null +++ b/queue-6.1/dt-bindings-clock-exynos7885-fix-duplicated-binding.patch @@ -0,0 +1,53 @@ +From 260819ce90c68212ed65bea1b75efe3cf47be8a1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 6 Aug 2024 14:11:44 +0200 +Subject: dt-bindings: clock: exynos7885: Fix duplicated binding + +From: David Virag + +[ Upstream commit abf3a3ea9acb5c886c8729191a670744ecd42024 ] + +The numbering in Exynos7885's FSYS CMU bindings has 4 duplicated by +accident, with the rest of the bindings continuing with 5. + +Fix this by moving CLK_MOUT_FSYS_USB30DRD_USER to the end as 11. + +Since CLK_MOUT_FSYS_USB30DRD_USER is not used in any device tree as of +now, and there are no other clocks affected (maybe apart from +CLK_MOUT_FSYS_MMC_SDIO_USER which the number was shared with, also not +used in a device tree), this is the least impactful way to solve this +problem. + +Fixes: cd268e309c29 ("dt-bindings: clock: Add bindings for Exynos7885 CMU_FSYS") +Cc: stable@vger.kernel.org +Signed-off-by: David Virag +Link: https://lore.kernel.org/r/20240806121157.479212-2-virag.david003@gmail.com +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Sasha Levin +--- + include/dt-bindings/clock/exynos7885.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/dt-bindings/clock/exynos7885.h b/include/dt-bindings/clock/exynos7885.h +index 8256e7430b63d..a363eb63dba7c 100644 +--- a/include/dt-bindings/clock/exynos7885.h ++++ b/include/dt-bindings/clock/exynos7885.h +@@ -139,13 +139,13 @@ + #define CLK_MOUT_FSYS_MMC_CARD_USER 2 + #define CLK_MOUT_FSYS_MMC_EMBD_USER 3 + #define CLK_MOUT_FSYS_MMC_SDIO_USER 4 +-#define CLK_MOUT_FSYS_USB30DRD_USER 4 + #define CLK_GOUT_MMC_CARD_ACLK 5 + #define CLK_GOUT_MMC_CARD_SDCLKIN 6 + #define CLK_GOUT_MMC_EMBD_ACLK 7 + #define CLK_GOUT_MMC_EMBD_SDCLKIN 8 + #define CLK_GOUT_MMC_SDIO_ACLK 9 + #define CLK_GOUT_MMC_SDIO_SDCLKIN 10 +-#define FSYS_NR_CLK 11 ++#define CLK_MOUT_FSYS_USB30DRD_USER 11 ++#define FSYS_NR_CLK 12 + + #endif /* _DT_BINDINGS_CLOCK_EXYNOS_7885_H */ +-- +2.43.0 + diff --git a/queue-6.1/dt-bindings-clock-qcom-add-gpll9-support-on-gcc-sc81.patch b/queue-6.1/dt-bindings-clock-qcom-add-gpll9-support-on-gcc-sc81.patch new file mode 100644 index 00000000000..5b08c41b9ad --- /dev/null +++ b/queue-6.1/dt-bindings-clock-qcom-add-gpll9-support-on-gcc-sc81.patch @@ -0,0 +1,37 @@ +From 4f7ef1c67ac5103ee079c107e80cae145889c6c6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 12 Aug 2024 10:43:02 +0530 +Subject: dt-bindings: clock: qcom: Add GPLL9 support on gcc-sc8180x + +From: Satya Priya Kakitapalli + +[ Upstream commit 648b4bde0aca2980ebc0b90cdfbb80d222370c3d ] + +Add the missing GPLL9 which is required for the gcc sdcc2 clock. + +Fixes: 0fadcdfdcf57 ("dt-bindings: clock: Add SC8180x GCC binding") +Cc: stable@vger.kernel.org +Acked-by: Krzysztof Kozlowski +Signed-off-by: Satya Priya Kakitapalli +Link: https://lore.kernel.org/r/20240812-gcc-sc8180x-fixes-v2-2-8b3eaa5fb856@quicinc.com +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + include/dt-bindings/clock/qcom,gcc-sc8180x.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/dt-bindings/clock/qcom,gcc-sc8180x.h b/include/dt-bindings/clock/qcom,gcc-sc8180x.h +index 90c6e021a0356..2569f874fe13c 100644 +--- a/include/dt-bindings/clock/qcom,gcc-sc8180x.h ++++ b/include/dt-bindings/clock/qcom,gcc-sc8180x.h +@@ -248,6 +248,7 @@ + #define GCC_USB3_SEC_CLKREF_CLK 238 + #define GCC_UFS_MEM_CLKREF_EN 239 + #define GCC_UFS_CARD_CLKREF_EN 240 ++#define GPLL9 241 + + #define GCC_EMAC_BCR 0 + #define GCC_GPU_BCR 1 +-- +2.43.0 + diff --git a/queue-6.1/dt-bindings-clock-qcom-add-missing-ufs-qref-clocks.patch b/queue-6.1/dt-bindings-clock-qcom-add-missing-ufs-qref-clocks.patch new file mode 100644 index 00000000000..6bfa428cd3d --- /dev/null +++ b/queue-6.1/dt-bindings-clock-qcom-add-missing-ufs-qref-clocks.patch @@ -0,0 +1,38 @@ +From 52d7448f2750a141b32cb6dc18511727ec2d18fb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 31 Jan 2024 12:37:26 +0530 +Subject: dt-bindings: clock: qcom: Add missing UFS QREF clocks + +From: Manivannan Sadhasivam + +[ Upstream commit 26447dad8119fd084d7c6f167c3026700b701666 ] + +Add missing QREF clocks for UFS MEM and UFS CARD controllers. + +Fixes: 0fadcdfdcf57 ("dt-bindings: clock: Add SC8180x GCC binding") +Acked-by: Krzysztof Kozlowski +Signed-off-by: Manivannan Sadhasivam +Link: https://lore.kernel.org/r/20240131-ufs-phy-clock-v3-3-58a49d2f4605@linaro.org +Signed-off-by: Bjorn Andersson +Stable-dep-of: 648b4bde0aca ("dt-bindings: clock: qcom: Add GPLL9 support on gcc-sc8180x") +Signed-off-by: Sasha Levin +--- + include/dt-bindings/clock/qcom,gcc-sc8180x.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/dt-bindings/clock/qcom,gcc-sc8180x.h b/include/dt-bindings/clock/qcom,gcc-sc8180x.h +index e893415ae13d0..90c6e021a0356 100644 +--- a/include/dt-bindings/clock/qcom,gcc-sc8180x.h ++++ b/include/dt-bindings/clock/qcom,gcc-sc8180x.h +@@ -246,6 +246,8 @@ + #define GCC_PCIE_3_CLKREF_CLK 236 + #define GCC_USB3_PRIM_CLKREF_CLK 237 + #define GCC_USB3_SEC_CLKREF_CLK 238 ++#define GCC_UFS_MEM_CLKREF_EN 239 ++#define GCC_UFS_CARD_CLKREF_EN 240 + + #define GCC_EMAC_BCR 0 + #define GCC_GPU_BCR 1 +-- +2.43.0 + diff --git a/queue-6.1/i2c-core-lock-address-during-client-device-instantia.patch b/queue-6.1/i2c-core-lock-address-during-client-device-instantia.patch new file mode 100644 index 00000000000..fdef479c4b2 --- /dev/null +++ b/queue-6.1/i2c-core-lock-address-during-client-device-instantia.patch @@ -0,0 +1,118 @@ +From cccf345a7c533c222fec0cd2fa46c9decfe2f9d3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 15 Aug 2024 21:44:50 +0200 +Subject: i2c: core: Lock address during client device instantiation + +From: Heiner Kallweit + +[ Upstream commit 8d3cefaf659265aa82b0373a563fdb9d16a2b947 ] + +Krzysztof reported an issue [0] which is caused by parallel attempts to +instantiate the same I2C client device. This can happen if driver +supports auto-detection, but certain devices are also instantiated +explicitly. +The original change isn't actually wrong, it just revealed that I2C core +isn't prepared yet to handle this scenario. +Calls to i2c_new_client_device() can be nested, therefore we can't use a +simple mutex here. Parallel instantiation of devices at different addresses +is ok, so we just have to prevent parallel instantiation at the same address. +We can use a bitmap with one bit per 7-bit I2C client address, and atomic +bit operations to set/check/clear bits. +Now a parallel attempt to instantiate a device at the same address will +result in -EBUSY being returned, avoiding the "sysfs: cannot create duplicate +filename" splash. + +Note: This patch version includes small cosmetic changes to the Tested-by + version, only functional change is that address locking is supported + for slave addresses too. + +[0] https://lore.kernel.org/linux-i2c/9479fe4e-eb0c-407e-84c0-bd60c15baf74@ans.pl/T/#m12706546e8e2414d8f1a0dc61c53393f731685cc + +Fixes: caba40ec3531 ("eeprom: at24: Probe for DDR3 thermal sensor in the SPD case") +Cc: stable@vger.kernel.org +Tested-by: Krzysztof Piotr Oledzki +Signed-off-by: Heiner Kallweit +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +--- + drivers/i2c/i2c-core-base.c | 28 ++++++++++++++++++++++++++++ + include/linux/i2c.h | 3 +++ + 2 files changed, 31 insertions(+) + +diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c +index 4417b2656f875..f7e3fc0b3a1da 100644 +--- a/drivers/i2c/i2c-core-base.c ++++ b/drivers/i2c/i2c-core-base.c +@@ -919,6 +919,27 @@ int i2c_dev_irq_from_resources(const struct resource *resources, + return 0; + } + ++/* ++ * Serialize device instantiation in case it can be instantiated explicitly ++ * and by auto-detection ++ */ ++static int i2c_lock_addr(struct i2c_adapter *adap, unsigned short addr, ++ unsigned short flags) ++{ ++ if (!(flags & I2C_CLIENT_TEN) && ++ test_and_set_bit(addr, adap->addrs_in_instantiation)) ++ return -EBUSY; ++ ++ return 0; ++} ++ ++static void i2c_unlock_addr(struct i2c_adapter *adap, unsigned short addr, ++ unsigned short flags) ++{ ++ if (!(flags & I2C_CLIENT_TEN)) ++ clear_bit(addr, adap->addrs_in_instantiation); ++} ++ + /** + * i2c_new_client_device - instantiate an i2c device + * @adap: the adapter managing the device +@@ -966,6 +987,10 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf + goto out_err_silent; + } + ++ status = i2c_lock_addr(adap, client->addr, client->flags); ++ if (status) ++ goto out_err_silent; ++ + /* Check for address business */ + status = i2c_check_addr_busy(adap, i2c_encode_flags_to_addr(client)); + if (status) +@@ -997,6 +1022,8 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf + dev_dbg(&adap->dev, "client [%s] registered with bus id %s\n", + client->name, dev_name(&client->dev)); + ++ i2c_unlock_addr(adap, client->addr, client->flags); ++ + return client; + + out_remove_swnode: +@@ -1008,6 +1035,7 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf + dev_err(&adap->dev, + "Failed to register i2c client %s at 0x%02x (%d)\n", + client->name, client->addr, status); ++ i2c_unlock_addr(adap, client->addr, client->flags); + out_err_silent: + if (need_put) + put_device(&client->dev); +diff --git a/include/linux/i2c.h b/include/linux/i2c.h +index 96432b0a05d4d..87b403a6d7e41 100644 +--- a/include/linux/i2c.h ++++ b/include/linux/i2c.h +@@ -752,6 +752,9 @@ struct i2c_adapter { + struct regulator *bus_regulator; + + struct dentry *debugfs; ++ ++ /* 7bit address space */ ++ DECLARE_BITMAP(addrs_in_instantiation, 1 << 7); + }; + #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) + +-- +2.43.0 + diff --git a/queue-6.1/i2c-create-debugfs-entry-per-adapter.patch b/queue-6.1/i2c-create-debugfs-entry-per-adapter.patch new file mode 100644 index 00000000000..6f0bca76c45 --- /dev/null +++ b/queue-6.1/i2c-create-debugfs-entry-per-adapter.patch @@ -0,0 +1,102 @@ +From 91a16e0d106f0fcd6ae31f077e689a618d7feed0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 12 Nov 2023 17:54:41 -0500 +Subject: i2c: create debugfs entry per adapter + +From: Wolfram Sang + +[ Upstream commit 73febd775bdbdb98c81255ff85773ac410ded5c4 ] + +Two drivers already implement custom debugfs handling for their +i2c_adapter and more will come. So, let the core create a debugfs +directory per adapter and pass that to drivers for their debugfs files. + +Signed-off-by: Wolfram Sang +Signed-off-by: Wolfram Sang +Stable-dep-of: 8d3cefaf6592 ("i2c: core: Lock address during client device instantiation") +Signed-off-by: Sasha Levin +--- + drivers/i2c/i2c-core-base.c | 11 +++++++++++ + include/linux/i2c.h | 2 ++ + 2 files changed, 13 insertions(+) + +diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c +index 643c7f1e5bfd4..4417b2656f875 100644 +--- a/drivers/i2c/i2c-core-base.c ++++ b/drivers/i2c/i2c-core-base.c +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -66,6 +67,8 @@ static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver); + static DEFINE_STATIC_KEY_FALSE(i2c_trace_msg_key); + static bool is_registered; + ++static struct dentry *i2c_debugfs_root; ++ + int i2c_transfer_trace_reg(void) + { + static_branch_inc(&i2c_trace_msg_key); +@@ -1528,6 +1531,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap) + goto out_list; + } + ++ adap->debugfs = debugfs_create_dir(dev_name(&adap->dev), i2c_debugfs_root); ++ + res = i2c_setup_smbus_alert(adap); + if (res) + goto out_reg; +@@ -1567,6 +1572,7 @@ static int i2c_register_adapter(struct i2c_adapter *adap) + return 0; + + out_reg: ++ debugfs_remove_recursive(adap->debugfs); + init_completion(&adap->dev_released); + device_unregister(&adap->dev); + wait_for_completion(&adap->dev_released); +@@ -1768,6 +1774,8 @@ void i2c_del_adapter(struct i2c_adapter *adap) + + i2c_host_notify_irq_teardown(adap); + ++ debugfs_remove_recursive(adap->debugfs); ++ + /* wait until all references to the device are gone + * + * FIXME: This is old code and should ideally be replaced by an +@@ -2065,6 +2073,8 @@ static int __init i2c_init(void) + + is_registered = true; + ++ i2c_debugfs_root = debugfs_create_dir("i2c", NULL); ++ + #ifdef CONFIG_I2C_COMPAT + i2c_adapter_compat_class = class_compat_register("i2c-adapter"); + if (!i2c_adapter_compat_class) { +@@ -2103,6 +2113,7 @@ static void __exit i2c_exit(void) + #ifdef CONFIG_I2C_COMPAT + class_compat_unregister(i2c_adapter_compat_class); + #endif ++ debugfs_remove_recursive(i2c_debugfs_root); + bus_unregister(&i2c_bus_type); + tracepoint_synchronize_unregister(); + } +diff --git a/include/linux/i2c.h b/include/linux/i2c.h +index 4f5285b87a7f0..96432b0a05d4d 100644 +--- a/include/linux/i2c.h ++++ b/include/linux/i2c.h +@@ -750,6 +750,8 @@ struct i2c_adapter { + + struct irq_domain *host_notify_domain; + struct regulator *bus_regulator; ++ ++ struct dentry *debugfs; + }; + #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) + +-- +2.43.0 + diff --git a/queue-6.1/i2c-xiic-fix-pm_runtime_set_suspended-with-runtime-p.patch b/queue-6.1/i2c-xiic-fix-pm_runtime_set_suspended-with-runtime-p.patch new file mode 100644 index 00000000000..3df02837148 --- /dev/null +++ b/queue-6.1/i2c-xiic-fix-pm_runtime_set_suspended-with-runtime-p.patch @@ -0,0 +1,39 @@ +From 9b8b306e44a276ccbf60680a72e73d0d5b862f00 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Sep 2024 11:42:50 +0800 +Subject: i2c: xiic: Fix pm_runtime_set_suspended() with runtime pm enabled + +From: Jinjie Ruan + +[ Upstream commit 0c8d604dea437b69a861479b413d629bc9b3da70 ] + +It is not valid to call pm_runtime_set_suspended() for devices +with runtime PM enabled because it returns -EAGAIN if it is enabled +already and working. So, call pm_runtime_disable() before to fix it. + +Fixes: 36ecbcab84d0 ("i2c: xiic: Implement power management") +Cc: # v4.6+ +Signed-off-by: Jinjie Ruan +Signed-off-by: Andi Shyti +Signed-off-by: Sasha Levin +--- + drivers/i2c/busses/i2c-xiic.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c +index 00998a69a6b13..d48b8429deb4b 100644 +--- a/drivers/i2c/busses/i2c-xiic.c ++++ b/drivers/i2c/busses/i2c-xiic.c +@@ -854,8 +854,8 @@ static int xiic_i2c_probe(struct platform_device *pdev) + return 0; + + err_pm_disable: +- pm_runtime_set_suspended(&pdev->dev); + pm_runtime_disable(&pdev->dev); ++ pm_runtime_set_suspended(&pdev->dev); + + return ret; + } +-- +2.43.0 + diff --git a/queue-6.1/i2c-xiic-use-devm_clk_get_enabled.patch b/queue-6.1/i2c-xiic-use-devm_clk_get_enabled.patch new file mode 100644 index 00000000000..0be97abdba8 --- /dev/null +++ b/queue-6.1/i2c-xiic-use-devm_clk_get_enabled.patch @@ -0,0 +1,94 @@ +From 900ff7e5208eef03460e794451e03376ecf4e90f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 12 Jun 2023 00:56:49 +0200 +Subject: i2c: xiic: Use devm_clk_get_enabled() + +From: Andi Shyti + +[ Upstream commit 8390dc7477e49e4acc9e553f385f4ff59d186efe ] + +Replace the pair of functions, devm_clk_get() and clk_prepare_enable(), +with a single function devm_clk_get_enabled(). + +Signed-off-by: Andi Shyti +Acked-by: Michal Simek +Signed-off-by: Wolfram Sang +Stable-dep-of: 0c8d604dea43 ("i2c: xiic: Fix pm_runtime_set_suspended() with runtime pm enabled") +Signed-off-by: Sasha Levin +--- + drivers/i2c/busses/i2c-xiic.c | 20 +++++++------------- + 1 file changed, 7 insertions(+), 13 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c +index 5ed8a341d62f9..00998a69a6b13 100644 +--- a/drivers/i2c/busses/i2c-xiic.c ++++ b/drivers/i2c/busses/i2c-xiic.c +@@ -798,16 +798,11 @@ static int xiic_i2c_probe(struct platform_device *pdev) + + mutex_init(&i2c->lock); + +- i2c->clk = devm_clk_get(&pdev->dev, NULL); ++ i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL); + if (IS_ERR(i2c->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk), +- "input clock not found.\n"); ++ "failed to enable input clock.\n"); + +- ret = clk_prepare_enable(i2c->clk); +- if (ret) { +- dev_err(&pdev->dev, "Unable to enable clock.\n"); +- return ret; +- } + i2c->dev = &pdev->dev; + pm_runtime_set_autosuspend_delay(i2c->dev, XIIC_PM_TIMEOUT); + pm_runtime_use_autosuspend(i2c->dev); +@@ -819,7 +814,7 @@ static int xiic_i2c_probe(struct platform_device *pdev) + + if (ret < 0) { + dev_err(&pdev->dev, "Cannot claim IRQ\n"); +- goto err_clk_dis; ++ goto err_pm_disable; + } + + i2c->singlemaster = +@@ -840,14 +835,14 @@ static int xiic_i2c_probe(struct platform_device *pdev) + ret = xiic_reinit(i2c); + if (ret < 0) { + dev_err(&pdev->dev, "Cannot xiic_reinit\n"); +- goto err_clk_dis; ++ goto err_pm_disable; + } + + /* add i2c adapter to i2c tree */ + ret = i2c_add_adapter(&i2c->adap); + if (ret) { + xiic_deinit(i2c); +- goto err_clk_dis; ++ goto err_pm_disable; + } + + if (pdata) { +@@ -858,10 +853,10 @@ static int xiic_i2c_probe(struct platform_device *pdev) + + return 0; + +-err_clk_dis: ++err_pm_disable: + pm_runtime_set_suspended(&pdev->dev); + pm_runtime_disable(&pdev->dev); +- clk_disable_unprepare(i2c->clk); ++ + return ret; + } + +@@ -879,7 +874,6 @@ static int xiic_i2c_remove(struct platform_device *pdev) + + xiic_deinit(i2c); + pm_runtime_put_sync(i2c->dev); +- clk_disable_unprepare(i2c->clk); + pm_runtime_disable(&pdev->dev); + pm_runtime_set_suspended(&pdev->dev); + pm_runtime_dont_use_autosuspend(&pdev->dev); +-- +2.43.0 + diff --git a/queue-6.1/io_uring-net-harden-multishot-termination-case-for-r.patch b/queue-6.1/io_uring-net-harden-multishot-termination-case-for-r.patch new file mode 100644 index 00000000000..0785218d5f9 --- /dev/null +++ b/queue-6.1/io_uring-net-harden-multishot-termination-case-for-r.patch @@ -0,0 +1,61 @@ +From d159acd607233902418598c0830ee8386b5f65db Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 26 Sep 2024 07:08:10 -0600 +Subject: io_uring/net: harden multishot termination case for recv + +From: Jens Axboe + +[ Upstream commit c314094cb4cfa6fc5a17f4881ead2dfebfa717a7 ] + +If the recv returns zero, or an error, then it doesn't matter if more +data has already been received for this buffer. A condition like that +should terminate the multishot receive. Rather than pass in the +collected return value, pass in whether to terminate or keep the recv +going separately. + +Note that this isn't a bug right now, as the only way to get there is +via setting MSG_WAITALL with multishot receive. And if an application +does that, then -EINVAL is returned anyway. But it seems like an easy +bug to introduce, so let's make it a bit more explicit. + +Link: https://github.com/axboe/liburing/issues/1246 +Cc: stable@vger.kernel.org +Fixes: b3fdea6ecb55 ("io_uring: multishot recv") +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + io_uring/net.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/io_uring/net.c b/io_uring/net.c +index 48404bd330017..f41acabf7b4a5 100644 +--- a/io_uring/net.c ++++ b/io_uring/net.c +@@ -893,6 +893,7 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags) + int ret, min_ret = 0; + bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK; + size_t len = sr->len; ++ bool mshot_finished; + + if (!(req->flags & REQ_F_POLLED) && + (sr->flags & IORING_RECVSEND_POLL_FIRST)) +@@ -957,6 +958,7 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags) + req_set_fail(req); + } + ++ mshot_finished = ret <= 0; + if (ret > 0) + ret += sr->done_io; + else if (sr->done_io) +@@ -968,7 +970,7 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags) + if (msg.msg_inq) + cflags |= IORING_CQE_F_SOCK_NONEMPTY; + +- if (!io_recv_finish(req, &ret, cflags, ret <= 0, issue_flags)) ++ if (!io_recv_finish(req, &ret, cflags, mshot_finished, issue_flags)) + goto retry_multishot; + + return ret; +-- +2.43.0 + diff --git a/queue-6.1/kconfig-qconf-fix-buffer-overflow-in-debug-links.patch b/queue-6.1/kconfig-qconf-fix-buffer-overflow-in-debug-links.patch new file mode 100644 index 00000000000..117c135ccbe --- /dev/null +++ b/queue-6.1/kconfig-qconf-fix-buffer-overflow-in-debug-links.patch @@ -0,0 +1,43 @@ +From 60bd1b8c5809e7559acda853eeecff0d87c0e685 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Oct 2024 18:02:22 +0900 +Subject: kconfig: qconf: fix buffer overflow in debug links + +From: Masahiro Yamada + +[ Upstream commit 984ed20ece1c6c20789ece040cbff3eb1a388fa9 ] + +If you enable "Option -> Show Debug Info" and click a link, the program +terminates with the following error: + + *** buffer overflow detected ***: terminated + +The buffer overflow is caused by the following line: + + strcat(data, "$"); + +The buffer needs one more byte to accommodate the additional character. + +Fixes: c4f7398bee9c ("kconfig: qconf: make debug links work again") +Signed-off-by: Masahiro Yamada +Signed-off-by: Sasha Levin +--- + scripts/kconfig/qconf.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc +index 78087b2d9ac67..61b679f6c2f2a 100644 +--- a/scripts/kconfig/qconf.cc ++++ b/scripts/kconfig/qconf.cc +@@ -1172,7 +1172,7 @@ void ConfigInfoView::clicked(const QUrl &url) + { + QByteArray str = url.toEncoded(); + const std::size_t count = str.size(); +- char *data = new char[count + 1]; ++ char *data = new char[count + 2]; // '$' + '\0' + struct symbol **result; + struct menu *m = NULL; + +-- +2.43.0 + diff --git a/queue-6.1/lib-buildid-harden-build-id-parsing-logic.patch b/queue-6.1/lib-buildid-harden-build-id-parsing-logic.patch new file mode 100644 index 00000000000..12cbf63278a --- /dev/null +++ b/queue-6.1/lib-buildid-harden-build-id-parsing-logic.patch @@ -0,0 +1,177 @@ +From d9be158325c75e2932d3cd4bfd8228ea8dac263a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Aug 2024 10:42:23 -0700 +Subject: lib/buildid: harden build ID parsing logic + +From: Andrii Nakryiko + +[ Upstream commit 905415ff3ffb1d7e5afa62bacabd79776bd24606 ] + +Harden build ID parsing logic, adding explicit READ_ONCE() where it's +important to have a consistent value read and validated just once. + +Also, as pointed out by Andi Kleen, we need to make sure that entire ELF +note is within a page bounds, so move the overflow check up and add an +extra note_size boundaries validation. + +Fixes tag below points to the code that moved this code into +lib/buildid.c, and then subsequently was used in perf subsystem, making +this code exposed to perf_event_open() users in v5.12+. + +Cc: stable@vger.kernel.org +Reviewed-by: Eduard Zingerman +Reviewed-by: Jann Horn +Suggested-by: Andi Kleen +Fixes: bd7525dacd7e ("bpf: Move stack_map_get_build_id into lib") +Signed-off-by: Andrii Nakryiko +Link: https://lore.kernel.org/r/20240829174232.3133883-2-andrii@kernel.org +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + lib/buildid.c | 76 +++++++++++++++++++++++++++++---------------------- + 1 file changed, 44 insertions(+), 32 deletions(-) + +diff --git a/lib/buildid.c b/lib/buildid.c +index 493537344fc81..e41fb0ee405f6 100644 +--- a/lib/buildid.c ++++ b/lib/buildid.c +@@ -18,31 +18,37 @@ static int parse_build_id_buf(unsigned char *build_id, + const void *note_start, + Elf32_Word note_size) + { +- Elf32_Word note_offs = 0, new_offs; +- +- while (note_offs + sizeof(Elf32_Nhdr) < note_size) { +- Elf32_Nhdr *nhdr = (Elf32_Nhdr *)(note_start + note_offs); ++ const char note_name[] = "GNU"; ++ const size_t note_name_sz = sizeof(note_name); ++ u64 note_off = 0, new_off, name_sz, desc_sz; ++ const char *data; ++ ++ while (note_off + sizeof(Elf32_Nhdr) < note_size && ++ note_off + sizeof(Elf32_Nhdr) > note_off /* overflow */) { ++ Elf32_Nhdr *nhdr = (Elf32_Nhdr *)(note_start + note_off); ++ ++ name_sz = READ_ONCE(nhdr->n_namesz); ++ desc_sz = READ_ONCE(nhdr->n_descsz); ++ ++ new_off = note_off + sizeof(Elf32_Nhdr); ++ if (check_add_overflow(new_off, ALIGN(name_sz, 4), &new_off) || ++ check_add_overflow(new_off, ALIGN(desc_sz, 4), &new_off) || ++ new_off > note_size) ++ break; + + if (nhdr->n_type == BUILD_ID && +- nhdr->n_namesz == sizeof("GNU") && +- !strcmp((char *)(nhdr + 1), "GNU") && +- nhdr->n_descsz > 0 && +- nhdr->n_descsz <= BUILD_ID_SIZE_MAX) { +- memcpy(build_id, +- note_start + note_offs + +- ALIGN(sizeof("GNU"), 4) + sizeof(Elf32_Nhdr), +- nhdr->n_descsz); +- memset(build_id + nhdr->n_descsz, 0, +- BUILD_ID_SIZE_MAX - nhdr->n_descsz); ++ name_sz == note_name_sz && ++ memcmp(nhdr + 1, note_name, note_name_sz) == 0 && ++ desc_sz > 0 && desc_sz <= BUILD_ID_SIZE_MAX) { ++ data = note_start + note_off + ALIGN(note_name_sz, 4); ++ memcpy(build_id, data, desc_sz); ++ memset(build_id + desc_sz, 0, BUILD_ID_SIZE_MAX - desc_sz); + if (size) +- *size = nhdr->n_descsz; ++ *size = desc_sz; + return 0; + } +- new_offs = note_offs + sizeof(Elf32_Nhdr) + +- ALIGN(nhdr->n_namesz, 4) + ALIGN(nhdr->n_descsz, 4); +- if (new_offs <= note_offs) /* overflow */ +- break; +- note_offs = new_offs; ++ ++ note_off = new_off; + } + + return -EINVAL; +@@ -71,7 +77,7 @@ static int get_build_id_32(const void *page_addr, unsigned char *build_id, + { + Elf32_Ehdr *ehdr = (Elf32_Ehdr *)page_addr; + Elf32_Phdr *phdr; +- int i; ++ __u32 i, phnum; + + /* + * FIXME +@@ -80,18 +86,19 @@ static int get_build_id_32(const void *page_addr, unsigned char *build_id, + */ + if (ehdr->e_phoff != sizeof(Elf32_Ehdr)) + return -EINVAL; ++ ++ phnum = READ_ONCE(ehdr->e_phnum); + /* only supports phdr that fits in one page */ +- if (ehdr->e_phnum > +- (PAGE_SIZE - sizeof(Elf32_Ehdr)) / sizeof(Elf32_Phdr)) ++ if (phnum > (PAGE_SIZE - sizeof(Elf32_Ehdr)) / sizeof(Elf32_Phdr)) + return -EINVAL; + + phdr = (Elf32_Phdr *)(page_addr + sizeof(Elf32_Ehdr)); + +- for (i = 0; i < ehdr->e_phnum; ++i) { ++ for (i = 0; i < phnum; ++i) { + if (phdr[i].p_type == PT_NOTE && + !parse_build_id(page_addr, build_id, size, +- page_addr + phdr[i].p_offset, +- phdr[i].p_filesz)) ++ page_addr + READ_ONCE(phdr[i].p_offset), ++ READ_ONCE(phdr[i].p_filesz))) + return 0; + } + return -EINVAL; +@@ -103,7 +110,7 @@ static int get_build_id_64(const void *page_addr, unsigned char *build_id, + { + Elf64_Ehdr *ehdr = (Elf64_Ehdr *)page_addr; + Elf64_Phdr *phdr; +- int i; ++ __u32 i, phnum; + + /* + * FIXME +@@ -112,18 +119,19 @@ static int get_build_id_64(const void *page_addr, unsigned char *build_id, + */ + if (ehdr->e_phoff != sizeof(Elf64_Ehdr)) + return -EINVAL; ++ ++ phnum = READ_ONCE(ehdr->e_phnum); + /* only supports phdr that fits in one page */ +- if (ehdr->e_phnum > +- (PAGE_SIZE - sizeof(Elf64_Ehdr)) / sizeof(Elf64_Phdr)) ++ if (phnum > (PAGE_SIZE - sizeof(Elf64_Ehdr)) / sizeof(Elf64_Phdr)) + return -EINVAL; + + phdr = (Elf64_Phdr *)(page_addr + sizeof(Elf64_Ehdr)); + +- for (i = 0; i < ehdr->e_phnum; ++i) { ++ for (i = 0; i < phnum; ++i) { + if (phdr[i].p_type == PT_NOTE && + !parse_build_id(page_addr, build_id, size, +- page_addr + phdr[i].p_offset, +- phdr[i].p_filesz)) ++ page_addr + READ_ONCE(phdr[i].p_offset), ++ READ_ONCE(phdr[i].p_filesz))) + return 0; + } + return -EINVAL; +@@ -152,6 +160,10 @@ int build_id_parse(struct vm_area_struct *vma, unsigned char *build_id, + page = find_get_page(vma->vm_file->f_mapping, 0); + if (!page) + return -EFAULT; /* page not mapped */ ++ if (!PageUptodate(page)) { ++ put_page(page); ++ return -EFAULT; ++ } + + ret = -EINVAL; + page_addr = kmap_atomic(page); +-- +2.43.0 + diff --git a/queue-6.1/media-i2c-imx335-enable-regulator-supplies.patch b/queue-6.1/media-i2c-imx335-enable-regulator-supplies.patch new file mode 100644 index 00000000000..b8c7bd88ce1 --- /dev/null +++ b/queue-6.1/media-i2c-imx335-enable-regulator-supplies.patch @@ -0,0 +1,122 @@ +From 52c5ada9f4902b65ccd62f551c33f00c9e55b094 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 18:29:46 +0530 +Subject: media: i2c: imx335: Enable regulator supplies + +From: Kieran Bingham + +[ Upstream commit fea91ee73b7cd19f08017221923d789f984abc54 ] + +Provide support for enabling and disabling regulator supplies to control +power to the camera sensor. + +While updating the power on function, document that a sleep is +represented as 'T4' in the datasheet power on sequence. + +Signed-off-by: Kieran Bingham +Signed-off-by: Sakari Ailus +Signed-off-by: Hans Verkuil +Stable-dep-of: 99d30e2fdea4 ("media: imx335: Fix reset-gpio handling") +Signed-off-by: Sasha Levin +--- + drivers/media/i2c/imx335.c | 36 ++++++++++++++++++++++++++++++++++-- + 1 file changed, 34 insertions(+), 2 deletions(-) + +diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c +index 8e91767d61300..d173a456ea046 100644 +--- a/drivers/media/i2c/imx335.c ++++ b/drivers/media/i2c/imx335.c +@@ -75,6 +75,12 @@ struct imx335_reg_list { + const struct imx335_reg *regs; + }; + ++static const char * const imx335_supply_name[] = { ++ "avdd", /* Analog (2.9V) supply */ ++ "ovdd", /* Digital I/O (1.8V) supply */ ++ "dvdd", /* Digital Core (1.2V) supply */ ++}; ++ + /** + * struct imx335_mode - imx335 sensor mode structure + * @width: Frame width +@@ -108,6 +114,7 @@ struct imx335_mode { + * @sd: V4L2 sub-device + * @pad: Media pad. Only one pad supported + * @reset_gpio: Sensor reset gpio ++ * @supplies: Regulator supplies to handle power control + * @inclk: Sensor input clock + * @ctrl_handler: V4L2 control handler + * @link_freq_ctrl: Pointer to link frequency control +@@ -127,6 +134,8 @@ struct imx335 { + struct v4l2_subdev sd; + struct media_pad pad; + struct gpio_desc *reset_gpio; ++ struct regulator_bulk_data supplies[ARRAY_SIZE(imx335_supply_name)]; ++ + struct clk *inclk; + struct v4l2_ctrl_handler ctrl_handler; + struct v4l2_ctrl *link_freq_ctrl; +@@ -790,6 +799,17 @@ static int imx335_parse_hw_config(struct imx335 *imx335) + return PTR_ERR(imx335->reset_gpio); + } + ++ for (i = 0; i < ARRAY_SIZE(imx335_supply_name); i++) ++ imx335->supplies[i].supply = imx335_supply_name[i]; ++ ++ ret = devm_regulator_bulk_get(imx335->dev, ++ ARRAY_SIZE(imx335_supply_name), ++ imx335->supplies); ++ if (ret) { ++ dev_err(imx335->dev, "Failed to get regulators\n"); ++ return ret; ++ } ++ + /* Get sensor input clock */ + imx335->inclk = devm_clk_get(imx335->dev, NULL); + if (IS_ERR(imx335->inclk)) { +@@ -868,6 +888,17 @@ static int imx335_power_on(struct device *dev) + struct imx335 *imx335 = to_imx335(sd); + int ret; + ++ ret = regulator_bulk_enable(ARRAY_SIZE(imx335_supply_name), ++ imx335->supplies); ++ if (ret) { ++ dev_err(dev, "%s: failed to enable regulators\n", ++ __func__); ++ return ret; ++ } ++ ++ usleep_range(500, 550); /* Tlow */ ++ ++ /* Set XCLR */ + gpiod_set_value_cansleep(imx335->reset_gpio, 1); + + ret = clk_prepare_enable(imx335->inclk); +@@ -876,12 +907,13 @@ static int imx335_power_on(struct device *dev) + goto error_reset; + } + +- usleep_range(20, 22); ++ usleep_range(20, 22); /* T4 */ + + return 0; + + error_reset: + gpiod_set_value_cansleep(imx335->reset_gpio, 0); ++ regulator_bulk_disable(ARRAY_SIZE(imx335_supply_name), imx335->supplies); + + return ret; + } +@@ -898,8 +930,8 @@ static int imx335_power_off(struct device *dev) + struct imx335 *imx335 = to_imx335(sd); + + gpiod_set_value_cansleep(imx335->reset_gpio, 0); +- + clk_disable_unprepare(imx335->inclk); ++ regulator_bulk_disable(ARRAY_SIZE(imx335_supply_name), imx335->supplies); + + return 0; + } +-- +2.43.0 + diff --git a/queue-6.1/media-imx335-fix-reset-gpio-handling.patch b/queue-6.1/media-imx335-fix-reset-gpio-handling.patch new file mode 100644 index 00000000000..c6a5a6eef4d --- /dev/null +++ b/queue-6.1/media-imx335-fix-reset-gpio-handling.patch @@ -0,0 +1,79 @@ +From c22b1659bc3eeac359221cf1ec77b7b5f33682be Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 30 Aug 2024 11:41:52 +0530 +Subject: media: imx335: Fix reset-gpio handling + +From: Umang Jain + +[ Upstream commit 99d30e2fdea4086be4e66e2deb10de854b547ab8 ] + +Rectify the logical value of reset-gpio so that it is set to +0 (disabled) during power-on and to 1 (enabled) during power-off. + +Set the reset-gpio to GPIO_OUT_HIGH at initialization time to make +sure it starts off in reset. Also drop the "Set XCLR" comment which +is not-so-informative. + +The existing usage of imx335 had reset-gpios polarity inverted +(GPIO_ACTIVE_HIGH) in their device-tree sources. With this patch +included, those DTS will not be able to stream imx335 anymore. The +reset-gpio polarity will need to be rectified in the device-tree +sources as shown in [1] example, in order to get imx335 functional +again (as it remains in reset prior to this fix). + +Cc: stable@vger.kernel.org +Fixes: 45d19b5fb9ae ("media: i2c: Add imx335 camera sensor driver") +Reviewed-by: Laurent Pinchart +Link: https://lore.kernel.org/linux-media/20240729110437.199428-1-umang.jain@ideasonboard.com/ +Signed-off-by: Umang Jain +Signed-off-by: Sakari Ailus +Signed-off-by: Hans Verkuil +Signed-off-by: Sasha Levin +--- + drivers/media/i2c/imx335.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c +index d173a456ea046..d8f47cf335d16 100644 +--- a/drivers/media/i2c/imx335.c ++++ b/drivers/media/i2c/imx335.c +@@ -792,7 +792,7 @@ static int imx335_parse_hw_config(struct imx335 *imx335) + + /* Request optional reset pin */ + imx335->reset_gpio = devm_gpiod_get_optional(imx335->dev, "reset", +- GPIOD_OUT_LOW); ++ GPIOD_OUT_HIGH); + if (IS_ERR(imx335->reset_gpio)) { + dev_err(imx335->dev, "failed to get reset gpio %ld", + PTR_ERR(imx335->reset_gpio)); +@@ -898,8 +898,7 @@ static int imx335_power_on(struct device *dev) + + usleep_range(500, 550); /* Tlow */ + +- /* Set XCLR */ +- gpiod_set_value_cansleep(imx335->reset_gpio, 1); ++ gpiod_set_value_cansleep(imx335->reset_gpio, 0); + + ret = clk_prepare_enable(imx335->inclk); + if (ret) { +@@ -912,7 +911,7 @@ static int imx335_power_on(struct device *dev) + return 0; + + error_reset: +- gpiod_set_value_cansleep(imx335->reset_gpio, 0); ++ gpiod_set_value_cansleep(imx335->reset_gpio, 1); + regulator_bulk_disable(ARRAY_SIZE(imx335_supply_name), imx335->supplies); + + return ret; +@@ -929,7 +928,7 @@ static int imx335_power_off(struct device *dev) + struct v4l2_subdev *sd = dev_get_drvdata(dev); + struct imx335 *imx335 = to_imx335(sd); + +- gpiod_set_value_cansleep(imx335->reset_gpio, 0); ++ gpiod_set_value_cansleep(imx335->reset_gpio, 1); + clk_disable_unprepare(imx335->inclk); + regulator_bulk_disable(ARRAY_SIZE(imx335_supply_name), imx335->supplies); + +-- +2.43.0 + diff --git a/queue-6.1/mm-z3fold-deprecate-config_z3fold.patch b/queue-6.1/mm-z3fold-deprecate-config_z3fold.patch new file mode 100644 index 00000000000..da24d012b15 --- /dev/null +++ b/queue-6.1/mm-z3fold-deprecate-config_z3fold.patch @@ -0,0 +1,151 @@ +From 975f02378ea5b74868b007af503a20b2fbb234de Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Oct 2024 19:32:00 +0000 +Subject: mm: z3fold: deprecate CONFIG_Z3FOLD + +From: Yosry Ahmed + +The z3fold compressed pages allocator is rarely used, most users use +zsmalloc. The only disadvantage of zsmalloc in comparison is the +dependency on MMU, and zbud is a more common option for !MMU as it was the +default zswap allocator for a long time. + +Historically, zsmalloc had worse latency than zbud and z3fold but offered +better memory savings. This is no longer the case as shown by a simple +recent analysis [1]. That analysis showed that z3fold does not have any +advantage over zsmalloc or zbud considering both performance and memory +usage. In a kernel build test on tmpfs in a limited cgroup, z3fold took +3% more time and used 1.8% more memory. The latency of zswap_load() was +7% higher, and that of zswap_store() was 10% higher. Zsmalloc is better +in all metrics. + +Moreover, z3fold apparently has latent bugs, which was made noticeable by +a recent soft lockup bug report with z3fold [2]. Switching to zsmalloc +not only fixed the problem, but also reduced the swap usage from 6~8G to +1~2G. Other users have also reported being bitten by mistakenly enabling +z3fold. + +Other than hurting users, z3fold is repeatedly causing wasted engineering +effort. Apart from investigating the above bug, it came up in multiple +development discussions (e.g. [3]) as something we need to handle, when +there aren't any legit users (at least not intentionally). + +The natural course of action is to deprecate z3fold, and remove in a few +cycles if no objections are raised from active users. Next on the list +should be zbud, as it offers marginal latency gains at the cost of huge +memory waste when compared to zsmalloc. That one will need to wait until +zsmalloc does not depend on MMU. + +Rename the user-visible config option from CONFIG_Z3FOLD to +CONFIG_Z3FOLD_DEPRECATED so that users with CONFIG_Z3FOLD=y get a new +prompt with explanation during make oldconfig. Also, remove +CONFIG_Z3FOLD=y from defconfigs. + +[1]https://lore.kernel.org/lkml/CAJD7tkbRF6od-2x_L8-A1QL3=2Ww13sCj4S3i4bNndqF+3+_Vg@mail.gmail.com/ +[2]https://lore.kernel.org/lkml/EF0ABD3E-A239-4111-A8AB-5C442E759CF3@gmail.com/ +[3]https://lore.kernel.org/lkml/CAJD7tkbnmeVugfunffSovJf9FAgy9rhBVt_tx=nxUveLUfqVsA@mail.gmail.com/ + +[arnd@arndb.de: deprecate ZSWAP_ZPOOL_DEFAULT_Z3FOLD as well] + Link: https://lkml.kernel.org/r/20240909202625.1054880-1-arnd@kernel.org +Link: https://lkml.kernel.org/r/20240904233343.933462-1-yosryahmed@google.com +Signed-off-by: Yosry Ahmed +Signed-off-by: Arnd Bergmann +Acked-by: Chris Down +Acked-by: Nhat Pham +Acked-by: Johannes Weiner +Acked-by: Vitaly Wool +Acked-by: Christoph Hellwig +Cc: Aneesh Kumar K.V +Cc: Christophe Leroy +Cc: Huacai Chen +Cc: Miaohe Lin +Cc: Michael Ellerman +Cc: Naveen N. Rao +Cc: Nicholas Piggin +Cc: Sergey Senozhatsky +Cc: WANG Xuerui +Cc: +Signed-off-by: Andrew Morton +(cherry picked from commit 7a2369b74abf76cd3e54c45b30f6addb497f831b) +Signed-off-by: Yosry Ahmed +Signed-off-by: Sasha Levin +--- + arch/loongarch/configs/loongson3_defconfig | 1 - + mm/Kconfig | 25 ++++++++++++++++------ + 2 files changed, 19 insertions(+), 7 deletions(-) + +diff --git a/arch/loongarch/configs/loongson3_defconfig b/arch/loongarch/configs/loongson3_defconfig +index 3540e9c0a6310..15b7420c868ba 100644 +--- a/arch/loongarch/configs/loongson3_defconfig ++++ b/arch/loongarch/configs/loongson3_defconfig +@@ -82,7 +82,6 @@ CONFIG_ZSWAP=y + CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD=y + CONFIG_ZPOOL=y + CONFIG_ZBUD=y +-CONFIG_Z3FOLD=y + CONFIG_ZSMALLOC=m + CONFIG_NET=y + CONFIG_PACKET=y +diff --git a/mm/Kconfig b/mm/Kconfig +index a65145fe89f2b..cf782e0474910 100644 +--- a/mm/Kconfig ++++ b/mm/Kconfig +@@ -132,12 +132,15 @@ config ZSWAP_ZPOOL_DEFAULT_ZBUD + help + Use the zbud allocator as the default allocator. + +-config ZSWAP_ZPOOL_DEFAULT_Z3FOLD +- bool "z3fold" +- select Z3FOLD ++config ZSWAP_ZPOOL_DEFAULT_Z3FOLD_DEPRECATED ++ bool "z3foldi (DEPRECATED)" ++ select Z3FOLD_DEPRECATED + help + Use the z3fold allocator as the default allocator. + ++ Deprecated and scheduled for removal in a few cycles, ++ see CONFIG_Z3FOLD_DEPRECATED. ++ + config ZSWAP_ZPOOL_DEFAULT_ZSMALLOC + bool "zsmalloc" + select ZSMALLOC +@@ -149,7 +152,7 @@ config ZSWAP_ZPOOL_DEFAULT + string + depends on ZSWAP + default "zbud" if ZSWAP_ZPOOL_DEFAULT_ZBUD +- default "z3fold" if ZSWAP_ZPOOL_DEFAULT_Z3FOLD ++ default "z3fold" if ZSWAP_ZPOOL_DEFAULT_Z3FOLD_DEPRECATED + default "zsmalloc" if ZSWAP_ZPOOL_DEFAULT_ZSMALLOC + default "" + +@@ -163,15 +166,25 @@ config ZBUD + deterministic reclaim properties that make it preferable to a higher + density approach when reclaim will be used. + +-config Z3FOLD +- tristate "3:1 compression allocator (z3fold)" ++config Z3FOLD_DEPRECATED ++ tristate "3:1 compression allocator (z3fold) (DEPRECATED)" + depends on ZSWAP + help ++ Deprecated and scheduled for removal in a few cycles. If you have ++ a good reason for using Z3FOLD over ZSMALLOC, please contact ++ linux-mm@kvack.org and the zswap maintainers. ++ + A special purpose allocator for storing compressed pages. + It is designed to store up to three compressed pages per physical + page. It is a ZBUD derivative so the simplicity and determinism are + still there. + ++config Z3FOLD ++ tristate ++ default y if Z3FOLD_DEPRECATED=y ++ default m if Z3FOLD_DEPRECATED=m ++ depends on Z3FOLD_DEPRECATED ++ + config ZSMALLOC + tristate + prompt "N:1 compression allocator (zsmalloc)" if ZSWAP +-- +2.43.0 + diff --git a/queue-6.1/r8169-add-tally-counter-fields-added-with-rtl8125.patch b/queue-6.1/r8169-add-tally-counter-fields-added-with-rtl8125.patch new file mode 100644 index 00000000000..2498c1f5aa1 --- /dev/null +++ b/queue-6.1/r8169-add-tally-counter-fields-added-with-rtl8125.patch @@ -0,0 +1,66 @@ +From cee564661642a1b757c0f996b5b96221ce802d73 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 17 Sep 2024 23:04:46 +0200 +Subject: r8169: add tally counter fields added with RTL8125 + +From: Heiner Kallweit + +[ Upstream commit ced8e8b8f40accfcce4a2bbd8b150aa76d5eff9a ] + +RTL8125 added fields to the tally counter, what may result in the chip +dma'ing these new fields to unallocated memory. Therefore make sure +that the allocated memory area is big enough to hold all of the +tally counter values, even if we use only parts of it. + +Fixes: f1bce4ad2f1c ("r8169: add support for RTL8125") +Cc: stable@vger.kernel.org +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/741d26a9-2b2b-485d-91d9-ecb302e345b5@gmail.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/realtek/r8169_main.c | 27 +++++++++++++++++++++++ + 1 file changed, 27 insertions(+) + +diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c +index beebb2dcd00f5..8b35e14fba3a8 100644 +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -564,6 +564,33 @@ struct rtl8169_counters { + __le32 rx_multicast; + __le16 tx_aborted; + __le16 tx_underrun; ++ /* new since RTL8125 */ ++ __le64 tx_octets; ++ __le64 rx_octets; ++ __le64 rx_multicast64; ++ __le64 tx_unicast64; ++ __le64 tx_broadcast64; ++ __le64 tx_multicast64; ++ __le32 tx_pause_on; ++ __le32 tx_pause_off; ++ __le32 tx_pause_all; ++ __le32 tx_deferred; ++ __le32 tx_late_collision; ++ __le32 tx_all_collision; ++ __le32 tx_aborted32; ++ __le32 align_errors32; ++ __le32 rx_frame_too_long; ++ __le32 rx_runt; ++ __le32 rx_pause_on; ++ __le32 rx_pause_off; ++ __le32 rx_pause_all; ++ __le32 rx_unknown_opcode; ++ __le32 rx_mac_error; ++ __le32 tx_underrun32; ++ __le32 rx_mac_missed; ++ __le32 rx_tcam_dropped; ++ __le32 tdu; ++ __le32 rdu; + }; + + struct rtl8169_tc_offsets { +-- +2.43.0 + diff --git a/queue-6.1/r8169-fix-spelling-mistake-tx_underun-tx_underrun.patch b/queue-6.1/r8169-fix-spelling-mistake-tx_underun-tx_underrun.patch new file mode 100644 index 00000000000..fe13f83ba78 --- /dev/null +++ b/queue-6.1/r8169-fix-spelling-mistake-tx_underun-tx_underrun.patch @@ -0,0 +1,48 @@ +From c0dac0257ec764d076c7588a62babc1be503dffb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Sep 2024 15:00:21 +0100 +Subject: r8169: Fix spelling mistake: "tx_underun" -> "tx_underrun" + +From: Colin Ian King + +[ Upstream commit 8df9439389a44fb2cc4ef695e08d6a8870b1616c ] + +There is a spelling mistake in the struct field tx_underun, rename +it to tx_underrun. + +Signed-off-by: Colin Ian King +Reviewed-by: Simon Horman +Reviewed-by: Heiner Kallweit +Link: https://patch.msgid.link/20240909140021.64884-1-colin.i.king@gmail.com +Signed-off-by: Jakub Kicinski +Stable-dep-of: ced8e8b8f40a ("r8169: add tally counter fields added with RTL8125") +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/realtek/r8169_main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c +index b187371fa2f0a..beebb2dcd00f5 100644 +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -563,7 +563,7 @@ struct rtl8169_counters { + __le64 rx_broadcast; + __le32 rx_multicast; + __le16 tx_aborted; +- __le16 tx_underun; ++ __le16 tx_underrun; + }; + + struct rtl8169_tc_offsets { +@@ -1710,7 +1710,7 @@ static void rtl8169_get_ethtool_stats(struct net_device *dev, + data[9] = le64_to_cpu(counters->rx_broadcast); + data[10] = le32_to_cpu(counters->rx_multicast); + data[11] = le16_to_cpu(counters->tx_aborted); +- data[12] = le16_to_cpu(counters->tx_underun); ++ data[12] = le16_to_cpu(counters->tx_underrun); + } + + static void rtl8169_get_strings(struct net_device *dev, u32 stringset, u8 *data) +-- +2.43.0 + diff --git a/queue-6.1/remoteproc-k3-r5-acquire-mailbox-handle-during-probe.patch b/queue-6.1/remoteproc-k3-r5-acquire-mailbox-handle-during-probe.patch new file mode 100644 index 00000000000..56030a19c81 --- /dev/null +++ b/queue-6.1/remoteproc-k3-r5-acquire-mailbox-handle-during-probe.patch @@ -0,0 +1,195 @@ +From d302e9c13da5daf51db503433f9a5ea89dbbd6ac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 8 Aug 2024 13:11:26 +0530 +Subject: remoteproc: k3-r5: Acquire mailbox handle during probe routine + +From: Beleswar Padhi + +[ Upstream commit f3f11cfe890733373ddbb1ce8991ccd4ee5e79e1 ] + +Acquire the mailbox handle during device probe and do not release handle +in stop/detach routine or error paths. This removes the redundant +requests for mbox handle later during rproc start/attach. This also +allows to defer remoteproc driver's probe if mailbox is not probed yet. + +Signed-off-by: Beleswar Padhi +Link: https://lore.kernel.org/r/20240808074127.2688131-3-b-padhi@ti.com +Signed-off-by: Mathieu Poirier +Stable-dep-of: 8fa052c29e50 ("remoteproc: k3-r5: Delay notification of wakeup event") +Signed-off-by: Sasha Levin +--- + drivers/remoteproc/ti_k3_r5_remoteproc.c | 78 +++++++++--------------- + 1 file changed, 30 insertions(+), 48 deletions(-) + +diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c +index 496a1c19a37e6..75bfe62736ab1 100644 +--- a/drivers/remoteproc/ti_k3_r5_remoteproc.c ++++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c +@@ -189,6 +189,10 @@ static void k3_r5_rproc_mbox_callback(struct mbox_client *client, void *data) + const char *name = kproc->rproc->name; + u32 msg = omap_mbox_message(data); + ++ /* Do not forward message from a detached core */ ++ if (kproc->rproc->state == RPROC_DETACHED) ++ return; ++ + dev_dbg(dev, "mbox msg: 0x%x\n", msg); + + switch (msg) { +@@ -224,6 +228,10 @@ static void k3_r5_rproc_kick(struct rproc *rproc, int vqid) + mbox_msg_t msg = (mbox_msg_t)vqid; + int ret; + ++ /* Do not forward message to a detached core */ ++ if (kproc->rproc->state == RPROC_DETACHED) ++ return; ++ + /* send the index of the triggered virtqueue in the mailbox payload */ + ret = mbox_send_message(kproc->mbox, (void *)msg); + if (ret < 0) +@@ -394,12 +402,9 @@ static int k3_r5_rproc_request_mbox(struct rproc *rproc) + client->knows_txdone = false; + + kproc->mbox = mbox_request_channel(client, 0); +- if (IS_ERR(kproc->mbox)) { +- ret = -EBUSY; +- dev_err(dev, "mbox_request_channel failed: %ld\n", +- PTR_ERR(kproc->mbox)); +- return ret; +- } ++ if (IS_ERR(kproc->mbox)) ++ return dev_err_probe(dev, PTR_ERR(kproc->mbox), ++ "mbox_request_channel failed\n"); + + /* + * Ping the remote processor, this is only for sanity-sake for now; +@@ -547,10 +552,6 @@ static int k3_r5_rproc_start(struct rproc *rproc) + u32 boot_addr; + int ret; + +- ret = k3_r5_rproc_request_mbox(rproc); +- if (ret) +- return ret; +- + boot_addr = rproc->bootaddr; + /* TODO: add boot_addr sanity checking */ + dev_dbg(dev, "booting R5F core using boot addr = 0x%x\n", boot_addr); +@@ -559,7 +560,7 @@ static int k3_r5_rproc_start(struct rproc *rproc) + core = kproc->core; + ret = ti_sci_proc_set_config(core->tsp, boot_addr, 0, 0); + if (ret) +- goto put_mbox; ++ return ret; + + /* unhalt/run all applicable cores */ + if (cluster->mode == CLUSTER_MODE_LOCKSTEP) { +@@ -575,13 +576,12 @@ static int k3_r5_rproc_start(struct rproc *rproc) + if (core != core0 && core0->rproc->state == RPROC_OFFLINE) { + dev_err(dev, "%s: can not start core 1 before core 0\n", + __func__); +- ret = -EPERM; +- goto put_mbox; ++ return -EPERM; + } + + ret = k3_r5_core_run(core); + if (ret) +- goto put_mbox; ++ return ret; + } + + return 0; +@@ -591,8 +591,6 @@ static int k3_r5_rproc_start(struct rproc *rproc) + if (k3_r5_core_halt(core)) + dev_warn(core->dev, "core halt back failed\n"); + } +-put_mbox: +- mbox_free_channel(kproc->mbox); + return ret; + } + +@@ -653,8 +651,6 @@ static int k3_r5_rproc_stop(struct rproc *rproc) + goto out; + } + +- mbox_free_channel(kproc->mbox); +- + return 0; + + unroll_core_halt: +@@ -669,42 +665,22 @@ static int k3_r5_rproc_stop(struct rproc *rproc) + /* + * Attach to a running R5F remote processor (IPC-only mode) + * +- * The R5F attach callback only needs to request the mailbox, the remote +- * processor is already booted, so there is no need to issue any TI-SCI +- * commands to boot the R5F cores in IPC-only mode. This callback is invoked +- * only in IPC-only mode. ++ * The R5F attach callback is a NOP. The remote processor is already booted, and ++ * all required resources have been acquired during probe routine, so there is ++ * no need to issue any TI-SCI commands to boot the R5F cores in IPC-only mode. ++ * This callback is invoked only in IPC-only mode and exists because ++ * rproc_validate() checks for its existence. + */ +-static int k3_r5_rproc_attach(struct rproc *rproc) +-{ +- struct k3_r5_rproc *kproc = rproc->priv; +- struct device *dev = kproc->dev; +- int ret; +- +- ret = k3_r5_rproc_request_mbox(rproc); +- if (ret) +- return ret; +- +- dev_info(dev, "R5F core initialized in IPC-only mode\n"); +- return 0; +-} ++static int k3_r5_rproc_attach(struct rproc *rproc) { return 0; } + + /* + * Detach from a running R5F remote processor (IPC-only mode) + * +- * The R5F detach callback performs the opposite operation to attach callback +- * and only needs to release the mailbox, the R5F cores are not stopped and +- * will be left in booted state in IPC-only mode. This callback is invoked +- * only in IPC-only mode. ++ * The R5F detach callback is a NOP. The R5F cores are not stopped and will be ++ * left in booted state in IPC-only mode. This callback is invoked only in ++ * IPC-only mode and exists for sanity sake. + */ +-static int k3_r5_rproc_detach(struct rproc *rproc) +-{ +- struct k3_r5_rproc *kproc = rproc->priv; +- struct device *dev = kproc->dev; +- +- mbox_free_channel(kproc->mbox); +- dev_info(dev, "R5F core deinitialized in IPC-only mode\n"); +- return 0; +-} ++static int k3_r5_rproc_detach(struct rproc *rproc) { return 0; } + + /* + * This function implements the .get_loaded_rsc_table() callback and is used +@@ -1273,6 +1249,10 @@ static int k3_r5_cluster_rproc_init(struct platform_device *pdev) + kproc->rproc = rproc; + core->rproc = rproc; + ++ ret = k3_r5_rproc_request_mbox(rproc); ++ if (ret) ++ return ret; ++ + ret = k3_r5_rproc_configure_mode(kproc); + if (ret < 0) + goto err_config; +@@ -1388,6 +1368,8 @@ static void k3_r5_cluster_rproc_exit(void *data) + } + } + ++ mbox_free_channel(kproc->mbox); ++ + rproc_del(rproc); + + k3_r5_reserved_mem_exit(kproc); +-- +2.43.0 + diff --git a/queue-6.1/remoteproc-k3-r5-delay-notification-of-wakeup-event.patch b/queue-6.1/remoteproc-k3-r5-delay-notification-of-wakeup-event.patch new file mode 100644 index 00000000000..4b511b466bd --- /dev/null +++ b/queue-6.1/remoteproc-k3-r5-delay-notification-of-wakeup-event.patch @@ -0,0 +1,57 @@ +From e49a1c4b4deb594432d7782cc6bcb6a1481f614a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 20 Aug 2024 16:20:04 +0530 +Subject: remoteproc: k3-r5: Delay notification of wakeup event + +From: Udit Kumar + +[ Upstream commit 8fa052c29e509f3e47d56d7fc2ca28094d78c60a ] + +Few times, core1 was scheduled to boot first before core0, which leads +to error: + +'k3_r5_rproc_start: can not start core 1 before core 0'. + +This was happening due to some scheduling between prepare and start +callback. The probe function waits for event, which is getting +triggered by prepare callback. To avoid above condition move event +trigger to start instead of prepare callback. + +Fixes: 61f6f68447ab ("remoteproc: k3-r5: Wait for core0 power-up before powering up core1") +Signed-off-by: Udit Kumar +[ Applied wakeup event trigger only for Split-Mode booted rprocs ] +Signed-off-by: Beleswar Padhi +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20240820105004.2788327-1-b-padhi@ti.com +Signed-off-by: Mathieu Poirier +Signed-off-by: Sasha Levin +--- + drivers/remoteproc/ti_k3_r5_remoteproc.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c +index 75bfe62736ab1..580f86de654f2 100644 +--- a/drivers/remoteproc/ti_k3_r5_remoteproc.c ++++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c +@@ -464,8 +464,6 @@ static int k3_r5_rproc_prepare(struct rproc *rproc) + ret); + return ret; + } +- core->released_from_reset = true; +- wake_up_interruptible(&cluster->core_transition); + + /* + * Newer IP revisions like on J7200 SoCs support h/w auto-initialization +@@ -582,6 +580,9 @@ static int k3_r5_rproc_start(struct rproc *rproc) + ret = k3_r5_core_run(core); + if (ret) + return ret; ++ ++ core->released_from_reset = true; ++ wake_up_interruptible(&cluster->core_transition); + } + + return 0; +-- +2.43.0 + diff --git a/queue-6.1/sched-psi-fix-bogus-pressure-spikes-from-aggregation.patch b/queue-6.1/sched-psi-fix-bogus-pressure-spikes-from-aggregation.patch new file mode 100644 index 00000000000..c6d9dd04291 --- /dev/null +++ b/queue-6.1/sched-psi-fix-bogus-pressure-spikes-from-aggregation.patch @@ -0,0 +1,185 @@ +From 351f2e29b34d3606f3cb49a6510ff335019f7cf5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Oct 2024 07:29:05 -0400 +Subject: sched: psi: fix bogus pressure spikes from aggregation race + +From: Johannes Weiner + +[ Upstream commit 3840cbe24cf060ea05a585ca497814609f5d47d1 ] + +Brandon reports sporadic, non-sensical spikes in cumulative pressure +time (total=) when reading cpu.pressure at a high rate. This is due to +a race condition between reader aggregation and tasks changing states. + +While it affects all states and all resources captured by PSI, in +practice it most likely triggers with CPU pressure, since scheduling +events are so frequent compared to other resource events. + +The race context is the live snooping of ongoing stalls during a +pressure read. The read aggregates per-cpu records for stalls that +have concluded, but will also incorporate ad-hoc the duration of any +active state that hasn't been recorded yet. This is important to get +timely measurements of ongoing stalls. Those ad-hoc samples are +calculated on-the-fly up to the current time on that CPU; since the +stall hasn't concluded, it's expected that this is the minimum amount +of stall time that will enter the per-cpu records once it does. + +The problem is that the path that concludes the state uses a CPU clock +read that is not synchronized against aggregators; the clock is read +outside of the seqlock protection. This allows aggregators to race and +snoop a stall with a longer duration than will actually be recorded. + +With the recorded stall time being less than the last snapshot +remembered by the aggregator, a subsequent sample will underflow and +observe a bogus delta value, resulting in an erratic jump in pressure. + +Fix this by moving the clock read of the state change into the seqlock +protection. This ensures no aggregation can snoop live stalls past the +time that's recorded when the state concludes. + +Reported-by: Brandon Duffany +Link: https://bugzilla.kernel.org/show_bug.cgi?id=219194 +Link: https://lore.kernel.org/lkml/20240827121851.GB438928@cmpxchg.org/ +Fixes: df77430639c9 ("psi: Reduce calls to sched_clock() in psi") +Cc: stable@vger.kernel.org +Signed-off-by: Johannes Weiner +Reviewed-by: Chengming Zhou +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + kernel/sched/psi.c | 26 ++++++++++++-------------- + 1 file changed, 12 insertions(+), 14 deletions(-) + +diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c +index 81dbced92df5f..fb56fcce29cd7 100644 +--- a/kernel/sched/psi.c ++++ b/kernel/sched/psi.c +@@ -777,13 +777,14 @@ static void record_times(struct psi_group_cpu *groupc, u64 now) + } + + static void psi_group_change(struct psi_group *group, int cpu, +- unsigned int clear, unsigned int set, u64 now, ++ unsigned int clear, unsigned int set, + bool wake_clock) + { + struct psi_group_cpu *groupc; + unsigned int t, m; + enum psi_states s; + u32 state_mask; ++ u64 now; + + lockdep_assert_rq_held(cpu_rq(cpu)); + groupc = per_cpu_ptr(group->pcpu, cpu); +@@ -798,6 +799,7 @@ static void psi_group_change(struct psi_group *group, int cpu, + * SOME and FULL time these may have resulted in. + */ + write_seqcount_begin(&groupc->seq); ++ now = cpu_clock(cpu); + + /* + * Start with TSK_ONCPU, which doesn't have a corresponding +@@ -911,18 +913,15 @@ void psi_task_change(struct task_struct *task, int clear, int set) + { + int cpu = task_cpu(task); + struct psi_group *group; +- u64 now; + + if (!task->pid) + return; + + psi_flags_change(task, clear, set); + +- now = cpu_clock(cpu); +- + group = task_psi_group(task); + do { +- psi_group_change(group, cpu, clear, set, now, true); ++ psi_group_change(group, cpu, clear, set, true); + } while ((group = group->parent)); + } + +@@ -931,7 +930,6 @@ void psi_task_switch(struct task_struct *prev, struct task_struct *next, + { + struct psi_group *group, *common = NULL; + int cpu = task_cpu(prev); +- u64 now = cpu_clock(cpu); + + if (next->pid) { + psi_flags_change(next, 0, TSK_ONCPU); +@@ -948,7 +946,7 @@ void psi_task_switch(struct task_struct *prev, struct task_struct *next, + break; + } + +- psi_group_change(group, cpu, 0, TSK_ONCPU, now, true); ++ psi_group_change(group, cpu, 0, TSK_ONCPU, true); + } while ((group = group->parent)); + } + +@@ -986,7 +984,7 @@ void psi_task_switch(struct task_struct *prev, struct task_struct *next, + do { + if (group == common) + break; +- psi_group_change(group, cpu, clear, set, now, wake_clock); ++ psi_group_change(group, cpu, clear, set, wake_clock); + } while ((group = group->parent)); + + /* +@@ -998,7 +996,7 @@ void psi_task_switch(struct task_struct *prev, struct task_struct *next, + if ((prev->psi_flags ^ next->psi_flags) & ~TSK_ONCPU) { + clear &= ~TSK_ONCPU; + for (; group; group = group->parent) +- psi_group_change(group, cpu, clear, set, now, wake_clock); ++ psi_group_change(group, cpu, clear, set, wake_clock); + } + } + } +@@ -1009,8 +1007,8 @@ void psi_account_irqtime(struct rq *rq, struct task_struct *curr, struct task_st + int cpu = task_cpu(curr); + struct psi_group *group; + struct psi_group_cpu *groupc; +- u64 now, irq; + s64 delta; ++ u64 irq; + + if (!curr->pid) + return; +@@ -1020,7 +1018,6 @@ void psi_account_irqtime(struct rq *rq, struct task_struct *curr, struct task_st + if (prev && task_psi_group(prev) == group) + return; + +- now = cpu_clock(cpu); + irq = irq_time_read(cpu); + delta = (s64)(irq - rq->psi_irq_time); + if (delta < 0) +@@ -1028,12 +1025,15 @@ void psi_account_irqtime(struct rq *rq, struct task_struct *curr, struct task_st + rq->psi_irq_time = irq; + + do { ++ u64 now; ++ + if (!group->enabled) + continue; + + groupc = per_cpu_ptr(group->pcpu, cpu); + + write_seqcount_begin(&groupc->seq); ++ now = cpu_clock(cpu); + + record_times(groupc, now); + groupc->times[PSI_IRQ_FULL] += delta; +@@ -1232,11 +1232,9 @@ void psi_cgroup_restart(struct psi_group *group) + for_each_possible_cpu(cpu) { + struct rq *rq = cpu_rq(cpu); + struct rq_flags rf; +- u64 now; + + rq_lock_irq(rq, &rf); +- now = cpu_clock(cpu); +- psi_group_change(group, cpu, 0, 0, now, true); ++ psi_group_change(group, cpu, 0, 0, true); + rq_unlock_irq(rq, &rf); + } + } +-- +2.43.0 + diff --git a/queue-6.1/series b/queue-6.1/series index 18479be9483..ad57d2296ae 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -617,3 +617,40 @@ close_range-fix-the-logics-in-descriptor-table-trimming.patch drm-i915-gem-fix-bitwise-and-logical-and-mixup.patch drm-sched-add-locking-to-drm_sched_entity_modify_sched.patch drm-amd-display-fix-system-hang-while-resume-with-tbt-monitor.patch +cpufreq-intel_pstate-make-hwp_notify_lock-a-raw-spin.patch +kconfig-qconf-fix-buffer-overflow-in-debug-links.patch +i2c-create-debugfs-entry-per-adapter.patch +i2c-core-lock-address-during-client-device-instantia.patch +i2c-xiic-use-devm_clk_get_enabled.patch +i2c-xiic-fix-pm_runtime_set_suspended-with-runtime-p.patch +dt-bindings-clock-exynos7885-fix-duplicated-binding.patch +spi-bcm63xx-fix-missing-pm_runtime_disable.patch +arm64-add-cortex-715-cpu-part-definition.patch +arm64-cputype-add-neoverse-n3-definitions.patch +arm64-errata-expand-speculative-ssbs-workaround-once.patch +io_uring-net-harden-multishot-termination-case-for-r.patch +uprobes-fix-kernel-info-leak-via-uprobes-vma.patch +mm-z3fold-deprecate-config_z3fold.patch +drm-amd-display-allow-backlight-to-go-below-amdgpu_d.patch +build-id-require-program-headers-to-be-right-after-e.patch +lib-buildid-harden-build-id-parsing-logic.patch +docs-zh_cn-update-the-translation-of-delay-accountin.patch +delayacct-improve-the-average-delay-precision-of-get.patch +sched-psi-fix-bogus-pressure-spikes-from-aggregation.patch +clk-imx6ul-fix-enet1-gate-configuration.patch +clk-imx6ul-add-ethernet-refclock-mux-support.patch +clk-imx6ul-retain-early-uart-clocks-during-kernel-in.patch +clk-imx6ul-fix-clock-parent-for-imx6ul_clk_enetx_ref.patch +media-i2c-imx335-enable-regulator-supplies.patch +media-imx335-fix-reset-gpio-handling.patch +remoteproc-k3-r5-acquire-mailbox-handle-during-probe.patch +remoteproc-k3-r5-delay-notification-of-wakeup-event.patch +dt-bindings-clock-qcom-add-missing-ufs-qref-clocks.patch +dt-bindings-clock-qcom-add-gpll9-support-on-gcc-sc81.patch +clk-samsung-exynos7885-do-not-define-number-of-clock.patch +clk-samsung-exynos7885-update-clks_nr_fsys-after-bin.patch +r8169-fix-spelling-mistake-tx_underun-tx_underrun.patch +r8169-add-tally-counter-fields-added-with-rtl8125.patch +clk-qcom-gcc-sc8180x-add-gpll9-support.patch +acpi-battery-simplify-battery-hook-locking.patch +acpi-battery-fix-possible-crash-when-unregistering-a.patch diff --git a/queue-6.1/spi-bcm63xx-fix-missing-pm_runtime_disable.patch b/queue-6.1/spi-bcm63xx-fix-missing-pm_runtime_disable.patch new file mode 100644 index 00000000000..5809d1eede4 --- /dev/null +++ b/queue-6.1/spi-bcm63xx-fix-missing-pm_runtime_disable.patch @@ -0,0 +1,58 @@ +From 10875dcdea74d4f917fd5a32fcd1b45a20938881 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 19 Aug 2024 20:33:49 +0800 +Subject: spi: bcm63xx: Fix missing pm_runtime_disable() + +From: Jinjie Ruan + +[ Upstream commit 265697288ec2160ca84707565d6641d46f69b0ff ] + +The pm_runtime_disable() is missing in the remove function, fix it +by using devm_pm_runtime_enable(), so the pm_runtime_disable() in +the probe error path can also be removed. + +Fixes: 2d13f2ff6073 ("spi: bcm63xx-spi: fix pm_runtime") +Cc: stable@vger.kernel.org # v5.13+ +Signed-off-by: Jinjie Ruan +Suggested-by: Jonas Gorski +Link: https://patch.msgid.link/20240819123349.4020472-3-ruanjinjie@huawei.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-bcm63xx.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c +index 51296615536a9..695ac74571286 100644 +--- a/drivers/spi/spi-bcm63xx.c ++++ b/drivers/spi/spi-bcm63xx.c +@@ -595,13 +595,15 @@ static int bcm63xx_spi_probe(struct platform_device *pdev) + + bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS); + +- pm_runtime_enable(&pdev->dev); ++ ret = devm_pm_runtime_enable(&pdev->dev); ++ if (ret) ++ goto out_clk_disable; + + /* register and we are done */ + ret = devm_spi_register_master(dev, master); + if (ret) { + dev_err(dev, "spi register failed\n"); +- goto out_pm_disable; ++ goto out_clk_disable; + } + + dev_info(dev, "at %pr (irq %d, FIFOs size %d)\n", +@@ -609,8 +611,6 @@ static int bcm63xx_spi_probe(struct platform_device *pdev) + + return 0; + +-out_pm_disable: +- pm_runtime_disable(&pdev->dev); + out_clk_disable: + clk_disable_unprepare(clk); + out_err: +-- +2.43.0 + diff --git a/queue-6.1/uprobes-fix-kernel-info-leak-via-uprobes-vma.patch b/queue-6.1/uprobes-fix-kernel-info-leak-via-uprobes-vma.patch new file mode 100644 index 00000000000..58948368106 --- /dev/null +++ b/queue-6.1/uprobes-fix-kernel-info-leak-via-uprobes-vma.patch @@ -0,0 +1,43 @@ +From 85a993c6a12963e5f3c5712bafe8434991ba726c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Oct 2024 19:46:01 +0200 +Subject: uprobes: fix kernel info leak via "[uprobes]" vma + +From: Oleg Nesterov + +commit 34820304cc2cd1804ee1f8f3504ec77813d29c8e upstream. + +xol_add_vma() maps the uninitialized page allocated by __create_xol_area() +into userspace. On some architectures (x86) this memory is readable even +without VM_READ, VM_EXEC results in the same pgprot_t as VM_EXEC|VM_READ, +although this doesn't really matter, debugger can read this memory anyway. + +Link: https://lore.kernel.org/all/20240929162047.GA12611@redhat.com/ + +Reported-by: Will Deacon +Fixes: d4b3b6384f98 ("uprobes/core: Allocate XOL slots for uprobes use") +Cc: stable@vger.kernel.org +Acked-by: Masami Hiramatsu (Google) +Signed-off-by: Oleg Nesterov +Signed-off-by: Masami Hiramatsu (Google) +Signed-off-by: Sasha Levin +--- + kernel/events/uprobes.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c +index 8a5989d46c930..9ee25351cecac 100644 +--- a/kernel/events/uprobes.c ++++ b/kernel/events/uprobes.c +@@ -1494,7 +1494,7 @@ static struct xol_area *__create_xol_area(unsigned long vaddr) + + area->xol_mapping.name = "[uprobes]"; + area->xol_mapping.pages = area->pages; +- area->pages[0] = alloc_page(GFP_HIGHUSER); ++ area->pages[0] = alloc_page(GFP_HIGHUSER | __GFP_ZERO); + if (!area->pages[0]) + goto free_bitmap; + area->pages[1] = NULL; +-- +2.43.0 +