Skip to contentSkip to conversation

target/riscv: Do not include 'pmp.h' in user emulation

PATCH Applied Philippe Mathieu-Daudé 4 participants 6 messages May 16, 2021 – Jun 5, 2021 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 target/riscv: Do not include 'pmp.h' in user emulation

Physical Memory Protection is a system feature. Avoid polluting the user-mode emulation by its definitions.

---
 target/riscv/cpu.h | 2 ++
 1 file changed, 2 insertions(+)
target/riscv/cpu.h +2 -0
index 7e879fb9ca5..0619b491a42 100644
@@ -97,7 +97,9 @@ enum {
 
 typedef struct CPURISCVState CPURISCVState;
 
+#if !defined(CONFIG_USER_ONLY)
 #include "pmp.h"
+#endif
 
 #define RV_VLEN_MAX 256
 
Signature · 1 line
2.26.3
#1 lore raw

Oops this is v1, not v2.

Quoted 26 lines · Philippe Mathieu-Daudé

Physical Memory Protection is a system feature. Avoid polluting the user-mode emulation by its definitions.

---
 target/riscv/cpu.h | 2 ++
 1 file changed, 2 insertions(+)
target/riscv/cpu.h +2 -1
index 7e879fb9ca5..0619b491a42 100644
@@ -97,7 +97,9 @@ enum {
 
 typedef struct CPURISCVState CPURISCVState;
 
+#if !defined(CONFIG_USER_ONLY)
 #include "pmp.h"
+#endif
 
 #define RV_VLEN_MAX 256
 
--

2.26.3

Reviewed-by on v2 1/1
#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 5 lines · Philippe Mathieu-Daudé

Physical Memory Protection is a system feature. Avoid polluting the user-mode emulation by its definitions.

Alistair

Quoted 22 lines
---
 target/riscv/cpu.h | 2 ++
 1 file changed, 2 insertions(+)
target/riscv/cpu.h +2 -1
index 7e879fb9ca5..0619b491a42 100644
@@ -97,7 +97,9 @@ enum {
 
 typedef struct CPURISCVState CPURISCVState;
 
+#if !defined(CONFIG_USER_ONLY)
 #include "pmp.h"
+#endif
 
 #define RV_VLEN_MAX 256
 
--

2.26.3

Reviewed-by on v2 1/1
#4 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 5 lines · Philippe Mathieu-Daudé

Physical Memory Protection is a system feature. Avoid polluting the user-mode emulation by its definitions.

Alistair

Quoted 22 lines
---
 target/riscv/cpu.h | 2 ++
 1 file changed, 2 insertions(+)
target/riscv/cpu.h +2 -1
index 7e879fb9ca5..0619b491a42 100644
@@ -97,7 +97,9 @@ enum {
 
 typedef struct CPURISCVState CPURISCVState;
 
+#if !defined(CONFIG_USER_ONLY)
 #include "pmp.h"
+#endif
 
 #define RV_VLEN_MAX 256
 
--

2.26.3

#5 lore raw
In reply to Philippe Mathieu-Daudé

Le 16/05/2021 à 22:53, Philippe Mathieu-Daudé a écrit :

Quoted 14 lines

Physical Memory Protection is a system feature. Avoid polluting the user-mode emulation by its definitions.

---
 target/riscv/cpu.h | 2 ++
 1 file changed, 2 insertions(+)
target/riscv/cpu.h +0 -0
index 7e879fb9ca5..0619b491a42 100644

target/riscv/cpu.h enum { · line 105

Quoted 9 lines
target/riscv/cpu.h +2 -0
@@ -97,7 +97,9 @@ enum {
 
 typedef struct CPURISCVState CPURISCVState;
 
+#if !defined(CONFIG_USER_ONLY)
 #include "pmp.h"
+#endif
 
 #define RV_VLEN_MAX 256
 

Applied to my trivial-patches branch.

Thanks,
Laurent