[PATCH v8 6/8] hw/misc/riscv_iopmp: Add API to configure RISCV CPU IOPMP support

Ethan Chen via posted 8 patches 5 months, 2 weeks ago
[PATCH v8 6/8] hw/misc/riscv_iopmp: Add API to configure RISCV CPU IOPMP support
Posted by Ethan Chen via 5 months, 2 weeks ago
The iopmp_setup_cpu() function configures the RISCV CPU to support IOPMP and
specifies the CPU's RRID.

Signed-off-by: Ethan Chen <ethan84@andestech.com>
---
 hw/misc/riscv_iopmp.c         | 6 ++++++
 include/hw/misc/riscv_iopmp.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/hw/misc/riscv_iopmp.c b/hw/misc/riscv_iopmp.c
index e62ac57437..374bf5c610 100644
--- a/hw/misc/riscv_iopmp.c
+++ b/hw/misc/riscv_iopmp.c
@@ -1211,5 +1211,11 @@ void iopmp_setup_system_memory(DeviceState *dev, const MemMapEntry *memmap,
                        "iopmp-downstream-as");
 }
 
+void iopmp_setup_cpu(RISCVCPU *cpu, uint32_t rrid)
+{
+    cpu->cfg.iopmp = true;
+    cpu->cfg.iopmp_rrid = rrid;
+}
+
 
 type_init(iopmp_register_types);
diff --git a/include/hw/misc/riscv_iopmp.h b/include/hw/misc/riscv_iopmp.h
index ebe9c4bc4a..7e7da56d10 100644
--- a/include/hw/misc/riscv_iopmp.h
+++ b/include/hw/misc/riscv_iopmp.h
@@ -167,5 +167,6 @@ typedef struct IopmpState {
 
 void iopmp_setup_system_memory(DeviceState *dev, const MemMapEntry *memmap,
                                uint32_t mapentry_num);
+void iopmp_setup_cpu(RISCVCPU *cpu, uint32_t rrid);
 
 #endif
-- 
2.34.1