[U-Boot] [PATCH v4 6/8] x86: qemu: fix up cpu node in device tree

Miao Yan yanmiaobest at gmail.com
Thu Dec 31 03:55:23 CET 2015


Remove 'cpus' node in dts files for QEMU targets,
retrieve cpu number through 'fw_cfg' interface and
fix up device tree blob at runtime.

Signed-off-by: Miao Yan <yanmiaobest at gmail.com>
---
 arch/x86/cpu/qemu/qemu.c         |  4 ++++
 arch/x86/dts/qemu-x86_i440fx.dts | 19 +------------------
 arch/x86/dts/qemu-x86_q35.dts    | 19 +------------------
 3 files changed, 6 insertions(+), 36 deletions(-)

diff --git a/arch/x86/cpu/qemu/qemu.c b/arch/x86/cpu/qemu/qemu.c
index d9ae066..3be3af0 100644
--- a/arch/x86/cpu/qemu/qemu.c
+++ b/arch/x86/cpu/qemu/qemu.c
@@ -15,6 +15,8 @@
 
 static bool i440fx;
 
+DECLARE_GLOBAL_DATA_PTR;
+
 static void qemu_chipset_init(void)
 {
 	u16 device, xbcs;
@@ -93,6 +95,8 @@ int arch_early_init_r(void)
 {
 	qemu_chipset_init();
 
+	qemu_fwcfg_fdt_fixup((void *)gd->fdt_blob, qemu_fwcfg_online_cpus());
+
 	return 0;
 }
 
diff --git a/arch/x86/dts/qemu-x86_i440fx.dts b/arch/x86/dts/qemu-x86_i440fx.dts
index 4332204..79bafbd 100644
--- a/arch/x86/dts/qemu-x86_i440fx.dts
+++ b/arch/x86/dts/qemu-x86_i440fx.dts
@@ -26,24 +26,7 @@
 		stdout-path = "/serial";
 	};
 
-	cpus {
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		cpu at 0 {
-			device_type = "cpu";
-			compatible = "cpu-qemu";
-			reg = <0>;
-			intel,apic-id = <0>;
-		};
-
-		cpu at 1 {
-			device_type = "cpu";
-			compatible = "cpu-qemu";
-			reg = <1>;
-			intel,apic-id = <1>;
-		};
-	};
+	/* cpu node will be dynamically filled by U-Boot */
 
 	tsc-timer {
 		clock-frequency = <1000000000>;
diff --git a/arch/x86/dts/qemu-x86_q35.dts b/arch/x86/dts/qemu-x86_q35.dts
index 3e2cfac..9563344 100644
--- a/arch/x86/dts/qemu-x86_q35.dts
+++ b/arch/x86/dts/qemu-x86_q35.dts
@@ -37,24 +37,7 @@
 		stdout-path = "/serial";
 	};
 
-	cpus {
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		cpu at 0 {
-			device_type = "cpu";
-			compatible = "cpu-qemu";
-			reg = <0>;
-			intel,apic-id = <0>;
-		};
-
-		cpu at 1 {
-			device_type = "cpu";
-			compatible = "cpu-qemu";
-			reg = <1>;
-			intel,apic-id = <1>;
-		};
-	};
+	/* cpu node will be dynamically filled by U-Boot */
 
 	tsc-timer {
 		clock-frequency = <1000000000>;
-- 
1.9.1



More information about the U-Boot mailing list