Change iommu list lock to SX as we need a sleepable lock so we

can call to ofw_bus_iommu_map().

Sponsored by:	UKRI
This commit is contained in:
Ruslan Bukin 2022-05-07 11:11:27 +01:00
parent 59446e8ac0
commit 7d0bbf43fd

View File

@ -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);