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

Philippe Mathieu-Daudé posted 1 patch 2 years, 11 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210516205333.696094-1-f4bug@amsat.org
target/riscv/cpu.h | 2 ++
1 file changed, 2 insertions(+)
[PATCH v2] target/riscv: Do not include 'pmp.h' in user emulation
Posted by Philippe Mathieu-Daudé 2 years, 11 months ago
Physical Memory Protection is a system feature.
Avoid polluting the user-mode emulation by its definitions.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/riscv/cpu.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index 7e879fb9ca5..0619b491a42 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -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

Re: [PATCH v2] target/riscv: Do not include 'pmp.h' in user emulation
Posted by Philippe Mathieu-Daudé 2 years, 11 months ago
Oops this is v1, not v2.

On Sun, May 16, 2021 at 10:53 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Physical Memory Protection is a system feature.
> Avoid polluting the user-mode emulation by its definitions.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  target/riscv/cpu.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> index 7e879fb9ca5..0619b491a42 100644
> --- a/target/riscv/cpu.h
> +++ b/target/riscv/cpu.h
> @@ -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
>

Re: [PATCH v2] target/riscv: Do not include 'pmp.h' in user emulation
Posted by Alistair Francis 2 years, 11 months ago
On Mon, May 17, 2021 at 6:53 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Physical Memory Protection is a system feature.
> Avoid polluting the user-mode emulation by its definitions.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  target/riscv/cpu.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> index 7e879fb9ca5..0619b491a42 100644
> --- a/target/riscv/cpu.h
> +++ b/target/riscv/cpu.h
> @@ -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
>
>

Re: [PATCH v2] target/riscv: Do not include 'pmp.h' in user emulation
Posted by Bin Meng 2 years, 11 months ago
On Mon, May 17, 2021 at 4:53 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Physical Memory Protection is a system feature.
> Avoid polluting the user-mode emulation by its definitions.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  target/riscv/cpu.h | 2 ++
>  1 file changed, 2 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Re: [PATCH v2] target/riscv: Do not include 'pmp.h' in user emulation
Posted by Alistair Francis 2 years, 11 months ago
On Mon, May 17, 2021 at 6:53 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Physical Memory Protection is a system feature.
> Avoid polluting the user-mode emulation by its definitions.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  target/riscv/cpu.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> index 7e879fb9ca5..0619b491a42 100644
> --- a/target/riscv/cpu.h
> +++ b/target/riscv/cpu.h
> @@ -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
>
>

Re: [PATCH v2] target/riscv: Do not include 'pmp.h' in user emulation
Posted by Laurent Vivier 2 years, 10 months ago
Le 16/05/2021 à 22:53, Philippe Mathieu-Daudé a écrit :
> Physical Memory Protection is a system feature.
> Avoid polluting the user-mode emulation by its definitions.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  target/riscv/cpu.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> index 7e879fb9ca5..0619b491a42 100644
> --- a/target/riscv/cpu.h
> +++ b/target/riscv/cpu.h
> @@ -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