From 7b9eb7366ef9ab334abecc46d5e7bb6283ebc669 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 28 Jun 2024 14:36:32 +0200 Subject: [PATCH] Remove unused PMEM regions Boots until the init, then fails with: [ 42.561840] Freeing unused kernel image (initmem) memory: 2448K [ 42.572360] Run /init as init process [ 42.577400] with arguments: [ 42.581780] /init [ 42.584520] with environment: [ 42.589320] HOME=/ [ 42.592140] TERM=linux [ 42.637580] init[1]: unhandled signal 4 code 0x1 at 0x0000003f966980d8 in ld-linux-riscv64-lp64d.so.1[3f96683000+23000] [ 42.650580] CPU: 0 PID: 1 Comm: init Not tainted 6.1.62 #1-NixOS [ 42.657720] Hardware name: Barcelona Supercomputing Center - Lagarto Ox (NixOS) (DT) [ 42.666760] epc : 0000003f966980d8 ra : 0000000000000000 sp : 0000003fe5c95db0 [ 42.675040] gp : ffffffff8197ea48 tp : 0000000000000000 t0 : 0000000000000000 [ 42.683320] t1 : 0000000000000000 t2 : 0000000000000000 s0 : 0000000000000000 [ 42.691600] s1 : 0000000000000000 a0 : 0000000000000000 a1 : 0000000000000000 [ 42.699880] a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000000 [ 42.708160] a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000000000000 [ 42.716420] s2 : 0000000000000000 s3 : 0000000000000000 s4 : 0000000000000000 [ 42.724700] s5 : 0000000000000000 s6 : 0000000000000000 s7 : 0000000000000000 [ 42.733380] s8 : 0000000000000000 s9 : 0000000000000000 s10: 0000000000000000 [ 42.741660] s11: 0000000000000000 t3 : 0000000000000000 t4 : 0000000000000000 [ 42.749920] t5 : 0000000000000000 t6 : 0000000000000000 [ 42.756440] status: 0000000200004020 badaddr: 0000000000010513 cause: 0000000000000002 [ 42.767620] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004 [ 42.775720] CPU: 0 PID: 1 Comm: init Not tainted 6.1.62 #1-NixOS [ 42.782320] Hardware name: Barcelona Supercomputing Center - Lagarto Ox (NixOS) (DT) [ 42.790460] Call Trace: [ 42.793380] [] dump_backtrace+0x38/0x48 [ 42.799520] [] show_stack+0x50/0x68 [ 42.805280] [] dump_stack_lvl+0x60/0x84 [ 42.811400] [] dump_stack+0x20/0x30 [ 42.817140] [] panic+0x160/0x390 [ 42.822620] [] do_exit+0xa70/0xa78 [ 42.828260] [] do_group_exit+0x44/0xb0 [ 42.834240] [] get_signal+0x9b4/0xa00 [ 42.840140] [] do_work_pending+0x18c/0x610 [ 42.846480] [] resume_userspace_slow+0x10/0x14 [ 42.853420] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004 ]--- --- flake.nix | 4 ++-- fpga/upload.sh | 12 +++++++----- ox-plic.dts | 22 ++++++---------------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/flake.nix b/flake.nix index cef84f7..a8a68fc 100644 --- a/flake.nix +++ b/flake.nix @@ -116,11 +116,11 @@ build = nixosconf.config.system.build; in syspkgs.mkShell { pname = "lagarto-ox-shell"; - TOPLEVEL = build.toplevel; + #TOPLEVEL = build.toplevel; OPENSBI = syspkgs.opensbi; KERNEL = build.kernel; INITRD = build.initialRamdisk; - ROOTFS = build.sdImage; + #ROOTFS = build.sdImage; UBOOT_ENV = syspkgs.uboot-env; shellHook = '' echo "Here are the current system pieces:" diff --git a/fpga/upload.sh b/fpga/upload.sh index a47a667..f36d23b 100755 --- a/fpga/upload.sh +++ b/fpga/upload.sh @@ -3,19 +3,21 @@ set -e set -x -dst=femu:nixos/ +#dst=femu:nixos/ +dst=fpgalogin1:nixos/ if [ "$1" != "" ]; then dst="$1" fi -rsync -a fpga/fpgactl "$dst" -rsync -a fpga/boot.sh "$dst" +#rsync -a fpga/fpgactl "$dst" +#rsync -a fpga/boot.sh "$dst" rsync -a fpga/env.sh "$dst" -rsync "$OPENSBI/share/opensbi/lp64/fpga/openpiton/firmware/fw_payload.bin" "$dst/opensbi.bin" +#rsync "$OPENSBI/share/opensbi/lp64/fpga/openpiton/firmware/fw_payload.bin" "$dst/opensbi.bin" +rsync "$OPENSBI/share/opensbi/lp64d/fpga/ox_alveo/firmware/fw_payload.bin" "$dst/opensbi.bin" rsync "$KERNEL/Image" "$dst/kernel.bin" rsync "$INITRD/initrd" "$dst/initrd.bin" -rsync "$ROOTFS/sd-image/rootfs.img" "$dst/rootfs.img" +#rsync "$ROOTFS/sd-image/rootfs.img" "$dst/rootfs.img" rsync "$UBOOT_ENV" "$dst/uboot.env" echo "Now go to $dst and run ./boot.sh" diff --git a/ox-plic.dts b/ox-plic.dts index 43cbfcc..e9afd0c 100644 --- a/ox-plic.dts +++ b/ox-plic.dts @@ -33,14 +33,12 @@ * * [0x0_6000_0000, 0x0_7000_0000) -> DMA pool (256 MiB) * [0x0_7000_0000, 0x0_8000_0000) -> DMA pool (256 MiB) - * [0x0_8000_0000, 0x0_f7e0_0000) -> RAM memory (~1.8 GiB) - * [0x0_f7e0_0000, 0x1_b7f0_0000) -> PMEM3 (3 GiB) - * [0x1_b7f0_0000, 0x1_bff0_0000) -> PMEM2 (128 MiB) + * [0x0_8000_0000, 0x1_bff0_0000) -> RAM memory (~5 GiB) * [0x1_bff0_0000, 0x2_8000_0000) -> PMEM (3 GiB) */ memory@80000000 { device_type = "memory"; - reg = <0x00000000 0x80000000 0x00000000 0x77e00000>; + reg = <0x00000000 0x80000000 0x00000001 0x3ff00000>; }; reserved-memory { #address-cells = <0x00000002>; @@ -64,22 +62,14 @@ phandle = <0x00000002>; }; pmem@1bff00000 { + /* volatile; This property indicates that this region is + * actually backed by non-persistent memory. This lets the OS + * know that it may skip the cache flushes required to ensure + * data is made persistent after a write. */ volatile; compatible = "pmem-region"; reg = <0x00000001 0xbff00000 0x00000000 0xc0100000>; }; - pmem2@1b7f00000 { - #address-cells = <0x00000002>; - #size-cells = <0x00000002>; - volatile; - compatible = "pmem-region"; - reg = <0x00000001 0xb7f00000 0x00000000 0x08000000>; - }; - pmem3@f7e00000 { - volatile; - compatible = "pmem-region"; - reg = <0x00000000 0xf7e00000 0x00000000 0xc0100000>; - }; soc { #address-cells = <0x00000002>; #size-cells = <0x00000002>;