--- /dev/null
+From 9e4e249018d208678888bdf22f6b652728106528 Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Fri, 28 Mar 2025 21:39:08 +0100
+Subject: cpufreq: Reference count policy in cpufreq_update_limits()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+commit 9e4e249018d208678888bdf22f6b652728106528 upstream.
+
+Since acpi_processor_notify() can be called before registering a cpufreq
+driver or even in cases when a cpufreq driver is not registered at all,
+cpufreq_update_limits() needs to check if a cpufreq driver is present
+and prevent it from being unregistered.
+
+For this purpose, make it call cpufreq_cpu_get() to obtain a cpufreq
+policy pointer for the given CPU and reference count the corresponding
+policy object, if present.
+
+Fixes: 5a25e3f7cc53 ("cpufreq: intel_pstate: Driver-specific handling of _PPC updates")
+Closes: https://lore.kernel.org/linux-acpi/Z-ShAR59cTow0KcR@mail-itl
+Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
+Cc: All applicable <stable@vger.kernel.org>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
+Link: https://patch.msgid.link/1928789.tdWV9SEqCh@rjwysocki.net
+[do not use __free(cpufreq_cpu_put) in a backport]
+Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/cpufreq/cpufreq.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/cpufreq/cpufreq.c
++++ b/drivers/cpufreq/cpufreq.c
+@@ -2766,10 +2766,18 @@ EXPORT_SYMBOL(cpufreq_update_policy);
+ */
+ void cpufreq_update_limits(unsigned int cpu)
+ {
++ struct cpufreq_policy *policy;
++
++ policy = cpufreq_cpu_get(cpu);
++ if (!policy)
++ return;
++
+ if (cpufreq_driver->update_limits)
+ cpufreq_driver->update_limits(cpu);
+ else
+ cpufreq_update_policy(cpu);
++
++ cpufreq_cpu_put(policy);
+ }
+ EXPORT_SYMBOL_GPL(cpufreq_update_limits);
+
--- /dev/null
+From 99d01048fc148dc10471b67da642df190a9727bb Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Mon, 7 Apr 2025 16:22:12 -0700
+Subject: kbuild: Add '-fno-builtin-wcslen'
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+commit 84ffc79bfbf70c779e60218563f2f3ad45288671 upstream.
+
+A recent optimization change in LLVM [1] aims to transform certain loop
+idioms into calls to strlen() or wcslen(). This change transforms the
+first while loop in UniStrcat() into a call to wcslen(), breaking the
+build when UniStrcat() gets inlined into alloc_path_with_tree_prefix():
+
+ ld.lld: error: undefined symbol: wcslen
+ >>> referenced by nls_ucs2_utils.h:54 (fs/smb/client/../../nls/nls_ucs2_utils.h:54)
+ >>> vmlinux.o:(alloc_path_with_tree_prefix)
+ >>> referenced by nls_ucs2_utils.h:54 (fs/smb/client/../../nls/nls_ucs2_utils.h:54)
+ >>> vmlinux.o:(alloc_path_with_tree_prefix)
+
+Disable this optimization with '-fno-builtin-wcslen', which prevents the
+compiler from assuming that wcslen() is available in the kernel's C
+library.
+
+[ More to the point - it's not that we couldn't implement wcslen(), it's
+ that this isn't an optimization at all in the context of the kernel.
+
+ Replacing a simple inlined loop with a function call to the same loop
+ is just stupid and pointless if you don't have long strings and fancy
+ libraries with vectorization support etc.
+
+ For the regular 'strlen()' cases, we want the compiler to do this in
+ order to handle the trivial case of constant strings. And we do have
+ optimized versions of 'strlen()' on some architectures. But for
+ wcslen? Just no. - Linus ]
+
+Cc: stable@vger.kernel.org
+Link: https://github.com/llvm/llvm-project/commit/9694844d7e36fd5e01011ab56b64f27b867aa72d [1]
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+[nathan: Resolve small conflict in older trees]
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Makefile | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/Makefile
++++ b/Makefile
+@@ -1015,6 +1015,9 @@ endif
+ # Ensure compilers do not transform certain loops into calls to wcslen()
+ KBUILD_CFLAGS += -fno-builtin-wcslen
+
++# Ensure compilers do not transform certain loops into calls to wcslen()
++KBUILD_CFLAGS += -fno-builtin-wcslen
++
+ # change __FILE__ to the relative path from the srctree
+ KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
+
--- /dev/null
+From 05a2b0011c4b6cbbc9b577f6abebe4e9333b0cf6 Mon Sep 17 00:00:00 2001
+From: Lukas Fischer <kernel@o1oo11oo.de>
+Date: Fri, 4 Apr 2025 14:51:51 +0200
+Subject: scripts: generate_rust_analyzer: Add ffi crate
+
+From: Lukas Fischer <kernel@o1oo11oo.de>
+
+commit 05a2b0011c4b6cbbc9b577f6abebe4e9333b0cf6 upstream.
+
+Commit d072acda4862 ("rust: use custom FFI integer types") did not
+update rust-analyzer to include the new crate.
+
+To enable rust-analyzer support for these custom ffi types, add the
+`ffi` crate as a dependency to the `bindings`, `uapi` and `kernel`
+crates, which all directly depend on it.
+
+Fixes: d072acda4862 ("rust: use custom FFI integer types")
+Signed-off-by: Lukas Fischer <kernel@o1oo11oo.de>
+Reviewed-by: Tamir Duberstein <tamird@gmail.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20250404125150.85783-2-kernel@o1oo11oo.de
+Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ scripts/generate_rust_analyzer.py | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+--- a/scripts/generate_rust_analyzer.py
++++ b/scripts/generate_rust_analyzer.py
+@@ -90,6 +90,12 @@ def generate_crates(srctree, objtree, sy
+ ["core", "compiler_builtins"],
+ )
+
++ append_crate(
++ "ffi",
++ srctree / "rust" / "ffi.rs",
++ ["core", "compiler_builtins"],
++ )
++
+ def append_crate_with_generated(
+ display_name,
+ deps,
+@@ -109,9 +115,9 @@ def generate_crates(srctree, objtree, sy
+ "exclude_dirs": [],
+ }
+
+- append_crate_with_generated("bindings", ["core"])
+- append_crate_with_generated("uapi", ["core"])
+- append_crate_with_generated("kernel", ["core", "macros", "build_error", "bindings", "uapi"])
++ append_crate_with_generated("bindings", ["core", "ffi"])
++ append_crate_with_generated("uapi", ["core", "ffi"])
++ append_crate_with_generated("kernel", ["core", "macros", "build_error", "ffi", "bindings", "uapi"])
+
+ def is_root_crate(build_file, target):
+ try:
arm64-sysreg-add-register-fields-for-hfgrtr2_el2.patch
arm64-sysreg-add-register-fields-for-hfgwtr2_el2.patch
arm64-boot-enable-el2-requirements-for-feat_pmuv3p9.patch
+cpufreq-reference-count-policy-in-cpufreq_update_limits.patch
+scripts-generate_rust_analyzer-add-ffi-crate.patch
+kbuild-add-fno-builtin-wcslen.patch