diff options
author | Ruslan Bukin <br@FreeBSD.org> | 2022-05-07 10:11:27 +0000 |
---|---|---|
committer | Ruslan Bukin <br@FreeBSD.org> | 2022-05-07 10:15:07 +0000 |
commit | 7d0bbf43fd3bfd8d8ac6457cb4ff4574142f3574 (patch) | |
tree | b7b32a98af60099b79f10037a19c4f3f686937be | |
parent | 59446e8ac0087eb91fd8b7238cbfd10f06a8ed2d (diff) | |
download | src-7d0bbf43fd3bfd8d8ac6457cb4ff4574142f3574.tar.gz src-7d0bbf43fd3bfd8d8ac6457cb4ff4574142f3574.zip |
Change iommu list lock to SX as we need a sleepable lock so we
can call to ofw_bus_iommu_map().
Sponsored by: UKRI
-rw-r--r-- | sys/arm64/iommu/iommu.c | 11 |
1 files changed, 6 insertions, 5 deletions
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 <sys/taskqueue.h> #include <sys/lock.h> #include <sys/mutex.h> +#include <sys/sx.h> #include <sys/sysctl.h> #include <vm/vm.h> @@ -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); |