Skip to contentSkip to conversation

x86: Add CPU uclass and multi-core support for Minnowboard MAX

PATCH Superseded Simon Glass 2 participants 18 messages Apr 30, 2015 – May 1, 2015 x86

lore
Share & tools
lore
#0 lore raw

v3 cover x86: Add CPU uclass and multi-core support for Minnowboard MAX

This series adds a new CPU uclass which is intended to be useful on any architecture. So far it has a very simple interface and a command to show CPU details.

This series also introduces multi-core init for x86. It is implemented and enabled on Minnowboard MAX, a single/dual-core Atom board. The CPU uclass is implemented for x86 and the Simple Firmware Interface provides these details to the kernel, since ACPI is not yet available.

With these changes Minnowboard MAX can boot into Linux with both cores enabled.

This series is available at u-boot-x86 branch 'cpu-working'.

Changes in v3:
- Rename CONFIG_STACK_SIZE to CONFIG_AP_STACK_SIZE
- Remove sipi_vector_location and sipi_vector_location_size variables
- Remove annoying /* 1ms */ comments
- Rename sipi.S to sipi_vector.S
- Correct 'ap_start32' to 'ap_start'
- Use macros for cr0 bit fields
- Correct style in a multi-line comment
- Use UCODE_HEADER_LEN instead of 48
- Remove unnecessary underscores in MP_FR_BLOCK_APS and MP_FR_NOBLOCK_APS
- Use 'cpu number' instead of 'coreboot cpu number'
- Remove a stray blank line in sipi.h
- Enhance comment for @microcode_lock
- Rename SMM_DEFAULT_BASE/SIZE to AP_DEFAULT_BASE/SIZE and drop smm.h
- Use data32 instead of our own 'o32'
- Move NUM_FIXED_MTRRS to mtrr.h
- Avoid using asmlinkage on ap_init()
- Add msr_clrbits_64() too
- Collect all new MSRs into msr-index.h
- Spell 'BayTrail' like so
- Make set_max_freq() static

Changes in v2:
- Correct 'I2C uclass' typo
- Add blank line in x86_cpu_get_desc()

Simon Glass (5):
x86: Add multi-processor init
x86: Add functions to set and clear bits on MSRs
x86: Allow CPUs to be set up after relocation
x86: Add a CPU driver for baytrail
x86: Enable multi-core init for Minnowboard MAX

 arch/x86/Kconfig                                  |  30 ++
 arch/x86/cpu/Makefile                             |   2 +
 arch/x86/cpu/baytrail/Makefile                    |   1 +
 arch/x86/cpu/baytrail/cpu.c                       | 205 +++++++++
 arch/x86/cpu/cpu.c                                |  38 ++
 arch/x86/cpu/ivybridge/car.S                      |   1 +
 arch/x86/cpu/ivybridge/model_206ax.c              |   4 +-
 arch/x86/cpu/mp_init.c                            | 496 ++++++++++++++++++++++
 arch/x86/cpu/sipi_vector.S                        | 216 ++++++++++
 arch/x86/dts/minnowmax.dts                        |  20 +
 arch/x86/include/asm/arch-ivybridge/microcode.h   |   3 -
 arch/x86/include/asm/arch-ivybridge/model_206ax.h |   2 -
 arch/x86/include/asm/cpu.h                        |  14 +
 arch/x86/include/asm/mp.h                         |  94 ++++
 arch/x86/include/asm/msr-index.h                  |  22 +-
 arch/x86/include/asm/msr.h                        |  28 ++
 arch/x86/include/asm/mtrr.h                       |   6 +-
 arch/x86/include/asm/processor.h                  |   3 +
 arch/x86/include/asm/sipi.h                       |  86 ++++
 arch/x86/include/asm/turbo.h                      |   3 -
 arch/x86/include/asm/u-boot-x86.h                 |   2 +
 common/board_r.c                                  |   2 +-
 configs/minnowmax_defconfig                       |   4 +
 23 files changed, 1268 insertions(+), 14 deletions(-)
 create mode 100644 arch/x86/cpu/baytrail/cpu.c
 create mode 100644 arch/x86/cpu/mp_init.c
 create mode 100644 arch/x86/cpu/sipi_vector.S
 create mode 100644 arch/x86/include/asm/mp.h
 create mode 100644 arch/x86/include/asm/sipi.h
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#1 lore raw

PATCH v3 1/5 x86: Add multi-processor init

Most modern x86 CPUs include more than one CPU core. The OS normally requires that these 'Application Processors' (APs) be brought up by the boot loader. Add the required support to U-Boot to init additional APs.

---

Changes in v3:
- Rename CONFIG_STACK_SIZE to CONFIG_AP_STACK_SIZE
- Remove sipi_vector_location and sipi_vector_location_size variables
- Remove annoying /* 1ms */ comments
- Rename sipi.S to sipi_vector.S
- Correct 'ap_start32' to 'ap_start'
- Use macros for cr0 bit fields
- Correct style in a multi-line comment
- Use UCODE_HEADER_LEN instead of 48
- Remove unnecessary underscores in MP_FR_BLOCK_APS and MP_FR_NOBLOCK_APS
- Use 'cpu number' instead of 'coreboot cpu number'
- Remove a stray blank line in sipi.h
- Enhance comment for @microcode_lock
- Rename SMM_DEFAULT_BASE/SIZE to AP_DEFAULT_BASE/SIZE and drop smm.h
- Use data32 instead of our own 'o32'
- Move NUM_FIXED_MTRRS to mtrr.h
- Avoid using asmlinkage on ap_init()

Changes in v2: None

 arch/x86/Kconfig                                |  30 ++
 arch/x86/cpu/Makefile                           |   2 +
 arch/x86/cpu/ivybridge/car.S                    |   1 +
 arch/x86/cpu/ivybridge/model_206ax.c            |   4 +-
 arch/x86/cpu/mp_init.c                          | 496 ++++++++++++++++++++++++
 arch/x86/cpu/sipi_vector.S                      | 216 +++++++++++
 arch/x86/include/asm/arch-ivybridge/microcode.h |   3 -
 arch/x86/include/asm/mp.h                       |  94 +++++
 arch/x86/include/asm/mtrr.h                     |   6 +-
 arch/x86/include/asm/processor.h                |   3 +
 arch/x86/include/asm/sipi.h                     |  86 ++++
 11 files changed, 934 insertions(+), 7 deletions(-)
 create mode 100644 arch/x86/cpu/mp_init.c
 create mode 100644 arch/x86/cpu/sipi_vector.S
 create mode 100644 arch/x86/include/asm/mp.h
 create mode 100644 arch/x86/include/asm/sipi.h
arch/x86/Kconfig +30 -0
index 467fe25..8e734fd 100644
@@ -361,6 +361,36 @@ config FSP_TEMP_RAM_ADDR
 	  Stack top address which is used in FspInit after DRAM is ready and
 	  CAR is disabled.
 
+config MAX_CPUS
+        int "Maximum number of CPUs permitted"
+        default 4
+        help
+          When using multi-CPU chips it is possible for U-Boot to start up
+          more than one CPU. The stack memory used by all of these CPUs is
+          pre-allocated so at present U-Boot wants to know the maximum
+          number of CPUs that may be present. Set this to at least as high
+          as the number of CPUs in your system (it uses about 4KB of RAM for
+          each CPU).
+
+config SMP
+	bool "Enable Symmetric Multiprocessing"
+	default n
+	help
+	  Enable use of more than one CPU in U-Boot and the Operating System
+	  when loaded. Each CPU will be started up and information can be
+	  obtained using the 'cpu' command. If this option is disabled, then
+	  only one CPU will be enabled regardless of the number of CPUs
+	  available.
+
+config AP_STACK_SIZE
+	hex
+	default 0x1000
+	help
+	  Each additional CPU started by U-Boot requires its own stack. This
+	  option sets the stack size used by each CPU and directly affects
+	  the memory used by this initialisation process. Typically 4KB is
+	  enough space.
+
 config TSC_CALIBRATION_BYPASS
 	bool "Bypass Time-Stamp Counter (TSC) calibration"
 	default n
arch/x86/cpu/Makefile +2 -0
index 6ded0a7..043bea2 100644
@@ -19,6 +19,8 @@ obj-$(CONFIG_NORTHBRIDGE_INTEL_IVYBRIDGE) += ivybridge/
 obj-$(CONFIG_INTEL_QUARK) += quark/
 obj-$(CONFIG_INTEL_QUEENSBAY) += queensbay/
 obj-y += lapic.o
+obj-$(CONFIG_SMP) += mp_init.o
 obj-y += mtrr.o
 obj-$(CONFIG_PCI) += pci.o
+obj-$(CONFIG_SMP) += sipi_vector.o
 obj-y += turbo.o
arch/x86/cpu/ivybridge/car.S +1 -0
index 9441666..407e451 100644
@@ -15,6 +15,7 @@
 #include <asm/msr-index.h>
 #include <asm/mtrr.h>
 #include <asm/post.h>
+#include <asm/processor.h>
 #include <asm/processor-flags.h>
 #include <asm/arch/microcode.h>
 
arch/x86/cpu/ivybridge/model_206ax.c +2 -2
index 11dc625..8b08c40 100644
@@ -435,8 +435,8 @@ static int intel_cores_init(struct x86_cpu_priv *cpu)
 
 		debug("CPU: %u has core %u\n", cpu->apic_id, new_cpu->apic_id);
 
-#if CONFIG_SMP && CONFIG_MAX_CPUS > 1
-		/* Start the new cpu */
+#if 0 && CONFIG_SMP && CONFIG_MAX_CPUS > 1
+		/* TODO(sjg at chromium.org): Start the new cpu */
 		if (!start_cpu(new_cpu)) {
 			/* Record the error in cpu? */
 			printk(BIOS_ERR, "CPU %u would not start!\n",
arch/x86/cpu/mp_init.c new file +496 -0

496 lines not on this page · raw message

arch/x86/cpu/sipi_vector.S new file +216 -0

216 lines not on this page · raw message

arch/x86/include/asm/arch-ivybridge/microcode.h +0 -3
index b868283..67f32cc 100644
@@ -7,9 +7,6 @@
 #ifndef __ASM_ARCH_MICROCODE_H
 #define __ASM_ARCH_MICROCODE_H
 
-/* Length of the public header on Intel microcode blobs */
-#define UCODE_HEADER_LEN	0x30
-
 #ifndef __ASSEMBLY__
 
 /**
arch/x86/include/asm/mp.h new file +94 -0

94 lines not on this page · raw message

arch/x86/include/asm/mtrr.h +4 -2
index 3841593..3ad617c 100644
@@ -34,8 +34,10 @@
 /* Number of MTRRs supported */
 #define MTRR_COUNT		8
 
-#define NUM_FIXED_RANGES 88
-#define RANGES_PER_FIXED_MTRR 8
+#define NUM_FIXED_MTRRS		11
+#define RANGES_PER_FIXED_MTRR	8
+#define NUM_FIXED_RANGES	(NUM_FIXED_MTRRS * RANGES_PER_FIXED_MTRR)
+
 #define MTRR_FIX_64K_00000_MSR 0x250
 #define MTRR_FIX_16K_80000_MSR 0x258
 #define MTRR_FIX_16K_A0000_MSR 0x259
arch/x86/include/asm/processor.h +3 -0
index 3575d34..7c77b90 100644
@@ -23,6 +23,9 @@
 
 #define X86_GDT_SIZE		(X86_GDT_NUM_ENTRIES * X86_GDT_ENTRY_SIZE)
 
+/* Length of the public header on Intel microcode blobs */
+#define UCODE_HEADER_LEN	0x30
+
 #ifndef __ASSEMBLY__
 
 /*
arch/x86/include/asm/sipi.h new file +86 -0

86 lines not on this page · raw message

Signature · 1 line
2.2.0.rc0.207.ga3a616c
#2 lore raw

PATCH v3 1/5 x86: Add multi-processor init

Quoted 7 lines · Simon Glass

Most modern x86 CPUs include more than one CPU core. The OS normally requires that these 'Application Processors' (APs) be brought up by the boot loader. Add the required support to U-Boot to init additional APs.

---

Quoted 9 lines

Changes in v3:
- Rename CONFIG_STACK_SIZE to CONFIG_AP_STACK_SIZE
- Remove sipi_vector_location and sipi_vector_location_size variables
- Remove annoying /* 1ms */ comments
- Rename sipi.S to sipi_vector.S
- Correct 'ap_start32' to 'ap_start'
- Use macros for cr0 bit fields
- Correct style in a multi-line comment
- Use UCODE_HEADER_LEN instead of 48

Quoted 9 lines

- Remove unnecessary underscores in MP_FR_BLOCK_APS and MP_FR_NOBLOCK_APS
- Use 'cpu number' instead of 'coreboot cpu number'
- Remove a stray blank line in sipi.h
- Enhance comment for @microcode_lock
- Rename SMM_DEFAULT_BASE/SIZE to AP_DEFAULT_BASE/SIZE and drop smm.h
- Use data32 instead of our own 'o32'
- Move NUM_FIXED_MTRRS to mtrr.h
- Avoid using asmlinkage on ap_init()

[snip]

Regards,
Bin

#3 lore raw

PATCH v3 1/5 x86: Add multi-processor init

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

Most modern x86 CPUs include more than one CPU core. The OS normally requires that these 'Application Processors' (APs) be brought up by the boot loader. Add the required support to U-Boot to init additional APs.

---

Applied to u-boot-x86.

#4 lore raw

PATCH v3 2/5 x86: Add functions to set and clear bits on MSRs

In reply to Simon Glass

Since we do these sorts of operations a lot, it is useful to have a simpler API, similar to clrsetbits_le32().

---

Changes in v3:
- Add msr_clrbits_64() too

Changes in v2: None

 arch/x86/include/asm/msr.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
arch/x86/include/asm/msr.h +28 -0
index 1955a75..c480920 100644
@@ -128,6 +128,34 @@ static inline void wrmsr(unsigned msr, unsigned low, unsigned high)
 #define wrmsrl(msr, val)						\
 	native_write_msr((msr), (u32)((u64)(val)), (u32)((u64)(val) >> 32))
 
+static inline void msr_clrsetbits_64(unsigned msr, u64 clear, u64 set)
+{
+	u64 val;
+
+	val = native_read_msr(msr);
+	val &= ~clear;
+	val |= set;
+	wrmsrl(msr, val);
+}
+
+static inline void msr_setbits_64(unsigned msr, u64 set)
+{
+	u64 val;
+
+	val = native_read_msr(msr);
+	val |= set;
+	wrmsrl(msr, val);
+}
+
+static inline void msr_clrbits_64(unsigned msr, u64 clear)
+{
+	u64 val;
+
+	val = native_read_msr(msr);
+	val &= ~clear;
+	wrmsrl(msr, val);
+}
+
 /* rdmsr with exception handling */
 #define rdmsr_safe(msr, p1, p2)					\
 ({								\
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#5 lore raw

PATCH v3 2/5 x86: Add functions to set and clear bits on MSRs

Quoted 8 lines · Simon Glass

Since we do these sorts of operations a lot, it is useful to have a simpler API, similar to clrsetbits_le32().

---

Changes in v3:
- Add msr_clrbits_64() too

[snip]

Regards,
Bin

#6 lore raw

PATCH v3 2/5 x86: Add functions to set and clear bits on MSRs

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

Since we do these sorts of operations a lot, it is useful to have a simpler API, similar to clrsetbits_le32().

---

Changes in v3:
- Add msr_clrbits_64() too

Applied to u-boot-x86.

#7 lore raw

PATCH v3 3/5 x86: Allow CPUs to be set up after relocation

In reply to Simon Glass

This permits init of additional CPU cores after relocation and when driver model is ready.

---

Changes in v3: None
Changes in v2:
- Correct 'I2C uclass' typo
- Add blank line in x86_cpu_get_desc()

 arch/x86/cpu/cpu.c                | 38 ++++++++++++++++++++++++++++++++++++++
 arch/x86/include/asm/cpu.h        | 14 ++++++++++++++
 arch/x86/include/asm/u-boot-x86.h |  2 ++
 common/board_r.c                  |  2 +-
 4 files changed, 55 insertions(+), 1 deletion(-)
arch/x86/cpu/cpu.c +38 -0
index 78eb3fe..bb4a110 100644
@@ -21,6 +21,8 @@
 
 #include <common.h>
 #include <command.h>
+#include <cpu.h>
+#include <dm.h>
 #include <errno.h>
 #include <malloc.h>
 #include <asm/control_regs.h>
@@ -518,6 +520,16 @@ char *cpu_get_name(char *name)
 	return ptr;
 }
 
+int x86_cpu_get_desc(struct udevice *dev, char *buf, int size)
+{
+	if (size < CPU_MAX_NAME_LEN)
+		return -ENOSPC;
+
+	cpu_get_name(buf);
+
+	return 0;
+}
+
 int default_print_cpuinfo(void)
 {
 	printf("CPU: %s, vendor %s, device %xh\n",
@@ -600,3 +612,29 @@ int last_stage_init(void)
 	return 0;
 }
 #endif
+
+__weak int x86_init_cpus(void)
+{
+	return 0;
+}
+
+int cpu_init_r(void)
+{
+	return x86_init_cpus();
+}
+
+static const struct cpu_ops cpu_x86_ops = {
+	.get_desc	= x86_cpu_get_desc,
+};
+
+static const struct udevice_id cpu_x86_ids[] = {
+	{ .compatible = "cpu-x86" },
+	{ }
+};
+
+U_BOOT_DRIVER(cpu_x86_drv) = {
+	.name		= "cpu_x86",
+	.id		= UCLASS_CPU,
+	.of_match	= cpu_x86_ids,
+	.ops		= &cpu_x86_ops,
+};
arch/x86/include/asm/cpu.h +14 -0
index 08284ee..ebc74ad 100644
@@ -197,6 +197,20 @@ const char *cpu_vendor_name(int vendor);
 char *cpu_get_name(char *name);
 
 /**
+ *
+* x86_cpu_get_desc() - Get a description string for an x86 CPU
+*
+* This uses cpu_get_name() and is suitable to use as the get_desc() method for
+* the CPU uclass.
+*
+* @dev:		Device to check (UCLASS_CPU)
+* @buf:		Buffer to place string
+* @size:	Size of string space
+* @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
+*/
+int x86_cpu_get_desc(struct udevice *dev, char *buf, int size);
+
+/**
  * cpu_call64() - Jump to a 64-bit Linux kernel (internal function)
  *
  * The kernel is uncompressed and the 64-bit entry point is expected to be
arch/x86/include/asm/u-boot-x86.h +2 -0
index 122e054..be103c0 100644
@@ -69,6 +69,8 @@ uint64_t timer_get_tsc(void);
 
 void quick_ram_check(void);
 
+int x86_init_cpus(void);
+
 #define PCI_VGA_RAM_IMAGE_START		0xc0000
 
 #endif	/* _U_BOOT_I386_H_ */
common/board_r.c +1 -1
index 307124e..1a46f62 100644
@@ -779,7 +779,7 @@ init_fnc_t init_sequence_r[] = {
 	initr_flash,
 #endif
 	INIT_FUNC_WATCHDOG_RESET
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86)
 	/* initialize higher level parts of CPU like time base and timers */
 	cpu_init_r,
 #endif
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#8 lore raw

PATCH v3 3/5 x86: Allow CPUs to be set up after relocation

Quoted 10 lines · Simon Glass

This permits init of additional CPU cores after relocation and when driver model is ready.

---

Changes in v3: None
Changes in v2:
- Correct 'I2C uclass' typo
- Add blank line in x86_cpu_get_desc()

[snip]

Regards,
Bin

#9 lore raw

PATCH v3 3/5 x86: Allow CPUs to be set up after relocation

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

This permits init of additional CPU cores after relocation and when driver model is ready.

---

Quoted 6 lines
Quoted 4 lines

Changes in v3: None
Changes in v2:
- Correct 'I2C uclass' typo
- Add blank line in x86_cpu_get_desc()

Applied to u-boot-x86.

#10 lore raw

PATCH v3 4/5 x86: Add a CPU driver for baytrail

In reply to Simon Glass

This driver supports multi-core init and sets up the CPU frequencies correctly.

---

Changes in v3:
- Collect all new MSRs into msr-index.h
- Spell 'BayTrail' like so
- Make set_max_freq() static

Changes in v2: None

 arch/x86/cpu/baytrail/Makefile                    |   1 +
 arch/x86/cpu/baytrail/cpu.c                       | 205 ++++++++++++++++++++++
 arch/x86/include/asm/arch-ivybridge/model_206ax.h |   2 -
 arch/x86/include/asm/msr-index.h                  |  22 ++-
 arch/x86/include/asm/turbo.h                      |   3 -
 5 files changed, 227 insertions(+), 6 deletions(-)
 create mode 100644 arch/x86/cpu/baytrail/cpu.c
arch/x86/cpu/baytrail/Makefile +1 -0
index 8914e8b..c78b644 100644
@@ -4,6 +4,7 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
+obj-y += cpu.o
 obj-y += early_uart.o
 obj-y += fsp_configs.o
 obj-y += pci.o
arch/x86/cpu/baytrail/cpu.c new file +205 -0

205 lines not on this page · raw message

arch/x86/include/asm/arch-ivybridge/model_206ax.h +0 -2
index 7b4f2e7..d2f9006 100644
@@ -37,7 +37,6 @@
 #define MSR_MISC_PWR_MGMT		0x1aa
 #define  MISC_PWR_MGMT_EIST_HW_DIS	(1 << 0)
 #define MSR_TURBO_RATIO_LIMIT		0x1ad
-#define MSR_POWER_CTL			0x1fc
 
 #define MSR_PKGC3_IRTL			0x60a
 #define MSR_PKGC6_IRTL			0x60b
@@ -63,7 +62,6 @@
 #define MSR_PP1_CURRENT_CONFIG		0x602
 #define  PP1_CURRENT_LIMIT_SNB		(35 << 3) /* 35 A */
 #define  PP1_CURRENT_LIMIT_IVB		(50 << 3) /* 50 A */
-#define MSR_PKG_POWER_SKU_UNIT		0x606
 #define MSR_PKG_POWER_SKU		0x614
 
 #define IVB_CONFIG_TDP_MIN_CPUID	0x306a2
arch/x86/include/asm/msr-index.h +21 -1
index 2cbb270..38dbb31 100644
@@ -53,10 +53,17 @@
 #define SNB_C1_AUTO_UNDEMOTE		(1UL << 27)
 #define SNB_C3_AUTO_UNDEMOTE		(1UL << 28)
 
+#define MSR_BSEL_CR_OVERCLOCK_CONTROL	0x000000cd
 #define MSR_PLATFORM_INFO		0x000000ce
+#define MSR_PMG_CST_CONFIG_CONTROL	0x000000e2
+#define SINGLE_PCTL			(1 << 11)
+
 #define MSR_MTRRcap			0x000000fe
 #define MSR_IA32_BBL_CR_CTL		0x00000119
 #define MSR_IA32_BBL_CR_CTL3		0x0000011e
+#define MSR_POWER_MISC			0x00000120
+#define ENABLE_ULFM_AUTOCM_MASK		(1 << 2)
+#define ENABLE_INDP_AUTOCM_MASK		(1 << 3)
 
 #define MSR_IA32_SYSENTER_CS		0x00000174
 #define MSR_IA32_SYSENTER_ESP		0x00000175
@@ -66,6 +73,7 @@
 #define MSR_IA32_MCG_STATUS		0x0000017a
 #define MSR_IA32_MCG_CTL		0x0000017b
 
+#define MSR_IA32_MISC_ENABLES		0x000001a0
 #define MSR_OFFCORE_RSP_0		0x000001a6
 #define MSR_OFFCORE_RSP_1		0x000001a7
 #define MSR_NHM_TURBO_RATIO_LIMIT	0x000001ad
@@ -73,6 +81,7 @@
 
 #define MSR_LBR_SELECT			0x000001c8
 #define MSR_LBR_TOS			0x000001c9
+#define MSR_POWER_CTL			0x000001fc
 #define MSR_LBR_NHM_FROM		0x00000680
 #define MSR_LBR_NHM_TO			0x000006c0
 #define MSR_LBR_CORE_FROM		0x00000040
@@ -136,7 +145,7 @@
 
 /* Run Time Average Power Limiting (RAPL) Interface */
 
-#define MSR_RAPL_POWER_UNIT		0x00000606
+#define MSR_PKG_POWER_SKU_UNIT		0x00000606
 
 #define MSR_PKG_POWER_LIMIT		0x00000610
 #define MSR_PKG_ENERGY_STATUS		0x00000611
@@ -158,6 +167,16 @@
 #define MSR_PP1_POLICY			0x00000642
 
 #define MSR_CORE_C1_RES			0x00000660
+#define MSR_IACORE_RATIOS		0x0000066a
+#define MSR_IACORE_TURBO_RATIOS		0x0000066c
+#define MSR_IACORE_VIDS			0x0000066b
+#define MSR_IACORE_TURBO_VIDS		0x0000066d
+#define MSR_PKG_TURBO_CFG1		0x00000670
+#define MSR_CPU_TURBO_WKLD_CFG1		0x00000671
+#define MSR_CPU_TURBO_WKLD_CFG2		0x00000672
+#define MSR_CPU_THERM_CFG1		0x00000673
+#define MSR_CPU_THERM_CFG2		0x00000674
+#define MSR_CPU_THERM_SENS_CFG		0x00000675
 
 #define MSR_AMD64_MC0_MASK		0xc0010044
 
@@ -348,6 +367,7 @@
 #define MSR_THERM2_CTL_TM_SELECT	(1ULL << 16)
 
 #define MSR_IA32_MISC_ENABLE		0x000001a0
+#define H_MISC_DISABLE_TURBO		(1 << 6)
 
 #define MSR_IA32_TEMPERATURE_TARGET	0x000001a2
 
arch/x86/include/asm/turbo.h +0 -3
index bb0d4b4..21b910b 100644
@@ -12,9 +12,6 @@
 #define CPUID_LEAF_PM		6
 #define PM_CAP_TURBO_MODE	(1 << 1)
 
-#define MSR_IA32_MISC_ENABLES	0x1a0
-#define H_MISC_DISABLE_TURBO	(1 << 6)
-
 enum {
 	TURBO_UNKNOWN,
 	TURBO_UNAVAILABLE,
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#11 lore raw

PATCH v3 4/5 x86: Add a CPU driver for baytrail

Quoted 11 lines · Simon Glass

This driver supports multi-core init and sets up the CPU frequencies correctly.

---

Changes in v3:
- Collect all new MSRs into msr-index.h
- Spell 'BayTrail' like so
- Make set_max_freq() static

[snip]

Regards,
Bin

#12 lore raw

PATCH v3 4/5 x86: Add a CPU driver for baytrail

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

This driver supports multi-core init and sets up the CPU frequencies correctly.

---

Quoted 7 lines
Quoted 5 lines

Changes in v3:
- Collect all new MSRs into msr-index.h
- Spell 'BayTrail' like so
- Make set_max_freq() static

Applied to u-boot-x86.

#13 lore raw

PATCH v3 5/5 x86: Enable multi-core init for Minnowboard MAX

In reply to Simon Glass

Enable the CPU uclass and Simple Firmware interface for Minnowbaord MAX. This enables multi-core support in Linux.

---

Changes in v3: None
Changes in v2: None

 arch/x86/dts/minnowmax.dts  | 20 ++++++++++++++++++++
 configs/minnowmax_defconfig |  4 ++++
 2 files changed, 24 insertions(+)
arch/x86/dts/minnowmax.dts +20 -0
index 0233f61..7103bc5 100644
@@ -68,6 +68,26 @@
 		stdout-path = "/serial";
 	};
 
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "intel,baytrail-cpu";
+			reg = <0>;
+			intel,apic-id = <0>;
+		};
+
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "intel,baytrail-cpu";
+			reg = <1>;
+			intel,apic-id = <4>;
+		};
+
+	};
+
 	spi {
 		#address-cells = <1>;
 		#size-cells = <0>;
configs/minnowmax_defconfig +4 -0
index c59f4ac..426fb52 100644
@@ -8,3 +8,7 @@ CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
 CONFIG_FRAMEBUFFER_VESA_MODE_11A=y
 CONFIG_MMCONF_BASE_ADDRESS=0xe0000000
 CONFIG_HAVE_INTEL_ME=y
+CONFIG_GENERATE_SFI_TABLE=y
+CONFIG_CPU=y
+CONFIG_CMD_CPU=y
+CONFIG_SMP=y
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#14 lore raw

PATCH v3 5/5 x86: Enable multi-core init for Minnowboard MAX

Quoted 5 lines · Simon Glass

Enable the CPU uclass and Simple Firmware interface for Minnowbaord MAX. This enables multi-core support in Linux.

Applied to u-boot-x86.

Quoted 8 lines

---

Changes in v3: None
Changes in v2: None

 arch/x86/dts/minnowmax.dts  | 20 ++++++++++++++++++++
 configs/minnowmax_defconfig |  4 ++++
 2 files changed, 24 insertions(+)
#15 lore raw

v3 cover x86: Add CPU uclass and multi-core support for Minnowboard MAX

In reply to Simon Glass

Hi Bin,

Quoted 7 lines · Simon Glass

This series adds a new CPU uclass which is intended to be useful on any architecture. So far it has a very simple interface and a command to show CPU details.

This series also introduces multi-core init for x86. It is implemented and enabled on Minnowboard MAX, a single/dual-core Atom board. The CPU uclass

is

Quoted 1 line

implemented for x86 and the Simple Firmware Interface provides these

details

Quoted 20 lines

to the kernel, since ACPI is not yet available.

With these changes Minnowboard MAX can boot into Linux with both cores enabled.

This series is available at u-boot-x86 branch 'cpu-working'.

Changes in v3:
- Rename CONFIG_STACK_SIZE to CONFIG_AP_STACK_SIZE
- Remove sipi_vector_location and sipi_vector_location_size variables
- Remove annoying /* 1ms */ comments
- Rename sipi.S to sipi_vector.S
- Correct 'ap_start32' to 'ap_start'
- Use macros for cr0 bit fields
- Correct style in a multi-line comment
- Use UCODE_HEADER_LEN instead of 48
- Remove unnecessary underscores in MP_FR_BLOCK_APS and MP_FR_NOBLOCK_APS
- Use 'cpu number' instead of 'coreboot cpu number'
- Remove a stray blank line in sipi.h
- Enhance comment for @microcode_lock

Quoted 8 lines

- Rename SMM_DEFAULT_BASE/SIZE to AP_DEFAULT_BASE/SIZE and drop smm.h
- Use data32 instead of our own 'o32'
- Move NUM_FIXED_MTRRS to mtrr.h
- Avoid using asmlinkage on ap_init()
- Add msr_clrbits_64() too
- Collect all new MSRs into msr-index.h
- Spell 'BayTrail' like so
- Make set_max_freq() static

I did not sort out the secondary CPU init in this series. I will take a look.

Quoted 12 lines

Changes in v2:
- Correct 'I2C uclass' typo
- Add blank line in x86_cpu_get_desc()

Simon Glass (5):
x86: Add multi-processor init
x86: Add functions to set and clear bits on MSRs
x86: Allow CPUs to be set up after relocation
x86: Add a CPU driver for baytrail
x86: Enable multi-core init for Minnowboard MAX

Quoted 8 lines
 arch/x86/Kconfig                                  |  30 ++
 arch/x86/cpu/Makefile                             |   2 +
 arch/x86/cpu/baytrail/Makefile                    |   1 +
 arch/x86/cpu/baytrail/cpu.c                       | 205 +++++++++
 arch/x86/cpu/cpu.c                                |  38 ++
 arch/x86/cpu/ivybridge/car.S                      |   1 +
 arch/x86/cpu/ivybridge/model_206ax.c              |   4 +-
 arch/x86/cpu/mp_init.c                            | 496

++++++++++++++++++++++

Quoted 22 lines
 arch/x86/cpu/sipi_vector.S                        | 216 ++++++++++
 arch/x86/dts/minnowmax.dts                        |  20 +
 arch/x86/include/asm/arch-ivybridge/microcode.h   |   3 -
 arch/x86/include/asm/arch-ivybridge/model_206ax.h |   2 -
 arch/x86/include/asm/cpu.h                        |  14 +
 arch/x86/include/asm/mp.h                         |  94 ++++
 arch/x86/include/asm/msr-index.h                  |  22 +-
 arch/x86/include/asm/msr.h                        |  28 ++
 arch/x86/include/asm/mtrr.h                       |   6 +-
 arch/x86/include/asm/processor.h                  |   3 +
 arch/x86/include/asm/sipi.h                       |  86 ++++
 arch/x86/include/asm/turbo.h                      |   3 -
 arch/x86/include/asm/u-boot-x86.h                 |   2 +
 common/board_r.c                                  |   2 +-
 configs/minnowmax_defconfig                       |   4 +
 23 files changed, 1268 insertions(+), 14 deletions(-)
 create mode 100644 arch/x86/cpu/baytrail/cpu.c
 create mode 100644 arch/x86/cpu/mp_init.c
 create mode 100644 arch/x86/cpu/sipi_vector.S
 create mode 100644 arch/x86/include/asm/mp.h
 create mode 100644 arch/x86/include/asm/sipi.h
Quoted 3 lines

--
2.2.0.rc0.207.ga3a616c

Regards,
Simon

#16 lore raw

v3 cover x86: Add CPU uclass and multi-core support for Minnowboard MAX

Hi Simon,

Quoted 42 lines · Simon Glass

Hi Bin,

Quoted 30 lines · Simon Glass

This series adds a new CPU uclass which is intended to be useful on any architecture. So far it has a very simple interface and a command to show CPU details.

This series also introduces multi-core init for x86. It is implemented and enabled on Minnowboard MAX, a single/dual-core Atom board. The CPU uclass is
implemented for x86 and the Simple Firmware Interface provides these details
to the kernel, since ACPI is not yet available.

With these changes Minnowboard MAX can boot into Linux with both cores enabled.

This series is available at u-boot-x86 branch 'cpu-working'.

Changes in v3:
- Rename CONFIG_STACK_SIZE to CONFIG_AP_STACK_SIZE
- Remove sipi_vector_location and sipi_vector_location_size variables
- Remove annoying /* 1ms */ comments
- Rename sipi.S to sipi_vector.S
- Correct 'ap_start32' to 'ap_start'
- Use macros for cr0 bit fields
- Correct style in a multi-line comment
- Use UCODE_HEADER_LEN instead of 48
- Remove unnecessary underscores in MP_FR_BLOCK_APS and MP_FR_NOBLOCK_APS
- Use 'cpu number' instead of 'coreboot cpu number'
- Remove a stray blank line in sipi.h
- Enhance comment for @microcode_lock

Quoted 8 lines

- Rename SMM_DEFAULT_BASE/SIZE to AP_DEFAULT_BASE/SIZE and drop smm.h
- Use data32 instead of our own 'o32'
- Move NUM_FIXED_MTRRS to mtrr.h
- Avoid using asmlinkage on ap_init()
- Add msr_clrbits_64() too
- Collect all new MSRs into msr-index.h
- Spell 'BayTrail' like so
- Make set_max_freq() static

Quoted 3 lines

I did not sort out the secondary CPU init in this series. I will take a look.

Thanks. What about the LAPIC patch? Is it dropped?
http://patchwork.ozlabs.org/patch/465854/

[snip]

Regards,
Bin

#17 lore raw

v3 cover x86: Add CPU uclass and multi-core support for Minnowboard MAX

Hi Bin,

Quoted 45 lines · Bin Meng

Hi Simon,

Quoted 42 lines · Simon Glass

Hi Bin,

Quoted 38 lines · Simon Glass

This series adds a new CPU uclass which is intended to be useful on any architecture. So far it has a very simple interface and a command to show CPU details.

This series also introduces multi-core init for x86. It is implemented and enabled on Minnowboard MAX, a single/dual-core Atom board. The CPU uclass is
implemented for x86 and the Simple Firmware Interface provides these details
to the kernel, since ACPI is not yet available.

With these changes Minnowboard MAX can boot into Linux with both cores enabled.

This series is available at u-boot-x86 branch 'cpu-working'.

Changes in v3:
- Rename CONFIG_STACK_SIZE to CONFIG_AP_STACK_SIZE
- Remove sipi_vector_location and sipi_vector_location_size variables
- Remove annoying /* 1ms */ comments
- Rename sipi.S to sipi_vector.S
- Correct 'ap_start32' to 'ap_start'
- Use macros for cr0 bit fields
- Correct style in a multi-line comment
- Use UCODE_HEADER_LEN instead of 48
- Remove unnecessary underscores in MP_FR_BLOCK_APS and MP_FR_NOBLOCK_APS
- Use 'cpu number' instead of 'coreboot cpu number'
- Remove a stray blank line in sipi.h
- Enhance comment for @microcode_lock
- Rename SMM_DEFAULT_BASE/SIZE to AP_DEFAULT_BASE/SIZE and drop smm.h
- Use data32 instead of our own 'o32'
- Move NUM_FIXED_MTRRS to mtrr.h
- Avoid using asmlinkage on ap_init()
- Add msr_clrbits_64() too
- Collect all new MSRs into msr-index.h
- Spell 'BayTrail' like so
- Make set_max_freq() static

Quoted 6 lines
Quoted 3 lines

I did not sort out the secondary CPU init in this series. I will take a look.

Thanks. What about the LAPIC patch? Is it dropped?
http://patchwork.ozlabs.org/patch/465854/

Yes, that was a clean-up patch so not required. As you noticed I did not go far enough so I'll take another crack at it later.

Regards,
Simon