From: Michael Ellerman <mpe@ellerman.id.au>
To: Xiongwei Song <sxwjean@me.com>,
benh@kernel.crashing.org, paulus@samba.org, oleg@redhat.com,
npiggin@gmail.com, christophe.leroy@csgroup.eu,
msuchanek@suse.de, aneesh.kumar@linux.ibm.com,
ravi.bangoria@linux.ibm.com, mikey@neuling.org,
haren@linux.ibm.com, alistair@popple.id.au, jniethe5@gmail.com,
peterz@infradead.org, leobras.c@gmail.com,
akpm@linux-foundation.org, rppt@kernel.org, peterx@redhat.com,
atrajeev@linux.vnet.ibm.com, maddy@linux.ibm.com,
kjain@linux.ibm.com, kan.liang@linux.intel.com, aik@ozlabs.ru,
pmladek@suse.com, john.ogness@linutronix.de
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
kvm-ppc@vger.kernel.org, Xiongwei Song <sxwjean@gmail.com>
Subject: Re: [PATCH v2] powerpc/traps: Enhance readability for trap types
Date: Wed, 31 Mar 2021 20:58:17 +1100 [thread overview]
Message-ID: <875z17y79i.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20210330150425.10145-1-sxwjean@me.com>
Xiongwei Song <sxwjean@me.com> writes:
> From: Xiongwei Song <sxwjean@gmail.com>
>
> Create a new header named traps.h, define macros to list ppc exception
> types in traps.h, replace the reference of the real trap values with
> these macros.
Personally I find the hex values easier to recognise, but I realise
that's probably not true of other people :)
...
> diff --git a/arch/powerpc/include/asm/traps.h b/arch/powerpc/include/asm/traps.h
> new file mode 100644
> index 000000000000..a31b6122de23
> --- /dev/null
> +++ b/arch/powerpc/include/asm/traps.h
> @@ -0,0 +1,19 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _ASM_PPC_TRAPS_H
> +#define _ASM_PPC_TRAPS_H
> +
> +#define TRAP_RESET 0x100 /* System reset */
> +#define TRAP_MCE 0x200 /* Machine check */
> +#define TRAP_DSI 0x300 /* Data storage */
> +#define TRAP_DSEGI 0x380 /* Data segment */
> +#define TRAP_ISI 0x400 /* Instruction storage */
> +#define TRAP_ISEGI 0x480 /* Instruction segment */
> +#define TRAP_ALIGN 0x600 /* Alignment */
> +#define TRAP_PROG 0x700 /* Program */
> +#define TRAP_DEC 0x900 /* Decrementer */
> +#define TRAP_SYSCALL 0xc00 /* System call */
> +#define TRAP_TRACEI 0xd00 /* Trace */
> +#define TRAP_FPA 0xe00 /* Floating-point Assist */
> +#define TRAP_PMI 0xf00 /* Performance monitor */
I know the macro is called TRAP and the field in pt_regs is called trap,
but the terminology in the architecture is "exception", and we already
have many uses of that. In particular we have a lot of uses of "exc" as
an abbreviation for "exception". So I think I'd rather we use that than
"TRAP".
I think we should probably use the names from the ISA, unless they are
really over long.
Which are:
0x100 System Reset
0x200 Machine Check
0x300 Data Storage
0x380 Data Segment
0x400 Instruction Storage
0x480 Instruction Segment
0x500 External
0x600 Alignment
0x700 Program
0x800 Floating-Point Unavailable
0x900 Decrementer
0x980 Hypervisor Decrementer
0xA00 Directed Privileged Doorbell
0xC00 System Call
0xD00 Trace
0xE00 Hypervisor Data Storage
0xE20 Hypervisor Instruction Storage
0xE40 Hypervisor Emulation Assistance
0xE60 Hypervisor Maintenance
0xE80 Directed Hypervisor Doorbell
0xEA0 Hypervisor Virtualization
0xF00 Performance Monitor
0xF20 Vector Unavailable
0xF40 VSX Unavailable
0xF60 Facility Unavailable
0xF80 Hypervisor Facility Unavailable
0xFA0 Directed Ultravisor Doorbell
So perhaps:
EXC_SYSTEM_RESET
EXC_MACHINE_CHECK
EXC_DATA_STORAGE
EXC_DATA_SEGMENT
EXC_INST_STORAGE
EXC_INST_SEGMENT
EXC_EXTERNAL_INTERRUPT
EXC_ALIGNMENT
EXC_PROGRAM_CHECK
EXC_FP_UNAVAILABLE
EXC_DECREMENTER
EXC_HV_DECREMENTER
EXC_SYSTEM_CALL
EXC_HV_DATA_STORAGE
EXC_PERF_MONITOR
cheers
next prev parent reply other threads:[~2021-03-31 9:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-30 15:04 [PATCH v2] powerpc/traps: Enhance readability for trap types Xiongwei Song
2021-03-31 9:58 ` Michael Ellerman [this message]
2021-03-31 21:25 ` Segher Boessenkool
2021-04-01 2:39 ` Michael Ellerman
2021-04-01 8:01 ` Nicholas Piggin
2021-04-01 16:16 ` Segher Boessenkool
2021-04-05 12:10 ` Xiongwei Song
[not found] ` <CAEVVKH8XDiEGHjXj6sJAHynhwqKWpNqj_Ws03AqwNjR8OmHf5w@mail.gmail.com>
2021-04-01 16:11 ` Segher Boessenkool
2021-04-02 0:36 ` Nicholas Piggin
2021-04-05 12:18 ` Xiongwei Song
2021-04-05 12:03 ` Xiongwei Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875z17y79i.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=aik@ozlabs.ru \
--cc=akpm@linux-foundation.org \
--cc=alistair@popple.id.au \
--cc=aneesh.kumar@linux.ibm.com \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@csgroup.eu \
--cc=haren@linux.ibm.com \
--cc=jniethe5@gmail.com \
--cc=john.ogness@linutronix.de \
--cc=kan.liang@linux.intel.com \
--cc=kjain@linux.ibm.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=leobras.c@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mikey@neuling.org \
--cc=msuchanek@suse.de \
--cc=npiggin@gmail.com \
--cc=oleg@redhat.com \
--cc=paulus@samba.org \
--cc=peterx@redhat.com \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=ravi.bangoria@linux.ibm.com \
--cc=rppt@kernel.org \
--cc=sxwjean@gmail.com \
--cc=sxwjean@me.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox