Skip to contentSkip to conversation

hw/riscv/virt.c: add cbo[mz]-block-size fdt properties

PATCH In review Daniel Henrique Barboza 3 participants 4 messages Mar 2, 2023 – Mar 5, 2023 RISC-V

lore
Share & tools
lore
#0 lore raw

v2 cover hw/riscv/virt.c: add cbo[mz]-block-size fdt properties

Based-on: [email protected] ("[PATCH v8 0/4] riscv: Add support for Zicbo[m,z,p] instructions")

Hi,

This second version, which is still dependent on:

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

Is adding the cboz FDT property as well as requested by Ben Dooks. First version refrain from adding it since it's still under review in the kernel but, given that we have cboz_blocksize already available, it makes sense to also expose it like we're already doing for cbom-block-size.

Changes from v1:
- also add riscv,cboz-block-size for Zicboz
- v1 link: https://lists.gnu.org/archive/html/qemu-devel/2023-03/msg00368.html

Cc Ben Dooks <[email protected]>

Anup Patel (1):
hw/riscv/virt.c: add cbo[mz]-block-size fdt properties

 hw/riscv/virt.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
Signature · 1 line
2.39.2
#1 lore raw

PATCH v2 1/1 hw/riscv/virt.c: add cbo[mz]-block-size fdt properties

From: Anup Patel <[email protected]>

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.

cboz-block-size has the same role but for the Zicboz extension, i.e. informs the size in bytes for Zicboz cache operations. Linux support for it is under review/approval in [1]. Patch 3 of that series describes cboz-block-size as:

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

[1] https://lore.kernel.org/all/[email protected]/

---
 hw/riscv/virt.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
hw/riscv/virt.c +11 -0
index 49acb57da4..3799fab9e5 100644
@@ -244,6 +244,17 @@ 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);
+        }
+
+        if (cpu_ptr->cfg.ext_icboz) {
+            qemu_fdt_setprop_cell(ms->fdt, cpu_name, "riscv,cboz-block-size",
+                                  cpu_ptr->cfg.cboz_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",
Signature · 1 line
2.39.2
Reviewed-by on v2 1/1
#2 lore raw
Quoted 23 lines · Daniel Henrique Barboza

From: Anup Patel <[email protected]>

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.

cboz-block-size has the same role but for the Zicboz extension, i.e. informs the size in bytes for Zicboz cache operations. Linux support for it is under review/approval in [1]. Patch 3 of that series describes cboz-block-size as:

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

Quoted 9 lines

[1] https://lore.kernel.org/all/[email protected]/

---
 hw/riscv/virt.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
#3 lore raw
In reply to Daniel Henrique Barboza
Quoted 19 lines · On Thu, 02 Mar 2023 01:14:05 PST (-0800), [email protected] wrote:

Based-on: [email protected] ("[PATCH v8 0/4] riscv: Add support for Zicbo[m,z,p] instructions")

Hi,

This second version, which is still dependent on:

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

Is adding the cboz FDT property as well as requested by Ben Dooks. First version refrain from adding it since it's still under review in the kernel but, given that we have cboz_blocksize already available, it makes sense to also expose it like we're already doing for cbom-block-size.

Changes from v1:
- also add riscv,cboz-block-size for Zicboz
- v1 link: https://lists.gnu.org/archive/html/qemu-devel/2023-03/msg00368.html

Quoted 7 lines
Cc Ben Dooks <[email protected]>

Anup Patel (1):
hw/riscv/virt.c: add cbo[mz]-block-size fdt properties

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

Thanks, this is in the queue.