From patchwork Fri Nov 24 14:41:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13467729 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FD2E2C1A3 for ; Fri, 24 Nov 2023 14:42:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TZiPaGoD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45C29C43391; Fri, 24 Nov 2023 14:42:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700836966; bh=5U8vgQMmddJWLlu0O09AXMbfAn+9mQzPX3eO30HQxrM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TZiPaGoDiCWhAMz0DfQWY7whcdtsP65f4rMT0nrgiXRcNI0O9wWme2jv3zJ1LbSQE 6yjv1pciRWBJ3LrTDMMExEWgHUPqRKea8Ie8Natei4wVdQYpTG3dFO0yIkIECYu0O7 +xPaT8mYu9k5ut19tv/vTySJR2iwsRRxQpqXo3hw3YxVdTydrmrcRijpp+3or+rFww mxW1Hmxgph34VVtquOY1yW0/CUQZcbBdARrQu/juxmT/LDudoyV7NdBh2+HaaybnN8 cRm6Ioh94+dEtC6jlatLJfJm7QEaHOxscfS/2cvIQ6vo5me78S9xMPmiJ3xMS6Nxy9 2ML9LF9ZT9HJQ== From: deller@kernel.org To: linux-parisc@vger.kernel.org Cc: Helge Deller Subject: [PATCH 1/8] parisc: Mark __ex_table entries 32-bit aligned in assembly.h Date: Fri, 24 Nov 2023 15:41:00 +0100 Message-ID: <20231124144158.158993-3-deller@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231124144158.158993-1-deller@kernel.org> References: <20231124144158.158993-1-deller@kernel.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Helge Deller Add an align statement to tell the linker that all __ex_table entries and as such the whole __ex_table section should be 32-bit aligned in vmlinux and modules. Signed-off-by: Helge Deller --- arch/parisc/include/asm/assembly.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/parisc/include/asm/assembly.h b/arch/parisc/include/asm/assembly.h index 75677b526b2b..74d17d7e759d 100644 --- a/arch/parisc/include/asm/assembly.h +++ b/arch/parisc/include/asm/assembly.h @@ -574,6 +574,7 @@ */ #define ASM_EXCEPTIONTABLE_ENTRY(fault_addr, except_addr) \ .section __ex_table,"aw" ! \ + .align 4 ! \ .word (fault_addr - .), (except_addr - .) ! \ .previous From patchwork Fri Nov 24 14:41:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13467730 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BC6228376 for ; Fri, 24 Nov 2023 14:42:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="S4P9BOaH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E08EEC433CD; Fri, 24 Nov 2023 14:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700836976; bh=ioypnsK8PrReCgZUGbLHH0MpBeBFgbC8elgt1qnCDKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S4P9BOaHMwC6n2kH8sRs15sgrrKCpPourXYR4ruiLokC5xmxlYcwlR0kXXwKtrxJa YXD06I1m4Qv39W0aRxtS74u4aJMndlwPAYptzf4rW9xInZvNJWVrNxK56OXo4dCocE xNfQieJuWmoEIvGivM99B6W2F32iqmN+Em5sM/2xQO5tJF9yWAn5kYhR0a9j1/KTp+ +TmeF/K4t3TP39YWfJkr33ceWxgl1y2yLZlUR4ZK7FXLBWLpu2s+Nstlo9OKiym1tz kfEhbIeco3CcUJRsQ8tASLUDfJwi8Dbx3R1BOTI6FkKSl2YT2luLh8vQSa4qt1+Skv XbDyIl82yoi+A== From: deller@kernel.org To: linux-parisc@vger.kernel.org Cc: Helge Deller Subject: [PATCH 2/8] parisc: Mark __ex_table entries 32-bit aligned in uaccess.h Date: Fri, 24 Nov 2023 15:41:02 +0100 Message-ID: <20231124144158.158993-5-deller@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231124144158.158993-1-deller@kernel.org> References: <20231124144158.158993-1-deller@kernel.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Helge Deller Add an align statement to tell the linker that all __ex_table entries and as such the whole __ex_table section should be 32-bit aligned in vmlinux and modules. Signed-off-by: Helge Deller --- arch/parisc/include/asm/uaccess.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h index 2bf660eabe42..4165079898d9 100644 --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h @@ -41,6 +41,7 @@ struct exception_table_entry { #define ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr )\ ".section __ex_table,\"aw\"\n" \ + ".align 4\n" \ ".word (" #fault_addr " - .), (" #except_addr " - .)\n\t" \ ".previous\n" From patchwork Fri Nov 24 14:41:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13467731 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 509411CFB7 for ; Fri, 24 Nov 2023 14:43:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mgsE1pDK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21241C43397; Fri, 24 Nov 2023 14:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700836984; bh=OUOiPVPzvznK0kb0DanuBVTlFgEspIRBW9U2myAjTMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mgsE1pDKlXNUzi8YVNs/K7Qy+iVW5RMBD28rLvkVGL7fJ7B7Vdmk0hlL3LlpUkcFT 23ULma8gWJvMxZKb2/sR8Yf6t0lYSmyQTRGDCY8tdT2Efhb7T4mcgb5KEttJwjIjam TeC1TrBAypXRq9XGIpU2bpSxPrq3SERwpK6SLvfqi31BQ/kQPgS0Jjn8ETVOW8mk/Z MxgMMsXt0HJAS6hrZ2PL0Vds0joUwl0y59LfbYhqRVQ0d+WJfRdmsPCQ8OmYZ3IfgA HfXt19e0cfn/0yvWtkbX/cmaIfWGrZJmkVNdoeT9FB+VG447cO8Z/f13518t8nI9aC +U1F/5z9ixJOw== From: deller@kernel.org To: linux-parisc@vger.kernel.org Cc: Helge Deller Subject: [PATCH 3/8] parisc: Specify alignments for .PARISC.unwind and .data..lock_aligned Date: Fri, 24 Nov 2023 15:41:04 +0100 Message-ID: <20231124144158.158993-7-deller@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231124144158.158993-1-deller@kernel.org> References: <20231124144158.158993-1-deller@kernel.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Helge Deller Make sure the unwind section will be 32-bit aligned. Explicitely mark the .data..lock_aligned explicitely 16-byte aligned in vmlinux.lds.S although the previous ALIGN(16) statement already does it right. Add __aligned(16) to __lock_aligned define to ensure that such variables will have an alignment of 16 in the sections of the object files. Signed-off-by: Helge Deller --- arch/parisc/include/asm/ldcw.h | 2 +- arch/parisc/kernel/vmlinux.lds.S | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/parisc/include/asm/ldcw.h b/arch/parisc/include/asm/ldcw.h index ee9e071859b2..47ebc4c91eaf 100644 --- a/arch/parisc/include/asm/ldcw.h +++ b/arch/parisc/include/asm/ldcw.h @@ -55,7 +55,7 @@ }) #ifdef CONFIG_SMP -# define __lock_aligned __section(".data..lock_aligned") +# define __lock_aligned __section(".data..lock_aligned") __aligned(16) #endif #endif /* __PARISC_LDCW_H */ diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S index 58694d1989c2..190e623e3ade 100644 --- a/arch/parisc/kernel/vmlinux.lds.S +++ b/arch/parisc/kernel/vmlinux.lds.S @@ -130,7 +130,7 @@ SECTIONS RO_DATA(8) /* unwind info */ - .PARISC.unwind : { + .PARISC.unwind ALIGN(4) : { __start___unwind = .; *(.PARISC.unwind) __stop___unwind = .; @@ -149,7 +149,7 @@ SECTIONS /* PA-RISC locks requires 16-byte alignment */ . = ALIGN(16); - .data..lock_aligned : { + .data..lock_aligned ALIGN(16) : { *(.data..lock_aligned) } From patchwork Fri Nov 24 14:41:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13467732 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D7882C1AE for ; Fri, 24 Nov 2023 14:43:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XELMk8G6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31F4BC433D9; Fri, 24 Nov 2023 14:43:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700836992; bh=a4Mn1QYYA/uopMseqH+xj88L0ZG+tJXc6R8hkX10Qzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XELMk8G6sZAtSdbH7TX7s2vfv/d2pWkTccYb39cmg0ovej0Qs/2KsALvAKmyRooj7 02gxINOUz5+mjfrEwXpK2+ytYAxIVpujg+m/DeuzFaUR0CD4fmENtPae2qorArQM3l kbmT4TVzPemOV6QTHsOjYNNVAuhxqMdNj4c83SI3QqbysxCLbrdv/7jSIkaMmQjGhq +9A7uNzp3N/DHkMsc1OfXz0IkK1uyhm23gU2C389EsObyyDWYupAI9vgAhhf1nmI1y GUlHC4wddpLGceo2JvOQUwbdv3owL41LyAVgFe6kqWAmR77GDXVd0+LWL4yyMhoK71 7lA0jY2F92hyw== From: deller@kernel.org To: linux-parisc@vger.kernel.org Cc: Helge Deller Subject: [PATCH 4/8] parisc: Mark altinstructions 32-bit aligned Date: Fri, 24 Nov 2023 15:41:06 +0100 Message-ID: <20231124144158.158993-9-deller@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231124144158.158993-1-deller@kernel.org> References: <20231124144158.158993-1-deller@kernel.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Helge Deller Make sure that the altinstruction section gets 32-bit aligned. Signed-off-by: Helge Deller --- arch/parisc/include/asm/alternative.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/parisc/include/asm/alternative.h b/arch/parisc/include/asm/alternative.h index 1ed45fd085d3..1eb488f25b83 100644 --- a/arch/parisc/include/asm/alternative.h +++ b/arch/parisc/include/asm/alternative.h @@ -34,7 +34,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end, /* Alternative SMP implementation. */ #define ALTERNATIVE(cond, replacement) "!0:" \ - ".section .altinstructions, \"aw\" !" \ + ".section .altinstructions, \"a\" !" \ + ".align 4 !" \ ".word (0b-4-.) !" \ ".hword 1, " __stringify(cond) " !" \ ".word " __stringify(replacement) " !" \ @@ -44,7 +45,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end, /* to replace one single instructions by a new instruction */ #define ALTERNATIVE(from, to, cond, replacement)\ - .section .altinstructions, "aw" ! \ + .section .altinstructions, "a" ! \ + .align 4 ! \ .word (from - .) ! \ .hword (to - from)/4, cond ! \ .word replacement ! \ @@ -52,7 +54,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end, /* to replace multiple instructions by new code */ #define ALTERNATIVE_CODE(from, num_instructions, cond, new_instr_ptr)\ - .section .altinstructions, "aw" ! \ + .section .altinstructions, "a" ! \ + .align 4 ! \ .word (from - .) ! \ .hword -num_instructions, cond ! \ .word (new_instr_ptr - .) ! \ From patchwork Fri Nov 24 14:41:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13467733 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABB712D635 for ; Fri, 24 Nov 2023 14:43:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VdiwAg++" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A788C433C7; Fri, 24 Nov 2023 14:43:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700837000; bh=mJ3o+Ukg3wgT8ohKU9ICvT4tbdf+dY1Tp/KomgS4yhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VdiwAg++u58TkeYfxQEka2vO9ICaQlO+qhHquvdqpDvcaDBR3Ma3I0MHHSP+oaoCj 469waMmy023JEKSkrfzMQRAbxFqjs+ynmx1hi1uyp9UbveB6zO6VEXY4hmFBXOuxL3 JEDINx5sIbSF9Vwe6BYk37hou+H63/9Z/hkIcr4F0l5eD5c/7zlCKjVo8qFzFWXzo4 JudJNEE5+OfLWv7J3sljkWkgoN1BmOpZjLimkLg94X0KS30ALhn2G7lMmsCzdlKLyq b/sqN2kJ/s3vZ8ChnkCz6GTocZ0sv8V2Kn4uwEddQddN9WHYoLwZO1zkVvO4zu73jd Xvh/e+3Eo9W9Q== From: deller@kernel.org To: linux-parisc@vger.kernel.org Cc: Helge Deller Subject: [PATCH 5/8] parisc: Mark __jump_table aligned to CPU long width Date: Fri, 24 Nov 2023 15:41:08 +0100 Message-ID: <20231124144158.158993-11-deller@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231124144158.158993-1-deller@kernel.org> References: <20231124144158.158993-1-deller@kernel.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Helge Deller The __jump_table stores two 32-bit words and one 32- or 64-bit word (for 64-bit kernel). Ensure that the third word is correctly 64-bit aligned by aligning the whole structure correctly. Signed-off-by: Helge Deller --- arch/parisc/include/asm/jump_label.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/parisc/include/asm/jump_label.h b/arch/parisc/include/asm/jump_label.h index af2a598bc0f8..94428798b6aa 100644 --- a/arch/parisc/include/asm/jump_label.h +++ b/arch/parisc/include/asm/jump_label.h @@ -15,10 +15,12 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran asm_volatile_goto("1:\n\t" "nop\n\t" ".pushsection __jump_table, \"aw\"\n\t" + ".align %1\n\t" ".word 1b - ., %l[l_yes] - .\n\t" __stringify(ASM_ULONG_INSN) " %c0 - .\n\t" ".popsection\n\t" - : : "i" (&((char *)key)[branch]) : : l_yes); + : : "i" (&((char *)key)[branch]), "i" (sizeof(long)) + : : l_yes); return false; l_yes: @@ -30,10 +32,12 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool asm_volatile_goto("1:\n\t" "b,n %l[l_yes]\n\t" ".pushsection __jump_table, \"aw\"\n\t" + ".align %1\n\t" ".word 1b - ., %l[l_yes] - .\n\t" __stringify(ASM_ULONG_INSN) " %c0 - .\n\t" ".popsection\n\t" - : : "i" (&((char *)key)[branch]) : : l_yes); + : : "i" (&((char *)key)[branch]), "i" (sizeof(long)) + : : l_yes); return false; l_yes: From patchwork Fri Nov 24 14:41:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13467734 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AEB82D781 for ; Fri, 24 Nov 2023 14:43:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="D2T28N5t" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF7F6C433C9; Fri, 24 Nov 2023 14:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700837008; bh=PLcYTiIlDBjMEojfPH4+Bm2d8yNNnrTTzmz7PUXkJIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D2T28N5tmilOysUorZD1wsjaVlWHw7QYfCqqK+V53l9szRtggyj2vCfWndpUDA10f Fe1KW9pa/TXISI2yAGBkmg+egoHo+i5sGez5eQb77C/hYM4NvEwVINnRippsuDnUw9 3JhzwcIlLXNQCXYIGtFRBMM/0TXJL9/mW+nKuPeAfmdbwNtxQEtt60SRi/3u7Gxtmo eKw6+SiWLDDIS+Jbv0Oi5JEC0GC7AqYzP53qhIcUIElEAXzfF/owXLEPpw/2NHKJB8 kWrpCnsxAKG6cBraY1ZyUEJN1C+tbnh4XrBtEmseqZF6w+AL6UGrrt4a0i6lqSu6K0 hx1RGHjQZ0/eQ== From: deller@kernel.org To: linux-parisc@vger.kernel.org Cc: Helge Deller Subject: [PATCH 6/8] parisc: Use correct alignment in __bug_table Date: Fri, 24 Nov 2023 15:41:10 +0100 Message-ID: <20231124144158.158993-13-deller@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231124144158.158993-1-deller@kernel.org> References: <20231124144158.158993-1-deller@kernel.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Helge Deller Make sure that the __bug_table section gets 32- or 64-bit aligned, depending if a 32- or 64-bit kernel is being built. Mark the ____bug_table not writeable, and use .blockz instead of .org assembler directive to pad the struct. Signed-off-by: Helge Deller --- arch/parisc/include/asm/bug.h | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/arch/parisc/include/asm/bug.h b/arch/parisc/include/asm/bug.h index 4b6d60b94124..b9cad0bb4461 100644 --- a/arch/parisc/include/asm/bug.h +++ b/arch/parisc/include/asm/bug.h @@ -28,13 +28,15 @@ do { \ asm volatile("\n" \ "1:\t" PARISC_BUG_BREAK_ASM "\n" \ - "\t.pushsection __bug_table,\"aw\"\n" \ + "\t.pushsection __bug_table,\"a\"\n" \ + "\t.align %4\n" \ "2:\t" ASM_WORD_INSN "1b, %c0\n" \ - "\t.short %c1, %c2\n" \ - "\t.org 2b+%c3\n" \ + "\t.short %1, %2\n" \ + "\t.blockz %3-2*%4-2*2\n" \ "\t.popsection" \ : : "i" (__FILE__), "i" (__LINE__), \ - "i" (0), "i" (sizeof(struct bug_entry)) ); \ + "i" (0), "i" (sizeof(struct bug_entry)), \ + "i" (sizeof(long)) ); \ unreachable(); \ } while(0) @@ -51,27 +53,31 @@ do { \ asm volatile("\n" \ "1:\t" PARISC_BUG_BREAK_ASM "\n" \ - "\t.pushsection __bug_table,\"aw\"\n" \ + "\t.pushsection __bug_table,\"a\"\n" \ + "\t.align %4\n" \ "2:\t" ASM_WORD_INSN "1b, %c0\n" \ - "\t.short %c1, %c2\n" \ - "\t.org 2b+%c3\n" \ + "\t.short %1, %2\n" \ + "\t.blockz %3-2*%4-2*2\n" \ "\t.popsection" \ : : "i" (__FILE__), "i" (__LINE__), \ "i" (BUGFLAG_WARNING|(flags)), \ - "i" (sizeof(struct bug_entry)) ); \ + "i" (sizeof(struct bug_entry)), \ + "i" (sizeof(long)) ); \ } while(0) #else #define __WARN_FLAGS(flags) \ do { \ asm volatile("\n" \ "1:\t" PARISC_BUG_BREAK_ASM "\n" \ - "\t.pushsection __bug_table,\"aw\"\n" \ + "\t.pushsection __bug_table,\"a\"\n" \ + "\t.align %2\n" \ "2:\t" ASM_WORD_INSN "1b\n" \ - "\t.short %c0\n" \ - "\t.org 2b+%c1\n" \ + "\t.short %0\n" \ + "\t.blockz %1-%2-2\n" \ "\t.popsection" \ : : "i" (BUGFLAG_WARNING|(flags)), \ - "i" (sizeof(struct bug_entry)) ); \ + "i" (sizeof(struct bug_entry)), \ + "i" (sizeof(long)) ); \ } while(0) #endif From patchwork Fri Nov 24 14:41:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13467735 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2B3A2C87A for ; Fri, 24 Nov 2023 14:43:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OWAVXFsy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19D7BC433C9; Fri, 24 Nov 2023 14:43:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700837017; bh=fE+2vrrbwsXIZxY6U9hJE6L8qv3ZN509yo2AnlnuBjs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OWAVXFsyyvVXO6vZtBw4My87Mbb7+mGnoICsGONPWd7j13EPGEhWQgG29iqxNLD4M IHoB6Z87HIa7HcCuLxgvdU8pJLCAfKfO6Iga+E1dEsfjFfc0m1D0YMue1nKrt9ZhQF ZwsKcjoQLVeLT4up4lFJ20Ex4OMS9xFyHWD7DsBqHfBln6RGthiY9N9jzwxHR+6WME cMi0wopSCPhVQwyojXUodiUuTEp6exdUyy+cVp6eIZHjzHoJTb5gxfpGKa8GQ1dVDE Y0hhKX46UWzbS68Gpw4pnIo6jl8Re8R2UEL837unMT1v3KNhQthORdKot8rK3H3yeH pxyIwAdXgiqyA== From: deller@kernel.org To: linux-parisc@vger.kernel.org Cc: Helge Deller , Bruno Haible Subject: [PATCH 7/8] parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes Date: Fri, 24 Nov 2023 15:41:12 +0100 Message-ID: <20231124144158.158993-15-deller@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231124144158.158993-1-deller@kernel.org> References: <20231124144158.158993-1-deller@kernel.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Helge Deller Those return codes are only defined for the parisc architecture and are leftovers from when we wanted to be HP-UX compatible. They are not returned by any Linux kernel syscall but do trigger problems with the glibc strerrorname_np() and strerror() functions as reported in glibc issue #31080. There is no need to keep them, so simply remove them. Signed-off-by: Helge Deller Reported-by: Bruno Haible Closes: https://sourceware.org/bugzilla/show_bug.cgi?id=31080 --- arch/parisc/include/uapi/asm/errno.h | 2 -- lib/errname.c | 6 ------ tools/arch/parisc/include/uapi/asm/errno.h | 2 -- 3 files changed, 10 deletions(-) diff --git a/arch/parisc/include/uapi/asm/errno.h b/arch/parisc/include/uapi/asm/errno.h index 87245c584784..8d94739d75c6 100644 --- a/arch/parisc/include/uapi/asm/errno.h +++ b/arch/parisc/include/uapi/asm/errno.h @@ -75,7 +75,6 @@ /* 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 EDESTADDRREQ 217 /* Destination address required */ #define EMSGSIZE 218 /* Message too long */ @@ -101,7 +100,6 @@ #define ETIMEDOUT 238 /* Connection timed out */ #define ECONNREFUSED 239 /* Connection refused */ #define EREFUSED ECONNREFUSED /* for HP's NFS apparently */ -#define EREMOTERELEASE 240 /* Remote peer released connection */ #define EHOSTDOWN 241 /* Host is down */ #define EHOSTUNREACH 242 /* No route to host */ diff --git a/lib/errname.c b/lib/errname.c index dd1b998552cd..4f9112b38f3a 100644 --- a/lib/errname.c +++ b/lib/errname.c @@ -111,9 +111,6 @@ static const char *names_0[] = { E(ENOSPC), E(ENOSR), E(ENOSTR), -#ifdef ENOSYM - E(ENOSYM), -#endif E(ENOSYS), E(ENOTBLK), E(ENOTCONN), @@ -144,9 +141,6 @@ static const char *names_0[] = { #endif E(EREMOTE), E(EREMOTEIO), -#ifdef EREMOTERELEASE - E(EREMOTERELEASE), -#endif E(ERESTART), E(ERFKILL), E(EROFS), diff --git a/tools/arch/parisc/include/uapi/asm/errno.h b/tools/arch/parisc/include/uapi/asm/errno.h index 87245c584784..8d94739d75c6 100644 --- a/tools/arch/parisc/include/uapi/asm/errno.h +++ b/tools/arch/parisc/include/uapi/asm/errno.h @@ -75,7 +75,6 @@ /* 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 EDESTADDRREQ 217 /* Destination address required */ #define EMSGSIZE 218 /* Message too long */ @@ -101,7 +100,6 @@ #define ETIMEDOUT 238 /* Connection timed out */ #define ECONNREFUSED 239 /* Connection refused */ #define EREFUSED ECONNREFUSED /* for HP's NFS apparently */ -#define EREMOTERELEASE 240 /* Remote peer released connection */ #define EHOSTDOWN 241 /* Host is down */ #define EHOSTUNREACH 242 /* No route to host */ From patchwork Fri Nov 24 14:41:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13467736 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45E82286B6 for ; Fri, 24 Nov 2023 14:43:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DbuLnQ1O" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 076B2C433CA; Fri, 24 Nov 2023 14:43:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700837021; bh=A5jorDEldyCVDWSZyZ0AJHq11wmlWXwFBpIDRg8t55Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DbuLnQ1OeUxAgMncDrcR0Hji4J17P63s9Xv8bjH8WSh9oKgZgzDiJ+EYUcivgn/Zw Vn4XX+OJxaXGI7sTIi2hzr/mOyIFBdqnDY2CQHo2kDzao0gr1jxcnK7ejdtn9J2o8R 0MX+BrcXs/2kfR1KKT952opkTD4p5HzxHOamMxClmgeXfOGbcEXlhPX20aEKQsWDS2 M8B3uyvlX5KMVC1IKkxVX81JosnazYOhoy+9PakvO/SvkHvxsLvvdARpbU5LgPBWgi pS8D73o7+T6rin8U+JiI87yB/kC7Fd4QlY22ztd+nuFKGlxgkwTiHvOzwibwbFaLPo yyBwYfPWms6NQ== From: deller@kernel.org To: linux-parisc@vger.kernel.org Cc: Helge Deller Subject: [PATCH 8/8] parisc: Reduce size of __bug_table[] on 64-bit kernel by half Date: Fri, 24 Nov 2023 15:41:13 +0100 Message-ID: <20231124144158.158993-16-deller@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231124144158.158993-1-deller@kernel.org> References: <20231124144158.158993-1-deller@kernel.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Helge Deller Enable GENERIC_BUG_RELATIVE_POINTERS which will store 32-bit relative offsets to the bug address and the source file name instead of 64-bit absolute addresses. This effectively reduces the size of the __bug_table[] array by half on 64-bit kernels. Signed-off-by: Helge Deller --- arch/parisc/Kconfig | 7 +++++-- arch/parisc/include/asm/bug.h | 34 +++++++++++++++++----------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index a7c9c0e69e5a..d14ccc948a29 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -115,9 +115,12 @@ config ARCH_HAS_ILOG2_U64 default n config GENERIC_BUG - bool - default y + def_bool y depends on BUG + select GENERIC_BUG_RELATIVE_POINTERS if 64BIT + +config GENERIC_BUG_RELATIVE_POINTERS + bool config GENERIC_HWEIGHT bool diff --git a/arch/parisc/include/asm/bug.h b/arch/parisc/include/asm/bug.h index b9cad0bb4461..1641ff9a8b83 100644 --- a/arch/parisc/include/asm/bug.h +++ b/arch/parisc/include/asm/bug.h @@ -17,26 +17,27 @@ #define PARISC_BUG_BREAK_ASM "break 0x1f, 0x1fff" #define PARISC_BUG_BREAK_INSN 0x03ffe01f /* PARISC_BUG_BREAK_ASM */ -#if defined(CONFIG_64BIT) -#define ASM_WORD_INSN ".dword\t" +#ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS +# define __BUG_REL(val) ".word " __stringify(val) " - ." #else -#define ASM_WORD_INSN ".word\t" +# define __BUG_REL(val) ".word " __stringify(val) #endif + #ifdef CONFIG_DEBUG_BUGVERBOSE #define BUG() \ do { \ asm volatile("\n" \ "1:\t" PARISC_BUG_BREAK_ASM "\n" \ "\t.pushsection __bug_table,\"a\"\n" \ - "\t.align %4\n" \ - "2:\t" ASM_WORD_INSN "1b, %c0\n" \ + "\t.align 4\n" \ + "2:\t" __BUG_REL(1b) "\n" \ + "\t" __BUG_REL(%c0) "\n" \ "\t.short %1, %2\n" \ - "\t.blockz %3-2*%4-2*2\n" \ + "\t.blockz %3-2*4-2*2\n" \ "\t.popsection" \ : : "i" (__FILE__), "i" (__LINE__), \ - "i" (0), "i" (sizeof(struct bug_entry)), \ - "i" (sizeof(long)) ); \ + "i" (0), "i" (sizeof(struct bug_entry)) ); \ unreachable(); \ } while(0) @@ -54,15 +55,15 @@ asm volatile("\n" \ "1:\t" PARISC_BUG_BREAK_ASM "\n" \ "\t.pushsection __bug_table,\"a\"\n" \ - "\t.align %4\n" \ - "2:\t" ASM_WORD_INSN "1b, %c0\n" \ + "\t.align 4\n" \ + "2:\t" __BUG_REL(1b) "\n" \ + "\t" __BUG_REL(%c0) "\n" \ "\t.short %1, %2\n" \ - "\t.blockz %3-2*%4-2*2\n" \ + "\t.blockz %3-2*4-2*2\n" \ "\t.popsection" \ : : "i" (__FILE__), "i" (__LINE__), \ "i" (BUGFLAG_WARNING|(flags)), \ - "i" (sizeof(struct bug_entry)), \ - "i" (sizeof(long)) ); \ + "i" (sizeof(struct bug_entry)) ); \ } while(0) #else #define __WARN_FLAGS(flags) \ @@ -71,13 +72,12 @@ "1:\t" PARISC_BUG_BREAK_ASM "\n" \ "\t.pushsection __bug_table,\"a\"\n" \ "\t.align %2\n" \ - "2:\t" ASM_WORD_INSN "1b\n" \ + "2:\t" __BUG_REL(1b) "\n" \ "\t.short %0\n" \ - "\t.blockz %1-%2-2\n" \ + "\t.blockz %1-4-2\n" \ "\t.popsection" \ : : "i" (BUGFLAG_WARNING|(flags)), \ - "i" (sizeof(struct bug_entry)), \ - "i" (sizeof(long)) ); \ + "i" (sizeof(struct bug_entry)) ); \ } while(0) #endif