[coreboot-gerrit] Change in coreboot[master]: x86/mpspec: order the I/O APICs by the APIC Id

Lubomir Rintel (Code Review) gerrit at coreboot.org
Mon Apr 23 23:37:31 CEST 2018


Lubomir Rintel has uploaded this change for review. ( https://review.coreboot.org/25799


Change subject: x86/mpspec: order the I/O APICs by the APIC Id
......................................................................

x86/mpspec: order the I/O APICs by the APIC Id

Linux (4.16) assumes that the PIT interrupt is connected to the pin 0 of the
IOAPIC[0] and panics otherwise.

This might be a Linux bug. The MP Specification 1.4 does seem to mandate
sequential ordering for Bus entries, but not for the I/O APICs.

Change-Id: Ibf823eb5b3a29e4590cba915069cdfe5f780edcd
Signed-off-by: Lubomir Rintel <lkundrak at v3.sk>
---
M src/arch/x86/mpspec.c
1 file changed, 23 insertions(+), 5 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/99/25799/1

diff --git a/src/arch/x86/mpspec.c b/src/arch/x86/mpspec.c
index d41abaf..fd3d837 100644
--- a/src/arch/x86/mpspec.c
+++ b/src/arch/x86/mpspec.c
@@ -523,6 +523,23 @@
 	return smp_next_mpe_entry(mc);
 }
 
+static struct device *find_next_ioapic(unsigned last_ioapic_id)
+{
+	struct device *dev;
+	struct device *result = NULL;
+	unsigned ioapic_id = MAX_APICS;
+
+	for (dev = all_devices; dev; dev = dev->next) {
+		if (dev->path.type == DEVICE_PATH_IOAPIC)
+		if (dev->path.type == DEVICE_PATH_IOAPIC &&
+		    dev->path.ioapic.ioapic_id > last_ioapic_id &&
+		    dev->path.ioapic.ioapic_id <= ioapic_id) {
+			result = dev;
+		}
+	}
+	return result;
+}
+
 unsigned long __attribute__((weak)) write_smp_table(unsigned long addr)
 {
 	struct drivers_generic_ioapic_config *ioapic_config;
@@ -534,6 +551,7 @@
 	void *tmp, *v;
 	int isaioapic = -1, have_fixed_entries;
 	struct pci_irq_info *pci_irq_info;
+	unsigned ioapic_id = 0;
 
 	v = smp_write_floating_table(addr, 0);
 	mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
@@ -544,17 +562,17 @@
 
 	mptable_write_buses(mc, NULL, &isa_bus);
 
-	for (dev = all_devices; dev; dev = dev->next) {
-		if (dev->path.type != DEVICE_PATH_IOAPIC)
-			continue;
-
+	while ((dev = find_next_ioapic(ioapic_id))) {
 		ioapic_config = dev->chip_info;
 		if (!ioapic_config) {
 			printk(BIOS_ERR, "%s has no config, ignoring\n",
 				dev_path(dev));
+			ioapic_id++;
 			continue;
 		}
-		smp_write_ioapic(mc, dev->path.ioapic.ioapic_id,
+
+		ioapic_id = dev->path.ioapic.ioapic_id;
+		smp_write_ioapic(mc, ioapic_id,
 				     ioapic_config->version,
 				     ioapic_config->base);
 

-- 
To view, visit https://review.coreboot.org/25799
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf823eb5b3a29e4590cba915069cdfe5f780edcd
Gerrit-Change-Number: 25799
Gerrit-PatchSet: 1
Gerrit-Owner: Lubomir Rintel <lkundrak at v3.sk>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180423/9065c0e2/attachment.html>


More information about the coreboot-gerrit mailing list