OSDN Git Service

RISC-V: Only Check PMP if MMU translation succeeds
authorHesham Almatary <Hesham.Almatary@cl.cam.ac.uk>
Thu, 30 May 2019 13:51:30 +0000 (14:51 +0100)
committerPalmer Dabbelt <palmer@sifive.com>
Mon, 24 Jun 2019 06:44:41 +0000 (23:44 -0700)
commite0f8fa72deba7ac7a7ae06ba25e6498aaad93ace
tree028d6cd225c50f0d1335ab0eae718e143bf6b7ed
parentcbf5827693addaff4e4d2102afedbf078a204eb2
RISC-V: Only Check PMP if MMU translation succeeds

The current implementation unnecessarily checks for PMP even if MMU translation
failed. This may trigger a wrong PMP access exception instead of
a page exception.

For example, the very first instruction fetched after the first satp write in
S-Mode will trigger a PMP access fault instead of an instruction fetch page
fault.

This patch prioritises MMU exceptions over PMP exceptions and only checks for
PMP if MMU translation succeeds. This patch is required for future commits
that properly report PMP exception violations if PTW succeeds.

Signed-off-by: Hesham Almatary <Hesham.Almatary@cl.cam.ac.uk>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
target/riscv/cpu_helper.c