diff mbox series

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

Message ID 20240715101409.1249373-1-ethan84@andestech.com (mailing list archive)
State New, archived
Headers show
Series Support RISC-V IOPMP | expand

Commit Message

Ethan Chen July 15, 2024, 10:14 a.m. UTC
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(+)

Comments

Alistair Francis Aug. 8, 2024, 4:25 a.m. UTC | #1
On Mon, Jul 15, 2024 at 8:15 PM Ethan Chen via <qemu-devel@nongnu.org> wrote:
>
> 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;
> +}

This should just be a normal CPU property, which the machine can then
set to true if required

Alistair

> +
>
>  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
>
>
Ethan Chen Aug. 9, 2024, 9:56 a.m. UTC | #2
On Thu, Aug 08, 2024 at 02:25:04PM +1000, Alistair Francis wrote:
> 
> On Mon, Jul 15, 2024 at 8:15 PM Ethan Chen via <qemu-devel@nongnu.org> wrote:
> >
> > 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;
> > +}
> 
> This should just be a normal CPU property, which the machine can then
> set to true if required

I will add CPU properties for IOPMP config.

Thanks,
Ethan Chen

> 
> Alistair
> 
> > +
> >
> >  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
> >
> >
diff mbox series

Patch

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