git: 66b62c07fb91 - stable/14 - Intel DMAR: remove the 'dev' member

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 07 Jun 2024 10:15:26 UTC
The branch stable/14 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=66b62c07fb9187abe14c2f84a7e1f3d858fb863e

commit 66b62c07fb9187abe14c2f84a7e1f3d858fb863e
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-05-30 14:05:22 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-06-07 10:15:11 +0000

    Intel DMAR: remove the 'dev' member
    
    (cherry picked from commit 164fdee11164e9a43e279f9e45117e7573ddc15f)
---
 sys/x86/iommu/intel_dmar.h    | 1 -
 sys/x86/iommu/intel_drv.c     | 1 -
 sys/x86/iommu/intel_intrmap.c | 4 ++--
 sys/x86/iommu/intel_quirks.c  | 7 ++++---
 sys/x86/iommu/intel_utils.c   | 2 +-
 5 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/sys/x86/iommu/intel_dmar.h b/sys/x86/iommu/intel_dmar.h
index 8289478aed19..b7f0300e16f0 100644
--- a/sys/x86/iommu/intel_dmar.h
+++ b/sys/x86/iommu/intel_dmar.h
@@ -123,7 +123,6 @@ struct dmar_msi_data {
 
 struct dmar_unit {
 	struct iommu_unit iommu;
-	device_t dev;
 	uint16_t segment;
 	uint64_t base;
 
diff --git a/sys/x86/iommu/intel_drv.c b/sys/x86/iommu/intel_drv.c
index 9a2fedf90b6a..0b25620114cd 100644
--- a/sys/x86/iommu/intel_drv.c
+++ b/sys/x86/iommu/intel_drv.c
@@ -410,7 +410,6 @@ dmar_attach(device_t dev)
 	int i, error;
 
 	unit = device_get_softc(dev);
-	unit->dev = dev;
 	unit->iommu.unit = device_get_unit(dev);
 	unit->iommu.dev = dev;
 	dmaru = dmar_find_by_index(unit->iommu.unit);
diff --git a/sys/x86/iommu/intel_intrmap.c b/sys/x86/iommu/intel_intrmap.c
index 02bf58dde299..137801125c38 100644
--- a/sys/x86/iommu/intel_intrmap.c
+++ b/sys/x86/iommu/intel_intrmap.c
@@ -272,7 +272,7 @@ dmar_ir_program_irte(struct dmar_unit *unit, u_int idx, uint64_t low,
 	high = DMAR_IRTE2_SVT_RID | DMAR_IRTE2_SQ_RID |
 	    DMAR_IRTE2_SID_RID(rid);
 	if (bootverbose) {
-		device_printf(unit->dev,
+		device_printf(unit->iommu.dev,
 		    "programming irte[%d] rid %#x high %#jx low %#jx\n",
 		    idx, rid, (uintmax_t)high, (uintmax_t)low);
 	}
@@ -336,7 +336,7 @@ dmar_init_irt(struct dmar_unit *unit)
 	if (!unit->qi_enabled) {
 		unit->ir_enabled = 0;
 		if (bootverbose)
-			device_printf(unit->dev,
+			device_printf(unit->iommu.dev,
 	     "QI disabled, disabling interrupt remapping\n");
 		return (0);
 	}
diff --git a/sys/x86/iommu/intel_quirks.c b/sys/x86/iommu/intel_quirks.c
index 486bd1bc9496..b405a24c4c8c 100644
--- a/sys/x86/iommu/intel_quirks.c
+++ b/sys/x86/iommu/intel_quirks.c
@@ -109,7 +109,7 @@ dmar_match_quirks(struct dmar_unit *dmar,
 				    (nb_quirk->rev_no == rev_no ||
 				    nb_quirk->rev_no == QUIRK_NB_ALL_REV)) {
 					if (bootverbose) {
-						device_printf(dmar->dev,
+						device_printf(dmar->iommu.dev,
 						    "NB IOMMU quirk %s\n",
 						    nb_quirk->descr);
 					}
@@ -117,7 +117,8 @@ dmar_match_quirks(struct dmar_unit *dmar,
 				}
 			}
 		} else {
-			device_printf(dmar->dev, "cannot find northbridge\n");
+			device_printf(dmar->iommu.dev,
+			    "cannot find northbridge\n");
 		}
 	}
 	if (cpu_quirks != NULL) {
@@ -136,7 +137,7 @@ dmar_match_quirks(struct dmar_unit *dmar,
 			    (cpu_quirk->stepping == -1 ||
 			    cpu_quirk->stepping == stepping)) {
 				if (bootverbose) {
-					device_printf(dmar->dev,
+					device_printf(dmar->iommu.dev,
 					    "CPU IOMMU quirk %s\n",
 					    cpu_quirk->descr);
 				}
diff --git a/sys/x86/iommu/intel_utils.c b/sys/x86/iommu/intel_utils.c
index b0f2d167658a..a66682b68a2b 100644
--- a/sys/x86/iommu/intel_utils.c
+++ b/sys/x86/iommu/intel_utils.c
@@ -137,7 +137,7 @@ domain_set_agaw(struct dmar_domain *domain, int mgaw)
 			return (0);
 		}
 	}
-	device_printf(domain->dmar->dev,
+	device_printf(domain->dmar->iommu.dev,
 	    "context request mgaw %d: no agaw found, sagaw %x\n",
 	    mgaw, sagaw);
 	return (EINVAL);