Skip to contentSkip to conversation

x86: qemu: Add MP initialization

PATCH New Bin Meng 2 participants 3 messages Jul 27, 2015 – Aug 2, 2015 1 message not in the archive x86

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Bin Meng

author
#1 lore raw

PATCH 2/2 x86: qemu: Add MP initialization

Add a cpu1 node to the device tree and enable the MP initialization on QEMU targets (i440fx and q35).

---

 arch/x86/dts/qemu-x86_i440fx.dts | 7 +++++++
 arch/x86/dts/qemu-x86_q35.dts    | 7 +++++++
 configs/qemu-x86_defconfig       | 2 ++
 doc/README.x86                   | 5 +++++
 4 files changed, 21 insertions(+)
arch/x86/dts/qemu-x86_i440fx.dts +7 -0
index c26c71b..fc74cd0 100644
@@ -34,6 +34,13 @@
 			reg = <0>;
 			intel,apic-id = <0>;
 		};
+
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "cpu-x86";
+			reg = <1>;
+			intel,apic-id = <1>;
+		};
 	};
 
 	pci {
arch/x86/dts/qemu-x86_q35.dts +7 -0
index 2e785fa..7f16971 100644
@@ -45,6 +45,13 @@
 			reg = <0>;
 			intel,apic-id = <0>;
 		};
+
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "cpu-x86";
+			reg = <1>;
+			intel,apic-id = <1>;
+		};
 	};
 
 	pci {
configs/qemu-x86_defconfig +2 -0
index 4b18d51..e579c36 100644
@@ -1,5 +1,7 @@
 CONFIG_X86=y
 CONFIG_DEFAULT_DEVICE_TREE="qemu-x86_i440fx"
+CONFIG_SMP=y
+CONFIG_MAX_CPUS=2
 CONFIG_GENERATE_PIRQ_TABLE=y
 CONFIG_GENERATE_MP_TABLE=y
 CONFIG_CMD_CPU=y
doc/README.x86 +5 -0
index 5d71244..1cab42c 100644
@@ -281,6 +281,11 @@ QEMU emulates a graphic card which U-Boot supports. Removing '-nographic' will
 show QEMU's VGA console window. Note this will disable QEMU's serial output.
 If you want to check both consoles, use '-serial stdio'.
 
+Multicore is also supported by QEMU via '-smp n' where n is the number of cores
+to instantiate. Currently the default U-Boot built for QEMU supports 2 cores.
+In order to support more cores, you need add additional cpu nodes in the device
+tree and change CONFIG_MAX_CPUS accordingly.
+
 CPU Microcode
 -------------
 Modern CPUs usually require a special bit stream called microcode [8] to be
Signature · 1 line
1.8.2.1
#2 lore raw

PATCH 2/2 x86: qemu: Add MP initialization

Quoted 65 lines · Bin Meng

Add a cpu1 node to the device tree and enable the MP initialization on QEMU targets (i440fx and q35).

---

 arch/x86/dts/qemu-x86_i440fx.dts | 7 +++++++
 arch/x86/dts/qemu-x86_q35.dts    | 7 +++++++
 configs/qemu-x86_defconfig       | 2 ++
 doc/README.x86                   | 5 +++++
 4 files changed, 21 insertions(+)
arch/x86/dts/qemu-x86_i440fx.dts +7 -0
index c26c71b..fc74cd0 100644
@@ -34,6 +34,13 @@
                        reg = <0>;
                        intel,apic-id = <0>;
                };
+
+               cpu at 1 {
+                       device_type = "cpu";
+                       compatible = "cpu-x86";
+                       reg = <1>;
+                       intel,apic-id = <1>;
+               };
        };
 
        pci {
arch/x86/dts/qemu-x86_q35.dts +7 -0
index 2e785fa..7f16971 100644
@@ -45,6 +45,13 @@
                        reg = <0>;
                        intel,apic-id = <0>;
                };
+
+               cpu at 1 {
+                       device_type = "cpu";
+                       compatible = "cpu-x86";
+                       reg = <1>;
+                       intel,apic-id = <1>;
+               };
        };
 
        pci {
configs/qemu-x86_defconfig +2 -0
index 4b18d51..e579c36 100644
@@ -1,5 +1,7 @@
 CONFIG_X86=y
 CONFIG_DEFAULT_DEVICE_TREE="qemu-x86_i440fx"
+CONFIG_SMP=y
+CONFIG_MAX_CPUS=2
 CONFIG_GENERATE_PIRQ_TABLE=y
 CONFIG_GENERATE_MP_TABLE=y
 CONFIG_CMD_CPU=y
doc/README.x86 +0 -0
index 5d71244..1cab42c 100644

doc/README.x86 QEMU emulates a graphic card which U-Boot supports. Removing '-nographic' will · line 285

Quoted 5 lines
doc/README.x86 +2 -0
@@ -281,6 +281,11 @@ QEMU emulates a graphic card which U-Boot supports. Removing '-nographic' will
 show QEMU's VGA console window. Note this will disable QEMU's serial output.
 If you want to check both consoles, use '-serial stdio'.
 
+Multicore is also supported by QEMU via '-smp n' where n is the number of cores
+to instantiate. Currently the default U-Boot built for QEMU supports 2 cores.

nit: is built

Quoted 9 lines
doc/README.x86 +3 -1
+In order to support more cores, you need add additional cpu nodes in the device
+tree and change CONFIG_MAX_CPUS accordingly.
+
 CPU Microcode
 -------------
 Modern CPUs usually require a special bit stream called microcode [8] to be
--

1.8.2.1

#3 lore raw

PATCH 2/2 x86: qemu: Add MP initialization

Quoted 74 lines · Simon Glass
Quoted 65 lines · Bin Meng

Add a cpu1 node to the device tree and enable the MP initialization on QEMU targets (i440fx and q35).

---

 arch/x86/dts/qemu-x86_i440fx.dts | 7 +++++++
 arch/x86/dts/qemu-x86_q35.dts    | 7 +++++++
 configs/qemu-x86_defconfig       | 2 ++
 doc/README.x86                   | 5 +++++
 4 files changed, 21 insertions(+)
arch/x86/dts/qemu-x86_i440fx.dts +7 -0
index c26c71b..fc74cd0 100644
@@ -34,6 +34,13 @@
                        reg = <0>;
                        intel,apic-id = <0>;
                };
+
+               cpu at 1 {
+                       device_type = "cpu";
+                       compatible = "cpu-x86";
+                       reg = <1>;
+                       intel,apic-id = <1>;
+               };
        };
 
        pci {
arch/x86/dts/qemu-x86_q35.dts +7 -0
index 2e785fa..7f16971 100644
@@ -45,6 +45,13 @@
                        reg = <0>;
                        intel,apic-id = <0>;
                };
+
+               cpu at 1 {
+                       device_type = "cpu";
+                       compatible = "cpu-x86";
+                       reg = <1>;
+                       intel,apic-id = <1>;
+               };
        };
 
        pci {
configs/qemu-x86_defconfig +2 -0
index 4b18d51..e579c36 100644
@@ -1,5 +1,7 @@
 CONFIG_X86=y
 CONFIG_DEFAULT_DEVICE_TREE="qemu-x86_i440fx"
+CONFIG_SMP=y
+CONFIG_MAX_CPUS=2
 CONFIG_GENERATE_PIRQ_TABLE=y
 CONFIG_GENERATE_MP_TABLE=y
 CONFIG_CMD_CPU=y
doc/README.x86 +0 -0
index 5d71244..1cab42c 100644

doc/README.x86 QEMU emulates a graphic card which U-Boot supports. Removing '-nographic' will · line 285

Quoted 5 lines
doc/README.x86 +2 -0
@@ -281,6 +281,11 @@ QEMU emulates a graphic card which U-Boot supports. Removing '-nographic' will
 show QEMU's VGA console window. Note this will disable QEMU's serial output.
 If you want to check both consoles, use '-serial stdio'.
 
+Multicore is also supported by QEMU via '-smp n' where n is the number of cores
+to instantiate. Currently the default U-Boot built for QEMU supports 2 cores.

nit: is built

Quoted 12 lines
Quoted 9 lines
doc/README.x86 +3 -1
+In order to support more cores, you need add additional cpu nodes in the device
+tree and change CONFIG_MAX_CPUS accordingly.
+
 CPU Microcode
 -------------
 Modern CPUs usually require a special bit stream called microcode [8] to be
--

1.8.2.1

Sorry, ignore that nit, it is fine.

Applied to u-boot-x86