Commit d2da77f4 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'parisc-for-6.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull parisc architecture fixes from Helge Deller:
 "This patchset fixes and enforces correct section alignments for the
  ex_table, altinstructions, parisc_unwind, jump_table and bug_table
  which are created by inline assembly.

  Due to not being correctly aligned at link & load time they can
  trigger unnecessarily the kernel unaligned exception handler at
  runtime. While at it, I switched the bug table to use relative
  addresses which reduces the size of the table by half on 64-bit.

  We still had the ENOSYM and EREMOTERELEASE errno symbols as left-overs
  from HP-UX, which now trigger build-issues with glibc. We can simply
  remove them.

  Most of the patches are tagged for stable kernel series.

  Summary:

   - Drop HP-UX ENOSYM and EREMOTERELEASE return codes to avoid glibc
     build issues

   - Fix section alignments for ex_table, altinstructions, parisc unwind
     table, jump_table and bug_table

   - Reduce size of bug_table on 64-bit kernel by using relative
     pointers"

* tag 'parisc-for-6.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  parisc: Reduce size of the bug_table on 64-bit kernel by half
  parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes
  parisc: Use natural CPU alignment for bug_table
  parisc: Ensure 32-bit alignment on parisc unwind section
  parisc: Mark lock_aligned variables 16-byte aligned on SMP
  parisc: Mark jump_table naturally aligned
  parisc: Mark altinstructions read-only and 32-bit aligned
  parisc: Mark ex_table entries 32-bit aligned in uaccess.h
  parisc: Mark ex_table entries 32-bit aligned in assembly.h
parents 4892711a 43266838
...@@ -115,9 +115,12 @@ config ARCH_HAS_ILOG2_U64 ...@@ -115,9 +115,12 @@ config ARCH_HAS_ILOG2_U64
default n default n
config GENERIC_BUG config GENERIC_BUG
bool def_bool y
default y
depends on BUG depends on BUG
select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
config GENERIC_BUG_RELATIVE_POINTERS
bool
config GENERIC_HWEIGHT config GENERIC_HWEIGHT
bool bool
......
...@@ -34,7 +34,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end, ...@@ -34,7 +34,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end,
/* Alternative SMP implementation. */ /* Alternative SMP implementation. */
#define ALTERNATIVE(cond, replacement) "!0:" \ #define ALTERNATIVE(cond, replacement) "!0:" \
".section .altinstructions, \"aw\" !" \ ".section .altinstructions, \"a\" !" \
".align 4 !" \
".word (0b-4-.) !" \ ".word (0b-4-.) !" \
".hword 1, " __stringify(cond) " !" \ ".hword 1, " __stringify(cond) " !" \
".word " __stringify(replacement) " !" \ ".word " __stringify(replacement) " !" \
...@@ -44,7 +45,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end, ...@@ -44,7 +45,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end,
/* to replace one single instructions by a new instruction */ /* to replace one single instructions by a new instruction */
#define ALTERNATIVE(from, to, cond, replacement)\ #define ALTERNATIVE(from, to, cond, replacement)\
.section .altinstructions, "aw" ! \ .section .altinstructions, "a" ! \
.align 4 ! \
.word (from - .) ! \ .word (from - .) ! \
.hword (to - from)/4, cond ! \ .hword (to - from)/4, cond ! \
.word replacement ! \ .word replacement ! \
...@@ -52,7 +54,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end, ...@@ -52,7 +54,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end,
/* to replace multiple instructions by new code */ /* to replace multiple instructions by new code */
#define ALTERNATIVE_CODE(from, num_instructions, cond, new_instr_ptr)\ #define ALTERNATIVE_CODE(from, num_instructions, cond, new_instr_ptr)\
.section .altinstructions, "aw" ! \ .section .altinstructions, "a" ! \
.align 4 ! \
.word (from - .) ! \ .word (from - .) ! \
.hword -num_instructions, cond ! \ .hword -num_instructions, cond ! \
.word (new_instr_ptr - .) ! \ .word (new_instr_ptr - .) ! \
......
...@@ -574,6 +574,7 @@ ...@@ -574,6 +574,7 @@
*/ */
#define ASM_EXCEPTIONTABLE_ENTRY(fault_addr, except_addr) \ #define ASM_EXCEPTIONTABLE_ENTRY(fault_addr, except_addr) \
.section __ex_table,"aw" ! \ .section __ex_table,"aw" ! \
.align 4 ! \
.word (fault_addr - .), (except_addr - .) ! \ .word (fault_addr - .), (except_addr - .) ! \
.previous .previous
......
...@@ -17,24 +17,27 @@ ...@@ -17,24 +17,27 @@
#define PARISC_BUG_BREAK_ASM "break 0x1f, 0x1fff" #define PARISC_BUG_BREAK_ASM "break 0x1f, 0x1fff"
#define PARISC_BUG_BREAK_INSN 0x03ffe01f /* PARISC_BUG_BREAK_ASM */ #define PARISC_BUG_BREAK_INSN 0x03ffe01f /* PARISC_BUG_BREAK_ASM */
#if defined(CONFIG_64BIT) #ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
#define ASM_WORD_INSN ".dword\t" # define __BUG_REL(val) ".word " __stringify(val) " - ."
#else #else
#define ASM_WORD_INSN ".word\t" # define __BUG_REL(val) ".word " __stringify(val)
#endif #endif
#ifdef CONFIG_DEBUG_BUGVERBOSE #ifdef CONFIG_DEBUG_BUGVERBOSE
#define BUG() \ #define BUG() \
do { \ do { \
asm volatile("\n" \ asm volatile("\n" \
"1:\t" PARISC_BUG_BREAK_ASM "\n" \ "1:\t" PARISC_BUG_BREAK_ASM "\n" \
"\t.pushsection __bug_table,\"aw\"\n" \ "\t.pushsection __bug_table,\"a\"\n" \
"2:\t" ASM_WORD_INSN "1b, %c0\n" \ "\t.align 4\n" \
"\t.short %c1, %c2\n" \ "2:\t" __BUG_REL(1b) "\n" \
"\t.org 2b+%c3\n" \ "\t" __BUG_REL(%c0) "\n" \
"\t.short %1, %2\n" \
"\t.blockz %3-2*4-2*2\n" \
"\t.popsection" \ "\t.popsection" \
: : "i" (__FILE__), "i" (__LINE__), \ : : "i" (__FILE__), "i" (__LINE__), \
"i" (0), "i" (sizeof(struct bug_entry)) ); \ "i" (0), "i" (sizeof(struct bug_entry)) ); \
unreachable(); \ unreachable(); \
} while(0) } while(0)
...@@ -51,10 +54,12 @@ ...@@ -51,10 +54,12 @@
do { \ do { \
asm volatile("\n" \ asm volatile("\n" \
"1:\t" PARISC_BUG_BREAK_ASM "\n" \ "1:\t" PARISC_BUG_BREAK_ASM "\n" \
"\t.pushsection __bug_table,\"aw\"\n" \ "\t.pushsection __bug_table,\"a\"\n" \
"2:\t" ASM_WORD_INSN "1b, %c0\n" \ "\t.align 4\n" \
"\t.short %c1, %c2\n" \ "2:\t" __BUG_REL(1b) "\n" \
"\t.org 2b+%c3\n" \ "\t" __BUG_REL(%c0) "\n" \
"\t.short %1, %2\n" \
"\t.blockz %3-2*4-2*2\n" \
"\t.popsection" \ "\t.popsection" \
: : "i" (__FILE__), "i" (__LINE__), \ : : "i" (__FILE__), "i" (__LINE__), \
"i" (BUGFLAG_WARNING|(flags)), \ "i" (BUGFLAG_WARNING|(flags)), \
...@@ -65,10 +70,11 @@ ...@@ -65,10 +70,11 @@
do { \ do { \
asm volatile("\n" \ asm volatile("\n" \
"1:\t" PARISC_BUG_BREAK_ASM "\n" \ "1:\t" PARISC_BUG_BREAK_ASM "\n" \
"\t.pushsection __bug_table,\"aw\"\n" \ "\t.pushsection __bug_table,\"a\"\n" \
"2:\t" ASM_WORD_INSN "1b\n" \ "\t.align %2\n" \
"\t.short %c0\n" \ "2:\t" __BUG_REL(1b) "\n" \
"\t.org 2b+%c1\n" \ "\t.short %0\n" \
"\t.blockz %1-4-2\n" \
"\t.popsection" \ "\t.popsection" \
: : "i" (BUGFLAG_WARNING|(flags)), \ : : "i" (BUGFLAG_WARNING|(flags)), \
"i" (sizeof(struct bug_entry)) ); \ "i" (sizeof(struct bug_entry)) ); \
......
...@@ -15,10 +15,12 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran ...@@ -15,10 +15,12 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran
asm_volatile_goto("1:\n\t" asm_volatile_goto("1:\n\t"
"nop\n\t" "nop\n\t"
".pushsection __jump_table, \"aw\"\n\t" ".pushsection __jump_table, \"aw\"\n\t"
".align %1\n\t"
".word 1b - ., %l[l_yes] - .\n\t" ".word 1b - ., %l[l_yes] - .\n\t"
__stringify(ASM_ULONG_INSN) " %c0 - .\n\t" __stringify(ASM_ULONG_INSN) " %c0 - .\n\t"
".popsection\n\t" ".popsection\n\t"
: : "i" (&((char *)key)[branch]) : : l_yes); : : "i" (&((char *)key)[branch]), "i" (sizeof(long))
: : l_yes);
return false; return false;
l_yes: l_yes:
...@@ -30,10 +32,12 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool ...@@ -30,10 +32,12 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool
asm_volatile_goto("1:\n\t" asm_volatile_goto("1:\n\t"
"b,n %l[l_yes]\n\t" "b,n %l[l_yes]\n\t"
".pushsection __jump_table, \"aw\"\n\t" ".pushsection __jump_table, \"aw\"\n\t"
".align %1\n\t"
".word 1b - ., %l[l_yes] - .\n\t" ".word 1b - ., %l[l_yes] - .\n\t"
__stringify(ASM_ULONG_INSN) " %c0 - .\n\t" __stringify(ASM_ULONG_INSN) " %c0 - .\n\t"
".popsection\n\t" ".popsection\n\t"
: : "i" (&((char *)key)[branch]) : : l_yes); : : "i" (&((char *)key)[branch]), "i" (sizeof(long))
: : l_yes);
return false; return false;
l_yes: l_yes:
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
}) })
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
# define __lock_aligned __section(".data..lock_aligned") # define __lock_aligned __section(".data..lock_aligned") __aligned(16)
#endif #endif
#endif /* __PARISC_LDCW_H */ #endif /* __PARISC_LDCW_H */
...@@ -41,6 +41,7 @@ struct exception_table_entry { ...@@ -41,6 +41,7 @@ struct exception_table_entry {
#define ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr )\ #define ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr )\
".section __ex_table,\"aw\"\n" \ ".section __ex_table,\"aw\"\n" \
".align 4\n" \
".word (" #fault_addr " - .), (" #except_addr " - .)\n\t" \ ".word (" #fault_addr " - .), (" #except_addr " - .)\n\t" \
".previous\n" ".previous\n"
......
...@@ -75,7 +75,6 @@ ...@@ -75,7 +75,6 @@
/* We now return you to your regularly scheduled HPUX. */ /* We now return you to your regularly scheduled HPUX. */
#define ENOSYM 215 /* symbol does not exist in executable */
#define ENOTSOCK 216 /* Socket operation on non-socket */ #define ENOTSOCK 216 /* Socket operation on non-socket */
#define EDESTADDRREQ 217 /* Destination address required */ #define EDESTADDRREQ 217 /* Destination address required */
#define EMSGSIZE 218 /* Message too long */ #define EMSGSIZE 218 /* Message too long */
...@@ -101,7 +100,6 @@ ...@@ -101,7 +100,6 @@
#define ETIMEDOUT 238 /* Connection timed out */ #define ETIMEDOUT 238 /* Connection timed out */
#define ECONNREFUSED 239 /* Connection refused */ #define ECONNREFUSED 239 /* Connection refused */
#define EREFUSED ECONNREFUSED /* for HP's NFS apparently */ #define EREFUSED ECONNREFUSED /* for HP's NFS apparently */
#define EREMOTERELEASE 240 /* Remote peer released connection */
#define EHOSTDOWN 241 /* Host is down */ #define EHOSTDOWN 241 /* Host is down */
#define EHOSTUNREACH 242 /* No route to host */ #define EHOSTUNREACH 242 /* No route to host */
......
...@@ -130,6 +130,7 @@ SECTIONS ...@@ -130,6 +130,7 @@ SECTIONS
RO_DATA(8) RO_DATA(8)
/* unwind info */ /* unwind info */
. = ALIGN(4);
.PARISC.unwind : { .PARISC.unwind : {
__start___unwind = .; __start___unwind = .;
*(.PARISC.unwind) *(.PARISC.unwind)
......
...@@ -111,9 +111,6 @@ static const char *names_0[] = { ...@@ -111,9 +111,6 @@ static const char *names_0[] = {
E(ENOSPC), E(ENOSPC),
E(ENOSR), E(ENOSR),
E(ENOSTR), E(ENOSTR),
#ifdef ENOSYM
E(ENOSYM),
#endif
E(ENOSYS), E(ENOSYS),
E(ENOTBLK), E(ENOTBLK),
E(ENOTCONN), E(ENOTCONN),
...@@ -144,9 +141,6 @@ static const char *names_0[] = { ...@@ -144,9 +141,6 @@ static const char *names_0[] = {
#endif #endif
E(EREMOTE), E(EREMOTE),
E(EREMOTEIO), E(EREMOTEIO),
#ifdef EREMOTERELEASE
E(EREMOTERELEASE),
#endif
E(ERESTART), E(ERESTART),
E(ERFKILL), E(ERFKILL),
E(EROFS), E(EROFS),
......
...@@ -75,7 +75,6 @@ ...@@ -75,7 +75,6 @@
/* We now return you to your regularly scheduled HPUX. */ /* We now return you to your regularly scheduled HPUX. */
#define ENOSYM 215 /* symbol does not exist in executable */
#define ENOTSOCK 216 /* Socket operation on non-socket */ #define ENOTSOCK 216 /* Socket operation on non-socket */
#define EDESTADDRREQ 217 /* Destination address required */ #define EDESTADDRREQ 217 /* Destination address required */
#define EMSGSIZE 218 /* Message too long */ #define EMSGSIZE 218 /* Message too long */
...@@ -101,7 +100,6 @@ ...@@ -101,7 +100,6 @@
#define ETIMEDOUT 238 /* Connection timed out */ #define ETIMEDOUT 238 /* Connection timed out */
#define ECONNREFUSED 239 /* Connection refused */ #define ECONNREFUSED 239 /* Connection refused */
#define EREFUSED ECONNREFUSED /* for HP's NFS apparently */ #define EREFUSED ECONNREFUSED /* for HP's NFS apparently */
#define EREMOTERELEASE 240 /* Remote peer released connection */
#define EHOSTDOWN 241 /* Host is down */ #define EHOSTDOWN 241 /* Host is down */
#define EHOSTUNREACH 242 /* No route to host */ #define EHOSTUNREACH 242 /* No route to host */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment