From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Ellerman Subject: Re: [PATCH 1/2] Move the pt_regs_offset struct definition from arch to common include file Date: Tue, 30 Jun 2015 13:29:05 +1000 Message-ID: <1435634945.24866.2.camel@ellerman.id.au> References: <1434386579-6045-1-git-send-email-dave.long@linaro.org> <1434386579-6045-2-git-send-email-dave.long@linaro.org> <5581BCD0.2040405@linaro.org> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5581BCD0.2040405@linaro.org> Sender: linux-hexagon-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" To: David Long Cc: Rob Herring , "H. Peter Anvin" , Andy Lutomirski , Anton Blanchard , Behan Webster , Benjamin Herrenschmidt , Eric Paris , Heiko Carstens , Ingo Molnar , Jan Willeke , Kees Cook , Martin Schwidefsky , Nikolay Borisov , Oleg Nesterov , Paul Mackerras , Richard Kuo , Robert Richter , Roland McGrath , Russell King , Tejun Heo , Thomas Gleixner , Will Deacon , "linux-arm-kernel@lists.infradead.org" On Wed, 2015-06-17 at 14:30 -0400, David Long wrote: > On 06/16/15 09:17, Rob Herring wrote: > > On Mon, Jun 15, 2015 at 11:42 AM, David Long wrote: > >> > >> #define REG_OFFSET_NAME(r) \ > >> {.name = #r, .offset = offsetof(struct pt_regs, ARM_##r)} > >> #define REG_OFFSET_END {.name = NULL, .offset = 0} > > > > Can't you also move these? ARM is complicated with the "ARM_" > > prefixing, but the others appear to be the same. Maybe you can remove > > the prefix or redefine the macro for ARM. > > That would mandate that all the architecture-specific pt_regs structures > would have to use a top-level named field for each named register. Why does it mandate that? See eg. powerpc where we use REG_OFFSET_NAME for the top-level named fields and then a different macro for the array elements: #define REG_OFFSET_NAME(r) {.name = #r, .offset = offsetof(struct pt_regs, r)} #define GPR_OFFSET_NAME(num) \ {.name = STR(gpr##num), .offset = offsetof(struct pt_regs, gpr[num])} static const struct pt_regs_offset regoffset_table[] = { GPR_OFFSET_NAME(0), GPR_OFFSET_NAME(1), GPR_OFFSET_NAME(2), GPR_OFFSET_NAME(3), ... REG_OFFSET_NAME(nip), REG_OFFSET_NAME(msr), So I don't see why REG_OFFSET_NAME couldn't be common. cheers From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Ellerman Date: Tue, 30 Jun 2015 03:29:05 +0000 Subject: Re: [PATCH 1/2] Move the pt_regs_offset struct definition from arch to common include file Message-Id: <1435634945.24866.2.camel@ellerman.id.au> List-Id: References: <1434386579-6045-1-git-send-email-dave.long@linaro.org> <1434386579-6045-2-git-send-email-dave.long@linaro.org> <5581BCD0.2040405@linaro.org> In-Reply-To: <5581BCD0.2040405@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-arm-kernel@lists.infradead.org On Wed, 2015-06-17 at 14:30 -0400, David Long wrote: > On 06/16/15 09:17, Rob Herring wrote: > > On Mon, Jun 15, 2015 at 11:42 AM, David Long wrote: > >> > >> #define REG_OFFSET_NAME(r) \ > >> {.name = #r, .offset = offsetof(struct pt_regs, ARM_##r)} > >> #define REG_OFFSET_END {.name = NULL, .offset = 0} > > > > Can't you also move these? ARM is complicated with the "ARM_" > > prefixing, but the others appear to be the same. Maybe you can remove > > the prefix or redefine the macro for ARM. > > That would mandate that all the architecture-specific pt_regs structures > would have to use a top-level named field for each named register. Why does it mandate that? See eg. powerpc where we use REG_OFFSET_NAME for the top-level named fields and then a different macro for the array elements: #define REG_OFFSET_NAME(r) {.name = #r, .offset = offsetof(struct pt_regs, r)} #define GPR_OFFSET_NAME(num) \ {.name = STR(gpr##num), .offset = offsetof(struct pt_regs, gpr[num])} static const struct pt_regs_offset regoffset_table[] = { GPR_OFFSET_NAME(0), GPR_OFFSET_NAME(1), GPR_OFFSET_NAME(2), GPR_OFFSET_NAME(3), ... REG_OFFSET_NAME(nip), REG_OFFSET_NAME(msr), So I don't see why REG_OFFSET_NAME couldn't be common. cheers From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 2E29A1A1007 for ; Tue, 30 Jun 2015 13:29:06 +1000 (AEST) Message-ID: <1435634945.24866.2.camel@ellerman.id.au> Subject: Re: [PATCH 1/2] Move the pt_regs_offset struct definition from arch to common include file From: Michael Ellerman To: David Long Cc: Rob Herring , "H. Peter Anvin" , Andy Lutomirski , Anton Blanchard , Behan Webster , Benjamin Herrenschmidt , Eric Paris , Heiko Carstens , Ingo Molnar , Jan Willeke , Kees Cook , Martin Schwidefsky , Nikolay Borisov , Oleg Nesterov , Paul Mackerras , Richard Kuo , Robert Richter , Roland McGrath , Russell King , Tejun Heo , Thomas Gleixner , Will Deacon , "linux-arm-kernel@lists.infradead.org" , linux-hexagon@vger.kernel.org, "linux-kernel@vger.kernel.org" , linux-s390@vger.kernel.org, SH-Linux , linux390@de.ibm.com, linuxppc-dev , "x86@kernel.org" Date: Tue, 30 Jun 2015 13:29:05 +1000 In-Reply-To: <5581BCD0.2040405@linaro.org> References: <1434386579-6045-1-git-send-email-dave.long@linaro.org> <1434386579-6045-2-git-send-email-dave.long@linaro.org> <5581BCD0.2040405@linaro.org> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Wed, 2015-06-17 at 14:30 -0400, David Long wrote: > On 06/16/15 09:17, Rob Herring wrote: > > On Mon, Jun 15, 2015 at 11:42 AM, David Long wrote: > >> > >> #define REG_OFFSET_NAME(r) \ > >> {.name = #r, .offset = offsetof(struct pt_regs, ARM_##r)} > >> #define REG_OFFSET_END {.name = NULL, .offset = 0} > > > > Can't you also move these? ARM is complicated with the "ARM_" > > prefixing, but the others appear to be the same. Maybe you can remove > > the prefix or redefine the macro for ARM. > > That would mandate that all the architecture-specific pt_regs structures > would have to use a top-level named field for each named register. Why does it mandate that? See eg. powerpc where we use REG_OFFSET_NAME for the top-level named fields and then a different macro for the array elements: #define REG_OFFSET_NAME(r) {.name = #r, .offset = offsetof(struct pt_regs, r)} #define GPR_OFFSET_NAME(num) \ {.name = STR(gpr##num), .offset = offsetof(struct pt_regs, gpr[num])} static const struct pt_regs_offset regoffset_table[] = { GPR_OFFSET_NAME(0), GPR_OFFSET_NAME(1), GPR_OFFSET_NAME(2), GPR_OFFSET_NAME(3), ... REG_OFFSET_NAME(nip), REG_OFFSET_NAME(msr), So I don't see why REG_OFFSET_NAME couldn't be common. cheers From mboxrd@z Thu Jan 1 00:00:00 1970 From: michael@ellerman.id.au (Michael Ellerman) Date: Tue, 30 Jun 2015 13:29:05 +1000 Subject: [PATCH 1/2] Move the pt_regs_offset struct definition from arch to common include file In-Reply-To: <5581BCD0.2040405@linaro.org> References: <1434386579-6045-1-git-send-email-dave.long@linaro.org> <1434386579-6045-2-git-send-email-dave.long@linaro.org> <5581BCD0.2040405@linaro.org> Message-ID: <1435634945.24866.2.camel@ellerman.id.au> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, 2015-06-17 at 14:30 -0400, David Long wrote: > On 06/16/15 09:17, Rob Herring wrote: > > On Mon, Jun 15, 2015 at 11:42 AM, David Long wrote: > >> > >> #define REG_OFFSET_NAME(r) \ > >> {.name = #r, .offset = offsetof(struct pt_regs, ARM_##r)} > >> #define REG_OFFSET_END {.name = NULL, .offset = 0} > > > > Can't you also move these? ARM is complicated with the "ARM_" > > prefixing, but the others appear to be the same. Maybe you can remove > > the prefix or redefine the macro for ARM. > > That would mandate that all the architecture-specific pt_regs structures > would have to use a top-level named field for each named register. Why does it mandate that? See eg. powerpc where we use REG_OFFSET_NAME for the top-level named fields and then a different macro for the array elements: #define REG_OFFSET_NAME(r) {.name = #r, .offset = offsetof(struct pt_regs, r)} #define GPR_OFFSET_NAME(num) \ {.name = STR(gpr##num), .offset = offsetof(struct pt_regs, gpr[num])} static const struct pt_regs_offset regoffset_table[] = { GPR_OFFSET_NAME(0), GPR_OFFSET_NAME(1), GPR_OFFSET_NAME(2), GPR_OFFSET_NAME(3), ... REG_OFFSET_NAME(nip), REG_OFFSET_NAME(msr), So I don't see why REG_OFFSET_NAME couldn't be common. cheers