From: Michael Ellerman <mpe@ellerman.id.au>
To: Michael Ellerman <mpe@ellerman.id.au>, <linuxppc-dev@ozlabs.org>
Cc: Paul Mackerras <paulus@samba.org>
Subject: Re: [v2] powerpc/xmon: Fix SPR read/write commands and add command to dump SPRs
Date: Sun, 8 May 2016 13:59:35 +1000 (AEST) [thread overview]
Message-ID: <3r2Wx35k4Fz9t3c@ozlabs.org> (raw)
In-Reply-To: <1460547084-1818-1-git-send-email-mpe@ellerman.id.au>
On Wed, 2016-13-04 at 11:31:24 UTC, Michael Ellerman wrote:
> From: Paul Mackerras <paulus@ozlabs.org>
>
> xmon has commands for reading and writing SPRs, but they don't work
> currently for several reasons. They attempt to synthesize a small
> function containing an mfspr or mtspr instruction and call it. However,
> the instructions are on the stack, which is usually not executable.
> Also, for 64-bit we set up a procedure descriptor, which is fine for the
> big-endian ABIv1, but not correct for ABIv2. Finally, the code uses the
> infrastructure for catching memory errors, but that only catches data
> storage interrupts and machine check interrupts, but a failed
> mfspr/mtspr can generate a program interrupt or a hypervisor emulation
> assist interrupt, or be a no-op.
>
> Instead of trying to synthesize a function on the fly, this adds two new
> functions, xmon_mfspr() and xmon_mtspr(), which take an SPR number as an
> argument and read or write the SPR. Because there is no Power ISA
> instruction which takes an SPR number in a register, we have to generate
> one of each possible mfspr and mtspr instruction, for all 1024 possible
> SPRs. Thus we get just over 8k bytes of code for each of xmon_mfspr()
> and xmon_mtspr(). However, this 16kB of code pales in comparison to the
> > 130kB of PPC opcode tables used by the xmon disassembler.
>
> To catch interrupts caused by the mfspr/mtspr instructions, we add a new
> 'catch_spr_faults' flag. If an interrupt occurs while it is set, we come
> back into xmon() via program_check_interrupt(), _exception() and die(),
> see that catch_spr_faults is set and do a longjmp to bus_error_jmp, back
> into read_spr() or write_spr().
>
> This adds a couple of other nice features: first, a "Sa" command that
> attempts to read and print out the value of all 1024 SPRs. If any mfspr
> instruction acts as a no-op, then the SPR is not implemented and not
> printed.
>
> Secondly, the Sr and Sw commands detect when an SPR is not
> implemented (i.e. mfspr is a no-op) and print a message to that effect
> rather than printing a bogus value.
>
> Signed-off-by: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Applied to powerpc next.
https://git.kernel.org/powerpc/c/4d2a14c627ab449d2cc79254d4
cheers
prev parent reply other threads:[~2016-05-08 3:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-13 11:31 [PATCH v2] powerpc/xmon: Fix SPR read/write commands and add command to dump SPRs Michael Ellerman
2016-05-08 3:59 ` Michael Ellerman [this message]
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=3r2Wx35k4Fz9t3c@ozlabs.org \
--to=mpe@ellerman.id.au \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
/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;
as well as URLs for NNTP newsgroup(s).