Update VirtIO PCI patches

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
This commit is contained in:
David Abdurachmanov 2019-07-04 15:10:52 +03:00
parent 2602a671e9
commit a29ada2896
Signed by: davidlt
GPG Key ID: 8B7F1DA0E2C9FDBB
4 changed files with 68 additions and 28 deletions

View File

@ -0,0 +1,29 @@
From e2d6896096bf15b7510da5c4a24966560d85c86c Mon Sep 17 00:00:00 2001
From: David Abdurachmanov <david.abdurachmanov@sifive.com>
Date: Thu, 4 Jul 2019 14:49:19 +0300
Subject: [PATCH 1/2] qemu-riscv: enable VIRTIO_PCI
libvirt v5.3.0 with QEMU 4.0.0 or newer uses PCI automatically and
thus devices (network, storage, etc) are connected via PCI.
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---
board/emulation/qemu-riscv/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig
index 7f9a74dd48..6cc7c31dc6 100644
--- a/board/emulation/qemu-riscv/Kconfig
+++ b/board/emulation/qemu-riscv/Kconfig
@@ -24,6 +24,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
imply VIRTIO_MMIO
imply VIRTIO_NET
imply VIRTIO_BLK
+ imply VIRTIO_PCI
imply CMD_PING
imply CMD_FS_GENERIC
imply DOS_PARTITION
--
2.21.0

View File

@ -1,8 +1,27 @@
From b78b7bc61723cd3df66cc2cc55948564eda8381e Mon Sep 17 00:00:00 2001
From: David Abdurachmanov <david.abdurachmanov@sifive.com>
Date: Thu, 4 Jul 2019 15:04:28 +0300
Subject: [PATCH 2/2] distro_bootcmd: refactor virtio to support PCI block
devices
libvirt v5.3.0 with QEMU 4.0.0 use PCI automatically and thus storage
is connected via PCI, which is not visible to U-Boot automatically.
Refactor to do "pci enum" followed by "virtio scan" to see PCI
connected storage.
Tested with Fedora/RISCV using the latest releases: libvirt 5.4.0,
QEMU 4.0.0 and U-Boot 2019.07 RC4.
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
---
include/config_distro_bootcmd.h | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 8f4c70e9..38f7abb9 100644
index 26e61ef196..047f7595cf 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -255,11 +255,11 @@
@@ -254,11 +254,11 @@
#endif
#if defined(CONFIG_DM_PCI)
@ -17,11 +36,12 @@ index 8f4c70e9..38f7abb9 100644
#define BOOTENV_SHARED_PCI
#endif
@@ -282,10 +282,24 @@
@@ -281,7 +281,25 @@
#endif
#ifdef CONFIG_CMD_VIRTIO
-#define BOOTENV_SHARED_VIRTIO BOOTENV_SHARED_BLKDEV(virtio)
+#ifdef CONFIG_DM_PCI
+#define BOOTENV_RUN_VIRTIO_INIT "run virtio_init; "
+#define BOOTENV_SET_VIRTIO_NEED_INIT "virtio_need_init=; "
+#define BOOTENV_SHARED_VIRTIO \
@ -35,15 +55,15 @@ index 8f4c70e9..38f7abb9 100644
+ BOOTENV_RUN_PCI_ENUM \
+ BOOTENV_RUN_VIRTIO_INIT \
+ BOOTENV_SHARED_BLKDEV_BODY(virtio)
+#else
+#define BOOTENV_RUN_VIRTIO_INIT
+#define BOOTENV_SET_VIRTIO_NEED_INIT
+#define BOOTENV_SHARED_VIRTIO BOOTENV_SHARED_BLKDEV(virtio)
+#endif
#define BOOTENV_DEV_VIRTIO BOOTENV_DEV_BLKDEV
#define BOOTENV_DEV_NAME_VIRTIO BOOTENV_DEV_NAME_BLKDEV
#else
+#define BOOTENV_RUN_VIRTIO_INIT
+#define BOOTENV_SET_VIRTIO_NEED_INIT
#define BOOTENV_SHARED_VIRTIO
#define BOOTENV_DEV_VIRTIO \
BOOT_TARGET_DEVICES_references_VIRTIO_without_CONFIG_CMD_VIRTIO
@@ -351,7 +365,7 @@
@@ -350,7 +368,7 @@
#define BOOTENV_DEV_DHCP(devtypeu, devtypel, instance) \
"bootcmd_dhcp=" \
BOOTENV_RUN_NET_USB_START \
@ -52,7 +72,7 @@ index 8f4c70e9..38f7abb9 100644
"if dhcp ${scriptaddr} ${boot_script_dhcp}; then " \
"source ${scriptaddr}; " \
"fi;" \
@@ -370,7 +384,7 @@
@@ -369,7 +387,7 @@
#define BOOTENV_DEV_PXE(devtypeu, devtypel, instance) \
"bootcmd_pxe=" \
BOOTENV_RUN_NET_USB_START \
@ -61,11 +81,14 @@ index 8f4c70e9..38f7abb9 100644
"dhcp; " \
"if pxe get; then " \
"pxe boot; " \
@@ -465,6 +479,7 @@
\
@@ -465,6 +483,7 @@
"distro_bootcmd=" BOOTENV_SET_SCSI_NEED_INIT \
BOOTENV_SET_NVME_NEED_INIT \
BOOTENV_SET_IDE_NEED_INIT \
+ BOOTENV_SET_VIRTIO_NEED_INIT \
"for target in ${boot_targets}; do " \
"run bootcmd_${target}; " \
"done\0"
--
2.21.0

View File

@ -1,12 +0,0 @@
diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig
index 7f9a74dd..6cc7c31d 100644
--- a/board/emulation/qemu-riscv/Kconfig
+++ b/board/emulation/qemu-riscv/Kconfig
@@ -24,6 +24,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
imply VIRTIO_MMIO
imply VIRTIO_NET
imply VIRTIO_BLK
+ imply VIRTIO_PCI
imply CMD_PING
imply CMD_FS_GENERIC
imply DOS_PARTITION

View File

@ -2,7 +2,7 @@
Name: uboot-tools
Version: 2019.07
Release: 0.2%{?candidate:.%{candidate}}.0.riscv64%{?dist}
Release: 0.2%{?candidate:.%{candidate}}.1.riscv64%{?dist}
Summary: U-Boot utilities
License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+
URL: http://www.denx.de/wiki/U-Boot
@ -29,8 +29,8 @@ Patch8: ARM-tegra-Add-NVIDIA-Jetson-Nano.patch
Patch9: arm-tegra-defaine-fdtfile-for-all-devices.patch
Patch10: 0001-configs-tinker-rk3288-disable-CONFIG_SPL_I2C_SUPPORT.patch
Patch20: u-boot-2019.07-rc4-riscv-imply-VIRTIO_PCI.patch
Patch21: u-boot-2019.07-rc4-fix-virtio.patch
Patch20: 0002-distro_bootcmd-refactor-virtio-to-support-PCI-block-.patch
Patch21: 0001-qemu-riscv-enable-VIRTIO_PCI.patch
BuildRequires: bc
BuildRequires: dtc
@ -292,7 +292,7 @@ cp -p board/warp7/README builds/docs/README.warp7
%endif
%changelog
* Tue Jul 2 2019 David Abdurachmanov <david.abdurachmanov@sifive.com> 2019.07-0.2-rc4.0.riscv64
* Thu Jul 4 2019 David Abdurachmanov <david.abdurachmanov@sifive.com> 2019.07-0.2-rc4.1.riscv64
- Run "virtio scan" before booting from VirtIO Block Device over PCIe transport
- Add VIRTIO_PCI for RISC-V QEMU emulation
- Add support for RISC-V (riscv64)