Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jun 2019 21:24:55 +0000 (UTC)
From:      "Jayachandran C." <jchandra@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349348 - head/sys/arm64/acpica
Message-ID:  <201906242124.x5OLOtUl085319@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jchandra
Date: Mon Jun 24 21:24:55 2019
New Revision: 349348
URL: https://svnweb.freebsd.org/changeset/base/349348

Log:
  arm64 acpi_iort: add some error handling
  
  Print warnings for some bad kernel configurations (like NUMA disabled
  with multiple domains). Check and report some firmware errors (like
  incorrect proximity domain entries).
  
  Differential Revision:	https://reviews.freebsd.org/D20416

Modified:
  head/sys/arm64/acpica/acpi_iort.c

Modified: head/sys/arm64/acpica/acpi_iort.c
==============================================================================
--- head/sys/arm64/acpica/acpi_iort.c	Mon Jun 24 21:13:45 2019	(r349347)
+++ head/sys/arm64/acpica/acpi_iort.c	Mon Jun 24 21:24:55 2019	(r349348)
@@ -370,19 +370,44 @@ srat_resolve_its_pxm(ACPI_SUBTABLE_HEADER *entry, void
 	ACPI_SRAT_GIC_ITS_AFFINITY *gicits;
 	struct iort_node *its_node;
 	struct iort_its_entry *its_entry;
-	int i, matches;
+	int *map_counts;
+	int i, matches, dom;
 
 	if (entry->Type != ACPI_SRAT_TYPE_GIC_ITS_AFFINITY)
 		return;
 
 	matches = 0;
+	map_counts = arg;
 	gicits = (ACPI_SRAT_GIC_ITS_AFFINITY *)entry;
+	dom = acpi_map_pxm_to_vm_domainid(gicits->ProximityDomain);
+
+	/*
+	 * Catch firmware and config errors. map_counts keeps a
+	 * count of ProximityDomain values mapping to a domain ID
+	 */
+#if MAXMEMDOM > 1
+	if (dom == -1)
+		printf("Firmware Error: Proximity Domain %d could not be"
+		    " mapped for GIC ITS ID %d!\n",
+		    gicits->ProximityDomain, gicits->ItsId);
+#endif
+	/* use dom + 1 as index to handle the case where dom == -1 */
+	i = ++map_counts[dom + 1];
+	if (i > 1) {
+#ifdef NUMA
+		if (dom != -1)
+			printf("ERROR: Multiple Proximity Domains map to the"
+			    " same NUMA domain %d!\n", dom);
+#else
+		printf("WARNING: multiple Proximity Domains in SRAT but NUMA"
+		    " NOT enabled!\n");
+#endif
+	}
 	TAILQ_FOREACH(its_node, &its_groups, next) {
 		its_entry = its_node->entries.its;
 		for (i = 0; i < its_node->nentries; i++, its_entry++) {
 			if (its_entry->its_id == gicits->ItsId) {
-				its_entry->pxm = acpi_map_pxm_to_vm_domainid(
-				    gicits->ProximityDomain);
+				its_entry->pxm = dom;
 				matches++;
 			}
 		}
@@ -401,6 +426,7 @@ iort_post_process_its(void)
 	ACPI_TABLE_MADT *madt;
 	ACPI_TABLE_SRAT *srat;
 	vm_paddr_t madt_pa, srat_pa;
+	int map_counts[MAXMEMDOM + 1] = { 0 };
 
 	/* Check ITS block in MADT */
 	madt_pa = acpi_find_table(ACPI_SIG_MADT);
@@ -417,7 +443,7 @@ iort_post_process_its(void)
 		srat = acpi_map_table(srat_pa, ACPI_SIG_SRAT);
 		KASSERT(srat != NULL, ("can't map SRAT!"));
 		acpi_walk_subtables(srat + 1, (char *)srat + srat->Header.Length,
-		    srat_resolve_its_pxm, NULL);
+		    srat_resolve_its_pxm, map_counts);
 		acpi_unmap_table(srat);
 	}
 	return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906242124.x5OLOtUl085319>