platform: generic: add CVA6 platform and support for PMU
Classified as: {OPEN}
Add a new generic platform called CVA6 (https://github.com/openhwgroup/cva6).
Add support for Performance Monitoring Unit for this platform.
I hope it is in the right place this time.
---
platform/generic/Kconfig | 4 +
platform/generic/configs/defconfig | 1 + platform/generic/openhwgroup/cva6.c | 185 ++++++++++++++++++++++++++++++++ platform/generic/openhwgroup/objects.mk | 3 + 4 files changed, 193 insertions(+)
platform/generic/Kconfig +4 -0
@@ -43,6 +43,10 @@ config PLATFORM_ANDES_QILAI select ANDES_SBI default n +config PLATFORM_OPENHWGROUP_CVA6 + bool "OpenHWGroup CVA6 support" + default n + config PLATFORM_OPENHWGROUP_OPENPITON bool "OpenHWGroup Openpiton support" default n
platform/generic/configs/defconfig +1 -0
@@ -9,6 +9,7 @@ CONFIG_PLATFORM_STARFIVE_JH7110=y CONFIG_PLATFORM_THEAD=y CONFIG_PLATFORM_MIPS_P8700=y CONFIG_PLATFORM_OPENHWGROUP_OPENPITON=y +CONFIG_PLATFORM_OPENHWGROUP_CVA6=y CONFIG_FDT_CPPC=y CONFIG_FDT_CPPC_RPMI=y CONFIG_FDT_GPIO=y
platform/generic/openhwgroup/cva6.c new file +184 -0
184 lines not on this page · raw message
platform/generic/openhwgroup/objects.mk +3 -0
@@ -3,6 +3,9 @@ # # Copyright (c) 2020 Western Digital Corporation or its affiliates. # +carray-platform_override_modules-$(CONFIG_PLATFORM_OPENHWGROUP_CVA6) += +openhwgroup_cva6 +platform-objs-$(CONFIG_PLATFORM_OPENHWGROUP_CVA6) += openhwgroup/cva6.o carray-platform_override_modules-$(CONFIG_PLATFORM_OPENHWGROUP_OPENPITON) += openhwgroup_openpiton platform-objs-$(CONFIG_PLATFORM_OPENHWGROUP_OPENPITON) += openhwgroup/openpiton.o
+
{OPEN}
Signature · 3 lines
opensbi mailing list [email protected] http://lists.infradead.org/mailman/listinfo/opensbi
Hi Jimmy,
This functionality has been already merged, you can find it for the CVA6 in this commit: e8dfa55f3d6ada2e1f71671213bd3a68ec96ea76.
Regards,
Manuel
Signature · 3 lines
opensbi mailing list [email protected] http://lists.infradead.org/mailman/listinfo/opensbi
Classified as: {OPEN}
Quoted 7 lines · Le jeudi 4 décembre 2025 18:30 Manuel Hernández a écrit :
Hi Jimmy,
This functionality has been already merged, you can find it for the CVA6 in this commit:
e8dfa55f3d6ada2e1f71671213bd3a68ec96ea76.Regards,
Manuel
Hi Manuel,
Thanks for your quick answer. I am confused, as for me Ariane is a legacy design, superseded by CVA6 which is maintained by the Open Hardware Group. Besides, my patch adds support for performance monitoring counters.
Kind regards,
Jimmy
{OPEN}
Signature · 3 lines
opensbi mailing list [email protected] http://lists.infradead.org/mailman/listinfo/opensbi
Quoted 9 lines · LE RHUN Jimmy
Classified as: {OPEN}
Quoted 5 lines · Le jeudi 4 décembre 2025 18:30 Manuel Hernández a écrit :
Hi Jimmy,
This functionality has been already merged, you can find it for the CVA6 in this commit:
e8dfa55f3d6ada2e1f71671213bd3a68ec96ea76.
Quoted 6 lines
Quoted 2 lines
Regards,
ManuelHi Manuel,
Thanks for your quick answer. I am confused, as for me Ariane is a legacy design, superseded by CVA6 which is maintained by the Open Hardware Group. Besides, my patch adds support for performance monitoring counters.
Now that both Ariane and Openpiton are part of the generic platform, you can use FDT / DeviceTree based PMU events discovery. Refer, <opensbi_sources>/docs/pmu_support.md for more details.
Regards,
Anup
Quoted 10 lines
Kind regards,
Jimmy{OPEN}
--
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
Signature · 3 lines
opensbi mailing list [email protected] http://lists.infradead.org/mailman/listinfo/opensbi
Quoted 105 lines · LE RHUN Jimmy
Classified as: {OPEN}
Add a new generic platform called CVA6 (https://github.com/openhwgroup/cva6).
Add support for Performance Monitoring Unit for this platform.I hope it is in the right place this time.
Signed-off-by Jimmy Le Rhun <[email protected]>---
platform/generic/Kconfig | 4 +platform/generic/configs/defconfig | 1 + platform/generic/openhwgroup/cva6.c | 185 ++++++++++++++++++++++++++++++++ platform/generic/openhwgroup/objects.mk | 3 + 4 files changed, 193 insertions(+)platform/generic/Kconfig +4
-0@@ -43,6 +43,10 @@ config PLATFORM_ANDES_QILAI select ANDES_SBI default n +config PLATFORM_OPENHWGROUP_CVA6 + bool "OpenHWGroup CVA6 support" + default n + config PLATFORM_OPENHWGROUP_OPENPITON bool "OpenHWGroup Openpiton support" default nplatform/generic/configs/defconfig +1
-0@@ -9,6 +9,7 @@ CONFIG_PLATFORM_STARFIVE_JH7110=y CONFIG_PLATFORM_THEAD=y CONFIG_PLATFORM_MIPS_P8700=y CONFIG_PLATFORM_OPENHWGROUP_OPENPITON=y +CONFIG_PLATFORM_OPENHWGROUP_CVA6=y CONFIG_FDT_CPPC=y CONFIG_FDT_CPPC_RPMI=y CONFIG_FDT_GPIO=yplatform/generic/openhwgroup/cva6.c new file +60
-0@@ -0,0 +1,185 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* +* Copyright (C) 2019 FORTH-ICS/CARV +* Panagiotis Peristerakis <[email protected]> +* Copyright (C) 2025 Thales Research & Technology +* Jimmy Le Rhun <[email protected]> +*/ + +#include <platform_override.h> +#include <sbi/sbi_console.h> +#include <sbi/sbi_pmu.h> +#include <sbi_utils/fdt/fdt_helper.h> +#include <sbi_utils/fdt/fdt_fixup.h> +#include <sbi_utils/ipi/aclint_mswi.h> +#include <sbi_utils/irqchip/plic.h> +#include <sbi_utils/serial/uart8250.h> +#include <sbi_utils/timer/aclint_mtimer.h> + +#define CVA6_UART_ADDR 0x10000000ULL +#define CVA6_UART_FREQ 50000000 +#define CVA6_UART_BAUDRATE 115200 +#define CVA6_UART_REG_SHIFT 2 +#define CVA6_UART_REG_WIDTH 4 +#define CVA6_UART_REG_OFFSET 0 +#define CVA6_UART_CAPS 0 +#define CVA6_PLIC_ADDR 0xc000000ULL +#define CVA6_PLIC_SIZE (0x200000 + \ + (CVA6_HART_COUNT * 0x1000)) +#define CVA6_PLIC_NUM_SOURCES 3 +#define CVA6_HART_COUNT 1 +#define CVA6_CLINT_ADDR 0x2000000ULL +#define CVA6_ACLINT_MTIMER_FREQ 1000000 +#define CVA6_ACLINT_MSWI_ADDR (CVA6_CLINT_ADDR + \ + CLINT_MSWI_OFFSET) +#define CVA6_ACLINT_MTIMER_ADDR (CVA6_CLINT_ADDR + \ + CLINT_MTIMER_OFFSET) + +#define CVA6_PERFCOUNTER_MASK 0x000001F8 //six configurable counters +#define CVA6_PERFEVENTS 22 //number of available events +#define CVA6_PERFEVENTS_RANGE 0x0000001F //five bits to encode 22 events + +static struct plic_data plic = { + .addr = (unsigned long )CVA6_PLIC_ADDR , + .size =CVA6_PLIC_SIZE , + .num_src =CVA6_PLIC_NUM_SOURCES , + .flags =PLIC_FLAG_ARIANE_BUG , + .context_map = { + [0 ] = {0 ,1 }, + }, +}; + +static struct aclint_mswi_data mswi = { + .addr = (unsigned long )CVA6_ACLINT_MSWI_ADDR , + .size =ACLINT_MSWI_SIZE , + .first_hartid =0 , + .hart_count =CVA6_HART_COUNT , +}; + +static struct aclint_mtimer_data mtimer = { + .mtime_freq =CVA6_ACLINT_MTIMER_FREQ ,
platform/generic/openhwgroup/cva6.c line 70
Quoted 10 lines
platform/generic/openhwgroup/cva6.c new file +10
-0+ .mtime_addr = (unsigned long)CVA6_ACLINT_MTIMER_ADDR + + ACLINT_DEFAULT_MTIME_OFFSET, + .mtime_size = ACLINT_DEFAULT_MTIME_SIZE, + .mtimecmp_addr = (unsigned long)CVA6_ACLINT_MTIMER_ADDR + + ACLINT_DEFAULT_MTIMECMP_OFFSET, + .mtimecmp_size = ACLINT_DEFAULT_MTIMECMP_SIZE, + .first_hartid = 0, + .hart_count = CVA6_HART_COUNT, + .has_64bit_mmio = true, +};
Please don't add new platforms with hardcoded device addresses/configurations. As Anup points out, all of this information should come from the devicetree. If you don't want OpenSBI to depend on an external FDT blob, you can embed the FDT by setting FW_FDT_PATH.
Regards,
Samuel
Signature · 3 lines
opensbi mailing list [email protected] http://lists.infradead.org/mailman/listinfo/opensbi