diff mbox series

[1/1] hw/riscv/virt.c: add cbom-block-size fdt property

Message ID 20230301215902.375217-2-dbarboza@ventanamicro.com (mailing list archive)
State New, archived
Headers show
Series hw/riscv/virt.c: add cbom-block-size fdt property | expand

Commit Message

Daniel Henrique Barboza March 1, 2023, 9:59 p.m. UTC
From: Anup Patel <apatel@ventanamicro.com>

The cbom-block-size fdt property property is used to inform the OS about
the blocksize in bytes for the Zicbom cache operations.

Linux documents it in Documentation/devicetree/bindings/riscv/cpus.yaml
as:

  riscv,cbom-block-size:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      The blocksize in bytes for the Zicbom cache operations.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
 hw/riscv/virt.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Ben Dooks March 2, 2023, 8:37 a.m. UTC | #1
On 01/03/2023 21:59, Daniel Henrique Barboza wrote:
> From: Anup Patel <apatel@ventanamicro.com>
> 
> The cbom-block-size fdt property property is used to inform the OS about
> the blocksize in bytes for the Zicbom cache operations.
> 
> Linux documents it in Documentation/devicetree/bindings/riscv/cpus.yaml
> as:
> 
>    riscv,cbom-block-size:
>      $ref: /schemas/types.yaml#/definitions/uint32
>      description:
>        The blocksize in bytes for the Zicbom cache operations.
> 
> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> ---
>   hw/riscv/virt.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index 49acb57da4..31b55cc62f 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -244,6 +244,12 @@ static void create_fdt_socket_cpus(RISCVVirtState *s, int socket,
>           name = riscv_isa_string(cpu_ptr);
>           qemu_fdt_setprop_string(ms->fdt, cpu_name, "riscv,isa", name);
>           g_free(name);
> +
> +        if (cpu_ptr->cfg.ext_icbom) {
> +            qemu_fdt_setprop_cell(ms->fdt, cpu_name, "riscv,cbom-block-size",
> +                                  cpu_ptr->cfg.cbom_blocksize);
> +        }
> +
>           qemu_fdt_setprop_string(ms->fdt, cpu_name, "compatible", "riscv");
>           qemu_fdt_setprop_string(ms->fdt, cpu_name, "status", "okay");
>           qemu_fdt_setprop_cell(ms->fdt, cpu_name, "reg",

You'll need the same for riscv,cboz-block-size as well.
Palmer Dabbelt March 5, 2023, 8:39 p.m. UTC | #2
On Thu, 02 Mar 2023 00:37:10 PST (-0800), ben.dooks@codethink.co.uk wrote:
> On 01/03/2023 21:59, Daniel Henrique Barboza wrote:
>> From: Anup Patel <apatel@ventanamicro.com>
>>
>> The cbom-block-size fdt property property is used to inform the OS about
>> the blocksize in bytes for the Zicbom cache operations.
>>
>> Linux documents it in Documentation/devicetree/bindings/riscv/cpus.yaml
>> as:
>>
>>    riscv,cbom-block-size:
>>      $ref: /schemas/types.yaml#/definitions/uint32
>>      description:
>>        The blocksize in bytes for the Zicbom cache operations.
>>
>> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
>> ---
>>   hw/riscv/virt.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
>> index 49acb57da4..31b55cc62f 100644
>> --- a/hw/riscv/virt.c
>> +++ b/hw/riscv/virt.c
>> @@ -244,6 +244,12 @@ static void create_fdt_socket_cpus(RISCVVirtState *s, int socket,
>>           name = riscv_isa_string(cpu_ptr);
>>           qemu_fdt_setprop_string(ms->fdt, cpu_name, "riscv,isa", name);
>>           g_free(name);
>> +
>> +        if (cpu_ptr->cfg.ext_icbom) {
>> +            qemu_fdt_setprop_cell(ms->fdt, cpu_name, "riscv,cbom-block-size",
>> +                                  cpu_ptr->cfg.cbom_blocksize);
>> +        }
>> +
>>           qemu_fdt_setprop_string(ms->fdt, cpu_name, "compatible", "riscv");
>>           qemu_fdt_setprop_string(ms->fdt, cpu_name, "status", "okay");
>>           qemu_fdt_setprop_cell(ms->fdt, cpu_name, "reg",
>
> You'll need the same for riscv,cboz-block-size as well.

Thanks.  There's a v2 over here 
<https://lore.kernel.org/qemu-devel/20230302091406.407824-1-dbarboza@ventanamicro.com/> 
that adds both.  The subject changed for the v2.
diff mbox series

Patch

diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 49acb57da4..31b55cc62f 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -244,6 +244,12 @@  static void create_fdt_socket_cpus(RISCVVirtState *s, int socket,
         name = riscv_isa_string(cpu_ptr);
         qemu_fdt_setprop_string(ms->fdt, cpu_name, "riscv,isa", name);
         g_free(name);
+
+        if (cpu_ptr->cfg.ext_icbom) {
+            qemu_fdt_setprop_cell(ms->fdt, cpu_name, "riscv,cbom-block-size",
+                                  cpu_ptr->cfg.cbom_blocksize);
+        }
+
         qemu_fdt_setprop_string(ms->fdt, cpu_name, "compatible", "riscv");
         qemu_fdt_setprop_string(ms->fdt, cpu_name, "status", "okay");
         qemu_fdt_setprop_cell(ms->fdt, cpu_name, "reg",