diff mbox series

[2/3] ARC: Add defconfigs for ARC HS58 & HS68 processors in simulators

Message ID 20240104190529.1521901-3-abrodkin@synopsys.com
State Superseded
Headers show
Series Add support for ARCv3 ISA processors | expand

Commit Message

Alexey Brodkin Jan. 4, 2024, 7:05 p.m. UTC
To simplify ramp-up with Linux on32-bit  ARC HS58 & 64-bit ARC HS68
processors we introduce 2 defconfigs with instructions on how to build
embedded Linux image for them and how to run resultoing image.

As with earlier images for simulated platforms it's possible to
use the same image with either proprietary Synopsys nSIM simulator,
QEMU or even with real FPGA-based prototyping platform called HAPS.

That not only convenient, but also helps to work on observed issues,
i.e. run the same image on so very different platforms and see if
earlier observed problem is still there. That way we may easily
verify various platforms against each other.

For example, if one image works on nSIM & FPGA but doesn't work
on QEMU, it's clear something needs to be fixed in QEMU.

But if exactly the same though unexpected behavior is observed on all
the platforms, we may say with quite some confidence, that we're dealing
with a pure software or tools issue.

Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
Signed-off-by: Vladimir Isaev <VVIsaev@gmail.com>
Signed-off-by: Vineet Gupta <vgupta@kernel.org>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
 board/synopsys/nsim/hs5x.props          | 30 +++++++++++++++++++++++++
 board/synopsys/nsim/hs6x.props          | 30 +++++++++++++++++++++++++
 board/synopsys/nsim/post-image-arcv3.sh |  4 ++++
 board/synopsys/nsim/readme.txt          | 16 +++++++++++++
 configs/snps_arc32_defconfig            | 29 ++++++++++++++++++++++++
 configs/snps_arc64_defconfig            | 26 +++++++++++++++++++++
 6 files changed, 135 insertions(+)
 create mode 100644 board/synopsys/nsim/hs5x.props
 create mode 100644 board/synopsys/nsim/hs6x.props
 create mode 100755 board/synopsys/nsim/post-image-arcv3.sh
 create mode 100644 configs/snps_arc32_defconfig
 create mode 100644 configs/snps_arc64_defconfig

Comments

Waldemar Brodkorb Jan. 5, 2024, 5:57 a.m. UTC | #1
Hi Alexey, All,
Alexey Brodkin via buildroot wrote,

> To simplify ramp-up with Linux on32-bit  ARC HS58 & 64-bit ARC HS68
                                 ^^^^^^^^
                                 missing space.
> processors we introduce 2 defconfigs with instructions on how to build
> embedded Linux image for them and how to run resultoing image.
> 
> As with earlier images for simulated platforms it's possible to
> use the same image with either proprietary Synopsys nSIM simulator,
> QEMU or even with real FPGA-based prototyping platform called HAPS.
> 
> That not only convenient, but also helps to work on observed issues,
> i.e. run the same image on so very different platforms and see if
> earlier observed problem is still there. That way we may easily
> verify various platforms against each other.
> 
> For example, if one image works on nSIM & FPGA but doesn't work
> on QEMU, it's clear something needs to be fixed in QEMU.
> 
> But if exactly the same though unexpected behavior is observed on all
> the platforms, we may say with quite some confidence, that we're dealing
> with a pure software or tools issue.

It seems networking is broken in nsimdrv for both defconfigs.
I am using nsimdrv -v
nSIM, Version: 2022.06 (Build: 006_FREE)

Is there a reason arc32 is using uclibc toolchain and arc64 is using
glibc by default?

best regards
 Waldemar
Alexey Brodkin Jan. 6, 2024, 9:47 p.m. UTC | #2
Hi Waldemar,
 
> > To simplify ramp-up with Linux on32-bit  ARC HS58 & 64-bit ARC HS68
>                                  ^^^^^^^^
>                                  missing space.

Thanks, fixed in v2, see https://lists.buildroot.org/pipermail/buildroot/2024-January/682466.html

> > processors we introduce 2 defconfigs with instructions on how to build
> > embedded Linux image for them and how to run resultoing image.
> >
> > As with earlier images for simulated platforms it's possible to
> > use the same image with either proprietary Synopsys nSIM simulator,
> > QEMU or even with real FPGA-based prototyping platform called HAPS.
> >
> > That not only convenient, but also helps to work on observed issues,
> > i.e. run the same image on so very different platforms and see if
> > earlier observed problem is still there. That way we may easily
> > verify various platforms against each other.
> >
> > For example, if one image works on nSIM & FPGA but doesn't work
> > on QEMU, it's clear something needs to be fixed in QEMU.
> >
> > But if exactly the same though unexpected behavior is observed on all
> > the platforms, we may say with quite some confidence, that we're dealing
> > with a pure software or tools issue.
> 
> It seems networking is broken in nsimdrv for both defconfigs.
> I am using nsimdrv -v
> nSIM, Version: 2022.06 (Build: 006_FREE)

First of all, 2022.06 is quite old and for good ARCv3 support you'd rather
switch to a newer version. Here https://www.synopsys.com/cgi-bin/dwarcnsim/req1.cgi
we have 2023.06.

Please get that later version, give it a try and let me know - if problems still
happen - we'll take a look at it.

But frankly speaking since QEMU port for ARC became stable I've been using it
for most of the purposes especally related to Linux stuff. That's because QEMU
has much nicer integration with the host. For example, SLIRP networking doesn't
require to mess with TUN/TAP stuff with elevated permissions, you may mount
various block devices and even pass-through USB & PCIe devices.

You may find more information on how to build and use QEMU for ARC here:
https://foss-for-synopsys-dwc-arc-processors.github.io/experimental-documentation/2023.09/simulators/qemu/

> Is there a reason arc32 is using uclibc toolchain and arc64 is using
> glibc by default?

Good that you asked :)

Back in the day uClibc used to be the default C library in Buildroot,
so the situation was quite the reverse: arc64 was forcefully set to use glibc.
Because we've started from glibc for ARCv3 as the ultimate and complete solution
and had it working. But then pretty unexpectedly we've got uClibc port for ARC HS58.
Sergey Matyukevich who joined Synopsys at that time made that as a warm-up project
literally in a week. And so we decided to keep at least ARC HS58 with the default
C library (which used to be uClibc), while for HS68 we had to use glibc as adding
new 64-bit port to uClibc could have been a much bigger project.

Then eventually glibc dethroned uClibc as the default C library and situation
has changed - now HS58 was using non-default C library.

But my take on that is we're getting more testing of things:
 - glibc for 32-bit targets is tested with ARCv2 defconfigs
 - uClibc for 32-bit ARC targets is tested with HS58 defconfigs
 - glibc for 64-bit ARC HS68 is tested by its defconfigs

If you think though we should switch HS58 defconfig to glibc - we may easily do that,
as glibc works there perfectly fine.

-Alexey
Waldemar Brodkorb Jan. 10, 2024, 9:50 a.m. UTC | #3
Hi Alexey,
Alexey Brodkin wrote,

> Hi Waldemar,
>  
> > It seems networking is broken in nsimdrv for both defconfigs.
> > I am using nsimdrv -v
> > nSIM, Version: 2022.06 (Build: 006_FREE)
> 
> First of all, 2022.06 is quite old and for good ARCv3 support you'd rather
> switch to a newer version. Here https://www.synopsys.com/cgi-bin/dwarcnsim/req1.cgi
> we have 2023.06.
> 
> Please get that later version, give it a try and let me know - if problems still
> happen - we'll take a look at it.

I now checked with 2023.06 and the network does not come up here,
too.

best regards
 Waldemar
diff mbox series

Patch

diff --git a/board/synopsys/nsim/hs5x.props b/board/synopsys/nsim/hs5x.props
new file mode 100644
index 0000000000..1d8974650e
--- /dev/null
+++ b/board/synopsys/nsim/hs5x.props
@@ -0,0 +1,30 @@ 
+nsim_isa_family=av3hs
+nsim_isa_dc_hw_prefetch=1
+nsim_isa_dual_issue_option=1
+nsim_isa_atomic_option=2
+nsim_isa_m128_option=0
+nsim_isa_ll64_option=1
+nsim_isa_mpy_option=9
+nsim_isa_div_rem_option=2
+nsim_isa_enable_timer_0=1
+nsim_isa_enable_timer_1=1
+nsim_isa_rtc_option=1
+icache=16384,64,4
+dcache=16384,64,2
+mmu_version=16
+mmu_pagesize=4096
+mmu_address_space=32
+nsim_mem-dev=uart0,kind=dwuart,base=0xf0000000,irq=24
+nsim_isa_number_of_interrupts=32
+nsim_isa_number_of_external_interrupts=32
+nsim_isa_has_fp=1
+nsim_isa_fp_dds_option=1
+nsim_isa_fp_div_option=1
+nsim_isa_fp_dp_option=1
+nsim_isa_fp_hp_option=1
+nsim_isa_fp_vec_option=1
+nsim_isa_fp_wide_option=1
+nsim_isa_mpy64=1
+nsim_isa_div64_option=1
+nsim_isa_dsp_option=3
+nsim_isa_dsp_wide_option=1
diff --git a/board/synopsys/nsim/hs6x.props b/board/synopsys/nsim/hs6x.props
new file mode 100644
index 0000000000..e26cec0a64
--- /dev/null
+++ b/board/synopsys/nsim/hs6x.props
@@ -0,0 +1,30 @@ 
+nsim_fast=0
+nsim_isa_dual_issue_option=1
+nsim_isa_has_hw_pf=1
+nsim_isa_m128_option=1
+nsim_isa_has_hw_pf=1
+nsim_isa_vec64=1
+nsim_isa_family=arc64
+nsim_isa_enable_timer_0=1
+nsim_isa_enable_timer_1=1
+nsim_isa_rtc_option=1
+nsim_isa_addr_size=64
+nsim_isa_pc_size=64
+icache=16384,64,4,o
+dcache=16384,64,4,o
+mmu_version=16
+mmu_pagesize=4096
+mmu_address_space=48
+nsim_mem-dev=uart0,kind=dwuart,base=0xf0000000,irq=24
+nsim_isa_mpy_option=9
+nsim_isa_mpy64=1
+nsim_isa_div64_option=1
+nsim_isa_div_rem_option=2
+nsim_isa_atomic_option=2
+nsim_isa_has_fp=1
+nsim_isa_fp_dds_option=1
+nsim_isa_fp_div_option=1
+nsim_isa_fp_dp_option=1
+nsim_isa_fp_hp_option=1
+nsim_isa_fp_vec_option=1
+nsim_isa_fp_wide_option=1
diff --git a/board/synopsys/nsim/post-image-arcv3.sh b/board/synopsys/nsim/post-image-arcv3.sh
new file mode 100755
index 0000000000..dd5a634661
--- /dev/null
+++ b/board/synopsys/nsim/post-image-arcv3.sh
@@ -0,0 +1,4 @@ 
+#!/bin/sh
+
+# Install vmlinux with debug symbols
+install -m 0644 ${2}/vmlinux ${1}/
diff --git a/board/synopsys/nsim/readme.txt b/board/synopsys/nsim/readme.txt
index cc89cf87ac..e43a70038f 100644
--- a/board/synopsys/nsim/readme.txt
+++ b/board/synopsys/nsim/readme.txt
@@ -41,3 +41,19 @@  $ nsimdrv \
 	-prop=nsim_isa_pct_counters=8 \
 	-prop=nsim_isa_pct_size=48 \
 	output/images/vmlinux
+
+Build & run image on ARC HS58:
+ * Build:       make snps_arc32_defconfig && make
+ * Run in nSIM: nsimdrv -propsfile=board/synopsys/nsim/hs5x.props output/images/loader
+ * Run in QEMU: qemu-system-arc -M virt,ram_start=0 -cpu hs5x -m 2G -display none \
+                        -nographic -monitor none -kernel output/images/loader \
+                        -netdev user,id=net0 -device virtio-net-device,netdev=net0 \
+                        -device virtio-rng-pci
+
+Build & run image on ARC HS58:
+ * Build:       make snps_arc64_defconfig && make
+ * Run in nSIM: nsimdrv -propsfile=board/synopsys/nsim/hs6x.props output/images/loader
+ * Run in QEMU: qemu-system-arc64 -M virt,ram_start=0 -cpu hs6x -m 2G -display none \
+                        -nographic -monitor none -kernel output/images/loader \
+                        -netdev user,id=net0 -device virtio-net-device,netdev=net0 \
+                        -device virtio-rng-pci
diff --git a/configs/snps_arc32_defconfig b/configs/snps_arc32_defconfig
new file mode 100644
index 0000000000..e94b0fdfeb
--- /dev/null
+++ b/configs/snps_arc32_defconfig
@@ -0,0 +1,29 @@ 
+#Architecture
+BR2_arcle=y
+BR2_arc32=y
+
+# System
+BR2_SYSTEM_DHCP="eth0"
+BR2_TARGET_GENERIC_GETTY=y
+
+# Filesystem
+BR2_TARGET_ROOTFS_INITRAMFS=y
+
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/synopsys/nsim/post-image-arcv3.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(LINUX_DIR)"
+
+# Toolchain
+BR2_TOOLCHAIN_BUILDROOT_UCLIBC=y
+
+# Linux headers same as kernel
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_16=y
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/foss-for-synopsys-dwc-arc-processors/linux.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="f6e9dab9d1dc1e8fa2acb75504bf5ff86b885b8e"
+BR2_LINUX_KERNEL_DEFCONFIG="haps_hs5x"
+BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y
+BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="loader"
diff --git a/configs/snps_arc64_defconfig b/configs/snps_arc64_defconfig
new file mode 100644
index 0000000000..7275b233eb
--- /dev/null
+++ b/configs/snps_arc64_defconfig
@@ -0,0 +1,26 @@ 
+#Architecture
+BR2_arcle=y
+BR2_arc64=y
+
+# System
+BR2_SYSTEM_DHCP="eth0"
+BR2_TARGET_GENERIC_GETTY=y
+
+# Filesystem
+BR2_TARGET_ROOTFS_INITRAMFS=y
+
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/synopsys/nsim/post-image-arcv3.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(LINUX_DIR)"
+
+# Linux headers same as kernel
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_16=y
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/foss-for-synopsys-dwc-arc-processors/linux.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="f6e9dab9d1dc1e8fa2acb75504bf5ff86b885b8e"
+BR2_LINUX_KERNEL_DEFCONFIG="haps_arc64"
+BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y
+BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="loader"