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

Ethan Chen via posted 8 patches 2 months, 1 week ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bmeng.cn@gmail.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Peter Xu <peterx@redhat.com>, David Hildenbrand <david@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>
[PATCH v8 6/8] hw/misc/riscv_iopmp: Add API to configure RISCV CPU IOPMP support
Posted by Ethan Chen via 2 months, 1 week 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
Re: [PATCH v8 6/8] hw/misc/riscv_iopmp: Add API to configure RISCV CPU IOPMP support
Posted by Alistair Francis 1 month, 2 weeks ago
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
>
>
Re: [PATCH v8 6/8] hw/misc/riscv_iopmp: Add API to configure RISCV CPU IOPMP support
Posted by Ethan Chen via 1 month, 1 week ago
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
> >
> >