All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] hw/riscv/virt.c: add cbom-block-size fdt property
@ 2023-03-01 21:59 Daniel Henrique Barboza
  2023-03-01 21:59 ` [PATCH 1/1] " Daniel Henrique Barboza
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Henrique Barboza @ 2023-03-01 21:59 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-riscv, alistair.francis, bmeng, liweiwei, zhiwei_liu,
	palmer, Daniel Henrique Barboza

Hi,

I'm sending this almost last minute patch as part of the work done in:

[PATCH v8 0/4] riscv: Add support for Zicbo[m,z,p] instructions

It turns out that the Linux kernel expects a 'cbom-block-size' FDT prop
to be able to determine the cbom-block-size. Without this patch the
kernel will misbehave with the Zicbom extension in the virt machine.

Note that a similar patch would be need for other RISC-V machines that
wants to support Linux with Zicbom.


Anup Patel (1):
  hw/riscv/virt.c: add cbom-block-size fdt property

 hw/riscv/virt.c | 6 ++++++
 1 file changed, 6 insertions(+)

-- 
2.39.2



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] hw/riscv/virt.c: add cbom-block-size fdt property
  2023-03-01 21:59 [PATCH 0/1] hw/riscv/virt.c: add cbom-block-size fdt property Daniel Henrique Barboza
@ 2023-03-01 21:59 ` Daniel Henrique Barboza
  2023-03-02  8:37   ` Ben Dooks
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Henrique Barboza @ 2023-03-01 21:59 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-riscv, alistair.francis, bmeng, liweiwei, zhiwei_liu,
	palmer, Anup Patel

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",
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] hw/riscv/virt.c: add cbom-block-size fdt property
  2023-03-01 21:59 ` [PATCH 1/1] " Daniel Henrique Barboza
@ 2023-03-02  8:37   ` Ben Dooks
  2023-03-05 20:39     ` Palmer Dabbelt
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Dooks @ 2023-03-02  8:37 UTC (permalink / raw)
  To: Daniel Henrique Barboza, qemu-devel
  Cc: qemu-riscv, alistair.francis, bmeng, liweiwei, zhiwei_liu,
	palmer, Anup Patel

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.

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] hw/riscv/virt.c: add cbom-block-size fdt property
  2023-03-02  8:37   ` Ben Dooks
@ 2023-03-05 20:39     ` Palmer Dabbelt
  0 siblings, 0 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2023-03-05 20:39 UTC (permalink / raw)
  To: ben.dooks
  Cc: dbarboza, qemu-devel, qemu-riscv, Alistair Francis, bmeng,
	liweiwei, zhiwei_liu, apatel

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-05 20:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-01 21:59 [PATCH 0/1] hw/riscv/virt.c: add cbom-block-size fdt property Daniel Henrique Barboza
2023-03-01 21:59 ` [PATCH 1/1] " Daniel Henrique Barboza
2023-03-02  8:37   ` Ben Dooks
2023-03-05 20:39     ` Palmer Dabbelt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.