mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 7/7] RISC-V: qemu-virt: add overlay for environment and state
Date: Thu, 25 Nov 2021 17:10:42 +0100	[thread overview]
Message-ID: <20211125161042.3829996-8-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20211125161042.3829996-1-a.fatoum@pengutronix.de>

Like we do on ARM, let's add state and environment to RISC-V QEMU Virt
as well.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/riscv/Kconfig.socs                      | 10 ++++++++++
 arch/riscv/configs/virt32_defconfig          |  4 ++++
 arch/riscv/configs/virt64_defconfig          |  4 ++++
 common/boards/qemu-virt/Makefile             |  3 +++
 common/boards/qemu-virt/board.c              |  1 +
 common/boards/qemu-virt/overlay-of-flash.dts |  5 +++++
 6 files changed, 27 insertions(+)

diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs
index b12c795041b0..9f2a4f825ebb 100644
--- a/arch/riscv/Kconfig.socs
+++ b/arch/riscv/Kconfig.socs
@@ -23,6 +23,16 @@ config SOC_VIRT
 	  Generates an image tht can be be booted by QEMU. The image is called
 	  barebox-dt-2nd.img
 
+config BOARD_RISCV_VIRT
+	depends on SOC_VIRT
+	bool "QEMU Virt Machine"
+	select OF_OVERLAY
+	select BOARD_QEMU_VIRT
+	default y
+	help
+	  Enables environment and state on top of QEMU RISC-V Virt machine
+	  cfi-flash.
+
 config BOARD_RISCVEMU
 	depends on SOC_VIRT
 	bool "TinyEMU Virt Machine (riscvemu)"
diff --git a/arch/riscv/configs/virt32_defconfig b/arch/riscv/configs/virt32_defconfig
index 6a8443d6d565..1d7b70fc0fbc 100644
--- a/arch/riscv/configs/virt32_defconfig
+++ b/arch/riscv/configs/virt32_defconfig
@@ -69,11 +69,14 @@ CONFIG_CMD_OF_FIXUP_STATUS=y
 CONFIG_CMD_OF_OVERLAY=y
 CONFIG_CMD_OFTREE=y
 CONFIG_CMD_TIME=y
+CONFIG_CMD_STATE=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_NET=y
 CONFIG_NET_NFS=y
 CONFIG_NET_NETCONSOLE=y
 CONFIG_NET_FASTBOOT=y
+CONFIG_OF_BAREBOX_DRIVERS=y
+CONFIG_OF_BAREBOX_ENV_IN_FS=y
 CONFIG_DRIVER_SERIAL_NS16550=y
 CONFIG_VIRTIO_CONSOLE=y
 CONFIG_DRIVER_NET_VIRTIO=y
@@ -94,6 +97,7 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_DRIVER_VIDEO_BOCHS_PCI=y
 CONFIG_DRIVER_VIDEO_SIMPLEFB_CLIENT=y
 CONFIG_CLOCKSOURCE_DUMMY_RATE=60000
+CONFIG_STATE_DRV=y
 CONFIG_EEPROM_AT24=y
 CONFIG_HWRNG=y
 CONFIG_HW_RANDOM_VIRTIO=y
diff --git a/arch/riscv/configs/virt64_defconfig b/arch/riscv/configs/virt64_defconfig
index 604292d4f4fd..8c66e3e574ff 100644
--- a/arch/riscv/configs/virt64_defconfig
+++ b/arch/riscv/configs/virt64_defconfig
@@ -70,11 +70,14 @@ CONFIG_CMD_OF_FIXUP_STATUS=y
 CONFIG_CMD_OF_OVERLAY=y
 CONFIG_CMD_OFTREE=y
 CONFIG_CMD_TIME=y
+CONFIG_CMD_STATE=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_NET=y
 CONFIG_NET_NFS=y
 CONFIG_NET_NETCONSOLE=y
 CONFIG_NET_FASTBOOT=y
+CONFIG_OF_BAREBOX_DRIVERS=y
+CONFIG_OF_BAREBOX_ENV_IN_FS=y
 CONFIG_DRIVER_SERIAL_NS16550=y
 CONFIG_VIRTIO_CONSOLE=y
 CONFIG_DRIVER_NET_VIRTIO=y
@@ -95,6 +98,7 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_DRIVER_VIDEO_BOCHS_PCI=y
 CONFIG_DRIVER_VIDEO_SIMPLEFB_CLIENT=y
 CONFIG_CLOCKSOURCE_DUMMY_RATE=60000
+CONFIG_STATE_DRV=y
 CONFIG_EEPROM_AT24=y
 CONFIG_HWRNG=y
 CONFIG_HW_RANDOM_VIRTIO=y
diff --git a/common/boards/qemu-virt/Makefile b/common/boards/qemu-virt/Makefile
index f10d39138578..88184e9a7969 100644
--- a/common/boards/qemu-virt/Makefile
+++ b/common/boards/qemu-virt/Makefile
@@ -2,3 +2,6 @@
 
 obj-y += board.o
 obj-y += overlay-of-flash.dtb.o
+ifeq ($(CONFIG_RISCV),y)
+DTC_CPP_FLAGS_overlay-of-flash.dtb := -DRISCV_VIRT=1
+endif
diff --git a/common/boards/qemu-virt/board.c b/common/boards/qemu-virt/board.c
index f10608e30343..4064409c80d3 100644
--- a/common/boards/qemu-virt/board.c
+++ b/common/boards/qemu-virt/board.c
@@ -54,6 +54,7 @@ static int virt_probe(struct device_d *dev)
 
 static const struct of_device_id virt_of_match[] = {
 	{ .compatible = "linux,dummy-virt", .data = arm_virt_init },
+	{ .compatible = "riscv-virtio" },
 	{ /* Sentinel */},
 };
 BAREBOX_DEEP_PROBE_ENABLE(virt_of_match);
diff --git a/common/boards/qemu-virt/overlay-of-flash.dts b/common/boards/qemu-virt/overlay-of-flash.dts
index ed6ad0072b55..a271a455105f 100644
--- a/common/boards/qemu-virt/overlay-of-flash.dts
+++ b/common/boards/qemu-virt/overlay-of-flash.dts
@@ -1,8 +1,13 @@
 /dts-v1/;
 /plugin/;
 
+#ifdef RISCV_VIRT
+#define PARTS_TARGET_PATH	"/soc/flash@20000000"
+#define ENV_DEVICE_PATH		"/soc/flash@20000000/partitions/partition@3c00000"
+#else
 #define PARTS_TARGET_PATH	"/flash@0"
 #define ENV_DEVICE_PATH		"/flash@0/partitions/partition@3c00000"
+#endif
 
 / {
 	fragment@0 {
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2021-11-25 16:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-25 16:10 [PATCH 0/7] ARM/RISC-V: qemu-virt: share common cleaned up state/env support Ahmad Fatoum
2021-11-25 16:10 ` [PATCH 1/7] state: mark state init errors specially Ahmad Fatoum
2021-11-25 16:10 ` [PATCH 2/7] state: make first boot less verbose Ahmad Fatoum
2021-11-30 10:47   ` Sascha Hauer
2021-11-30 13:52     ` Ahmad Fatoum
2021-11-25 16:10 ` [PATCH 3/7] of: overlay: rescan aliases calling of_overlay_apply_tree on live tree Ahmad Fatoum
2021-11-25 16:10 ` [PATCH 4/7] ARM: qemu: enable deep probe support Ahmad Fatoum
2021-11-25 16:10 ` [PATCH 5/7] ARM: qemu: move board code to central location Ahmad Fatoum
2021-11-25 16:10 ` [PATCH 6/7] common: boards: qemu-virt: genericize to support non-ARM architectures Ahmad Fatoum
2021-11-25 16:10 ` Ahmad Fatoum [this message]
2021-12-07 14:04 ` [PATCH 0/7] ARM/RISC-V: qemu-virt: share common cleaned up state/env support Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211125161042.3829996-8-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --subject='Re: [PATCH 7/7] RISC-V: qemu-virt: add overlay for environment and state' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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