From 65c7eca2c8a5511f357dcc6c670e07ddc7279db6 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 1 Jul 2024 13:28:32 +0200 Subject: [PATCH] Fix OpenSBI configuration for newer versions OpenSBI 1.3 an newer require the heap_size to be specified in the sbi_platform structure, othewise the default 0 value causes a hangg at the start. I found the problem after bisecting OpenSBI: # Bisect opensbi version = src.shortRev; src = builtins.fetchGit { url = "file:///home/Computational/rarias/riscv/opensbi"; #rev = "908be1b85c8ff0695ea226fbbf0ff24a779cdece"; #good #rev = "6bc02dede86c47f87e65293b7099e9caf3b22c29"; #good #rev = "bbff53fe3b6cdd3c9bc084d489640d7ee2a3f831"; #bad #rev = "8b99a7f7d8294be29e18a667d51e13755ed2c0e0"; #good #rev = "bdde2ecd27af1ac158669809f6658376fb5137ab"; #good #rev = "5cf9a540164a018a31a679578a27eb964af0340d"; #good #rev = "2a04f7037317c6c5b591b160a074c700de9b3378"; #bad rev = "40d36a6673131e36075b1df78af4d7ab92e8cc01"; #bad }; --- lagarto-ox.nix | 10 ++-------- ox-alveo-platform-plic.patch | 3 ++- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lagarto-ox.nix b/lagarto-ox.nix index b160dda..3e89bc2 100644 --- a/lagarto-ox.nix +++ b/lagarto-ox.nix @@ -189,19 +189,13 @@ echo 'booti ''${kernel_addr_r} ''${ramdisk_addr_r}:''${ramdisk_size} ''${fdtcontroladdr}' >> $out ''; - # Lagarto OX doesn't work with newer versions of OpenSBI (1.3, 1.4), not - # sure why. opensbi = prev.opensbi.overrideAttrs (old: rec { - version = "1.2"; # ok - #version = "1.3"; # bad - #version = "1.4"; # bad + version = "1.4"; src = prev.fetchFromGitHub { owner = "riscv-software-src"; repo = "opensbi"; rev = "v${version}"; - hash = "sha256-Zcl+SE2nySMycV/ozsl4AvGipRsMblA5mt3oVZ81Z44="; #1.2 - #hash = "sha256-Dr16fVUGLYGnGYHkjAyqpJxt8p95F0CJIU9ESGWKGWo="; #1.3 - #hash = "sha256-T8ZeAzjM9aeTXitjE7s+m+jjGGtDo2jK1qO5EuKiVLU="; #1.4 + hash = "sha256-T8ZeAzjM9aeTXitjE7s+m+jjGGtDo2jK1qO5EuKiVLU="; }; #NIX_DEBUG=5; makeFlags = [ diff --git a/ox-alveo-platform-plic.patch b/ox-alveo-platform-plic.patch index d906a6f..cd54047 100644 --- a/ox-alveo-platform-plic.patch +++ b/ox-alveo-platform-plic.patch @@ -42,7 +42,7 @@ new file mode 100644 index 0000000..a359b34 --- /dev/null +++ b/platform/fpga/ox_alveo/platform.c -@@ -0,0 +1,121 @@ +@@ -0,0 +1,122 @@ +#include +#include +#include @@ -162,5 +162,6 @@ index 0000000..a359b34 + .features = SBI_PLATFORM_DEFAULT_FEATURES, + .hart_count = OX_ALVEO_HART_COUNT, + .hart_stack_size = SBI_PLATFORM_DEFAULT_HART_STACK_SIZE, ++ .heap_size = SBI_PLATFORM_DEFAULT_HEAP_SIZE(OX_ALVEO_HART_COUNT), + .platform_ops_addr = (unsigned long)&ox_alveo_ops +};