From 4a206afefa1efa076e790d2a4d4647fdb40af6a2 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 21 Jul 2023 07:40:41 +0200 Subject: [PATCH] 5.10-stable patches added patches: erofs-fix-compact-4b-support-for-16k-block-size.patch mips-loongson-fix-cpu_probe_loongson-again.patch misc-fastrpc-create-fastrpc-scalar-with-correct-buffer-count.patch powerpc-fail-build-if-using-recordmcount-with-binutils-v2.37.patch --- ...ompact-4b-support-for-16k-block-size.patch | 66 ++++++++++++++ ...oongson-fix-cpu_probe_loongson-again.patch | 85 +++++++++++++++++++ ...rpc-scalar-with-correct-buffer-count.patch | 37 ++++++++ ...ing-recordmcount-with-binutils-v2.37.patch | 49 +++++++++++ queue-5.10/series | 4 + 5 files changed, 241 insertions(+) create mode 100644 queue-5.10/erofs-fix-compact-4b-support-for-16k-block-size.patch create mode 100644 queue-5.10/mips-loongson-fix-cpu_probe_loongson-again.patch create mode 100644 queue-5.10/misc-fastrpc-create-fastrpc-scalar-with-correct-buffer-count.patch create mode 100644 queue-5.10/powerpc-fail-build-if-using-recordmcount-with-binutils-v2.37.patch diff --git a/queue-5.10/erofs-fix-compact-4b-support-for-16k-block-size.patch b/queue-5.10/erofs-fix-compact-4b-support-for-16k-block-size.patch new file mode 100644 index 00000000000..8782d8e163d --- /dev/null +++ b/queue-5.10/erofs-fix-compact-4b-support-for-16k-block-size.patch @@ -0,0 +1,66 @@ +From 001b8ccd0650727e54ec16ef72bf1b8eeab7168e Mon Sep 17 00:00:00 2001 +From: Gao Xiang +Date: Thu, 1 Jun 2023 19:23:41 +0800 +Subject: erofs: fix compact 4B support for 16k block size + +From: Gao Xiang + +commit 001b8ccd0650727e54ec16ef72bf1b8eeab7168e upstream. + +In compact 4B, two adjacent lclusters are packed together as a unit to +form on-disk indexes for effective random access, as below: + +(amortized = 4, vcnt = 2) + _____________________________________________ + |___@_____ encoded bits __________|_ blkaddr _| + 0 . amortized * vcnt = 8 + . . + . . amortized * vcnt - 4 = 4 + . . + .____________________________. + |_type (2 bits)_|_clusterofs_| + +Therefore, encoded bits for each pack are 32 bits (4 bytes). IOWs, +since each lcluster can get 16 bits for its type and clusterofs, the +maximum supported lclustersize for compact 4B format is 16k (14 bits). + +Fix this to enable compact 4B format for 16k lclusters (blocks), which +is tested on an arm64 server with 16k page size. + +Fixes: 152a333a5895 ("staging: erofs: add compacted compression indexes support") +Signed-off-by: Gao Xiang +Link: https://lore.kernel.org/r/20230601112341.56960-1-hsiangkao@linux.alibaba.com +Signed-off-by: Greg Kroah-Hartman +--- + fs/erofs/zmap.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +--- a/fs/erofs/zmap.c ++++ b/fs/erofs/zmap.c +@@ -215,7 +215,7 @@ static int unpack_compacted_index(struct + int i; + u8 *in, type; + +- if (1 << amortizedshift == 4) ++ if (1 << amortizedshift == 4 && lclusterbits <= 14) + vcnt = 2; + else if (1 << amortizedshift == 2 && lclusterbits == 12) + vcnt = 16; +@@ -273,7 +273,6 @@ static int compacted_load_cluster_from_d + { + struct inode *const inode = m->inode; + struct erofs_inode *const vi = EROFS_I(inode); +- const unsigned int lclusterbits = vi->z_logical_clusterbits; + const erofs_off_t ebase = ALIGN(iloc(EROFS_I_SB(inode), vi->nid) + + vi->inode_isize + vi->xattr_isize, 8) + + sizeof(struct z_erofs_map_header); +@@ -283,9 +282,6 @@ static int compacted_load_cluster_from_d + erofs_off_t pos; + int err; + +- if (lclusterbits != 12) +- return -EOPNOTSUPP; +- + if (lcn >= totalidx) + return -EINVAL; + diff --git a/queue-5.10/mips-loongson-fix-cpu_probe_loongson-again.patch b/queue-5.10/mips-loongson-fix-cpu_probe_loongson-again.patch new file mode 100644 index 00000000000..179c3d703d2 --- /dev/null +++ b/queue-5.10/mips-loongson-fix-cpu_probe_loongson-again.patch @@ -0,0 +1,85 @@ +From 65fee014dc41a774bcd94896f3fb380bc39d8dda Mon Sep 17 00:00:00 2001 +From: Huacai Chen +Date: Mon, 26 Jun 2023 15:50:14 +0800 +Subject: MIPS: Loongson: Fix cpu_probe_loongson() again + +From: Huacai Chen + +commit 65fee014dc41a774bcd94896f3fb380bc39d8dda upstream. + +Commit 7db5e9e9e5e6c10d7d ("MIPS: loongson64: fix FTLB configuration") +move decode_configs() from the beginning of cpu_probe_loongson() to the +end in order to fix FTLB configuration. However, it breaks the CPUCFG +decoding because decode_configs() use "c->options = xxxx" rather than +"c->options |= xxxx", all information get from CPUCFG by decode_cpucfg() +is lost. + +This causes error when creating a KVM guest on Loongson-3A4000: +Exception Code: 4 not handled @ PC: 0000000087ad5981, inst: 0xcb7a1898 BadVaddr: 0x0 Status: 0x0 + +Fix this by moving the c->cputype setting to the beginning and moving +decode_configs() after that. + +Fixes: 7db5e9e9e5e6c10d7d ("MIPS: loongson64: fix FTLB configuration") +Cc: stable@vger.kernel.org +Cc: Huang Pei +Signed-off-by: Huacai Chen +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/kernel/cpu-probe.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +--- a/arch/mips/kernel/cpu-probe.c ++++ b/arch/mips/kernel/cpu-probe.c +@@ -1721,7 +1721,10 @@ static inline void decode_cpucfg(struct + + static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu) + { ++ c->cputype = CPU_LOONGSON64; ++ + /* All Loongson processors covered here define ExcCode 16 as GSExc. */ ++ decode_configs(c); + c->options |= MIPS_CPU_GSEXCEX; + + switch (c->processor_id & PRID_IMP_MASK) { +@@ -1731,7 +1734,6 @@ static inline void cpu_probe_loongson(st + case PRID_REV_LOONGSON2K_R1_1: + case PRID_REV_LOONGSON2K_R1_2: + case PRID_REV_LOONGSON2K_R1_3: +- c->cputype = CPU_LOONGSON64; + __cpu_name[cpu] = "Loongson-2K"; + set_elf_platform(cpu, "gs264e"); + set_isa(c, MIPS_CPU_ISA_M64R2); +@@ -1744,14 +1746,12 @@ static inline void cpu_probe_loongson(st + switch (c->processor_id & PRID_REV_MASK) { + case PRID_REV_LOONGSON3A_R2_0: + case PRID_REV_LOONGSON3A_R2_1: +- c->cputype = CPU_LOONGSON64; + __cpu_name[cpu] = "ICT Loongson-3"; + set_elf_platform(cpu, "loongson3a"); + set_isa(c, MIPS_CPU_ISA_M64R2); + break; + case PRID_REV_LOONGSON3A_R3_0: + case PRID_REV_LOONGSON3A_R3_1: +- c->cputype = CPU_LOONGSON64; + __cpu_name[cpu] = "ICT Loongson-3"; + set_elf_platform(cpu, "loongson3a"); + set_isa(c, MIPS_CPU_ISA_M64R2); +@@ -1771,7 +1771,6 @@ static inline void cpu_probe_loongson(st + c->ases &= ~MIPS_ASE_VZ; /* VZ of Loongson-3A2000/3000 is incomplete */ + break; + case PRID_IMP_LOONGSON_64G: +- c->cputype = CPU_LOONGSON64; + __cpu_name[cpu] = "ICT Loongson-3"; + set_elf_platform(cpu, "loongson3a"); + set_isa(c, MIPS_CPU_ISA_M64R2); +@@ -1781,8 +1780,6 @@ static inline void cpu_probe_loongson(st + panic("Unknown Loongson Processor ID!"); + break; + } +- +- decode_configs(c); + } + #else + static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu) { } diff --git a/queue-5.10/misc-fastrpc-create-fastrpc-scalar-with-correct-buffer-count.patch b/queue-5.10/misc-fastrpc-create-fastrpc-scalar-with-correct-buffer-count.patch new file mode 100644 index 00000000000..4e946ed25ec --- /dev/null +++ b/queue-5.10/misc-fastrpc-create-fastrpc-scalar-with-correct-buffer-count.patch @@ -0,0 +1,37 @@ +From 0b4e32df3e09406b835d8230b9331273f2805058 Mon Sep 17 00:00:00 2001 +From: Ekansh Gupta +Date: Wed, 14 Jun 2023 17:24:45 +0530 +Subject: misc: fastrpc: Create fastrpc scalar with correct buffer count + +From: Ekansh Gupta + +commit 0b4e32df3e09406b835d8230b9331273f2805058 upstream. + +A process can spawn a PD on DSP with some attributes that can be +associated with the PD during spawn and run. The invocation +corresponding to the create request with attributes has total +4 buffers at the DSP side implementation. If this number is not +correct, the invocation is expected to fail on DSP. Added change +to use correct number of buffer count for creating fastrpc scalar. + +Fixes: d73f71c7c6ee ("misc: fastrpc: Add support for create remote init process") +Cc: stable +Tested-by: Ekansh Gupta +Signed-off-by: Ekansh Gupta +Message-ID: <1686743685-21715-1-git-send-email-quic_ekangupt@quicinc.com> +Signed-off-by: Greg Kroah-Hartman +--- + drivers/misc/fastrpc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/misc/fastrpc.c ++++ b/drivers/misc/fastrpc.c +@@ -1106,7 +1106,7 @@ static int fastrpc_init_create_process(s + + sc = FASTRPC_SCALARS(FASTRPC_RMID_INIT_CREATE, 4, 0); + if (init.attrs) +- sc = FASTRPC_SCALARS(FASTRPC_RMID_INIT_CREATE_ATTR, 6, 0); ++ sc = FASTRPC_SCALARS(FASTRPC_RMID_INIT_CREATE_ATTR, 4, 0); + + err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, + sc, args); diff --git a/queue-5.10/powerpc-fail-build-if-using-recordmcount-with-binutils-v2.37.patch b/queue-5.10/powerpc-fail-build-if-using-recordmcount-with-binutils-v2.37.patch new file mode 100644 index 00000000000..fa179d913f9 --- /dev/null +++ b/queue-5.10/powerpc-fail-build-if-using-recordmcount-with-binutils-v2.37.patch @@ -0,0 +1,49 @@ +From 25ea739ea1d4d3de41acc4f4eb2d1a97eee0eb75 Mon Sep 17 00:00:00 2001 +From: Naveen N Rao +Date: Tue, 30 May 2023 11:44:36 +0530 +Subject: powerpc: Fail build if using recordmcount with binutils v2.37 + +From: Naveen N Rao + +commit 25ea739ea1d4d3de41acc4f4eb2d1a97eee0eb75 upstream. + +binutils v2.37 drops unused section symbols, which prevents recordmcount +from capturing mcount locations in sections that have no non-weak +symbols. This results in a build failure with a message such as: + Cannot find symbol for section 12: .text.perf_callchain_kernel. + kernel/events/callchain.o: failed + +The change to binutils was reverted for v2.38, so this behavior is +specific to binutils v2.37: +https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c09c8b42021180eee9495bd50d8b35e683d3901b + +Objtool is able to cope with such sections, so this issue is specific to +recordmcount. + +Fail the build and print a warning if binutils v2.37 is detected and if +we are using recordmcount. + +Cc: stable@vger.kernel.org +Suggested-by: Joel Stanley +Signed-off-by: Naveen N Rao +Signed-off-by: Michael Ellerman +Link: https://msgid.link/20230530061436.56925-1-naveen@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + arch/powerpc/Makefile | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/arch/powerpc/Makefile ++++ b/arch/powerpc/Makefile +@@ -429,3 +429,11 @@ checkbin: + echo -n '*** Please use a different binutils version.' ; \ + false ; \ + fi ++ @if test "x${CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT}" = "xy" -a \ ++ "x${CONFIG_LD_IS_BFD}" = "xy" -a \ ++ "${CONFIG_LD_VERSION}" = "23700" ; then \ ++ echo -n '*** binutils 2.37 drops unused section symbols, which recordmcount ' ; \ ++ echo 'is unable to handle.' ; \ ++ echo '*** Please use a different binutils version.' ; \ ++ false ; \ ++ fi diff --git a/queue-5.10/series b/queue-5.10/series index b4a55ad5aca..849bda5f03f 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -381,3 +381,7 @@ pinctrl-amd-only-use-special-debounce-behavior-for-gpio-0.patch tpm-tpm_vtpm_proxy-fix-a-race-condition-in-dev-vtpmx-creation.patch mtd-rawnand-meson-fix-unaligned-dma-buffers-handling.patch net-bcmgenet-ensure-mdio-unregistration-has-clocks-enabled.patch +powerpc-fail-build-if-using-recordmcount-with-binutils-v2.37.patch +misc-fastrpc-create-fastrpc-scalar-with-correct-buffer-count.patch +erofs-fix-compact-4b-support-for-16k-block-size.patch +mips-loongson-fix-cpu_probe_loongson-again.patch -- 2.47.3