From fd135ff9e152adace548bc5cca6e16a356a83e29 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 4 Jul 2024 11:28:29 +0200 Subject: [PATCH] drop some broken patches from 5.10 and 5.4 --- .../s390-cpacf-get-rid-of-register-asm.patch | 375 ------------------ ...use-of-invalid-opcode-produce-a-link.patch | 65 --- ...lit-and-rework-cpacf-query-functions.patch | 152 ------- queue-5.10/series | 4 - .../sh-rework-sync_file_range-abi.patch | 72 ---- .../s390-cpacf-get-rid-of-register-asm.patch | 375 ------------------ ...use-of-invalid-opcode-produce-a-link.patch | 65 --- ...lit-and-rework-cpacf-query-functions.patch | 152 ------- queue-5.4/series | 4 - queue-5.4/sh-rework-sync_file_range-abi.patch | 72 ---- 10 files changed, 1336 deletions(-) delete mode 100644 queue-5.10/s390-cpacf-get-rid-of-register-asm.patch delete mode 100644 queue-5.10/s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch delete mode 100644 queue-5.10/s390-cpacf-split-and-rework-cpacf-query-functions.patch delete mode 100644 queue-5.10/sh-rework-sync_file_range-abi.patch delete mode 100644 queue-5.4/s390-cpacf-get-rid-of-register-asm.patch delete mode 100644 queue-5.4/s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch delete mode 100644 queue-5.4/s390-cpacf-split-and-rework-cpacf-query-functions.patch delete mode 100644 queue-5.4/sh-rework-sync_file_range-abi.patch diff --git a/queue-5.10/s390-cpacf-get-rid-of-register-asm.patch b/queue-5.10/s390-cpacf-get-rid-of-register-asm.patch deleted file mode 100644 index 85c96ad4d51..00000000000 --- a/queue-5.10/s390-cpacf-get-rid-of-register-asm.patch +++ /dev/null @@ -1,375 +0,0 @@ -From 67dff0da116be96e472460e4bf7b63a26f39ec4a Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 25 Jun 2021 16:42:55 +0200 -Subject: s390/cpacf: get rid of register asm - -From: Heiko Carstens - -[ Upstream commit b84d0c417a5ac1eb820c8114c0c7cf1fcbf6f017 ] - -Using register asm statements has been proven to be very error prone, -especially when using code instrumentation where gcc may add function -calls, which clobbers register contents in an unexpected way. - -Therefore get rid of register asm statements in cpacf code, and make -sure this bug class cannot happen. - -Reviewed-by: Patrick Steuer -Signed-off-by: Heiko Carstens -Stable-dep-of: 830999bd7e72 ("s390/cpacf: Split and rework cpacf query functions") -Signed-off-by: Sasha Levin ---- - arch/s390/include/asm/cpacf.h | 208 ++++++++++++++++++---------------- - 1 file changed, 111 insertions(+), 97 deletions(-) - -diff --git a/arch/s390/include/asm/cpacf.h b/arch/s390/include/asm/cpacf.h -index c0f3bfeddcbeb..646b12981f208 100644 ---- a/arch/s390/include/asm/cpacf.h -+++ b/arch/s390/include/asm/cpacf.h -@@ -173,17 +173,16 @@ typedef struct { unsigned char bytes[16]; } cpacf_mask_t; - */ - static __always_inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask) - { -- register unsigned long r0 asm("0") = 0; /* query function */ -- register unsigned long r1 asm("1") = (unsigned long) mask; -- - asm volatile( -- " spm 0\n" /* pckmo doesn't change the cc */ -+ " lghi 0,0\n" /* query function */ -+ " lgr 1,%[mask]\n" -+ " spm 0\n" /* pckmo doesn't change the cc */ - /* Parameter regs are ignored, but must be nonzero and unique */ - "0: .insn rrf,%[opc] << 16,2,4,6,0\n" - " brc 1,0b\n" /* handle partial completion */ - : "=m" (*mask) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (opcode) -- : "cc"); -+ : [mask] "d" ((unsigned long)mask), [opc] "i" (opcode) -+ : "cc", "0", "1"); - } - - static __always_inline int __cpacf_check_opcode(unsigned int opcode) -@@ -249,20 +248,22 @@ static __always_inline int cpacf_query_func(unsigned int opcode, unsigned int fu - static inline int cpacf_km(unsigned long func, void *param, - u8 *dest, const u8 *src, long src_len) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) src; -- register unsigned long r3 asm("3") = (unsigned long) src_len; -- register unsigned long r4 asm("4") = (unsigned long) dest; -+ union register_pair d, s; - -+ d.even = (unsigned long)dest; -+ s.even = (unsigned long)src; -+ s.odd = (unsigned long)src_len; - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rre,%[opc] << 16,%[dst],%[src]\n" - " brc 1,0b\n" /* handle partial completion */ -- : [src] "+a" (r2), [len] "+d" (r3), [dst] "+a" (r4) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KM) -- : "cc", "memory"); -+ : [src] "+&d" (s.pair), [dst] "+&d" (d.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_KM) -+ : "cc", "memory", "0", "1"); - -- return src_len - r3; -+ return src_len - s.odd; - } - - /** -@@ -279,20 +280,22 @@ static inline int cpacf_km(unsigned long func, void *param, - static inline int cpacf_kmc(unsigned long func, void *param, - u8 *dest, const u8 *src, long src_len) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) src; -- register unsigned long r3 asm("3") = (unsigned long) src_len; -- register unsigned long r4 asm("4") = (unsigned long) dest; -+ union register_pair d, s; - -+ d.even = (unsigned long)dest; -+ s.even = (unsigned long)src; -+ s.odd = (unsigned long)src_len; - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rre,%[opc] << 16,%[dst],%[src]\n" - " brc 1,0b\n" /* handle partial completion */ -- : [src] "+a" (r2), [len] "+d" (r3), [dst] "+a" (r4) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KMC) -- : "cc", "memory"); -+ : [src] "+&d" (s.pair), [dst] "+&d" (d.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_KMC) -+ : "cc", "memory", "0", "1"); - -- return src_len - r3; -+ return src_len - s.odd; - } - - /** -@@ -306,17 +309,19 @@ static inline int cpacf_kmc(unsigned long func, void *param, - static inline void cpacf_kimd(unsigned long func, void *param, - const u8 *src, long src_len) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) src; -- register unsigned long r3 asm("3") = (unsigned long) src_len; -+ union register_pair s; - -+ s.even = (unsigned long)src; -+ s.odd = (unsigned long)src_len; - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rre,%[opc] << 16,0,%[src]\n" - " brc 1,0b\n" /* handle partial completion */ -- : [src] "+a" (r2), [len] "+d" (r3) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KIMD) -- : "cc", "memory"); -+ : [src] "+&d" (s.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)(param)), -+ [opc] "i" (CPACF_KIMD) -+ : "cc", "memory", "0", "1"); - } - - /** -@@ -329,17 +334,19 @@ static inline void cpacf_kimd(unsigned long func, void *param, - static inline void cpacf_klmd(unsigned long func, void *param, - const u8 *src, long src_len) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) src; -- register unsigned long r3 asm("3") = (unsigned long) src_len; -+ union register_pair s; - -+ s.even = (unsigned long)src; -+ s.odd = (unsigned long)src_len; - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rre,%[opc] << 16,0,%[src]\n" - " brc 1,0b\n" /* handle partial completion */ -- : [src] "+a" (r2), [len] "+d" (r3) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KLMD) -- : "cc", "memory"); -+ : [src] "+&d" (s.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_KLMD) -+ : "cc", "memory", "0", "1"); - } - - /** -@@ -355,19 +362,21 @@ static inline void cpacf_klmd(unsigned long func, void *param, - static inline int cpacf_kmac(unsigned long func, void *param, - const u8 *src, long src_len) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) src; -- register unsigned long r3 asm("3") = (unsigned long) src_len; -+ union register_pair s; - -+ s.even = (unsigned long)src; -+ s.odd = (unsigned long)src_len; - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rre,%[opc] << 16,0,%[src]\n" - " brc 1,0b\n" /* handle partial completion */ -- : [src] "+a" (r2), [len] "+d" (r3) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KMAC) -- : "cc", "memory"); -+ : [src] "+&d" (s.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_KMAC) -+ : "cc", "memory", "0", "1"); - -- return src_len - r3; -+ return src_len - s.odd; - } - - /** -@@ -385,22 +394,24 @@ static inline int cpacf_kmac(unsigned long func, void *param, - static inline int cpacf_kmctr(unsigned long func, void *param, u8 *dest, - const u8 *src, long src_len, u8 *counter) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) src; -- register unsigned long r3 asm("3") = (unsigned long) src_len; -- register unsigned long r4 asm("4") = (unsigned long) dest; -- register unsigned long r6 asm("6") = (unsigned long) counter; -+ union register_pair d, s, c; - -+ d.even = (unsigned long)dest; -+ s.even = (unsigned long)src; -+ s.odd = (unsigned long)src_len; -+ c.even = (unsigned long)counter; - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rrf,%[opc] << 16,%[dst],%[src],%[ctr],0\n" - " brc 1,0b\n" /* handle partial completion */ -- : [src] "+a" (r2), [len] "+d" (r3), -- [dst] "+a" (r4), [ctr] "+a" (r6) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KMCTR) -- : "cc", "memory"); -+ : [src] "+&d" (s.pair), [dst] "+&d" (d.pair), -+ [ctr] "+&d" (c.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_KMCTR) -+ : "cc", "memory", "0", "1"); - -- return src_len - r3; -+ return src_len - s.odd; - } - - /** -@@ -417,20 +428,21 @@ static inline void cpacf_prno(unsigned long func, void *param, - u8 *dest, unsigned long dest_len, - const u8 *seed, unsigned long seed_len) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) dest; -- register unsigned long r3 asm("3") = (unsigned long) dest_len; -- register unsigned long r4 asm("4") = (unsigned long) seed; -- register unsigned long r5 asm("5") = (unsigned long) seed_len; -+ union register_pair d, s; - -+ d.even = (unsigned long)dest; -+ d.odd = (unsigned long)dest_len; -+ s.even = (unsigned long)seed; -+ s.odd = (unsigned long)seed_len; - asm volatile ( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rre,%[opc] << 16,%[dst],%[seed]\n" - " brc 1,0b\n" /* handle partial completion */ -- : [dst] "+a" (r2), [dlen] "+d" (r3) -- : [fc] "d" (r0), [pba] "a" (r1), -- [seed] "a" (r4), [slen] "d" (r5), [opc] "i" (CPACF_PRNO) -- : "cc", "memory"); -+ : [dst] "+&d" (d.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [seed] "d" (s.pair), [opc] "i" (CPACF_PRNO) -+ : "cc", "memory", "0", "1"); - } - - /** -@@ -443,19 +455,19 @@ static inline void cpacf_prno(unsigned long func, void *param, - static inline void cpacf_trng(u8 *ucbuf, unsigned long ucbuf_len, - u8 *cbuf, unsigned long cbuf_len) - { -- register unsigned long r0 asm("0") = (unsigned long) CPACF_PRNO_TRNG; -- register unsigned long r2 asm("2") = (unsigned long) ucbuf; -- register unsigned long r3 asm("3") = (unsigned long) ucbuf_len; -- register unsigned long r4 asm("4") = (unsigned long) cbuf; -- register unsigned long r5 asm("5") = (unsigned long) cbuf_len; -+ union register_pair u, c; - -+ u.even = (unsigned long)ucbuf; -+ u.odd = (unsigned long)ucbuf_len; -+ c.even = (unsigned long)cbuf; -+ c.odd = (unsigned long)cbuf_len; - asm volatile ( -+ " lghi 0,%[fc]\n" - "0: .insn rre,%[opc] << 16,%[ucbuf],%[cbuf]\n" - " brc 1,0b\n" /* handle partial completion */ -- : [ucbuf] "+a" (r2), [ucbuflen] "+d" (r3), -- [cbuf] "+a" (r4), [cbuflen] "+d" (r5) -- : [fc] "d" (r0), [opc] "i" (CPACF_PRNO) -- : "cc", "memory"); -+ : [ucbuf] "+&d" (u.pair), [cbuf] "+&d" (c.pair) -+ : [fc] "K" (CPACF_PRNO_TRNG), [opc] "i" (CPACF_PRNO) -+ : "cc", "memory", "0"); - } - - /** -@@ -466,15 +478,15 @@ static inline void cpacf_trng(u8 *ucbuf, unsigned long ucbuf_len, - */ - static inline void cpacf_pcc(unsigned long func, void *param) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rre,%[opc] << 16,0,0\n" /* PCC opcode */ - " brc 1,0b\n" /* handle partial completion */ - : -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_PCC) -- : "cc", "memory"); -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_PCC) -+ : "cc", "memory", "0", "1"); - } - - /** -@@ -487,14 +499,14 @@ static inline void cpacf_pcc(unsigned long func, void *param) - */ - static inline void cpacf_pckmo(long func, void *param) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - " .insn rre,%[opc] << 16,0,0\n" /* PCKMO opcode */ - : -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_PCKMO) -- : "cc", "memory"); -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_PCKMO) -+ : "cc", "memory", "0", "1"); - } - - /** -@@ -512,21 +524,23 @@ static inline void cpacf_kma(unsigned long func, void *param, u8 *dest, - const u8 *src, unsigned long src_len, - const u8 *aad, unsigned long aad_len) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) src; -- register unsigned long r3 asm("3") = (unsigned long) src_len; -- register unsigned long r4 asm("4") = (unsigned long) aad; -- register unsigned long r5 asm("5") = (unsigned long) aad_len; -- register unsigned long r6 asm("6") = (unsigned long) dest; -+ union register_pair d, s, a; - -+ d.even = (unsigned long)dest; -+ s.even = (unsigned long)src; -+ s.odd = (unsigned long)src_len; -+ a.even = (unsigned long)aad; -+ a.odd = (unsigned long)aad_len; - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rrf,%[opc] << 16,%[dst],%[src],%[aad],0\n" - " brc 1,0b\n" /* handle partial completion */ -- : [dst] "+a" (r6), [src] "+a" (r2), [slen] "+d" (r3), -- [aad] "+a" (r4), [alen] "+d" (r5) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KMA) -- : "cc", "memory"); -+ : [dst] "+&d" (d.pair), [src] "+&d" (s.pair), -+ [aad] "+&d" (a.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_KMA) -+ : "cc", "memory", "0", "1"); - } - - #endif /* _ASM_S390_CPACF_H */ --- -2.43.0 - diff --git a/queue-5.10/s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch b/queue-5.10/s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch deleted file mode 100644 index 8da7a146ff6..00000000000 --- a/queue-5.10/s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch +++ /dev/null @@ -1,65 +0,0 @@ -From dd53b6a67fdd1af2fbfb0333570ef8689f774427 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 14 May 2024 10:09:32 +0200 -Subject: s390/cpacf: Make use of invalid opcode produce a link error - -From: Harald Freudenberger - -[ Upstream commit 32e8bd6423fc127d2b37bdcf804fd76af3bbec79 ] - -Instead of calling BUG() at runtime introduce and use a prototype for a -non-existing function to produce a link error during compile when a not -supported opcode is used with the __cpacf_query() or __cpacf_check_opcode() -inline functions. - -Suggested-by: Heiko Carstens -Signed-off-by: Harald Freudenberger -Reviewed-by: Holger Dengler -Reviewed-by: Juergen Christ -Cc: stable@vger.kernel.org -Signed-off-by: Heiko Carstens -Signed-off-by: Sasha Levin ---- - arch/s390/include/asm/cpacf.h | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/arch/s390/include/asm/cpacf.h b/arch/s390/include/asm/cpacf.h -index fa31f71cf5746..0f6ff2008a159 100644 ---- a/arch/s390/include/asm/cpacf.h -+++ b/arch/s390/include/asm/cpacf.h -@@ -161,6 +161,13 @@ - - typedef struct { unsigned char bytes[16]; } cpacf_mask_t; - -+/* -+ * Prototype for a not existing function to produce a link -+ * error if __cpacf_query() or __cpacf_check_opcode() is used -+ * with an invalid compile time const opcode. -+ */ -+void __cpacf_bad_opcode(void); -+ - static __always_inline void __cpacf_query_rre(u32 opc, u8 r1, u8 r2, - cpacf_mask_t *mask) - { -@@ -232,7 +239,7 @@ static __always_inline void __cpacf_query(unsigned int opcode, - __cpacf_query_rre(CPACF_PRNO, 2, 4, mask); - break; - default: -- BUG(); -+ __cpacf_bad_opcode(); - } - } - -@@ -257,7 +264,8 @@ static __always_inline int __cpacf_check_opcode(unsigned int opcode) - case CPACF_KMA: - return test_facility(146); /* check for MSA8 */ - default: -- BUG(); -+ __cpacf_bad_opcode(); -+ return 0; - } - } - --- -2.43.0 - diff --git a/queue-5.10/s390-cpacf-split-and-rework-cpacf-query-functions.patch b/queue-5.10/s390-cpacf-split-and-rework-cpacf-query-functions.patch deleted file mode 100644 index e75c575bb08..00000000000 --- a/queue-5.10/s390-cpacf-split-and-rework-cpacf-query-functions.patch +++ /dev/null @@ -1,152 +0,0 @@ -From 10586c7ae6ec3b01d18b5385fc96ffc248958045 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 3 May 2024 11:31:42 +0200 -Subject: s390/cpacf: Split and rework cpacf query functions - -From: Harald Freudenberger - -[ Upstream commit 830999bd7e72f4128b9dfa37090d9fa8120ce323 ] - -Rework the cpacf query functions to use the correct RRE -or RRF instruction formats and set register fields within -instructions correctly. - -Fixes: 1afd43e0fbba ("s390/crypto: allow to query all known cpacf functions") -Reported-by: Nina Schoetterl-Glausch -Suggested-by: Heiko Carstens -Suggested-by: Juergen Christ -Suggested-by: Holger Dengler -Signed-off-by: Harald Freudenberger -Reviewed-by: Holger Dengler -Reviewed-by: Juergen Christ -Cc: -Signed-off-by: Heiko Carstens -Signed-off-by: Sasha Levin ---- - arch/s390/include/asm/cpacf.h | 101 +++++++++++++++++++++++++++------- - 1 file changed, 81 insertions(+), 20 deletions(-) - -diff --git a/arch/s390/include/asm/cpacf.h b/arch/s390/include/asm/cpacf.h -index 646b12981f208..fa31f71cf5746 100644 ---- a/arch/s390/include/asm/cpacf.h -+++ b/arch/s390/include/asm/cpacf.h -@@ -161,28 +161,79 @@ - - typedef struct { unsigned char bytes[16]; } cpacf_mask_t; - --/** -- * cpacf_query() - check if a specific CPACF function is available -- * @opcode: the opcode of the crypto instruction -- * @func: the function code to test for -- * -- * Executes the query function for the given crypto instruction @opcode -- * and checks if @func is available -- * -- * Returns 1 if @func is available for @opcode, 0 otherwise -- */ --static __always_inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask) -+static __always_inline void __cpacf_query_rre(u32 opc, u8 r1, u8 r2, -+ cpacf_mask_t *mask) - { - asm volatile( -- " lghi 0,0\n" /* query function */ -- " lgr 1,%[mask]\n" -- " spm 0\n" /* pckmo doesn't change the cc */ -- /* Parameter regs are ignored, but must be nonzero and unique */ -- "0: .insn rrf,%[opc] << 16,2,4,6,0\n" -- " brc 1,0b\n" /* handle partial completion */ -- : "=m" (*mask) -- : [mask] "d" ((unsigned long)mask), [opc] "i" (opcode) -- : "cc", "0", "1"); -+ " la %%r1,%[mask]\n" -+ " xgr %%r0,%%r0\n" -+ " .insn rre,%[opc] << 16,%[r1],%[r2]\n" -+ : [mask] "=R" (*mask) -+ : [opc] "i" (opc), -+ [r1] "i" (r1), [r2] "i" (r2) -+ : "cc", "r0", "r1"); -+} -+ -+static __always_inline void __cpacf_query_rrf(u32 opc, -+ u8 r1, u8 r2, u8 r3, u8 m4, -+ cpacf_mask_t *mask) -+{ -+ asm volatile( -+ " la %%r1,%[mask]\n" -+ " xgr %%r0,%%r0\n" -+ " .insn rrf,%[opc] << 16,%[r1],%[r2],%[r3],%[m4]\n" -+ : [mask] "=R" (*mask) -+ : [opc] "i" (opc), [r1] "i" (r1), [r2] "i" (r2), -+ [r3] "i" (r3), [m4] "i" (m4) -+ : "cc", "r0", "r1"); -+} -+ -+static __always_inline void __cpacf_query(unsigned int opcode, -+ cpacf_mask_t *mask) -+{ -+ switch (opcode) { -+ case CPACF_KDSA: -+ __cpacf_query_rre(CPACF_KDSA, 0, 2, mask); -+ break; -+ case CPACF_KIMD: -+ __cpacf_query_rre(CPACF_KIMD, 0, 2, mask); -+ break; -+ case CPACF_KLMD: -+ __cpacf_query_rre(CPACF_KLMD, 0, 2, mask); -+ break; -+ case CPACF_KM: -+ __cpacf_query_rre(CPACF_KM, 2, 4, mask); -+ break; -+ case CPACF_KMA: -+ __cpacf_query_rrf(CPACF_KMA, 2, 4, 6, 0, mask); -+ break; -+ case CPACF_KMAC: -+ __cpacf_query_rre(CPACF_KMAC, 0, 2, mask); -+ break; -+ case CPACF_KMC: -+ __cpacf_query_rre(CPACF_KMC, 2, 4, mask); -+ break; -+ case CPACF_KMCTR: -+ __cpacf_query_rrf(CPACF_KMCTR, 2, 4, 6, 0, mask); -+ break; -+ case CPACF_KMF: -+ __cpacf_query_rre(CPACF_KMF, 2, 4, mask); -+ break; -+ case CPACF_KMO: -+ __cpacf_query_rre(CPACF_KMO, 2, 4, mask); -+ break; -+ case CPACF_PCC: -+ __cpacf_query_rre(CPACF_PCC, 0, 0, mask); -+ break; -+ case CPACF_PCKMO: -+ __cpacf_query_rre(CPACF_PCKMO, 0, 0, mask); -+ break; -+ case CPACF_PRNO: -+ __cpacf_query_rre(CPACF_PRNO, 2, 4, mask); -+ break; -+ default: -+ BUG(); -+ } - } - - static __always_inline int __cpacf_check_opcode(unsigned int opcode) -@@ -210,6 +261,16 @@ static __always_inline int __cpacf_check_opcode(unsigned int opcode) - } - } - -+/** -+ * cpacf_query() - check if a specific CPACF function is available -+ * @opcode: the opcode of the crypto instruction -+ * @func: the function code to test for -+ * -+ * Executes the query function for the given crypto instruction @opcode -+ * and checks if @func is available -+ * -+ * Returns 1 if @func is available for @opcode, 0 otherwise -+ */ - static __always_inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask) - { - if (__cpacf_check_opcode(opcode)) { --- -2.43.0 - diff --git a/queue-5.10/series b/queue-5.10/series index 8a03fdd4be0..52967d24bd0 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -34,8 +34,6 @@ mmc-davinci-don-t-strip-remove-function-when-driver-.patch selftests-mm-compaction_test-fix-incorrect-write-of-.patch selftests-mm-conform-test-to-tap-format-output.patch selftests-mm-compaction_test-fix-bogus-test-success-.patch -s390-cpacf-get-rid-of-register-asm.patch -s390-cpacf-split-and-rework-cpacf-query-functions.patch btrfs-fix-leak-of-qgroup-extent-records-after-transa.patch nilfs2-remove-check-for-pageerror.patch nilfs2-return-the-mapped-address-from-nilfs_get_page.patch @@ -176,7 +174,6 @@ pmdomain-ti-sci-fix-duplicate-pd-referrals.patch knfsd-lookup-can-return-an-illegal-error-value.patch spmi-hisi-spmi-controller-do-not-override-device-ide.patch bcache-fix-variable-length-array-abuse-in-btree_iter.patch -s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch tracing-add-module_description-to-preemptirq_delay_t.patch x86-cpu-vfm-add-new-macros-to-work-with-vendor-famil.patch x86-cpu-fix-x86_match_cpu-to-match-just-x86_vendor_i.patch @@ -259,7 +256,6 @@ net-can-j1939-initialize-unused-data-in-j1939_send_one.patch net-can-j1939-recover-socket-queue-on-can-bus-error-during-bam-transmission.patch net-can-j1939-enhanced-error-handling-for-tightly-received-rts-messages-in-xtp_rx_rts_session_new.patch kbuild-install-dtb-files-as-0644-in-makefile.dtbinst.patch -sh-rework-sync_file_range-abi.patch csky-hexagon-fix-broken-sys_sync_file_range.patch hexagon-fix-fadvise64_64-calling-conventions.patch drm-nouveau-dispnv04-fix-null-pointer-dereference-in-nv17_tv_get_ld_modes.patch diff --git a/queue-5.10/sh-rework-sync_file_range-abi.patch b/queue-5.10/sh-rework-sync_file_range-abi.patch deleted file mode 100644 index 9cfdd48bde0..00000000000 --- a/queue-5.10/sh-rework-sync_file_range-abi.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 30766f1105d6d2459c3b9fe34a3e52b637a72950 Mon Sep 17 00:00:00 2001 -From: Arnd Bergmann -Date: Tue, 11 Jun 2024 22:12:43 +0200 -Subject: sh: rework sync_file_range ABI - -From: Arnd Bergmann - -commit 30766f1105d6d2459c3b9fe34a3e52b637a72950 upstream. - -The unusual function calling conventions on SuperH ended up causing -sync_file_range to have the wrong argument order, with the 'flags' -argument getting sorted before 'nbytes' by the compiler. - -In userspace, I found that musl, glibc, uclibc and strace all expect the -normal calling conventions with 'nbytes' last, so changing the kernel -to match them should make all of those work. - -In order to be able to also fix libc implementations to work with existing -kernels, they need to be able to tell which ABI is used. An easy way -to do this is to add yet another system call using the sync_file_range2 -ABI that works the same on all architectures. - -Old user binaries can now work on new kernels, and new binaries can -try the new sync_file_range2() to work with new kernels or fall back -to the old sync_file_range() version if that doesn't exist. - -Cc: stable@vger.kernel.org -Fixes: 75c92acdd5b1 ("sh: Wire up new syscalls.") -Acked-by: John Paul Adrian Glaubitz -Signed-off-by: Arnd Bergmann -Signed-off-by: Greg Kroah-Hartman ---- - arch/sh/kernel/sys_sh32.c | 11 +++++++++++ - arch/sh/kernel/syscalls/syscall.tbl | 3 ++- - 2 files changed, 13 insertions(+), 1 deletion(-) - ---- a/arch/sh/kernel/sys_sh32.c -+++ b/arch/sh/kernel/sys_sh32.c -@@ -59,3 +59,14 @@ asmlinkage int sys_fadvise64_64_wrapper( - (u64)len0 << 32 | len1, advice); - #endif - } -+ -+/* -+ * swap the arguments the way that libc wants them instead of -+ * moving flags ahead of the 64-bit nbytes argument -+ */ -+SYSCALL_DEFINE6(sh_sync_file_range6, int, fd, SC_ARG64(offset), -+ SC_ARG64(nbytes), unsigned int, flags) -+{ -+ return ksys_sync_file_range(fd, SC_VAL64(loff_t, offset), -+ SC_VAL64(loff_t, nbytes), flags); -+} ---- a/arch/sh/kernel/syscalls/syscall.tbl -+++ b/arch/sh/kernel/syscalls/syscall.tbl -@@ -321,7 +321,7 @@ - 311 common set_robust_list sys_set_robust_list - 312 common get_robust_list sys_get_robust_list - 313 common splice sys_splice --314 common sync_file_range sys_sync_file_range -+314 common sync_file_range sys_sh_sync_file_range6 - 315 common tee sys_tee - 316 common vmsplice sys_vmsplice - 317 common move_pages sys_move_pages -@@ -395,6 +395,7 @@ - 385 common pkey_alloc sys_pkey_alloc - 386 common pkey_free sys_pkey_free - 387 common rseq sys_rseq -+388 common sync_file_range2 sys_sync_file_range2 - # room for arch specific syscalls - 393 common semget sys_semget - 394 common semctl sys_semctl diff --git a/queue-5.4/s390-cpacf-get-rid-of-register-asm.patch b/queue-5.4/s390-cpacf-get-rid-of-register-asm.patch deleted file mode 100644 index 971604366d5..00000000000 --- a/queue-5.4/s390-cpacf-get-rid-of-register-asm.patch +++ /dev/null @@ -1,375 +0,0 @@ -From 960e9d0e6a0f61cc59077a87dd86dcfef6973383 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 25 Jun 2021 16:42:55 +0200 -Subject: s390/cpacf: get rid of register asm - -From: Heiko Carstens - -[ Upstream commit b84d0c417a5ac1eb820c8114c0c7cf1fcbf6f017 ] - -Using register asm statements has been proven to be very error prone, -especially when using code instrumentation where gcc may add function -calls, which clobbers register contents in an unexpected way. - -Therefore get rid of register asm statements in cpacf code, and make -sure this bug class cannot happen. - -Reviewed-by: Patrick Steuer -Signed-off-by: Heiko Carstens -Stable-dep-of: 830999bd7e72 ("s390/cpacf: Split and rework cpacf query functions") -Signed-off-by: Sasha Levin ---- - arch/s390/include/asm/cpacf.h | 208 ++++++++++++++++++---------------- - 1 file changed, 111 insertions(+), 97 deletions(-) - -diff --git a/arch/s390/include/asm/cpacf.h b/arch/s390/include/asm/cpacf.h -index c0f3bfeddcbeb..646b12981f208 100644 ---- a/arch/s390/include/asm/cpacf.h -+++ b/arch/s390/include/asm/cpacf.h -@@ -173,17 +173,16 @@ typedef struct { unsigned char bytes[16]; } cpacf_mask_t; - */ - static __always_inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask) - { -- register unsigned long r0 asm("0") = 0; /* query function */ -- register unsigned long r1 asm("1") = (unsigned long) mask; -- - asm volatile( -- " spm 0\n" /* pckmo doesn't change the cc */ -+ " lghi 0,0\n" /* query function */ -+ " lgr 1,%[mask]\n" -+ " spm 0\n" /* pckmo doesn't change the cc */ - /* Parameter regs are ignored, but must be nonzero and unique */ - "0: .insn rrf,%[opc] << 16,2,4,6,0\n" - " brc 1,0b\n" /* handle partial completion */ - : "=m" (*mask) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (opcode) -- : "cc"); -+ : [mask] "d" ((unsigned long)mask), [opc] "i" (opcode) -+ : "cc", "0", "1"); - } - - static __always_inline int __cpacf_check_opcode(unsigned int opcode) -@@ -249,20 +248,22 @@ static __always_inline int cpacf_query_func(unsigned int opcode, unsigned int fu - static inline int cpacf_km(unsigned long func, void *param, - u8 *dest, const u8 *src, long src_len) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) src; -- register unsigned long r3 asm("3") = (unsigned long) src_len; -- register unsigned long r4 asm("4") = (unsigned long) dest; -+ union register_pair d, s; - -+ d.even = (unsigned long)dest; -+ s.even = (unsigned long)src; -+ s.odd = (unsigned long)src_len; - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rre,%[opc] << 16,%[dst],%[src]\n" - " brc 1,0b\n" /* handle partial completion */ -- : [src] "+a" (r2), [len] "+d" (r3), [dst] "+a" (r4) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KM) -- : "cc", "memory"); -+ : [src] "+&d" (s.pair), [dst] "+&d" (d.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_KM) -+ : "cc", "memory", "0", "1"); - -- return src_len - r3; -+ return src_len - s.odd; - } - - /** -@@ -279,20 +280,22 @@ static inline int cpacf_km(unsigned long func, void *param, - static inline int cpacf_kmc(unsigned long func, void *param, - u8 *dest, const u8 *src, long src_len) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) src; -- register unsigned long r3 asm("3") = (unsigned long) src_len; -- register unsigned long r4 asm("4") = (unsigned long) dest; -+ union register_pair d, s; - -+ d.even = (unsigned long)dest; -+ s.even = (unsigned long)src; -+ s.odd = (unsigned long)src_len; - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rre,%[opc] << 16,%[dst],%[src]\n" - " brc 1,0b\n" /* handle partial completion */ -- : [src] "+a" (r2), [len] "+d" (r3), [dst] "+a" (r4) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KMC) -- : "cc", "memory"); -+ : [src] "+&d" (s.pair), [dst] "+&d" (d.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_KMC) -+ : "cc", "memory", "0", "1"); - -- return src_len - r3; -+ return src_len - s.odd; - } - - /** -@@ -306,17 +309,19 @@ static inline int cpacf_kmc(unsigned long func, void *param, - static inline void cpacf_kimd(unsigned long func, void *param, - const u8 *src, long src_len) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) src; -- register unsigned long r3 asm("3") = (unsigned long) src_len; -+ union register_pair s; - -+ s.even = (unsigned long)src; -+ s.odd = (unsigned long)src_len; - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rre,%[opc] << 16,0,%[src]\n" - " brc 1,0b\n" /* handle partial completion */ -- : [src] "+a" (r2), [len] "+d" (r3) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KIMD) -- : "cc", "memory"); -+ : [src] "+&d" (s.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)(param)), -+ [opc] "i" (CPACF_KIMD) -+ : "cc", "memory", "0", "1"); - } - - /** -@@ -329,17 +334,19 @@ static inline void cpacf_kimd(unsigned long func, void *param, - static inline void cpacf_klmd(unsigned long func, void *param, - const u8 *src, long src_len) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) src; -- register unsigned long r3 asm("3") = (unsigned long) src_len; -+ union register_pair s; - -+ s.even = (unsigned long)src; -+ s.odd = (unsigned long)src_len; - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rre,%[opc] << 16,0,%[src]\n" - " brc 1,0b\n" /* handle partial completion */ -- : [src] "+a" (r2), [len] "+d" (r3) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KLMD) -- : "cc", "memory"); -+ : [src] "+&d" (s.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_KLMD) -+ : "cc", "memory", "0", "1"); - } - - /** -@@ -355,19 +362,21 @@ static inline void cpacf_klmd(unsigned long func, void *param, - static inline int cpacf_kmac(unsigned long func, void *param, - const u8 *src, long src_len) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) src; -- register unsigned long r3 asm("3") = (unsigned long) src_len; -+ union register_pair s; - -+ s.even = (unsigned long)src; -+ s.odd = (unsigned long)src_len; - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rre,%[opc] << 16,0,%[src]\n" - " brc 1,0b\n" /* handle partial completion */ -- : [src] "+a" (r2), [len] "+d" (r3) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KMAC) -- : "cc", "memory"); -+ : [src] "+&d" (s.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_KMAC) -+ : "cc", "memory", "0", "1"); - -- return src_len - r3; -+ return src_len - s.odd; - } - - /** -@@ -385,22 +394,24 @@ static inline int cpacf_kmac(unsigned long func, void *param, - static inline int cpacf_kmctr(unsigned long func, void *param, u8 *dest, - const u8 *src, long src_len, u8 *counter) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) src; -- register unsigned long r3 asm("3") = (unsigned long) src_len; -- register unsigned long r4 asm("4") = (unsigned long) dest; -- register unsigned long r6 asm("6") = (unsigned long) counter; -+ union register_pair d, s, c; - -+ d.even = (unsigned long)dest; -+ s.even = (unsigned long)src; -+ s.odd = (unsigned long)src_len; -+ c.even = (unsigned long)counter; - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rrf,%[opc] << 16,%[dst],%[src],%[ctr],0\n" - " brc 1,0b\n" /* handle partial completion */ -- : [src] "+a" (r2), [len] "+d" (r3), -- [dst] "+a" (r4), [ctr] "+a" (r6) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KMCTR) -- : "cc", "memory"); -+ : [src] "+&d" (s.pair), [dst] "+&d" (d.pair), -+ [ctr] "+&d" (c.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_KMCTR) -+ : "cc", "memory", "0", "1"); - -- return src_len - r3; -+ return src_len - s.odd; - } - - /** -@@ -417,20 +428,21 @@ static inline void cpacf_prno(unsigned long func, void *param, - u8 *dest, unsigned long dest_len, - const u8 *seed, unsigned long seed_len) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) dest; -- register unsigned long r3 asm("3") = (unsigned long) dest_len; -- register unsigned long r4 asm("4") = (unsigned long) seed; -- register unsigned long r5 asm("5") = (unsigned long) seed_len; -+ union register_pair d, s; - -+ d.even = (unsigned long)dest; -+ d.odd = (unsigned long)dest_len; -+ s.even = (unsigned long)seed; -+ s.odd = (unsigned long)seed_len; - asm volatile ( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rre,%[opc] << 16,%[dst],%[seed]\n" - " brc 1,0b\n" /* handle partial completion */ -- : [dst] "+a" (r2), [dlen] "+d" (r3) -- : [fc] "d" (r0), [pba] "a" (r1), -- [seed] "a" (r4), [slen] "d" (r5), [opc] "i" (CPACF_PRNO) -- : "cc", "memory"); -+ : [dst] "+&d" (d.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [seed] "d" (s.pair), [opc] "i" (CPACF_PRNO) -+ : "cc", "memory", "0", "1"); - } - - /** -@@ -443,19 +455,19 @@ static inline void cpacf_prno(unsigned long func, void *param, - static inline void cpacf_trng(u8 *ucbuf, unsigned long ucbuf_len, - u8 *cbuf, unsigned long cbuf_len) - { -- register unsigned long r0 asm("0") = (unsigned long) CPACF_PRNO_TRNG; -- register unsigned long r2 asm("2") = (unsigned long) ucbuf; -- register unsigned long r3 asm("3") = (unsigned long) ucbuf_len; -- register unsigned long r4 asm("4") = (unsigned long) cbuf; -- register unsigned long r5 asm("5") = (unsigned long) cbuf_len; -+ union register_pair u, c; - -+ u.even = (unsigned long)ucbuf; -+ u.odd = (unsigned long)ucbuf_len; -+ c.even = (unsigned long)cbuf; -+ c.odd = (unsigned long)cbuf_len; - asm volatile ( -+ " lghi 0,%[fc]\n" - "0: .insn rre,%[opc] << 16,%[ucbuf],%[cbuf]\n" - " brc 1,0b\n" /* handle partial completion */ -- : [ucbuf] "+a" (r2), [ucbuflen] "+d" (r3), -- [cbuf] "+a" (r4), [cbuflen] "+d" (r5) -- : [fc] "d" (r0), [opc] "i" (CPACF_PRNO) -- : "cc", "memory"); -+ : [ucbuf] "+&d" (u.pair), [cbuf] "+&d" (c.pair) -+ : [fc] "K" (CPACF_PRNO_TRNG), [opc] "i" (CPACF_PRNO) -+ : "cc", "memory", "0"); - } - - /** -@@ -466,15 +478,15 @@ static inline void cpacf_trng(u8 *ucbuf, unsigned long ucbuf_len, - */ - static inline void cpacf_pcc(unsigned long func, void *param) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rre,%[opc] << 16,0,0\n" /* PCC opcode */ - " brc 1,0b\n" /* handle partial completion */ - : -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_PCC) -- : "cc", "memory"); -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_PCC) -+ : "cc", "memory", "0", "1"); - } - - /** -@@ -487,14 +499,14 @@ static inline void cpacf_pcc(unsigned long func, void *param) - */ - static inline void cpacf_pckmo(long func, void *param) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - " .insn rre,%[opc] << 16,0,0\n" /* PCKMO opcode */ - : -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_PCKMO) -- : "cc", "memory"); -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_PCKMO) -+ : "cc", "memory", "0", "1"); - } - - /** -@@ -512,21 +524,23 @@ static inline void cpacf_kma(unsigned long func, void *param, u8 *dest, - const u8 *src, unsigned long src_len, - const u8 *aad, unsigned long aad_len) - { -- register unsigned long r0 asm("0") = (unsigned long) func; -- register unsigned long r1 asm("1") = (unsigned long) param; -- register unsigned long r2 asm("2") = (unsigned long) src; -- register unsigned long r3 asm("3") = (unsigned long) src_len; -- register unsigned long r4 asm("4") = (unsigned long) aad; -- register unsigned long r5 asm("5") = (unsigned long) aad_len; -- register unsigned long r6 asm("6") = (unsigned long) dest; -+ union register_pair d, s, a; - -+ d.even = (unsigned long)dest; -+ s.even = (unsigned long)src; -+ s.odd = (unsigned long)src_len; -+ a.even = (unsigned long)aad; -+ a.odd = (unsigned long)aad_len; - asm volatile( -+ " lgr 0,%[fc]\n" -+ " lgr 1,%[pba]\n" - "0: .insn rrf,%[opc] << 16,%[dst],%[src],%[aad],0\n" - " brc 1,0b\n" /* handle partial completion */ -- : [dst] "+a" (r6), [src] "+a" (r2), [slen] "+d" (r3), -- [aad] "+a" (r4), [alen] "+d" (r5) -- : [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KMA) -- : "cc", "memory"); -+ : [dst] "+&d" (d.pair), [src] "+&d" (s.pair), -+ [aad] "+&d" (a.pair) -+ : [fc] "d" (func), [pba] "d" ((unsigned long)param), -+ [opc] "i" (CPACF_KMA) -+ : "cc", "memory", "0", "1"); - } - - #endif /* _ASM_S390_CPACF_H */ --- -2.43.0 - diff --git a/queue-5.4/s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch b/queue-5.4/s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch deleted file mode 100644 index 37729977bb8..00000000000 --- a/queue-5.4/s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 2ad575173fd2dea39bc933a54f2a5a883e102a41 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 14 May 2024 10:09:32 +0200 -Subject: s390/cpacf: Make use of invalid opcode produce a link error - -From: Harald Freudenberger - -[ Upstream commit 32e8bd6423fc127d2b37bdcf804fd76af3bbec79 ] - -Instead of calling BUG() at runtime introduce and use a prototype for a -non-existing function to produce a link error during compile when a not -supported opcode is used with the __cpacf_query() or __cpacf_check_opcode() -inline functions. - -Suggested-by: Heiko Carstens -Signed-off-by: Harald Freudenberger -Reviewed-by: Holger Dengler -Reviewed-by: Juergen Christ -Cc: stable@vger.kernel.org -Signed-off-by: Heiko Carstens -Signed-off-by: Sasha Levin ---- - arch/s390/include/asm/cpacf.h | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/arch/s390/include/asm/cpacf.h b/arch/s390/include/asm/cpacf.h -index fa31f71cf5746..0f6ff2008a159 100644 ---- a/arch/s390/include/asm/cpacf.h -+++ b/arch/s390/include/asm/cpacf.h -@@ -161,6 +161,13 @@ - - typedef struct { unsigned char bytes[16]; } cpacf_mask_t; - -+/* -+ * Prototype for a not existing function to produce a link -+ * error if __cpacf_query() or __cpacf_check_opcode() is used -+ * with an invalid compile time const opcode. -+ */ -+void __cpacf_bad_opcode(void); -+ - static __always_inline void __cpacf_query_rre(u32 opc, u8 r1, u8 r2, - cpacf_mask_t *mask) - { -@@ -232,7 +239,7 @@ static __always_inline void __cpacf_query(unsigned int opcode, - __cpacf_query_rre(CPACF_PRNO, 2, 4, mask); - break; - default: -- BUG(); -+ __cpacf_bad_opcode(); - } - } - -@@ -257,7 +264,8 @@ static __always_inline int __cpacf_check_opcode(unsigned int opcode) - case CPACF_KMA: - return test_facility(146); /* check for MSA8 */ - default: -- BUG(); -+ __cpacf_bad_opcode(); -+ return 0; - } - } - --- -2.43.0 - diff --git a/queue-5.4/s390-cpacf-split-and-rework-cpacf-query-functions.patch b/queue-5.4/s390-cpacf-split-and-rework-cpacf-query-functions.patch deleted file mode 100644 index ddff23722fc..00000000000 --- a/queue-5.4/s390-cpacf-split-and-rework-cpacf-query-functions.patch +++ /dev/null @@ -1,152 +0,0 @@ -From 4a9ecd61be4df446ea9b2b865e172d434da8deb5 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 3 May 2024 11:31:42 +0200 -Subject: s390/cpacf: Split and rework cpacf query functions - -From: Harald Freudenberger - -[ Upstream commit 830999bd7e72f4128b9dfa37090d9fa8120ce323 ] - -Rework the cpacf query functions to use the correct RRE -or RRF instruction formats and set register fields within -instructions correctly. - -Fixes: 1afd43e0fbba ("s390/crypto: allow to query all known cpacf functions") -Reported-by: Nina Schoetterl-Glausch -Suggested-by: Heiko Carstens -Suggested-by: Juergen Christ -Suggested-by: Holger Dengler -Signed-off-by: Harald Freudenberger -Reviewed-by: Holger Dengler -Reviewed-by: Juergen Christ -Cc: -Signed-off-by: Heiko Carstens -Signed-off-by: Sasha Levin ---- - arch/s390/include/asm/cpacf.h | 101 +++++++++++++++++++++++++++------- - 1 file changed, 81 insertions(+), 20 deletions(-) - -diff --git a/arch/s390/include/asm/cpacf.h b/arch/s390/include/asm/cpacf.h -index 646b12981f208..fa31f71cf5746 100644 ---- a/arch/s390/include/asm/cpacf.h -+++ b/arch/s390/include/asm/cpacf.h -@@ -161,28 +161,79 @@ - - typedef struct { unsigned char bytes[16]; } cpacf_mask_t; - --/** -- * cpacf_query() - check if a specific CPACF function is available -- * @opcode: the opcode of the crypto instruction -- * @func: the function code to test for -- * -- * Executes the query function for the given crypto instruction @opcode -- * and checks if @func is available -- * -- * Returns 1 if @func is available for @opcode, 0 otherwise -- */ --static __always_inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask) -+static __always_inline void __cpacf_query_rre(u32 opc, u8 r1, u8 r2, -+ cpacf_mask_t *mask) - { - asm volatile( -- " lghi 0,0\n" /* query function */ -- " lgr 1,%[mask]\n" -- " spm 0\n" /* pckmo doesn't change the cc */ -- /* Parameter regs are ignored, but must be nonzero and unique */ -- "0: .insn rrf,%[opc] << 16,2,4,6,0\n" -- " brc 1,0b\n" /* handle partial completion */ -- : "=m" (*mask) -- : [mask] "d" ((unsigned long)mask), [opc] "i" (opcode) -- : "cc", "0", "1"); -+ " la %%r1,%[mask]\n" -+ " xgr %%r0,%%r0\n" -+ " .insn rre,%[opc] << 16,%[r1],%[r2]\n" -+ : [mask] "=R" (*mask) -+ : [opc] "i" (opc), -+ [r1] "i" (r1), [r2] "i" (r2) -+ : "cc", "r0", "r1"); -+} -+ -+static __always_inline void __cpacf_query_rrf(u32 opc, -+ u8 r1, u8 r2, u8 r3, u8 m4, -+ cpacf_mask_t *mask) -+{ -+ asm volatile( -+ " la %%r1,%[mask]\n" -+ " xgr %%r0,%%r0\n" -+ " .insn rrf,%[opc] << 16,%[r1],%[r2],%[r3],%[m4]\n" -+ : [mask] "=R" (*mask) -+ : [opc] "i" (opc), [r1] "i" (r1), [r2] "i" (r2), -+ [r3] "i" (r3), [m4] "i" (m4) -+ : "cc", "r0", "r1"); -+} -+ -+static __always_inline void __cpacf_query(unsigned int opcode, -+ cpacf_mask_t *mask) -+{ -+ switch (opcode) { -+ case CPACF_KDSA: -+ __cpacf_query_rre(CPACF_KDSA, 0, 2, mask); -+ break; -+ case CPACF_KIMD: -+ __cpacf_query_rre(CPACF_KIMD, 0, 2, mask); -+ break; -+ case CPACF_KLMD: -+ __cpacf_query_rre(CPACF_KLMD, 0, 2, mask); -+ break; -+ case CPACF_KM: -+ __cpacf_query_rre(CPACF_KM, 2, 4, mask); -+ break; -+ case CPACF_KMA: -+ __cpacf_query_rrf(CPACF_KMA, 2, 4, 6, 0, mask); -+ break; -+ case CPACF_KMAC: -+ __cpacf_query_rre(CPACF_KMAC, 0, 2, mask); -+ break; -+ case CPACF_KMC: -+ __cpacf_query_rre(CPACF_KMC, 2, 4, mask); -+ break; -+ case CPACF_KMCTR: -+ __cpacf_query_rrf(CPACF_KMCTR, 2, 4, 6, 0, mask); -+ break; -+ case CPACF_KMF: -+ __cpacf_query_rre(CPACF_KMF, 2, 4, mask); -+ break; -+ case CPACF_KMO: -+ __cpacf_query_rre(CPACF_KMO, 2, 4, mask); -+ break; -+ case CPACF_PCC: -+ __cpacf_query_rre(CPACF_PCC, 0, 0, mask); -+ break; -+ case CPACF_PCKMO: -+ __cpacf_query_rre(CPACF_PCKMO, 0, 0, mask); -+ break; -+ case CPACF_PRNO: -+ __cpacf_query_rre(CPACF_PRNO, 2, 4, mask); -+ break; -+ default: -+ BUG(); -+ } - } - - static __always_inline int __cpacf_check_opcode(unsigned int opcode) -@@ -210,6 +261,16 @@ static __always_inline int __cpacf_check_opcode(unsigned int opcode) - } - } - -+/** -+ * cpacf_query() - check if a specific CPACF function is available -+ * @opcode: the opcode of the crypto instruction -+ * @func: the function code to test for -+ * -+ * Executes the query function for the given crypto instruction @opcode -+ * and checks if @func is available -+ * -+ * Returns 1 if @func is available for @opcode, 0 otherwise -+ */ - static __always_inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask) - { - if (__cpacf_check_opcode(opcode)) { --- -2.43.0 - diff --git a/queue-5.4/series b/queue-5.4/series index 5794e13729e..1e8f27a1147 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -34,8 +34,6 @@ serial-sc16is7xx-fix-bug-in-sc16is7xx_set_baud-when-.patch selftests-mm-compaction_test-fix-incorrect-write-of-.patch selftests-mm-conform-test-to-tap-format-output.patch selftests-mm-compaction_test-fix-bogus-test-success-.patch -s390-cpacf-get-rid-of-register-asm.patch -s390-cpacf-split-and-rework-cpacf-query-functions.patch nilfs2-remove-check-for-pageerror.patch nilfs2-return-the-mapped-address-from-nilfs_get_page.patch nilfs2-fix-nilfs_empty_dir-misjudgment-and-long-loop.patch @@ -120,7 +118,6 @@ arm-dts-samsung-smdkv310-fix-keypad-no-autorepeat.patch arm-dts-samsung-exynos4412-origen-fix-keypad-no-auto.patch arm-dts-samsung-smdk4412-fix-keypad-no-autorepeat.patch arm64-dts-qcom-qcs404-fix-bluetooth-device-address.patch -s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch tracing-add-module_description-to-preemptirq_delay_t.patch revert-kheaders-substituting-sort-in-archive-creatio.patch kheaders-explicitly-define-file-modes-for-archived-h.patch @@ -169,7 +166,6 @@ tty-mcf-mcf54418-has-10-uarts.patch net-can-j1939-initialize-unused-data-in-j1939_send_one.patch net-can-j1939-recover-socket-queue-on-can-bus-error-during-bam-transmission.patch net-can-j1939-enhanced-error-handling-for-tightly-received-rts-messages-in-xtp_rx_rts_session_new.patch -sh-rework-sync_file_range-abi.patch csky-hexagon-fix-broken-sys_sync_file_range.patch hexagon-fix-fadvise64_64-calling-conventions.patch drm-nouveau-dispnv04-fix-null-pointer-dereference-in-nv17_tv_get_ld_modes.patch diff --git a/queue-5.4/sh-rework-sync_file_range-abi.patch b/queue-5.4/sh-rework-sync_file_range-abi.patch deleted file mode 100644 index 9cfdd48bde0..00000000000 --- a/queue-5.4/sh-rework-sync_file_range-abi.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 30766f1105d6d2459c3b9fe34a3e52b637a72950 Mon Sep 17 00:00:00 2001 -From: Arnd Bergmann -Date: Tue, 11 Jun 2024 22:12:43 +0200 -Subject: sh: rework sync_file_range ABI - -From: Arnd Bergmann - -commit 30766f1105d6d2459c3b9fe34a3e52b637a72950 upstream. - -The unusual function calling conventions on SuperH ended up causing -sync_file_range to have the wrong argument order, with the 'flags' -argument getting sorted before 'nbytes' by the compiler. - -In userspace, I found that musl, glibc, uclibc and strace all expect the -normal calling conventions with 'nbytes' last, so changing the kernel -to match them should make all of those work. - -In order to be able to also fix libc implementations to work with existing -kernels, they need to be able to tell which ABI is used. An easy way -to do this is to add yet another system call using the sync_file_range2 -ABI that works the same on all architectures. - -Old user binaries can now work on new kernels, and new binaries can -try the new sync_file_range2() to work with new kernels or fall back -to the old sync_file_range() version if that doesn't exist. - -Cc: stable@vger.kernel.org -Fixes: 75c92acdd5b1 ("sh: Wire up new syscalls.") -Acked-by: John Paul Adrian Glaubitz -Signed-off-by: Arnd Bergmann -Signed-off-by: Greg Kroah-Hartman ---- - arch/sh/kernel/sys_sh32.c | 11 +++++++++++ - arch/sh/kernel/syscalls/syscall.tbl | 3 ++- - 2 files changed, 13 insertions(+), 1 deletion(-) - ---- a/arch/sh/kernel/sys_sh32.c -+++ b/arch/sh/kernel/sys_sh32.c -@@ -59,3 +59,14 @@ asmlinkage int sys_fadvise64_64_wrapper( - (u64)len0 << 32 | len1, advice); - #endif - } -+ -+/* -+ * swap the arguments the way that libc wants them instead of -+ * moving flags ahead of the 64-bit nbytes argument -+ */ -+SYSCALL_DEFINE6(sh_sync_file_range6, int, fd, SC_ARG64(offset), -+ SC_ARG64(nbytes), unsigned int, flags) -+{ -+ return ksys_sync_file_range(fd, SC_VAL64(loff_t, offset), -+ SC_VAL64(loff_t, nbytes), flags); -+} ---- a/arch/sh/kernel/syscalls/syscall.tbl -+++ b/arch/sh/kernel/syscalls/syscall.tbl -@@ -321,7 +321,7 @@ - 311 common set_robust_list sys_set_robust_list - 312 common get_robust_list sys_get_robust_list - 313 common splice sys_splice --314 common sync_file_range sys_sync_file_range -+314 common sync_file_range sys_sh_sync_file_range6 - 315 common tee sys_tee - 316 common vmsplice sys_vmsplice - 317 common move_pages sys_move_pages -@@ -395,6 +395,7 @@ - 385 common pkey_alloc sys_pkey_alloc - 386 common pkey_free sys_pkey_free - 387 common rseq sys_rseq -+388 common sync_file_range2 sys_sync_file_range2 - # room for arch specific syscalls - 393 common semget sys_semget - 394 common semctl sys_semctl -- 2.47.3