Re: [U-Boot] [PATCH v2 1/4] ARM: qemu-arm: Add support for AArch64

2018-01-13 Thread Jonathan Gray
On Sat, Jan 13, 2018 at 02:45:32PM +0200, Tuomas Tynkkynen wrote:
> Hi Jonathan,
> 
> On 01/13/2018 09:08 AM, Jonathan Gray wrote:
> > On Thu, Jan 11, 2018 at 04:11:23PM +0200, Tuomas Tynkkynen wrote:
> > > This adds support for '-machine virt' on AArch64. This is rather simple:
> > > we just add TARGET_QEMU_ARM_xxBIT to select a few different Kconfig
> > > symbols, provide the ARMv8 memory map from the board file and add a new
> > > defconfig based on the 32-bit defconfig.
> > 
> > While nvme is in the defconfig it seems only ahci works with
> > distroboot automatically.
> > 
> > Booting off nvme requires manually running
> > 
> > => nvme scan
> > => setenv devtype nvme
> > => run scan_dev_for_boot_part
> > 
> > Having it work automatically requires something like the below
> > 
> 
> Yeah. You should probably send that as a formal patch (or two I guess;
> one for config_distro_bootcmd.h; one for qemu-arm.h).
> 
> FWIW, I have a mostly-working virtio stack for U-Boot which probably
> would be the best disk interface for booting Linux. Still needs a
> lot of cleanup, hopefully one day it will be ready...

That would be great.  I'm interested in running OpenBSD not Linux and
ahci cant't map the interrupt with qemu (does on pci ecam + ahci on an
overdrive 1000), and nvme turns out to hang when mounting the root
filesystem.

Would be nice to be able to replace using edk2 ovmf for booting off
virtio storage.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/4] ARM: qemu-arm: Add support for AArch64

2018-01-13 Thread Tuomas Tynkkynen

Hi Jonathan,

On 01/13/2018 09:08 AM, Jonathan Gray wrote:

On Thu, Jan 11, 2018 at 04:11:23PM +0200, Tuomas Tynkkynen wrote:

This adds support for '-machine virt' on AArch64. This is rather simple:
we just add TARGET_QEMU_ARM_xxBIT to select a few different Kconfig
symbols, provide the ARMv8 memory map from the board file and add a new
defconfig based on the 32-bit defconfig.


While nvme is in the defconfig it seems only ahci works with
distroboot automatically.

Booting off nvme requires manually running

=> nvme scan
=> setenv devtype nvme
=> run scan_dev_for_boot_part

Having it work automatically requires something like the below



Yeah. You should probably send that as a formal patch (or two I guess;
one for config_distro_bootcmd.h; one for qemu-arm.h).

FWIW, I have a mostly-working virtio stack for U-Boot which probably
would be the best disk interface for booting Linux. Still needs a
lot of cleanup, hopefully one day it will be ready...
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/4] ARM: qemu-arm: Add support for AArch64

2018-01-12 Thread Jonathan Gray
On Thu, Jan 11, 2018 at 04:11:23PM +0200, Tuomas Tynkkynen wrote:
> This adds support for '-machine virt' on AArch64. This is rather simple:
> we just add TARGET_QEMU_ARM_xxBIT to select a few different Kconfig
> symbols, provide the ARMv8 memory map from the board file and add a new
> defconfig based on the 32-bit defconfig.

While nvme is in the defconfig it seems only ahci works with
distroboot automatically.

Booting off nvme requires manually running

=> nvme scan
=> setenv devtype nvme
=> run scan_dev_for_boot_part

Having it work automatically requires something like the below

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 5c469a23fa..305e102cb8 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -195,6 +195,31 @@
BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_SCSI
 #endif
 
+#ifdef CONFIG_NVME
+#define BOOTENV_RUN_NVME_INIT "run nvme_init; "
+#define BOOTENV_SET_NVME_NEED_INIT "setenv nvme_need_init; "
+#define BOOTENV_SHARED_NVME \
+   "nvme_init=" \
+   "if ${nvme_need_init}; then " \
+   "setenv nvme_need_init false; " \
+   "nvme scan; " \
+   "fi\0" \
+   \
+   "nvme_boot=" \
+   BOOTENV_RUN_NVME_INIT \
+   BOOTENV_SHARED_BLKDEV_BODY(nvme)
+#define BOOTENV_DEV_NVME   BOOTENV_DEV_BLKDEV
+#define BOOTENV_DEV_NAME_NVME  BOOTENV_DEV_NAME_BLKDEV
+#else
+#define BOOTENV_RUN_NVME_INIT
+#define BOOTENV_SET_NVME_NEED_INIT
+#define BOOTENV_SHARED_NVME
+#define BOOTENV_DEV_NVME \
+   BOOT_TARGET_DEVICES_references_NVME_without_CONFIG_NVME
+#define BOOTENV_DEV_NAME_NVME \
+   BOOT_TARGET_DEVICES_references_NVME_without_CONFIG_NVME
+#endif
+
 #ifdef CONFIG_IDE
 #define BOOTENV_SHARED_IDE BOOTENV_SHARED_BLKDEV(ide)
 #define BOOTENV_DEV_IDEBOOTENV_DEV_BLKDEV
@@ -324,6 +349,7 @@
 #define BOOTENV \
BOOTENV_SHARED_HOST \
BOOTENV_SHARED_MMC \
+   BOOTENV_SHARED_NVME \
BOOTENV_SHARED_PCI \
BOOTENV_SHARED_USB \
BOOTENV_SHARED_SATA \
@@ -390,6 +416,7 @@
BOOT_TARGET_DEVICES(BOOTENV_DEV)  \
\
"distro_bootcmd=" BOOTENV_SET_SCSI_NEED_INIT  \
+   BOOTENV_SET_NVME_NEED_INIT\
"for target in ${boot_targets}; do "  \
"run bootcmd_${target}; " \
"done\0"
diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h
index c8852cef34..8c65babb77 100644
--- a/include/configs/qemu-arm.h
+++ b/include/configs/qemu-arm.h
@@ -38,7 +38,8 @@
 #include 
 
 #define BOOT_TARGET_DEVICES(func) \
-   func(SCSI, scsi, 0)
+   func(SCSI, scsi, 0) \
+   func(NVME, nvme, 0)
 
 #include 
 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 1/4] ARM: qemu-arm: Add support for AArch64

2018-01-11 Thread Tuomas Tynkkynen
This adds support for '-machine virt' on AArch64. This is rather simple:
we just add TARGET_QEMU_ARM_xxBIT to select a few different Kconfig
symbols, provide the ARMv8 memory map from the board file and add a new
defconfig based on the 32-bit defconfig.

Signed-off-by: Tuomas Tynkkynen 
Reviewed-by: Tom Rini 
---
v2: No change (except added Reviewed-by)
---
 arch/arm/Kconfig   |  2 --
 arch/arm/mach-qemu/Kconfig | 11 +++
 board/emulation/qemu-arm/MAINTAINERS   |  1 +
 board/emulation/qemu-arm/qemu-arm.c| 35 ++
 .../{qemu_arm_defconfig => qemu_arm64_defconfig}   |  1 +
 configs/qemu_arm_defconfig |  1 +
 6 files changed, 49 insertions(+), 2 deletions(-)
 copy configs/{qemu_arm_defconfig => qemu_arm64_defconfig} (94%)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f2c35e32c6..ee27f07285 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -642,8 +642,6 @@ config ARCH_MX5
 
 config ARCH_QEMU
bool "QEMU Virtual Platform"
-   select CPU_V7
-   select ARCH_SUPPORT_PSCI
select DM
select DM_SERIAL
select OF_CONTROL
diff --git a/arch/arm/mach-qemu/Kconfig b/arch/arm/mach-qemu/Kconfig
index 3500b56cb0..133163aecf 100644
--- a/arch/arm/mach-qemu/Kconfig
+++ b/arch/arm/mach-qemu/Kconfig
@@ -10,3 +10,14 @@ config SYS_CONFIG_NAME
default "qemu-arm"
 
 endif
+
+config TARGET_QEMU_ARM_32BIT
+   bool "Support qemu_arm"
+   depends on ARCH_QEMU
+   select CPU_V7
+   select ARCH_SUPPORT_PSCI
+
+config TARGET_QEMU_ARM_64BIT
+   bool "Support qemu_arm64"
+   depends on ARCH_QEMU
+   select ARM64
diff --git a/board/emulation/qemu-arm/MAINTAINERS 
b/board/emulation/qemu-arm/MAINTAINERS
index a803061ff4..e757ffc64f 100644
--- a/board/emulation/qemu-arm/MAINTAINERS
+++ b/board/emulation/qemu-arm/MAINTAINERS
@@ -4,3 +4,4 @@ S:  Maintained
 F: board/emulation/qemu-arm/
 F: include/configs/qemu-arm.h
 F: configs/qemu_arm_defconfig
+F: configs/qemu_arm64_defconfig
diff --git a/board/emulation/qemu-arm/qemu-arm.c 
b/board/emulation/qemu-arm/qemu-arm.c
index e29ba4630f..1bc7edcfb7 100644
--- a/board/emulation/qemu-arm/qemu-arm.c
+++ b/board/emulation/qemu-arm/qemu-arm.c
@@ -6,6 +6,41 @@
 #include 
 #include 
 
+#ifdef CONFIG_ARM64
+#include 
+
+static struct mm_region qemu_arm64_mem_map[] = {
+   {
+   /* Flash */
+   .virt = 0xUL,
+   .phys = 0xUL,
+   .size = 0x0800UL,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+PTE_BLOCK_INNER_SHARE
+   }, {
+   /* Peripherals */
+   .virt = 0x0800UL,
+   .phys = 0x0800UL,
+   .size = 0x3800,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+PTE_BLOCK_NON_SHARE |
+PTE_BLOCK_PXN | PTE_BLOCK_UXN
+   }, {
+   /* RAM */
+   .virt = 0x4000UL,
+   .phys = 0x4000UL,
+   .size = 0xc000UL,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+PTE_BLOCK_INNER_SHARE
+   }, {
+   /* List terminator */
+   0,
+   }
+};
+
+struct mm_region *mem_map = qemu_arm64_mem_map;
+#endif
+
 int board_init(void)
 {
return 0;
diff --git a/configs/qemu_arm_defconfig b/configs/qemu_arm64_defconfig
similarity index 94%
copy from configs/qemu_arm_defconfig
copy to configs/qemu_arm64_defconfig
index 3cd4d45433..4309bd25eb 100644
--- a/configs/qemu_arm_defconfig
+++ b/configs/qemu_arm64_defconfig
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARM_SMCCC=y
 CONFIG_ARCH_QEMU=y
+CONFIG_TARGET_QEMU_ARM_64BIT=y
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_DISPLAY_CPUINFO is not set
diff --git a/configs/qemu_arm_defconfig b/configs/qemu_arm_defconfig
index 3cd4d45433..db61b12869 100644
--- a/configs/qemu_arm_defconfig
+++ b/configs/qemu_arm_defconfig
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARM_SMCCC=y
 CONFIG_ARCH_QEMU=y
+CONFIG_TARGET_QEMU_ARM_32BIT=y
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_DISPLAY_CPUINFO is not set
-- 
2.15.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot