target/riscv/pmp: Restrict priviledged PMP to system-mode emulation
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Tue, 23 Jul 2019 12:08:15 +0000 (14:08 +0200)
committerPalmer Dabbelt <palmer@sifive.com>
Tue, 17 Sep 2019 15:42:42 +0000 (08:42 -0700)
The RISC-V Physical Memory Protection is restricted to privileged
modes. Restrict its compilation to QEMU system builds.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
target/riscv/Makefile.objs
target/riscv/pmp.c

index b1c79bc1d1723974f468bcffc8bc6ccd9502141f..b754e4bf3213e89d69268f14307c208b4941aa43 100644 (file)
@@ -1,4 +1,5 @@
-obj-y += translate.o op_helper.o cpu_helper.o cpu.o csr.o fpu_helper.o gdbstub.o pmp.o
+obj-y += translate.o op_helper.o cpu_helper.o cpu.o csr.o fpu_helper.o gdbstub.o
+obj-$(CONFIG_SOFTMMU) += pmp.o
 
 DECODETREE = $(SRC_PATH)/scripts/decodetree.py
 
index 958c7502a0e0a333e777e127a02ffa53a5b0ee7f..d836288cb4cdb42614dae860c7b28a54591ad204 100644 (file)
@@ -28,8 +28,6 @@
 #include "qapi/error.h"
 #include "cpu.h"
 
-#ifndef CONFIG_USER_ONLY
-
 #define RISCV_DEBUG_PMP 0
 #define PMP_DEBUG(fmt, ...)                                                    \
     do {                                                                       \
@@ -382,5 +380,3 @@ target_ulong pmpaddr_csr_read(CPURISCVState *env, uint32_t addr_index)
         return 0;
     }
 }
-
-#endif