Attention is currently required from: Arthur Heymans, Christian Walter, Johnny Lin, Jonathan Zhang, Lean Sheng Tan, Patrick Rudolph, Tim Chu.

Shuo Liu has uploaded this change for review.

View Change

soc/intel/xeon_sp/spr: Improves CPU codes

1. xeonsp_acpi_create_madt_lapics is removed due to ACPI common
code can handle this well with ACPI_COMMON_MADT_LAPIC set.

2. Improvement in log prints, comments and the file include list.

Change-Id: I2bc94391f060cec9de91183021da03bc5c7438c0
Signed-off-by: Shuo Liu <shuo.liu@intel.com>
---
M src/soc/intel/xeon_sp/include/soc/acpi.h
M src/soc/intel/xeon_sp/spr/cpu.c
M src/soc/intel/xeon_sp/spr/soc_acpi.c
3 files changed, 10 insertions(+), 34 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/97/82097/1
diff --git a/src/soc/intel/xeon_sp/include/soc/acpi.h b/src/soc/intel/xeon_sp/include/soc/acpi.h
index e374544..e11b19e 100644
--- a/src/soc/intel/xeon_sp/include/soc/acpi.h
+++ b/src/soc/intel/xeon_sp/include/soc/acpi.h
@@ -18,7 +18,6 @@

unsigned long northbridge_write_acpi_tables(const struct device *device,
unsigned long current, struct acpi_rsdp *rsdp);
-unsigned long xeonsp_acpi_create_madt_lapics(unsigned long current);
unsigned long acpi_fill_cedt(unsigned long current);
unsigned long acpi_fill_hmat(unsigned long current);
unsigned long cxl_fill_srat(unsigned long current);
diff --git a/src/soc/intel/xeon_sp/spr/cpu.c b/src/soc/intel/xeon_sp/spr/cpu.c
index f9c8e26..1cb16e5 100644
--- a/src/soc/intel/xeon_sp/spr/cpu.c
+++ b/src/soc/intel/xeon_sp/spr/cpu.c
@@ -1,28 +1,17 @@
/* SPDX-License-Identifier: GPL-2.0-only */

-#include <acpi/acpigen.h>
-#include <acpi/acpi.h>
-#include <console/console.h>
#include <console/debug.h>
-#include <cpu/cpu.h>
-#include <cpu/intel/cpu_ids.h>
#include <cpu/intel/common/common.h>
-#include <cpu/intel/em64t101_save_state.h>
#include <cpu/intel/microcode.h>
#include <cpu/intel/smm_reloc.h>
#include <cpu/intel/turbo.h>
-#include <cpu/x86/lapic.h>
#include <cpu/x86/mp.h>
-#include <cpu/x86/mtrr.h>
#include <cpu/x86/topology.h>
-#include <device/pci_mmio_cfg.h>
#include <intelblocks/cpulib.h>
#include <intelblocks/mp_init.h>
#include <intelpch/lockdown.h>
#include <soc/msr.h>
-#include <soc/pci_devs.h>
#include <soc/pm.h>
-#include <soc/soc_util.h>
#include <soc/smmrelocate.h>
#include <soc/util.h>

@@ -235,6 +224,12 @@
{
unsigned int num_phys = 0, num_virts = 0;

+ /*
+ * This call calculates the thread count which is corresponding to num_virts
+ * (logical cores), while num_phys is corresponding to physical cores (in SMT
+ * system, one physical core has multiple threads, a.k.a. logical cores).
+ * Hence num_phys is not actually used.
+ */
cpu_read_topology(&num_phys, &num_virts);
printk(BIOS_SPEW, "Detected %u cores and %u threads\n", num_phys, num_virts);
return num_virts * soc_get_num_cpus();
@@ -275,10 +270,11 @@
microcode_patch = intel_microcode_find();

if (!microcode_patch)
- printk(BIOS_ERR, "microcode not found in CBFS!\n");
+ printk(BIOS_WARNING, "microcode not found in CBFS and the update will be skipped!\n");

intel_microcode_load_unlocked(microcode_patch);

- if (mp_init_with_smm(bus, &mp_ops) < 0)
- printk(BIOS_ERR, "MP initialization failure.\n");
+ enum cb_err ret = mp_init_with_smm(bus, &mp_ops);
+ if (ret < 0)
+ printk(BIOS_ERR, "MP initialization failure %d.\n", ret);
}
diff --git a/src/soc/intel/xeon_sp/spr/soc_acpi.c b/src/soc/intel/xeon_sp/spr/soc_acpi.c
index 1249b8f..c939dee 100644
--- a/src/soc/intel/xeon_sp/spr/soc_acpi.c
+++ b/src/soc/intel/xeon_sp/spr/soc_acpi.c
@@ -155,25 +155,6 @@
acpigen_pop_len();
}

-unsigned long xeonsp_acpi_create_madt_lapics(unsigned long current)
-{
- struct device *cpu;
- uint8_t num_cpus = 0;
-
- for (cpu = all_devices; cpu; cpu = cpu->next) {
- if ((cpu->path.type != DEVICE_PATH_APIC)
- || (cpu->upstream->dev->path.type != DEVICE_PATH_CPU_CLUSTER)) {
- continue;
- }
- if (!cpu->enabled)
- continue;
- current = acpi_create_madt_one_lapic(current, num_cpus, cpu->path.apic.apic_id);
- num_cpus++;
- }
-
- return current;
-}
-
unsigned long acpi_fill_cedt(unsigned long current)
{
const IIO_UDS *hob = get_iio_uds();

To view, visit change 82097. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I2bc94391f060cec9de91183021da03bc5c7438c0
Gerrit-Change-Number: 82097
Gerrit-PatchSet: 1
Gerrit-Owner: Shuo Liu <shuo.liu@intel.com>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Reviewer: Christian Walter <christian.walter@9elements.com>
Gerrit-Reviewer: Johnny Lin <Johnny_Lin@wiwynn.com>
Gerrit-Reviewer: Jonathan Zhang <jon.zhixiong.zhang@gmail.com>
Gerrit-Reviewer: Lean Sheng Tan <sheng.tan@9elements.com>
Gerrit-Reviewer: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-Reviewer: Tim Chu <Tim.Chu@quantatw.com>
Gerrit-Attention: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-Attention: Jonathan Zhang <jon.zhixiong.zhang@gmail.com>
Gerrit-Attention: Johnny Lin <Johnny_Lin@wiwynn.com>
Gerrit-Attention: Christian Walter <christian.walter@9elements.com>
Gerrit-Attention: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Attention: Lean Sheng Tan <sheng.tan@9elements.com>
Gerrit-Attention: Tim Chu <Tim.Chu@quantatw.com>
Gerrit-MessageType: newchange