mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 1/3] kvx: add qemu dts
@ 2024-08-13 12:44 Yann Sionneau
  2024-08-13 12:44 ` [PATCH v2 2/3] ci: container: add qemu-system-kvx Yann Sionneau
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Yann Sionneau @ 2024-08-13 12:44 UTC (permalink / raw)
  To: barebox; +Cc: jvetter, jborne, Yann Sionneau

Add qemu dts that will mostly be used to run test in CI.

Signed-off-by: Yann Sionneau <ysionneau@kalrayinc.com>
---
v1 -> v2:
  - Rewrite '/' node compatible to be more readable: split into 2 strings instead of using \0 in the middle.
  - use phandle for stdout-path
  - always compile qemu.dtb, remove option in Kconfig
  - add 'scall-poweroff' node in qemu.dts to make poweroff work in qemu

 arch/kvx/configs/generic_defconfig |   1 +
 arch/kvx/dts/Makefile              |   1 +
 arch/kvx/dts/qemu.dts              | 273 +++++++++++++++++++++++++++++
 3 files changed, 275 insertions(+)
 create mode 100644 arch/kvx/dts/qemu.dts

diff --git a/arch/kvx/configs/generic_defconfig b/arch/kvx/configs/generic_defconfig
index 0d971ff3d5..7f1235b6d2 100644
--- a/arch/kvx/configs/generic_defconfig
+++ b/arch/kvx/configs/generic_defconfig
@@ -11,3 +11,4 @@ CONFIG_CLOCKSOURCE_KVX=y
 CONFIG_WATCHDOG=y
 CONFIG_WATCHDOG_KVX=y
 CONFIG_PINCTRL_SINGLE=y
+CONFIG_BOARD_QEMU=y
diff --git a/arch/kvx/dts/Makefile b/arch/kvx/dts/Makefile
index 41613033ce..43fc2aacd3 100644
--- a/arch/kvx/dts/Makefile
+++ b/arch/kvx/dts/Makefile
@@ -10,5 +10,6 @@ obj-$(CONFIG_BUILTIN_DTB) += $(BUILTIN_DTB).dtb.o
 endif
 
 obj-$(CONFIG_BOARD_K200) += k200.dtb.o
+extra-y += qemu.dtb.o
 
 clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts *.dtb.z
diff --git a/arch/kvx/dts/qemu.dts b/arch/kvx/dts/qemu.dts
new file mode 100644
index 0000000000..f1ec8370c5
--- /dev/null
+++ b/arch/kvx/dts/qemu.dts
@@ -0,0 +1,273 @@
+/dts-v1/;
+
+/ {
+	model = "Kalray Coolidge processor (QEMU)";
+	#address-cells = <0x02>;
+	#size-cells = <0x02>;
+	compatible = "kalray,coolidge","kalray,iss";
+
+	chosen {
+		stdout-path = &uart0;
+	};
+
+	memory@0 {
+		reg = <0x00 0x00 0x00 0x400000>;
+		device_type = "memory";
+	};
+
+	apic_mailbox: apic-mailbox@a00000 {
+		msi-controller;
+		interrupts = <0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4a 0x4b 0x4c 0x4d 0x4e 0x4f 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5a 0x5b 0x5c 0x5d 0x5e 0x5f 0x60 0x61 0x62 0x63 0x64 0x65 0x66 0x67 0x68 0x69 0x6a 0x6b 0x6c 0x6d 0x6e 0x6f 0x70 0x71 0x72 0x73 0x74 0x75 0x76 0x77 0x78>;
+		interrupt-parent = <&apic_gic>;
+		#interrupt-cells = <0x00>;
+		interrupt-controller;
+		reg = <0x00 0xa00000 0x00 0x10000>;
+		compatible = "kalray,kvx-apic-mailbox";
+	};
+
+	apic_gic: apic-gic@a20000 {
+		interrupts = <0x04 0x05 0x06 0x07>;
+		interrupt-parent = <&core_intc>;
+		#interrupt-cells = <0x01>;
+		interrupt-controller;
+		reg = <0x00 0xa20000 0x00 0x12000>;
+		compatible = "kalray,kvx-apic-gic";
+	};
+
+	pwr_ctrl: pwr-ctrl@a40000 {
+		reg = <0x00 0xa40000 0x00 0x4188>;
+		compatible = "kalray,kvx-pwr-ctrl";
+	};
+
+	dsu-clock@a44180 {
+		clocks = <&core_clk>;
+		reg = <0x00 0xa44180 0x00 0x08>;
+		compatible = "kalray,kvx-dsu-clock";
+	};
+
+	ipi-ctrl@ad0000 {
+		interrupts = <0x18>;
+		interrupt-parent = <&core_intc>;
+		reg = <0x00 0xad0000 0x00 0x1000>;
+		compatible = "kalray,kvx-ipi-ctrl";
+	};
+
+	scall-poweroff {
+		compatible = "kalray,kvx-scall-poweroff";
+	};
+
+	axi {
+		ranges;
+		#address-cells = <0x02>;
+		#size-cells = <0x02>;
+		compatible = "simple-bus";
+
+		uart0: uart0@20210000 {
+			reg-shift = <0x02>;
+			reg-io-width = <0x04>;
+			clocks = <&ref_clk>;
+			interrupts = <0x29 0x04>;
+			interrupt-parent = <&itgen_socp_0>;
+			reg = <0x00 0x20210000 0x00 0x100>;
+			compatible = "snps,dw-apb-uart";
+		};
+
+		uart1@20211000 {
+			reg-shift = <0x02>;
+			reg-io-width = <0x04>;
+			clocks = <&ref_clk>;
+			interrupts = <0x2a 0x04>;
+			interrupt-parent = <&itgen_socp_0>;
+			reg = <0x00 0x20211000 0x00 0x100>;
+			compatible = "snps,dw-apb-uart";
+		};
+
+		uart2@20212000 {
+			reg-shift = <0x02>;
+			reg-io-width = <0x04>;
+			clocks = <&ref_clk>;
+			interrupts = <0x2b 0x04>;
+			interrupt-parent = <&itgen_socp_0>;
+			reg = <0x00 0x20212000 0x00 0x100>;
+			compatible = "snps,dw-apb-uart";
+		};
+
+		uart3@20213000 {
+			reg-shift = <0x02>;
+			reg-io-width = <0x04>;
+			clocks = <&ref_clk>;
+			interrupts = <0x2c 0x04>;
+			interrupt-parent = <&itgen_socp_0>;
+			reg = <0x00 0x20213000 0x00 0x100>;
+			compatible = "snps,dw-apb-uart";
+		};
+
+		uart4@20214000 {
+			reg-shift = <0x02>;
+			reg-io-width = <0x04>;
+			clocks = <&ref_clk>;
+			interrupts = <0x2d 0x04>;
+			interrupt-parent = <&itgen_socp_0>;
+			reg = <0x00 0x20214000 0x00 0x100>;
+			compatible = "snps,dw-apb-uart";
+		};
+
+		uart5@20215000 {
+			reg-shift = <0x02>;
+			reg-io-width = <0x04>;
+			clocks = <&ref_clk>;
+			interrupts = <0x2e 0x04>;
+			interrupt-parent = <&itgen_socp_0>;
+			reg = <0x00 0x20215000 0x00 0x100>;
+			compatible = "snps,dw-apb-uart";
+		};
+
+		itgen_socp_0: itgen-soc-periph0@27000000 {
+			msi-parent = <&apic_mailbox>;
+			#interrupt-cells = <0x02>;
+			interrupt-controller;
+			reg = <0x00 0x27000000 0x00 0x1104>;
+			compatible = "kalray,kvx-itgen";
+		};
+
+		itgen_socp_1: itgen-soc-periph1@27010000 {
+			msi-parent = <&apic_mailbox>;
+			#interrupt-cells = <0x02>;
+			interrupt-controller;
+			reg = <0x00 0x27010000 0x00 0x1104>;
+			compatible = "kalray,kvx-itgen";
+		};
+	};
+
+	memory@100000000 {
+		reg = <0x01 0x00 0x00 0x80000000>;
+		device_type = "memory";
+	};
+
+	ftu@10181000 {
+		reg = <0x00 0x10181000 0x00 0x418>;
+		compatible = "kalray,kvx-syscon";
+	};
+
+	core_intc: core-intc {
+		#interrupt-cells = <0x01>;
+		interrupt-controller;
+		compatible = "kalray,kvx-core-intc";
+	};
+
+	core-timer {
+		clocks = <&core_clk>;
+		interrupts = <0x00>;
+		interrupt-parent = <&core_intc>;
+		compatible = "kalray,kvx-core-timer";
+	};
+
+	core-watchdog {
+		clocks = <&core_clk>;
+		interrupts = <0x02>;
+		interrupt-parent = <&core_intc>;
+		compatible = "kalray,kvx-core-watchdog";
+	};
+
+	clocks {
+
+		core_clk: core-clk {
+			clock-frequency = <1000000>;
+			#clock-cells = <0x00>;
+			compatible = "fixed-clock";
+		};
+
+		ref_clk: ref-clk {
+			clock-frequency = <0x5f5e100>;
+			#clock-cells = <0x00>;
+			compatible = "fixed-clock";
+		};
+	};
+
+	cpus {
+		#address-cells = <0x01>;
+		#size-cells = <0x00>;
+
+		cpu@0 {
+			power-controller = <&pwr_ctrl>;
+			clocks = <&core_clk>;
+			reg = <0x00>;
+			compatible = "kalray,kvx-pe";
+		};
+
+		cpu@1 {
+			reg = <0x01>;
+			compatible = "kalray,kvx-pe";
+		};
+
+		cpu@2 {
+			reg = <0x02>;
+			compatible = "kalray,kvx-pe";
+		};
+
+		cpu@3 {
+			reg = <0x03>;
+			compatible = "kalray,kvx-pe";
+		};
+
+		cpu@4 {
+			reg = <0x04>;
+			compatible = "kalray,kvx-pe";
+		};
+
+		cpu@5 {
+			reg = <0x05>;
+			compatible = "kalray,kvx-pe";
+		};
+
+		cpu@6 {
+			reg = <0x06>;
+			compatible = "kalray,kvx-pe";
+		};
+
+		cpu@7 {
+			reg = <0x07>;
+			compatible = "kalray,kvx-pe";
+		};
+
+		cpu@8 {
+			reg = <0x08>;
+			compatible = "kalray,kvx-pe";
+		};
+
+		cpu@9 {
+			reg = <0x09>;
+			compatible = "kalray,kvx-pe";
+		};
+
+		cpu@10 {
+			reg = <0x0a>;
+			compatible = "kalray,kvx-pe";
+		};
+
+		cpu@11 {
+			reg = <0x0b>;
+			compatible = "kalray,kvx-pe";
+		};
+
+		cpu@12 {
+			reg = <0x0c>;
+			compatible = "kalray,kvx-pe";
+		};
+
+		cpu@13 {
+			reg = <0x0d>;
+			compatible = "kalray,kvx-pe";
+		};
+
+		cpu@14 {
+			reg = <0x0e>;
+			compatible = "kalray,kvx-pe";
+		};
+
+		cpu@15 {
+			reg = <0x0f>;
+			compatible = "kalray,kvx-pe";
+		};
+	};
+};
-- 
2.34.1








^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 2/3] ci: container: add qemu-system-kvx
  2024-08-13 12:44 [PATCH v2 1/3] kvx: add qemu dts Yann Sionneau
@ 2024-08-13 12:44 ` Yann Sionneau
  2024-08-13 12:44 ` [PATCH v2 3/3] ci: add support for running basic tests on kvx arch Yann Sionneau
  2024-08-14  8:46 ` [PATCH v2 1/3] kvx: add qemu dts Sascha Hauer
  2 siblings, 0 replies; 5+ messages in thread
From: Yann Sionneau @ 2024-08-13 12:44 UTC (permalink / raw)
  To: barebox; +Cc: jvetter, jborne, Yann Sionneau

Add qemu-system-kvx in CI container.

This will allow to run tests in CI for kvx arch.

Signed-off-by: Yann Sionneau <ysionneau@kalrayinc.com>
---
v1 -> v2:
  - no change

 test/Containerfile | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/test/Containerfile b/test/Containerfile
index fe3e3a6186..507673bff5 100644
--- a/test/Containerfile
+++ b/test/Containerfile
@@ -14,14 +14,18 @@ RUN apt-get update && apt-get install -y \
 	bison \
 	build-essential \
 	coreutils \
+	cmake \
 	flex \
 	gawk \
 	git \
 	imagemagick \
 	libc6-i386 \
+	libfdt-dev \
 	libgit2-dev \
+	libglib2.0-dev \
 	libguestfs-tools \
 	liblz4-tool \
+	libpixman-1-dev \
 	libseccomp-dev \
 	libssl-dev \
 	libtool \
@@ -30,6 +34,7 @@ RUN apt-get update && apt-get install -y \
 	lzma-alone \
 	lzop \
 	mount \
+	ninja-build \
 	openssl \
 	pkg-config \
 	util-linux \
@@ -47,6 +52,8 @@ RUN apt-get update && apt-get install -y \
 	virtualenv \
 	sudo \
 	u-boot-tools \
+	unzip \
+	zlib1g-dev \
 	&& rm -rf /var/lib/apt/lists/*
 
 ENV GCC_VERSION=13.1.0
@@ -62,6 +69,12 @@ RUN korg_crosstool_dl() { wget -nv -O - https://mirrors.edge.kernel.org/pub/tool
 
 RUN wget "https://github.com/qemu/qemu/blob/v5.2.0/pc-bios/opensbi-riscv32-generic-fw_dynamic.bin?raw=true" -O /usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.bin
 
+# Compile qemu-system-kvx
+RUN git clone https://github.com/kalray/qemu-builder
+RUN cd qemu-builder && git submodule update --init
+RUN cd qemu-builder && make -j$(($(nproc) + 1))
+RUN cd qemu-builder && ln -s $(realpath prefix/bin/qemu-system-kvx) /usr/local/bin/
+
 # Create our user/group
 RUN useradd -m -U barebox
 RUN echo barebox ALL=NOPASSWD: ALL > /etc/sudoers.d/barebox
-- 
2.34.1








^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 3/3] ci: add support for running basic tests on kvx arch
  2024-08-13 12:44 [PATCH v2 1/3] kvx: add qemu dts Yann Sionneau
  2024-08-13 12:44 ` [PATCH v2 2/3] ci: container: add qemu-system-kvx Yann Sionneau
@ 2024-08-13 12:44 ` Yann Sionneau
  2024-08-14  8:46 ` [PATCH v2 1/3] kvx: add qemu dts Sascha Hauer
  2 siblings, 0 replies; 5+ messages in thread
From: Yann Sionneau @ 2024-08-13 12:44 UTC (permalink / raw)
  To: barebox; +Cc: jvetter, jborne, Yann Sionneau

Add support for running tests on qemu for kvx port of Barebox.

Signed-off-by: Yann Sionneau <ysionneau@kalrayinc.com>
---
v1 -> v2:
  - use `dtb` key in kvx test yaml config instead of extra_args
  - add `-semihosting` as extra qemu arg to make qemu exit properly upon executing "scall 0xfff" from poweroff driver.

 .github/workflows/test-labgrid-pytest.yml |  4 ++++
 test/kvx/qemu@generic_defconfig.yaml      | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 test/kvx/qemu@generic_defconfig.yaml

diff --git a/.github/workflows/test-labgrid-pytest.yml b/.github/workflows/test-labgrid-pytest.yml
index 2e038e371f..f4ef1b3a00 100644
--- a/.github/workflows/test-labgrid-pytest.yml
+++ b/.github/workflows/test-labgrid-pytest.yml
@@ -23,6 +23,10 @@ jobs:
             lgenv: test/arm/multi_v8_defconfig.yaml
             defconfig: multi_v8_defconfig
 
+          - ARCH: kvx
+            lgenv: test/kvx/qemu@generic_defconfig.yaml
+            defconfig: generic_defconfig
+
           - ARCH: mips
             lgenv: test/mips/qemu-malta_defconfig.yaml
             defconfig: qemu-malta_defconfig
diff --git a/test/kvx/qemu@generic_defconfig.yaml b/test/kvx/qemu@generic_defconfig.yaml
new file mode 100644
index 0000000000..97f5d8689a
--- /dev/null
+++ b/test/kvx/qemu@generic_defconfig.yaml
@@ -0,0 +1,20 @@
+targets:
+  main:
+    drivers:
+      QEMUDriver:
+        qemu_bin: qemu-system-kvx
+        machine: mppa-coolidge
+        cpu: kv3-1
+        memory: 2G
+        kernel: barebox
+        extra_args: '-semihosting'
+        dtb: qemu.dtb
+      BareboxDriver:
+        prompt: 'barebox:/ '
+        bootstring: 'commandline:'
+      BareboxTestStrategy: {}
+images:
+  barebox: !template "$LG_BUILDDIR/barebox"
+  qemu.dtb: !template "$LG_BUILDDIR/arch/kvx/dts/qemu.dtb"
+imports:
+  -  ../strategy.py
-- 
2.34.1








^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/3] kvx: add qemu dts
  2024-08-13 12:44 [PATCH v2 1/3] kvx: add qemu dts Yann Sionneau
  2024-08-13 12:44 ` [PATCH v2 2/3] ci: container: add qemu-system-kvx Yann Sionneau
  2024-08-13 12:44 ` [PATCH v2 3/3] ci: add support for running basic tests on kvx arch Yann Sionneau
@ 2024-08-14  8:46 ` Sascha Hauer
  2024-08-14 10:38   ` Sascha Hauer
  2 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2024-08-14  8:46 UTC (permalink / raw)
  To: barebox, Yann Sionneau; +Cc: jvetter, jborne


On Tue, 13 Aug 2024 14:44:06 +0200, Yann Sionneau wrote:
> Add qemu dts that will mostly be used to run test in CI.
> 
> 

Applied, thanks!

[1/3] kvx: add qemu dts
      https://git.pengutronix.de/cgit/barebox/commit/?id=b5e4def4741e (link may not be stable)
[2/3] ci: container: add qemu-system-kvx
      https://git.pengutronix.de/cgit/barebox/commit/?id=e7d4174db5f2 (link may not be stable)
[3/3] ci: add support for running basic tests on kvx arch
      https://git.pengutronix.de/cgit/barebox/commit/?id=61749d3e754c (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/3] kvx: add qemu dts
  2024-08-14  8:46 ` [PATCH v2 1/3] kvx: add qemu dts Sascha Hauer
@ 2024-08-14 10:38   ` Sascha Hauer
  0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2024-08-14 10:38 UTC (permalink / raw)
  To: barebox, Yann Sionneau; +Cc: jvetter, jborne

On Wed, Aug 14, 2024 at 10:46:17AM +0200, Sascha Hauer wrote:
> 
> On Tue, 13 Aug 2024 14:44:06 +0200, Yann Sionneau wrote:
> > Add qemu dts that will mostly be used to run test in CI.
> > 
> > 
> 
> Applied, thanks!
> 
> [1/3] kvx: add qemu dts
>       https://git.pengutronix.de/cgit/barebox/commit/?id=b5e4def4741e (link may not be stable)
> [2/3] ci: container: add qemu-system-kvx
>       https://git.pengutronix.de/cgit/barebox/commit/?id=e7d4174db5f2 (link may not be stable)
> [3/3] ci: add support for running basic tests on kvx arch
>       https://git.pengutronix.de/cgit/barebox/commit/?id=61749d3e754c (link may not be stable)

I had to revert these again because githubs response on this is:

You are running out of disk space. The runner will stop working when the machine runs out of disk space. Free space left: 0 MB

I think our possibilities are either find a way to reduce the image size
or to insert $$$ into github.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-08-14 10:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-13 12:44 [PATCH v2 1/3] kvx: add qemu dts Yann Sionneau
2024-08-13 12:44 ` [PATCH v2 2/3] ci: container: add qemu-system-kvx Yann Sionneau
2024-08-13 12:44 ` [PATCH v2 3/3] ci: add support for running basic tests on kvx arch Yann Sionneau
2024-08-14  8:46 ` [PATCH v2 1/3] kvx: add qemu dts Sascha Hauer
2024-08-14 10:38   ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox