git: 164fdee11164 - main - Intel DMAR: remove the 'dev' member

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 31 May 2024 19:18:10 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=164fdee11164e9a43e279f9e45117e7573ddc15f

commit 164fdee11164e9a43e279f9e45117e7573ddc15f
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-05-30 14:05:22 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-05-31 19:10:39 +0000

    Intel DMAR: remove the 'dev' member
    
    It duplicates iommu.dev, and was forgotten when struct iommu was split
    out from dmar.
    
    Sponsored by:   The FreeBSD Foundation
    Sponsored by:   AMD dvanced Micro Devices (AMD)
    MFC after:      1 week
---
 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 035de24a2d4e..66238b46c25e 100644
--- a/sys/x86/iommu/intel_intrmap.c
+++ b/sys/x86/iommu/intel_intrmap.c
@@ -271,7 +271,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);
 	}
@@ -335,7 +335,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 fd5c522d588d..751237a3ab54 100644
--- a/sys/x86/iommu/intel_quirks.c
+++ b/sys/x86/iommu/intel_quirks.c
@@ -108,7 +108,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);
 					}
@@ -116,7 +116,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) {
@@ -135,7 +136,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 356b8d5e6436..a96f65fddfc5 100644
--- a/sys/x86/iommu/intel_utils.c
+++ b/sys/x86/iommu/intel_utils.c
@@ -136,7 +136,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);