Skip to contentSkip to conversation

x86: qemu: Add 64-bit U-Boot support

PATCH New Bin Meng 2 participants 47 messages Jan 18, 2017 – Feb 7, 2017 x86

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

cover x86: qemu: Add 64-bit U-Boot support

This brings U-Boot x86 64-bit support on QEMU target.

This series is available at u-boot-x86/qemu64-working for testing.

Bin Meng (14):
x86: qemu: Add missing DECLARE_GLOBAL_DATA_PTR in e820.c
x86: Wrap print_ch() with config option
x86: spl: Add weak arch_cpu_init_dm()
x86: Compile irq.c for 64-bit
x86: qemu: Hide arch_cpu_init() and print_cpuinfo() for U-Boot proper
x86: qemu: Fix compiler warnings for 64-bit
x86: qemu: Set up device tree for SPL
x86: qemu: Mark ucode as optional for SPL in u-boot.dtsi
tools: binman: Call correct init for Entry_u_boot_spl_with_ucode_ptr
tools: binman: Handle optional microcode case in SPL image
spl: Add a LF to the loading message
x86: qemu: Add a text base for 64-bit U-Boot
x86: qemu: Add build options for SPL
x86: qemu: Add a config for 64-bit U-Boot

 arch/x86/cpu/Makefile                           |  2 +-
 arch/x86/cpu/irq.c                              |  6 +-
 arch/x86/cpu/qemu/e820.c                        |  2 +
 arch/x86/cpu/qemu/qemu.c                        |  7 ++-
 arch/x86/cpu/x86_64/cpu.c                       |  2 +
 arch/x86/dts/emulation-u-boot.dtsi              |  6 ++
 arch/x86/dts/qemu-x86_i440fx.dts                |  4 ++
 arch/x86/dts/qemu-x86_q35.dts                   |  4 ++
 arch/x86/lib/spl.c                              |  5 ++
 board/emulation/Kconfig                         |  7 +++
 board/emulation/qemu-x86/Kconfig                |  6 +-
 board/emulation/qemu-x86/MAINTAINERS            |  7 +++
 common/spl/spl.c                                |  2 +-
 configs/qemu-x86_64_defconfig                   | 80 +++++++++++++++++++++++++
 include/configs/qemu-x86.h                      |  9 +++
 tools/binman/etype/u_boot_spl_with_ucode_ptr.py |  2 +-
 tools/binman/etype/u_boot_ucode.py              |  6 ++
 17 files changed, 146 insertions(+), 11 deletions(-)
 create mode 100644 configs/qemu-x86_64_defconfig
Signature · 1 line
2.9.2
author
#1 lore raw

PATCH 1/14 x86: qemu: Add missing DECLARE_GLOBAL_DATA_PTR in e820.c

DECLARE_GLOBAL_DATA_PTR is missing which causes 64-bit build error.

---

 arch/x86/cpu/qemu/e820.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/cpu/qemu/e820.c +2 -0
index 63853e4..c1c9b89 100644
@@ -7,6 +7,8 @@
 #include <common.h>
 #include <asm/e820.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
 {
 	entries[0].addr = 0;
Signature · 1 line
2.9.2
author
#3 lore raw

PATCH 1/14 x86: qemu: Add missing DECLARE_GLOBAL_DATA_PTR in e820.c

Quoted 10 lines · Simon Glass
Quoted 7 lines · Bin Meng

DECLARE_GLOBAL_DATA_PTR is missing which causes 64-bit build error.

---

 arch/x86/cpu/qemu/e820.c | 2 ++
 1 file changed, 2 insertions(+)

applied to u-boot-x86, thanks!

author
#4 lore raw

PATCH 2/14 x86: Wrap print_ch() with config option

In reply to Bin Meng

print_ch() should not be used if DEBUG_UART is off.

---

 arch/x86/cpu/x86_64/cpu.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/cpu/x86_64/cpu.c +2 -0
index 77cbb56..82ea456 100644
@@ -31,7 +31,9 @@ void arch_setup_gd(gd_t *new_gd)
 	 *
 	 * U-Boot SPL 2017.01
 	 */
+#if CONFIG_IS_ENABLED(DEBUG_UART)
 	printch(' ');
+#endif
 }
 
 int cpu_has_64bit(void)
Signature · 1 line
2.9.2
#5 lore raw

PATCH 2/14 x86: Wrap print_ch() with config option

Hi Bin,

Quoted 7 lines · Bin Meng

print_ch() should not be used if DEBUG_UART is off.

---

 arch/x86/cpu/x86_64/cpu.c | 2 ++
 1 file changed, 2 insertions(+)

arch/x86/cpu/x86_64/cpu.c void arch_setup_gd(gd_t *new_gd) · line 34

Quoted 10 lines
arch/x86/cpu/x86_64/cpu.c +1 -0
index 77cbb56..82ea456 100644
@@ -31,7 +31,9 @@ void arch_setup_gd(gd_t *new_gd)
         *
         * U-Boot SPL 2017.01
         */
+#if CONFIG_IS_ENABLED(DEBUG_UART)

Or just #ifdef CONFIG_DEBUF_UART ?

Quoted 8 lines
arch/x86/cpu/x86_64/cpu.c +1 -1
        printch(' ');
+#endif
 }
 
 int cpu_has_64bit(void)
--

2.9.2

Regards,
Simon

author
#6 lore raw

PATCH 2/14 x86: Wrap print_ch() with config option

Quoted 14 lines · Simon Glass

Hi Bin,

Quoted 7 lines · Bin Meng

print_ch() should not be used if DEBUG_UART is off.

---

 arch/x86/cpu/x86_64/cpu.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 1 line
Quoted 11 lines

arch/x86/cpu/x86_64/cpu.c void arch_setup_gd(gd_t *new_gd) · line 34

Quoted 9 lines
arch/x86/cpu/x86_64/cpu.c +1 -0
index 77cbb56..82ea456 100644
@@ -31,7 +31,9 @@ void arch_setup_gd(gd_t *new_gd)
         *
         * U-Boot SPL 2017.01
         */
+#if CONFIG_IS_ENABLED(DEBUG_UART)

Or just #ifdef CONFIG_DEBUF_UART ?

Fixed, and

applied to u-boot-x86, thanks!

author
#7 lore raw

PATCH 3/14 x86: spl: Add weak arch_cpu_init_dm()

In reply to Bin Meng

arch_cpu_init_dm() might not be implemented by every platform. Implement a weak version for SPL.

---

 arch/x86/lib/spl.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/x86/lib/spl.c +5 -0
index 7403d15..8c5b90f 100644
@@ -15,6 +15,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+__weak int arch_cpu_init_dm(void)
+{
+	return 0;
+}
+
 static int x86_spl_init(void)
 {
 	/*
Signature · 1 line
2.9.2
#8 lore raw

PATCH 3/14 x86: spl: Add weak arch_cpu_init_dm()

Hi Bin,

Quoted 14 lines · Bin Meng

arch_cpu_init_dm() might not be implemented by every platform. Implement a weak version for SPL.

---

 arch/x86/lib/spl.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/x86/lib/spl.c +0 -0
index 7403d15..8c5b90f 100644

arch/x86/lib/spl.c line 21

Quoted 7 lines
arch/x86/lib/spl.c +4 -0
@@ -15,6 +15,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+__weak int arch_cpu_init_dm(void)
+{
+       return 0;
+}

There is already one of these in board_f.c - do we need another?

Quoted 7 lines
arch/x86/lib/spl.c +1 -1
+
 static int x86_spl_init(void)
 {
        /*
--

2.9.2

Regards,
Simon

author
#9 lore raw

PATCH 3/14 x86: spl: Add weak arch_cpu_init_dm()

Hi Simon,

Quoted 18 lines · Simon Glass

Hi Bin,

Quoted 15 lines · Bin Meng

arch_cpu_init_dm() might not be implemented by every platform. Implement a weak version for SPL.

---

 arch/x86/lib/spl.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/x86/lib/spl.c +0 -0
index 7403d15..8c5b90f 100644
@@ -15,6 +15,11 @@
 
Quoted 9 lines

arch/x86/lib/spl.c line 21

Quoted 6 lines
arch/x86/lib/spl.c +4 -0
 DECLARE_GLOBAL_DATA_PTR;
 
+__weak int arch_cpu_init_dm(void)
+{
+       return 0;
+}

There is already one of these in board_f.c - do we need another?

board_f.c is not built for SPL.

Regards,
Bin

#10 lore raw

PATCH 3/14 x86: spl: Add weak arch_cpu_init_dm()

Quoted 31 lines · Bin Meng

Hi Simon,

Quoted 18 lines · Simon Glass

Hi Bin,

Quoted 15 lines · Bin Meng

arch_cpu_init_dm() might not be implemented by every platform. Implement a weak version for SPL.

---

 arch/x86/lib/spl.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/x86/lib/spl.c +0 -0
index 7403d15..8c5b90f 100644
@@ -15,6 +15,11 @@
 
Quoted 9 lines

arch/x86/lib/spl.c line 21

Quoted 6 lines
arch/x86/lib/spl.c +4 -0
 DECLARE_GLOBAL_DATA_PTR;
 
+__weak int arch_cpu_init_dm(void)
+{
+       return 0;
+}

There is already one of these in board_f.c - do we need another?

Quoted 1 line

board_f.c is not built for SPL.

I'm not a big fan of weak functions, but OK.

author
#11 lore raw

PATCH 3/14 x86: spl: Add weak arch_cpu_init_dm()

Quoted 32 lines · Simon Glass
Quoted 31 lines · Bin Meng

Hi Simon,

Quoted 27 lines · Simon Glass

Hi Bin,

Quoted 14 lines · Bin Meng

arch_cpu_init_dm() might not be implemented by every platform. Implement a weak version for SPL.

---

 arch/x86/lib/spl.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/x86/lib/spl.c +0 -0
index 7403d15..8c5b90f 100644

arch/x86/lib/spl.c line 21

Quoted 7 lines
arch/x86/lib/spl.c +4 -0
@@ -15,6 +15,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+__weak int arch_cpu_init_dm(void)
+{
+       return 0;
+}

There is already one of these in board_f.c - do we need another?

Quoted 5 lines
Quoted 1 line

board_f.c is not built for SPL.

I'm not a big fan of weak functions, but OK.

applied to u-boot-x86, thanks!

author
#12 lore raw

PATCH 4/14 x86: Compile irq.c for 64-bit

In reply to Bin Meng

There is no reason not to compile irq.c for 64-bit.

---

 arch/x86/cpu/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/cpu/Makefile +1 -1
index 45f95ab..92a9023 100644
@@ -35,8 +35,8 @@ obj-$(CONFIG_NORTHBRIDGE_INTEL_IVYBRIDGE) += ivybridge/
 obj-$(CONFIG_INTEL_QUARK) += quark/
 obj-$(CONFIG_INTEL_QUEENSBAY) += queensbay/
 obj-y += lapic.o ioapic.o
-ifndef CONFIG_$(SPL_)X86_64
 obj-y += irq.o
+ifndef CONFIG_$(SPL_)X86_64
 obj-$(CONFIG_SMP) += mp_init.o
 endif
 obj-y += mtrr.o
Signature · 1 line
2.9.2
author
#14 lore raw

PATCH 4/14 x86: Compile irq.c for 64-bit

Quoted 10 lines · Simon Glass
Quoted 7 lines · Bin Meng

There is no reason not to compile irq.c for 64-bit.

---

 arch/x86/cpu/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

applied to u-boot-x86, thanks!

author
#15 lore raw

PATCH 5/14 x86: qemu: Hide arch_cpu_init() and print_cpuinfo() for U-Boot proper

In reply to Bin Meng

arch_cpu_init() and print_cpuinfo() should be only available in SPL build.

---

 arch/x86/cpu/qemu/qemu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/cpu/qemu/qemu.c +4 -1
index c3092f2..85e2481 100644
@@ -137,14 +137,17 @@ static void qemu_chipset_init(void)
 #endif
 }
 
+#if !CONFIG_IS_ENABLED(SPL_X86_32BIT_INIT)
 int arch_cpu_init(void)
 {
 	post_code(POST_CPU_INIT);
 
 	return x86_cpu_init_f();
 }
+#endif
 
-#ifndef CONFIG_EFI_STUB
+#if !CONFIG_IS_ENABLED(EFI_STUB) && \
+	!CONFIG_IS_ENABLED(SPL_X86_32BIT_INIT)
 int print_cpuinfo(void)
 {
 	post_code(POST_CPU_INFO);
Signature · 1 line
2.9.2
author
#17 lore raw

PATCH 5/14 x86: qemu: Hide arch_cpu_init() and print_cpuinfo() for U-Boot proper

Quoted 11 lines · Simon Glass
Quoted 8 lines · Bin Meng

arch_cpu_init() and print_cpuinfo() should be only available in SPL build.

---

 arch/x86/cpu/qemu/qemu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

applied to u-boot-x86, thanks!

author
#18 lore raw

PATCH 6/14 x86: qemu: Fix compiler warnings for 64-bit

In reply to Bin Meng

This fixes compiler warnings for QEMU in 64-bit.

---

 arch/x86/cpu/irq.c       | 6 +++---
 arch/x86/cpu/qemu/qemu.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/cpu/irq.c +3 -3
index 442d373..d2901de 100644
@@ -26,7 +26,7 @@ bool pirq_check_irq_routed(struct udevice *dev, int link, u8 irq)
 	if (priv->config == PIRQ_VIA_PCI)
 		dm_pci_read_config8(dev->parent, LINK_N2V(link, base), &pirq);
 	else
-		pirq = readb(priv->ibase + LINK_N2V(link, base));
+		pirq = readb((uintptr_t)priv->ibase + LINK_N2V(link, base));
 
 	pirq &= 0xf;
 
@@ -56,7 +56,7 @@ void pirq_assign_irq(struct udevice *dev, int link, u8 irq)
 	if (priv->config == PIRQ_VIA_PCI)
 		dm_pci_write_config8(dev->parent, LINK_N2V(link, base), irq);
 	else
-		writeb(irq, priv->ibase + LINK_N2V(link, base));
+		writeb(irq, (uintptr_t)priv->ibase + LINK_N2V(link, base));
 }
 
 static struct irq_info *check_dup_entry(struct irq_info *slot_base,
@@ -234,7 +234,7 @@ static void irq_enable_sci(struct udevice *dev)
 		if (priv->config == PIRQ_VIA_PCI)
 			dm_pci_write_config32(dev->parent, priv->actl_addr, 0);
 		else
-			writel(0, priv->ibase + priv->actl_addr);
+			writel(0, (uintptr_t)priv->ibase + priv->actl_addr);
 	}
 }
 
arch/x86/cpu/qemu/qemu.c +1 -1
index 85e2481..7153eb2 100644
@@ -47,7 +47,7 @@ static void qemu_x86_fwcfg_read_entry_pio(uint16_t entry,
 static void qemu_x86_fwcfg_read_entry_dma(struct fw_cfg_dma_access *dma)
 {
 	/* the DMA address register is big endian */
-	outl(cpu_to_be32((uint32_t)dma), FW_DMA_PORT_HIGH);
+	outl(cpu_to_be32((uintptr_t)dma), FW_DMA_PORT_HIGH);
 
 	while (be32_to_cpu(dma->control) & ~FW_CFG_DMA_ERROR)
 		__asm__ __volatile__ ("pause");
Signature · 1 line
2.9.2
author
#20 lore raw

PATCH 6/14 x86: qemu: Fix compiler warnings for 64-bit

Quoted 11 lines · Simon Glass
Quoted 8 lines · Bin Meng

This fixes compiler warnings for QEMU in 64-bit.

---

 arch/x86/cpu/irq.c       | 6 +++---
 arch/x86/cpu/qemu/qemu.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

applied to u-boot-x86, thanks!

author
#21 lore raw

PATCH 7/14 x86: qemu: Set up device tree for SPL

In reply to Bin Meng

Add the correct pre-relocation tag so that the required device tree nodes are present in the SPL device tree.

---

 arch/x86/dts/qemu-x86_i440fx.dts | 4 ++++
 arch/x86/dts/qemu-x86_q35.dts    | 4 ++++
 2 files changed, 8 insertions(+)
arch/x86/dts/qemu-x86_i440fx.dts +4 -0
index 9c3f2a0..afea14e 100644
@@ -29,10 +29,12 @@
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
+		u-boot,dm-pre-reloc;
 
 		cpu at 0 {
 			device_type = "cpu";
 			compatible = "cpu-qemu";
+			u-boot,dm-pre-reloc;
 			reg = <0>;
 			intel,apic-id = <0>;
 		};
@@ -54,9 +56,11 @@
 		pch at 1,0 {
 			reg = <0x00000800 0 0 0 0>;
 			compatible = "intel,pch7";
+			u-boot,dm-pre-reloc;
 
 			irq-router {
 				compatible = "intel,irq-router";
+				u-boot,dm-pre-reloc;
 				intel,pirq-config = "pci";
 				intel,pirq-link = <0x60 4>;
 				intel,pirq-mask = <0x0e40>;
arch/x86/dts/qemu-x86_q35.dts +4 -0
index 0d462a9..bc398dd 100644
@@ -40,10 +40,12 @@
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
+		u-boot,dm-pre-reloc;
 
 		cpu at 0 {
 			device_type = "cpu";
 			compatible = "cpu-qemu";
+			u-boot,dm-pre-reloc;
 			reg = <0>;
 			intel,apic-id = <0>;
 		};
@@ -65,9 +67,11 @@
 		pch at 1f,0 {
 			reg = <0x0000f800 0 0 0 0>;
 			compatible = "intel,pch9";
+			u-boot,dm-pre-reloc;
 
 			irq-router {
 				compatible = "intel,irq-router";
+				u-boot,dm-pre-reloc;
 				intel,pirq-config = "pci";
 				intel,actl-8bit;
 				intel,actl-addr = <0x44>;
Signature · 1 line
2.9.2
#22 lore raw

PATCH 7/14 x86: qemu: Set up device tree for SPL

Quoted 9 lines · Bin Meng

Add the correct pre-relocation tag so that the required device tree nodes are present in the SPL device tree.

---

 arch/x86/dts/qemu-x86_i440fx.dts | 4 ++++
 arch/x86/dts/qemu-x86_q35.dts    | 4 ++++
 2 files changed, 8 insertions(+)
author
#23 lore raw

PATCH 7/14 x86: qemu: Set up device tree for SPL

Quoted 4 lines · Simon Glass
Quoted 3 lines · Bin Meng

Add the correct pre-relocation tag so that the required device tree nodes are present in the SPL device tree.

Quoted 8 lines
Quoted 6 lines

---

 arch/x86/dts/qemu-x86_i440fx.dts | 4 ++++
 arch/x86/dts/qemu-x86_q35.dts    | 4 ++++
 2 files changed, 8 insertions(+)

applied to u-boot-x86, thanks!

author
#24 lore raw

PATCH 8/14 x86: qemu: Mark ucode as optional for SPL in u-boot.dtsi

In reply to Bin Meng

QEMU does not need ucode and this is indicated in u-boot.dtsi for U-Boot proper. Now add the same for SPL.

---

 arch/x86/dts/emulation-u-boot.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/x86/dts/emulation-u-boot.dtsi +6 -0
index 56d34af..7714ed0 100644
@@ -10,9 +10,15 @@
 #ifdef CONFIG_ROM_SIZE
 / {
 	binman {
+#ifdef CONFIG_SPL
+		u-boot-spl-with-ucode-ptr {
+			optional-ucode;
+		};
+#else
 		u-boot-with-ucode-ptr {
 			optional-ucode;
 		};
+#endif
 	};
 };
 #endif
Signature · 1 line
2.9.2
#25 lore raw

PATCH 8/14 x86: qemu: Mark ucode as optional for SPL in u-boot.dtsi

Quoted 8 lines · Bin Meng

QEMU does not need ucode and this is indicated in u-boot.dtsi for U-Boot proper. Now add the same for SPL.

---

 arch/x86/dts/emulation-u-boot.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
author
#26 lore raw

PATCH 8/14 x86: qemu: Mark ucode as optional for SPL in u-boot.dtsi

Quoted 11 lines · Simon Glass
Quoted 8 lines · Bin Meng

QEMU does not need ucode and this is indicated in u-boot.dtsi for U-Boot proper. Now add the same for SPL.

---

 arch/x86/dts/emulation-u-boot.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

applied to u-boot-x86, thanks!

author
#27 lore raw

PATCH 9/14 tools: binman: Call correct init for Entry_u_boot_spl_with_ucode_ptr

In reply to Bin Meng

u_boot_spl_with_ucode_ptr is derived from u_boot_with_ucode_ptr, hence it should call its parent's init.

---

 tools/binman/etype/u_boot_spl_with_ucode_ptr.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/binman/etype/u_boot_spl_with_ucode_ptr.py +1 -1
index 764c282..1c6706d 100644
@@ -21,7 +21,7 @@ class Entry_u_boot_spl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr):
     process.
     """
     def __init__(self, image, etype, node):
-        Entry_blob.__init__(self, image, etype, node)
+        Entry_u_boot_with_ucode_ptr.__init__(self, image, etype, node)
         self.elf_fname = 'spl/u-boot-spl'
 
     def GetDefaultFilename(self):
Signature · 1 line
2.9.2
#28 lore raw

PATCH 9/14 tools: binman: Call correct init for Entry_u_boot_spl_with_ucode_ptr

Quoted 9 lines · Bin Meng

u_boot_spl_with_ucode_ptr is derived from u_boot_with_ucode_ptr, hence it should call its parent's init.

---

 tools/binman/etype/u_boot_spl_with_ucode_ptr.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
author
#29 lore raw

PATCH 9/14 tools: binman: Call correct init for Entry_u_boot_spl_with_ucode_ptr

Quoted 5 lines · Simon Glass
Quoted 4 lines · Bin Meng

u_boot_spl_with_ucode_ptr is derived from u_boot_with_ucode_ptr, hence it should call its parent's init.

Quoted 7 lines
Quoted 5 lines

---

 tools/binman/etype/u_boot_spl_with_ucode_ptr.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

applied to u-boot-x86, thanks!

author
#30 lore raw

PATCH 10/14 tools: binman: Handle optional microcode case in SPL image

In reply to Bin Meng

On platforms which do not require microcode in SPL, handle such case like U-Boot proper.

---

 tools/binman/etype/u_boot_ucode.py | 6 ++++++
 1 file changed, 6 insertions(+)
tools/binman/etype/u_boot_ucode.py +6 -0
index 8fe27ac..8e51e99 100644
@@ -62,6 +62,12 @@ class Entry_u_boot_ucode(Entry_blob):
             self.data = ''
             return True
 
+        # Handle microcode in SPL image as well
+        ucode_dest_entry = self.image.FindEntryType('u-boot-spl-with-ucode-ptr')
+        if ucode_dest_entry and not ucode_dest_entry.target_pos:
+            self.data = ''
+            return True
+
         # Get the microcode from the device tree entry
         fdt_entry = self.image.FindEntryType('u-boot-dtb-with-ucode')
         if not fdt_entry or not fdt_entry.ucode_data:
Signature · 1 line
2.9.2
author
#32 lore raw

PATCH 10/14 tools: binman: Handle optional microcode case in SPL image

Quoted 11 lines · Simon Glass
Quoted 8 lines · Bin Meng

On platforms which do not require microcode in SPL, handle such case like U-Boot proper.

---

 tools/binman/etype/u_boot_ucode.py | 6 ++++++
 1 file changed, 6 insertions(+)

applied to u-boot-x86, thanks!

author
#33 lore raw

PATCH 11/14 spl: Add a LF to the loading message

In reply to Bin Meng

SPL prints "Trying to boot from %s" without a LF. Add one to improve reading on the serial console.

---

 common/spl/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/spl.c +1 -1
index 8fb8da4..1210da3 100644
@@ -266,7 +266,7 @@ static int boot_from_devices(struct spl_image_info *spl_image,
 		loader = spl_ll_find_loader(spl_boot_list[i]);
 #if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
 		if (loader)
-			printf("Trying to boot from %s", loader->name);
+			printf("Trying to boot from %s\n", loader->name);
 		else
 			puts("SPL: Unsupported Boot Device!\n");
 #endif
Signature · 1 line
2.9.2
author
#35 lore raw

PATCH 11/14 spl: Add a LF to the loading message

Quoted 11 lines · Simon Glass
Quoted 8 lines · Bin Meng

SPL prints "Trying to boot from %s" without a LF. Add one to improve reading on the serial console.

---

 common/spl/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Drop this commit, since another commit has been merged to mainstream already:

commit cf947da19aecd1b430f22d73ad109af64a6051b5

Author: Andrew F. Davis <[email protected]>
Date:   Thu Jan 12 10:19:55 2017 -0600

spl: Add some missing newlines

Regards,
Bin

author
#36 lore raw

PATCH 12/14 x86: qemu: Add a text base for 64-bit U-Boot

In reply to Bin Meng

Set up the 64-bit U-Boot text base if building for that target.

---

 board/emulation/qemu-x86/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/emulation/qemu-x86/Kconfig +2 -2
index c9181fc..a773e8f 100644
@@ -13,8 +13,8 @@ config SYS_CONFIG_NAME
 	default "qemu-x86"
 
 config SYS_TEXT_BASE
-	default 0xfff00000 if !EFI_STUB
-	default 0x01110000 if EFI_STUB
+	default 0xfff00000 if !EFI_STUB && !SUPPORT_SPL
+	default 0x01110000 if EFI_STUB || SUPPORT_SPL
 
 config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y
Signature · 1 line
2.9.2
author
#38 lore raw

PATCH 12/14 x86: qemu: Add a text base for 64-bit U-Boot

Quoted 10 lines · Simon Glass
Quoted 7 lines · Bin Meng

Set up the 64-bit U-Boot text base if building for that target.

---

 board/emulation/qemu-x86/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

applied to u-boot-x86, thanks!

author
#39 lore raw

PATCH 13/14 x86: qemu: Add build options for SPL

In reply to Bin Meng

If SPL is used we want to use the generic SPL framework and boot from SPI via a board-specific means. Add these options to the board config file.

---

 include/configs/qemu-x86.h | 9 +++++++++
 1 file changed, 9 insertions(+)
include/configs/qemu-x86.h +9 -0
index 4783563..d4acd67 100644
@@ -54,4 +54,13 @@
 #undef CONFIG_ENV_IS_IN_SPI_FLASH
 #define CONFIG_ENV_IS_NOWHERE
 
+#define CONFIG_SPL_FRAMEWORK
+
+#define CONFIG_SPL_TEXT_BASE		0xfffd0000
+
+#define BOOT_DEVICE_SPI			10
+
+#define CONFIG_SPL_BOARD_LOAD_IMAGE
+#define BOOT_DEVICE_BOARD		11
+
 #endif	/* __CONFIG_H */
Signature · 1 line
2.9.2
#40 lore raw

PATCH 13/14 x86: qemu: Add build options for SPL

Quoted 9 lines · Bin Meng

If SPL is used we want to use the generic SPL framework and boot from SPI via a board-specific means. Add these options to the board config file.

---

 include/configs/qemu-x86.h | 9 +++++++++
 1 file changed, 9 insertions(+)
author
#41 lore raw

PATCH 13/14 x86: qemu: Add build options for SPL

Quoted 5 lines · Simon Glass
Quoted 4 lines · Bin Meng

If SPL is used we want to use the generic SPL framework and boot from SPI via a board-specific means. Add these options to the board config file.

Quoted 7 lines
Quoted 5 lines

---

 include/configs/qemu-x86.h | 9 +++++++++
 1 file changed, 9 insertions(+)

applied to u-boot-x86, thanks!

author
#42 lore raw

PATCH 14/14 x86: qemu: Add a config for 64-bit U-Boot

In reply to Bin Meng

Add a new board config which uses 64-bit U-Boot. Supported features are the same as the other 64-bit board (Google Chromebook Link). It is a start for us to test 64-bit U-Boot easily without the need to access a real hardware.

Note CONFIG_SPL_ENV_SUPPORT is required for QEMU 64-bit as without this the SPL build fails at the end. This is just a workaround as CONFIG_SPL_ENV_SUPPORT is not needed at all.

common/built-in.o:(.data.env_htab+0xc): undefined reference to 'env_flags_validate' lib/built-in.o: In function `hsearch_r':
lib/hashtable.c:380: undefined reference to 'env_callback_init' lib/hashtable.c:382: undefined reference to 'env_flags_init'
make[1]: *** [spl/u-boot-spl] Error 1

Except those SPL options required by 64-bit, compared to 32-bit config, the following options are different:

- CONFIG_SYS_MALLOC_F_LEN has to be increased to 0x1000 for SPL.
- CONFIG_DEBUG_UART has to be included due to the weird issue. See TODO comments in arch/x86/cpu/x86_64/cpu.c:arch_setup_gd(). Once this issue gets fixed, debug uart can be optional.

---

 board/emulation/Kconfig              |  7 ++++
 board/emulation/qemu-x86/Kconfig     |  2 +-
 board/emulation/qemu-x86/MAINTAINERS |  7 ++++
 configs/qemu-x86_64_defconfig        | 80 ++++++++++++++++++++++++++++++++++++
 4 files changed, 95 insertions(+), 1 deletion(-)
 create mode 100644 configs/qemu-x86_64_defconfig
board/emulation/Kconfig +7 -0
index 36809fd..6d55dca 100644
@@ -18,6 +18,13 @@ config TARGET_QEMU_X86
 	  supported by U-Boot. They are via QEMU '-M pc', an i440FX/PIIX
 	  chipset platform and '-M q35', a Q35/ICH9 chipset platform.
 
+config TARGET_QEMU_X86_64
+	bool "QEMU x86 64-bit"
+	help
+	  This is the QEMU emulated x86 64-bit board. With this config
+	  U-Boot is built as a 64-bit binary. This allows testing while
+	  this feature is being completed.
+
 endchoice
 
 source "board/emulation/qemu-x86/Kconfig"
board/emulation/qemu-x86/Kconfig +1 -1
index a773e8f..a593f8c 100644
@@ -1,4 +1,4 @@
-if TARGET_QEMU_X86
+if TARGET_QEMU_X86 || TARGET_QEMU_X86_64
 
 config SYS_BOARD
 	default "qemu-x86"
board/emulation/qemu-x86/MAINTAINERS +7 -0
index 54dc2c5..4cf8ac9 100644
@@ -6,3 +6,10 @@ F:	include/configs/qemu-x86.h
 F:	configs/qemu-x86_defconfig
 F:	configs/qemu-x86_efi_payload32_defconfig
 F:	configs/qemu-x86_efi_payload64_defconfig
+
+QEMU X86 64-bit BOARD
+M:	Bin Meng <[email protected]>
+S:	Maintained
+F:	board/emulation/qemu-x86/
+F:	include/configs/qemu-x86.h
+F:	configs/qemu-x86_64_defconfig
configs/qemu-x86_64_defconfig new file +80 -0

80 lines not on this page · raw message

Signature · 1 line
2.9.2
#43 lore raw

PATCH 14/14 x86: qemu: Add a config for 64-bit U-Boot

Quoted 25 lines · Bin Meng

Add a new board config which uses 64-bit U-Boot. Supported features are the same as the other 64-bit board (Google Chromebook Link). It is a start for us to test 64-bit U-Boot easily without the need to access a real hardware.

Note CONFIG_SPL_ENV_SUPPORT is required for QEMU 64-bit as without this the SPL build fails at the end. This is just a workaround as CONFIG_SPL_ENV_SUPPORT is not needed at all.

common/built-in.o:(.data.env_htab+0xc): undefined reference to 'env_flags_validate' lib/built-in.o: In function `hsearch_r':
lib/hashtable.c:380: undefined reference to 'env_callback_init' lib/hashtable.c:382: undefined reference to 'env_flags_init'
make[1]: *** [spl/u-boot-spl] Error 1

Except those SPL options required by 64-bit, compared to 32-bit config, the following options are different:

- CONFIG_SYS_MALLOC_F_LEN has to be increased to 0x1000 for SPL.
- CONFIG_DEBUG_UART has to be included due to the weird issue. See TODO comments in arch/x86/cpu/x86_64/cpu.c:arch_setup_gd(). Once this issue gets fixed, debug uart can be optional.

Quoted 8 lines

---

 board/emulation/Kconfig              |  7 ++++
 board/emulation/qemu-x86/Kconfig     |  2 +-
 board/emulation/qemu-x86/MAINTAINERS |  7 ++++
 configs/qemu-x86_64_defconfig        | 80 ++++++++++++++++++++++++++++++++++++
 4 files changed, 95 insertions(+), 1 deletion(-)
 create mode 100644 configs/qemu-x86_64_defconfig
author
#44 lore raw

PATCH 14/14 x86: qemu: Add a config for 64-bit U-Boot

Quoted 28 lines · Simon Glass
Quoted 27 lines · Bin Meng

Add a new board config which uses 64-bit U-Boot. Supported features are the same as the other 64-bit board (Google Chromebook Link). It is a start for us to test 64-bit U-Boot easily without the need to access a real hardware.

Note CONFIG_SPL_ENV_SUPPORT is required for QEMU 64-bit as without this the SPL build fails at the end. This is just a workaround as CONFIG_SPL_ENV_SUPPORT is not needed at all.

common/built-in.o:(.data.env_htab+0xc): undefined reference to 'env_flags_validate' lib/built-in.o: In function `hsearch_r':
lib/hashtable.c:380: undefined reference to 'env_callback_init' lib/hashtable.c:382: undefined reference to 'env_flags_init'
make[1]: *** [spl/u-boot-spl] Error 1

Except those SPL options required by 64-bit, compared to 32-bit config, the following options are different:

- CONFIG_SYS_MALLOC_F_LEN has to be increased to 0x1000 for SPL.
- CONFIG_DEBUG_UART has to be included due to the weird issue. See TODO comments in arch/x86/cpu/x86_64/cpu.c:arch_setup_gd(). Once this issue gets fixed, debug uart can be optional.

---

Quoted 8 lines
Quoted 6 lines
 board/emulation/Kconfig              |  7 ++++
 board/emulation/qemu-x86/Kconfig     |  2 +-
 board/emulation/qemu-x86/MAINTAINERS |  7 ++++
 configs/qemu-x86_64_defconfig        | 80 ++++++++++++++++++++++++++++++++++++
 4 files changed, 95 insertions(+), 1 deletion(-)
 create mode 100644 configs/qemu-x86_64_defconfig

applied to u-boot-x86, thanks!

#45 lore raw

cover x86: qemu: Add 64-bit U-Boot support

In reply to Bin Meng

Hi Bin,

Quoted 41 lines · Bin Meng

This brings U-Boot x86 64-bit support on QEMU target.

This series is available at u-boot-x86/qemu64-working for testing.

Bin Meng (14):
x86: qemu: Add missing DECLARE_GLOBAL_DATA_PTR in e820.c
x86: Wrap print_ch() with config option
x86: spl: Add weak arch_cpu_init_dm()
x86: Compile irq.c for 64-bit
x86: qemu: Hide arch_cpu_init() and print_cpuinfo() for U-Boot proper
x86: qemu: Fix compiler warnings for 64-bit
x86: qemu: Set up device tree for SPL
x86: qemu: Mark ucode as optional for SPL in u-boot.dtsi
tools: binman: Call correct init for Entry_u_boot_spl_with_ucode_ptr
tools: binman: Handle optional microcode case in SPL image
spl: Add a LF to the loading message
x86: qemu: Add a text base for 64-bit U-Boot
x86: qemu: Add build options for SPL
x86: qemu: Add a config for 64-bit U-Boot

 arch/x86/cpu/Makefile                           |  2 +-
 arch/x86/cpu/irq.c                              |  6 +-
 arch/x86/cpu/qemu/e820.c                        |  2 +
 arch/x86/cpu/qemu/qemu.c                        |  7 ++-
 arch/x86/cpu/x86_64/cpu.c                       |  2 +
 arch/x86/dts/emulation-u-boot.dtsi              |  6 ++
 arch/x86/dts/qemu-x86_i440fx.dts                |  4 ++
 arch/x86/dts/qemu-x86_q35.dts                   |  4 ++
 arch/x86/lib/spl.c                              |  5 ++
 board/emulation/Kconfig                         |  7 +++
 board/emulation/qemu-x86/Kconfig                |  6 +-
 board/emulation/qemu-x86/MAINTAINERS            |  7 +++
 common/spl/spl.c                                |  2 +-
 configs/qemu-x86_64_defconfig                   | 80 +++++++++++++++++++++++++
 include/configs/qemu-x86.h                      |  9 +++
 tools/binman/etype/u_boot_spl_with_ucode_ptr.py |  2 +-
 tools/binman/etype/u_boot_ucode.py              |  6 ++
 17 files changed, 146 insertions(+), 11 deletions(-)
 create mode 100644 configs/qemu-x86_64_defconfig
Quoted 3 lines

--
2.9.2

One point I noted in trying this out is that the binman tests fail now, since this commit:

d26a38f binman: Remove hard-coded file name for x86 CMC/FSP/VGA

Could you please take a look?

Regards,
Simon

author
#46 lore raw

cover x86: qemu: Add 64-bit U-Boot support

Hi Simon,

Quoted 48 lines · Simon Glass

Hi Bin,

Quoted 41 lines · Bin Meng

This brings U-Boot x86 64-bit support on QEMU target.

This series is available at u-boot-x86/qemu64-working for testing.

Bin Meng (14):
x86: qemu: Add missing DECLARE_GLOBAL_DATA_PTR in e820.c
x86: Wrap print_ch() with config option
x86: spl: Add weak arch_cpu_init_dm()
x86: Compile irq.c for 64-bit
x86: qemu: Hide arch_cpu_init() and print_cpuinfo() for U-Boot proper
x86: qemu: Fix compiler warnings for 64-bit
x86: qemu: Set up device tree for SPL
x86: qemu: Mark ucode as optional for SPL in u-boot.dtsi
tools: binman: Call correct init for Entry_u_boot_spl_with_ucode_ptr
tools: binman: Handle optional microcode case in SPL image
spl: Add a LF to the loading message
x86: qemu: Add a text base for 64-bit U-Boot
x86: qemu: Add build options for SPL
x86: qemu: Add a config for 64-bit U-Boot

 arch/x86/cpu/Makefile                           |  2 +-
 arch/x86/cpu/irq.c                              |  6 +-
 arch/x86/cpu/qemu/e820.c                        |  2 +
 arch/x86/cpu/qemu/qemu.c                        |  7 ++-
 arch/x86/cpu/x86_64/cpu.c                       |  2 +
 arch/x86/dts/emulation-u-boot.dtsi              |  6 ++
 arch/x86/dts/qemu-x86_i440fx.dts                |  4 ++
 arch/x86/dts/qemu-x86_q35.dts                   |  4 ++
 arch/x86/lib/spl.c                              |  5 ++
 board/emulation/Kconfig                         |  7 +++
 board/emulation/qemu-x86/Kconfig                |  6 +-
 board/emulation/qemu-x86/MAINTAINERS            |  7 +++
 common/spl/spl.c                                |  2 +-
 configs/qemu-x86_64_defconfig                   | 80 +++++++++++++++++++++++++
 include/configs/qemu-x86.h                      |  9 +++
 tools/binman/etype/u_boot_spl_with_ucode_ptr.py |  2 +-
 tools/binman/etype/u_boot_ucode.py              |  6 ++
 17 files changed, 146 insertions(+), 11 deletions(-)
 create mode 100644 configs/qemu-x86_64_defconfig
Quoted 3 lines

--
2.9.2

Quoted 6 lines

One point I noted in trying this out is that the binman tests fail now, since this commit:

d26a38f binman: Remove hard-coded file name for x86 CMC/FSP/VGA

Could you please take a look?

I will look into this.

Regards,
Bin