qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hongzheng-Li <ethan.lee.qnl@gmail.com>
To: qemu-riscv@nongnu.org, qemu-devel@nongnu.org
Cc: Hou Weiying <weiying_hou@outlook.com>,
	sagark@eecs.berkeley.edu, kbastian@mail.uni-paderborn.de,
	Hongzheng-Li <Ethan.Lee.QNL@gmail.com>,
	Alistair.Francis@wdc.com, palmer@dabbelt.com,
	Myriad-Dreamin <camiyoru@gmail.com>
Subject: [PATCH 4/4] Add a config option for ePMP.
Date: Sat,  8 Aug 2020 17:09:50 +0800	[thread overview]
Message-ID: <20200808090950.13-5-Ethan.Lee.QNL@gmail.com> (raw)
In-Reply-To: <20200808090950.13-1-Ethan.Lee.QNL@gmail.com>

From: Hou Weiying <weiying_hou@outlook.com>

Add a config option to enable experimental support for ePMP. This
is disabled by default and can be enabled with 'x-epmp=true'.

Signed-off-by: Hongzheng-Li <Ethan.Lee.QNL@gmail.com>
Signed-off-by: Hou Weiying <weiying_hou@outlook.com>
Signed-off-by: Myriad-Dreamin <camiyoru@gmail.com>
---
 target/riscv/cpu.c | 9 +++++++++
 target/riscv/cpu.h | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 059d71f2c7..79fa9d3c2f 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -407,6 +407,14 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)
 
     if (cpu->cfg.pmp) {
         set_feature(env, RISCV_FEATURE_PMP);
+
+        /*
+         * Enhanced PMP should only be available
+         * on harts with PMP support
+         */
+        if (cpu->cfg.epmp) {
+            set_feature(env, RISCV_FEATURE_EPMP);
+        }
     }
 
     /* If misa isn't set (rv32 and rv64 machines) set it here */
@@ -509,6 +517,7 @@ static Property riscv_cpu_properties[] = {
     DEFINE_PROP_STRING("priv_spec", RISCVCPU, cfg.priv_spec),
     DEFINE_PROP_BOOL("mmu", RISCVCPU, cfg.mmu, true),
     DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true),
+    DEFINE_PROP_BOOL("x-epmp", RISCVCPU, cfg.epmp, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index d0e7f5b9c5..afdc9fa2bf 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -77,6 +77,7 @@
 enum {
     RISCV_FEATURE_MMU,
     RISCV_FEATURE_PMP,
+    RISCV_FEATURE_EPMP,
     RISCV_FEATURE_MISA
 };
 
@@ -202,6 +203,7 @@ struct CPURISCVState {
 
     /* physical memory protection */
     pmp_table_t pmp_state;
+    target_ulong mseccfg;
 
     /* machine specific rdtime callback */
     uint64_t (*rdtime_fn)(void);
@@ -272,6 +274,7 @@ typedef struct RISCVCPU {
         char *user_spec;
         bool mmu;
         bool pmp;
+        bool epmp;
     } cfg;
 } RISCVCPU;
 
-- 
2.20.1



  parent reply	other threads:[~2020-08-08 13:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-08  9:09 [PATCH 0/4] riscv: Add enhanced PMP support Hongzheng-Li
2020-08-08  9:09 ` [PATCH 1/4] Define ePMP mseccfg Hongzheng-Li
2020-08-08  9:09 ` [PATCH 2/4] Implementation of enhanced PMP(ePMP) support Hongzheng-Li
2020-08-08  9:09 ` [PATCH 3/4] Add ePMP CSR accesses Hongzheng-Li
2020-08-08  9:09 ` Hongzheng-Li [this message]
     [not found] <20200808085656.28692-1-weiying_hou@outlook.com>
2020-08-08  8:56 ` [PATCH 4/4] Add a config option for ePMP Hou Weiying
     [not found] <20200808052031.19523-1-weiying_hou@outlook.com>
2020-08-08  5:20 ` Hou Weiying

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200808090950.13-5-Ethan.Lee.QNL@gmail.com \
    --to=ethan.lee.qnl@gmail.com \
    --cc=Alistair.Francis@wdc.com \
    --cc=camiyoru@gmail.com \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=sagark@eecs.berkeley.edu \
    --cc=weiying_hou@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).