git: 7d0bbf43fd3b - main - Change iommu list lock to SX as we need a sleepable lock so we can call to ofw_bus_iommu_map().
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 07 May 2022 10:20:30 UTC
The branch main has been updated by br: URL: https://cgit.FreeBSD.org/src/commit/?id=7d0bbf43fd3bfd8d8ac6457cb4ff4574142f3574 commit 7d0bbf43fd3bfd8d8ac6457cb4ff4574142f3574 Author: Ruslan Bukin <br@FreeBSD.org> AuthorDate: 2022-05-07 10:11:27 +0000 Commit: Ruslan Bukin <br@FreeBSD.org> CommitDate: 2022-05-07 10:15:07 +0000 Change iommu list lock to SX as we need a sleepable lock so we can call to ofw_bus_iommu_map(). Sponsored by: UKRI --- sys/arm64/iommu/iommu.c | 11 ++++++----- 1 file 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);