diff --git a/sys/arm64/iommu/iommu.c b/sys/arm64/iommu/iommu.c index 690c11f4777c..36f3dad290d5 100644 --- a/sys/arm64/iommu/iommu.c +++ b/sys/arm64/iommu/iommu.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -61,13 +62,13 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_IOMMU, "IOMMU", "IOMMU framework"); -#define IOMMU_LIST_LOCK() mtx_lock(&iommu_mtx) -#define IOMMU_LIST_UNLOCK() mtx_unlock(&iommu_mtx) -#define IOMMU_LIST_ASSERT_LOCKED() mtx_assert(&iommu_mtx, MA_OWNED) +#define IOMMU_LIST_LOCK() sx_xlock(&iommu_sx) +#define IOMMU_LIST_UNLOCK() sx_xunlock(&iommu_sx) +#define IOMMU_LIST_ASSERT_LOCKED() sx_assert(&iommu_sx, SA_XLOCKED) #define dprintf(fmt, ...) -static struct mtx iommu_mtx; +static struct sx iommu_sx; struct iommu_entry { struct iommu_unit *iommu; @@ -391,7 +392,7 @@ static void iommu_init(void) { - mtx_init(&iommu_mtx, "IOMMU", NULL, MTX_DEF); + sx_init(&iommu_sx, "IOMMU list"); } SYSINIT(iommu, SI_SUB_DRIVERS, SI_ORDER_FIRST, iommu_init, NULL);