arch-riscv: Dynamically add V extension to device tree (#464)

Currently, we are hardcoding the ISA string in the device tree
generator. The ISA string from the device tree affects which
ISA extensions will be used by the bootloader/kernel.

This function allows generating the ISA string from the gem5's
ISA object rather than using hardcoded values.

This series of changes also correct a couple of hardcoded
RISC-V ISA strings in the standard library, as well as not
enable RVV instructions for the U74 core model.

Signed-off-by: Hoa Nguyen <hn@hnpl.org>
This commit is contained in:
Jason Lowe-Power
2023-10-30 10:29:25 -07:00
committed by GitHub
5 changed files with 24 additions and 3 deletions

View File

@@ -316,7 +316,7 @@ class LupvBoard(AbstractSystemBoard, KernelDiskWorkload):
node.append(FdtPropertyWords("reg", state.CPUAddrCells(i)))
node.append(FdtPropertyStrings("mmu-type", "riscv,sv48"))
node.append(FdtPropertyStrings("status", "okay"))
node.append(FdtPropertyStrings("riscv,isa", "rv64imafdcsu"))
node.append(FdtPropertyStrings("riscv,isa", "rv64imafdc"))
# TODO: Should probably get this from the core.
freq = self.clk_domain.clock[0].frequency
node.appendCompatible(["riscv"])

View File

@@ -280,7 +280,11 @@ class RiscvBoard(AbstractSystemBoard, KernelDiskWorkload):
node.append(FdtPropertyWords("reg", state.CPUAddrCells(i)))
node.append(FdtPropertyStrings("mmu-type", "riscv,sv48"))
node.append(FdtPropertyStrings("status", "okay"))
node.append(FdtPropertyStrings("riscv,isa", "rv64imafdc"))
node.append(
FdtPropertyStrings(
"riscv,isa", core.core.isa[0].get_isa_string()
)
)
# TODO: Should probably get this from the core.
freq = self.clk_domain.clock[0].frequency
node.append(FdtPropertyWords("clock-frequency", freq))

View File

@@ -214,3 +214,4 @@ class U74Core(BaseCPUCore):
core_id,
):
super().__init__(core=U74CPU(cpu_id=core_id), isa=ISA.RISCV)
self.core.isa[0].enable_rvv = False