svn commit: r323921 - stable/11/sys/x86/iommu

Konstantin Belousov kib at FreeBSD.org
Fri Sep 22 10:51:33 UTC 2017


Author: kib
Date: Fri Sep 22 10:51:32 2017
New Revision: 323921
URL: https://svnweb.freebsd.org/changeset/base/323921

Log:
  MFC r323326:
  Use IOAPIC PCI rid as the interrupt TLP source id for DMAR interrupt
  remapping.

Modified:
  stable/11/sys/x86/iommu/intel_drv.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/x86/iommu/intel_drv.c
==============================================================================
--- stable/11/sys/x86/iommu/intel_drv.c	Fri Sep 22 10:49:04 2017	(r323920)
+++ stable/11/sys/x86/iommu/intel_drv.c	Fri Sep 22 10:51:32 2017	(r323921)
@@ -71,6 +71,9 @@ __FBSDID("$FreeBSD$");
 
 #ifdef DEV_APIC
 #include "pcib_if.h"
+#include <machine/intr_machdep.h>
+#include <x86/apicreg.h>
+#include <x86/apicvar.h>
 #endif
 
 #define	DMAR_FAULT_IRQ_RID	0
@@ -788,6 +791,9 @@ dmar_find_nonpci(u_int id, u_int entry_type, uint16_t 
 	ACPI_DMAR_DEVICE_SCOPE *devscope;
 	ACPI_DMAR_PCI_PATH *path;
 	char *ptr, *ptrend;
+#ifdef DEV_APIC
+	int error;
+#endif
 	int i;
 
 	for (i = 0; i < dmar_devcnt; i++) {
@@ -809,6 +815,17 @@ dmar_find_nonpci(u_int id, u_int entry_type, uint16_t 
 				continue;
 			if (devscope->EnumerationId != id)
 				continue;
+#ifdef DEV_APIC
+			if (entry_type == ACPI_DMAR_SCOPE_TYPE_IOAPIC) {
+				error = ioapic_get_rid(id, rid);
+				/*
+				 * If our IOAPIC has PCI bindings then
+				 * use the PCI device rid.
+				 */
+				if (error == 0)
+					return (unit);
+			}
+#endif
 			if (devscope->Length - sizeof(ACPI_DMAR_DEVICE_SCOPE)
 			    == 2) {
 				if (rid != NULL) {
@@ -818,12 +835,11 @@ dmar_find_nonpci(u_int id, u_int entry_type, uint16_t 
 					    path->Device, path->Function);
 				}
 				return (unit);
-			} else {
-				/* XXXKIB */
-				printf(
-		       "dmar_find_nonpci: id %d type %d path length != 2\n",
-				    id, entry_type);
 			}
+			printf(
+		           "dmar_find_nonpci: id %d type %d path length != 2\n",
+			    id, entry_type);
+			break;
 		}
 	}
 	return (NULL);


More information about the svn-src-all mailing list