qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/7] target/arm: Implement M profile derived exceptions
@ 2018-01-30 15:02 Peter Maydell
  2018-01-30 15:02 ` [Qemu-devel] [PATCH 1/7] target/arm: Add armv7m_nvic_set_pending_derived() Peter Maydell
                   ` (6 more replies)
  0 siblings, 7 replies; 21+ messages in thread
From: Peter Maydell @ 2018-01-30 15:02 UTC (permalink / raw)
  To: qemu-arm, qemu-devel; +Cc: patches

In the Arm M-profile architecture, the process of taking or
returning from an exception can itself cause an exception
(for instance if there is an MPU permissions fault when
writing or reading the exception stack frame). This is called
a derived exception. Currently we don't implement this at
all in QEMU, instead just doing direct physical address
loads and stores which bypass MPU/SAU checks.

This patchset changes all the loads and stores we do on
exception entry and exit so that they do the MPU and SAU checks
and handle failures in the architecturally required way.

A note for reviewers: the way I've structured handling of
derived exceptions on exception entry diverges a bit from the
structure of the v8M Arm ARM pseudocode. In the pseudocode,
derived exceptions cause the attempt to process the original
exception to be abandoned (either without calling TakeException,
or bailing out of TakeException partway through). Then at the top
level the pseudocode calls DerivedLateArrival to prioritize the
derived exception and call TakeException from there.
For the QEMU implementation, I chose to let the NVIC do the
prioritization and continue forward, so that the call to
v7m_exception_taken() will then take either the original or the
erived exception. The effect is the same, but this structure works
better for QEMU, because we don't have a convenient top level place
to do the abandon-and-retry logic.

(The motivation for filling in this missing bit of functionality
is that the Zephyr RTOS would like to implement stack-overrun
checking on v7M cores using the MPU, so noticing permissions
failures when exceptions frames are written to the stack is
important.)

Peter Maydell (7):
  target/arm: Add armv7m_nvic_set_pending_derived()
  target/arm: Split "get pending exception info" from "acknowledge it"
  target/arm: Add ignore_stackfaults argument to v7m_exception_taken()
  target/arm: Make v7M exception entry stack push check MPU
  target/arm: Make v7m_push_callee_stack() honour MPU
  target/arm: Make exception vector loads honour the SAU
  target/arm: Handle exceptions during exception stack pop

 target/arm/cpu.h      |  32 ++++-
 hw/intc/armv7m_nvic.c |  98 +++++++++++--
 target/arm/helper.c   | 392 ++++++++++++++++++++++++++++++++++++++++----------
 hw/intc/trace-events  |   5 +-
 4 files changed, 435 insertions(+), 92 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2018-02-06  9:42 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-30 15:02 [Qemu-devel] [PATCH 0/7] target/arm: Implement M profile derived exceptions Peter Maydell
2018-01-30 15:02 ` [Qemu-devel] [PATCH 1/7] target/arm: Add armv7m_nvic_set_pending_derived() Peter Maydell
2018-02-03 21:01   ` Richard Henderson
2018-01-30 15:02 ` [Qemu-devel] [PATCH 2/7] target/arm: Split "get pending exception info" from "acknowledge it" Peter Maydell
2018-02-03 21:06   ` Richard Henderson
2018-02-05 23:44   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-02-06  9:42     ` Peter Maydell
2018-01-30 15:02 ` [Qemu-devel] [PATCH 3/7] target/arm: Add ignore_stackfaults argument to v7m_exception_taken() Peter Maydell
2018-02-03 21:08   ` Richard Henderson
2018-01-30 15:02 ` [Qemu-devel] [PATCH 4/7] target/arm: Make v7M exception entry stack push check MPU Peter Maydell
2018-02-03 21:21   ` Richard Henderson
2018-02-03 21:30     ` Peter Maydell
2018-02-03 21:39       ` Richard Henderson
2018-02-03 21:32   ` [Qemu-devel] [Qemu-arm] " Peter Maydell
2018-01-30 15:02 ` [Qemu-devel] [PATCH 5/7] target/arm: Make v7m_push_callee_stack() honour MPU Peter Maydell
2018-02-03 21:26   ` Richard Henderson
2018-02-05 23:48   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-01-30 15:02 ` [Qemu-devel] [PATCH 6/7] target/arm: Make exception vector loads honour the SAU Peter Maydell
2018-02-03 21:29   ` Richard Henderson
2018-01-30 15:02 ` [Qemu-devel] [PATCH 7/7] target/arm: Handle exceptions during exception stack pop Peter Maydell
2018-02-03 21:31   ` Richard Henderson

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).