
Remove 'cpus' node in dts files for QEMU targets, retrieve cpu number through 'fw_cfg' interface and fixup device tree blob at runtime.
Signed-off-by: Miao Yan yanmiaobest@gmail.com --- arch/x86/cpu/qemu/qemu.c | 4 ++++ arch/x86/dts/qemu-x86_i440fx.dts | 18 +----------------- arch/x86/dts/qemu-x86_q35.dts | 19 +------------------ 3 files changed, 6 insertions(+), 35 deletions(-)
diff --git a/arch/x86/cpu/qemu/qemu.c b/arch/x86/cpu/qemu/qemu.c index c0a79d2..e643e04 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; @@ -96,6 +98,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 8c9d35a..3f32ec9 100644 --- a/arch/x86/dts/qemu-x86_i440fx.dts +++ b/arch/x86/dts/qemu-x86_i440fx.dts @@ -25,24 +25,8 @@ stdout-path = "/serial"; };
- cpus { - #address-cells = <1>; - #size-cells = <0>;
- cpu@0 { - device_type = "cpu"; - compatible = "cpu-qemu"; - reg = <0>; - intel,apic-id = <0>; - }; - - cpu@1 { - device_type = "cpu"; - compatible = "cpu-qemu"; - reg = <1>; - intel,apic-id = <1>; - }; - }; + /* cpu node will be dynamically filled by qemu */
pci { compatible = "pci-x86"; diff --git a/arch/x86/dts/qemu-x86_q35.dts b/arch/x86/dts/qemu-x86_q35.dts index c980f45..c1c6a9a 100644 --- a/arch/x86/dts/qemu-x86_q35.dts +++ b/arch/x86/dts/qemu-x86_q35.dts @@ -36,24 +36,7 @@ stdout-path = "/serial"; };
- cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "cpu-qemu"; - reg = <0>; - intel,apic-id = <0>; - }; - - cpu@1 { - device_type = "cpu"; - compatible = "cpu-qemu"; - reg = <1>; - intel,apic-id = <1>; - }; - }; + /* cpu node will be dynamically filled by qemu */
pci { compatible = "pci-x86";