git: ac4ddc467bfe - main - arm64: Fixed IOMMU compilation errors

From: Dmitry Salychev <dsl_at_FreeBSD.org>
Date: Wed, 22 May 2024 09:08:46 UTC
The branch main has been updated by dsl:

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

commit ac4ddc467bfe895e965ed18e8b7bbbb4d7bf964d
Author:     Dmitry Salychev <dsl@FreeBSD.org>
AuthorDate: 2024-05-21 20:25:59 +0000
Commit:     Dmitry Salychev <dsl@FreeBSD.org>
CommitDate: 2024-05-22 09:08:00 +0000

    arm64: Fixed IOMMU compilation errors
    
    These are missing changes after 1228b93b410a when ref_count was
    removed from bus_dma_tag_common and 1e3f42b6bad5, when the address
    arguments were switched to pointers.
    
    Reviewed by:            jhb
    MFC after:              3 days
    Differential Revision:  https://reviews.freebsd.org/D45289
---
 sys/arm64/conf/NOTES         | 4 +++-
 sys/arm64/iommu/iommu.c      | 1 -
 sys/arm64/iommu/iommu_pmap.c | 8 ++++----
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/sys/arm64/conf/NOTES b/sys/arm64/conf/NOTES
index 3e8499c872b9..cc713db86538 100644
--- a/sys/arm64/conf/NOTES
+++ b/sys/arm64/conf/NOTES
@@ -240,6 +240,8 @@ nooptions 	COMPAT_FREEBSD10
 # arm64 supports 32-bit FreeBSD/arm binaries (armv[67] ABIs)
 options 	COMPAT_FREEBSD32	# Compatible with FreeBSD/arm
 
+options		IOMMU # ARM64 SMMU/IOMMU
+
 #####################################################################
 # ZFS support
 
@@ -250,4 +252,4 @@ options 	ZFS
 #
 device		iichid		# HID-over-I2C support
 options 	IICHID_DEBUG	# Enable HID-over-I2C debug messages
-options 	IICHID_SAMPLING	# Workaround missing GPIO INTR support
+options 	IICHID_SAMPLING	# Workaround missing GPIO INTR support
\ No newline at end of file
diff --git a/sys/arm64/iommu/iommu.c b/sys/arm64/iommu/iommu.c
index cb2b86c9dc41..b765763e3a60 100644
--- a/sys/arm64/iommu/iommu.c
+++ b/sys/arm64/iommu/iommu.c
@@ -172,7 +172,6 @@ iommu_tag_init(struct iommu_domain *iodom, struct bus_dma_tag_iommu *t)
 
 	maxaddr = MIN(iodom->end, BUS_SPACE_MAXADDR);
 
-	t->common.ref_count = 0;
 	t->common.impl = &bus_dma_iommu_impl;
 	t->common.alignment = 1;
 	t->common.boundary = 0;
diff --git a/sys/arm64/iommu/iommu_pmap.c b/sys/arm64/iommu/iommu_pmap.c
index d356a92c4d66..8a0ea641e231 100644
--- a/sys/arm64/iommu/iommu_pmap.c
+++ b/sys/arm64/iommu/iommu_pmap.c
@@ -632,8 +632,8 @@ retry:
 
 		l1p = smmu_pmap_l1(pmap, va);
 		l2p = smmu_pmap_l2(pmap, va);
-		cpu_dcache_wb_range((vm_offset_t)l1p, sizeof(pd_entry_t));
-		cpu_dcache_wb_range((vm_offset_t)l2p, sizeof(pd_entry_t));
+		cpu_dcache_wb_range(l1p, sizeof(pd_entry_t));
+		cpu_dcache_wb_range(l2p, sizeof(pd_entry_t));
 
 		goto retry;
 	}
@@ -644,7 +644,7 @@ retry:
 	/* New mapping */
 	smmu_pmap_store(l3, new_l3);
 
-	cpu_dcache_wb_range((vm_offset_t)l3, sizeof(pt_entry_t));
+	cpu_dcache_wb_range(l3, sizeof(pt_entry_t));
 
 	smmu_pmap_resident_count_inc(pmap, 1);
 	dsb(ishst);
@@ -681,7 +681,7 @@ pmap_gpu_remove(struct smmu_pmap *pmap, vm_offset_t va)
 
 	smmu_pmap_resident_count_dec(pmap, 1);
 	smmu_pmap_clear(pte);
-	cpu_dcache_wb_range((vm_offset_t)pte, sizeof(pt_entry_t));
+	cpu_dcache_wb_range(pte, sizeof(pt_entry_t));
 	rc = KERN_SUCCESS;
 
 out: