From nobody Sat May 07 10:20:30 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B79AF1AC5CE2; Sat, 7 May 2022 10:20:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KwNjp4nymz4mxP; Sat, 7 May 2022 10:20:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651918830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dJJw7lmMvyuei9muHL6YUichH9o6Xk6UDO856sZeRo0=; b=GUKqpNAIIV3pPGQvHZfPgxAdXVQSzTnbM5qULKbx0d08N6eoXT3Dd427WsjU/vHJ9pSCTb sEk+xZNC7pn81qkBJBNvxf9eqWbMF4ZA+677vkWs4C9GZsKIKpW7RPjZq/Yy0pcwnUbRwG wzPBQFaXukRHEkckuNe2boqmyutNUHy/hwMhtktrxrQTEEOL3qxfMmoGbreIp2fc9ETilW uPCI0/MAoq4j5fJaV0H4fM1Emh8qIWs2qZH7uP5Afj+r2E64gXOEwHaq3dKh8vyrrgghlQ i2053KQSdHeK9zRUj8cVtFIOOV3XXPjeEoo0Jn4jFy9YS7o6A/LBw7tJWqxIlA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 801116C21; Sat, 7 May 2022 10:20:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 247AKUZk064606; Sat, 7 May 2022 10:20:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 247AKUBs064605; Sat, 7 May 2022 10:20:30 GMT (envelope-from git) Date: Sat, 7 May 2022 10:20:30 GMT Message-Id: <202205071020.247AKUBs064605@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ruslan Bukin Subject: git: 7d0bbf43fd3b - main - Change iommu list lock to SX as we need a sleepable lock so we can call to ofw_bus_iommu_map(). List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: br X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7d0bbf43fd3bfd8d8ac6457cb4ff4574142f3574 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651918830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dJJw7lmMvyuei9muHL6YUichH9o6Xk6UDO856sZeRo0=; b=epn0odFJI61oCmNmJfXA+rIwVIjMcMNDXsoOWPuLTeQkcsm5Khl/E2Nkqk8vDqOlfaFFmR zd19M0KRp6gvR3mxAQoKED2wkE5Fox4f0PW7TfqoXBMIUMaBxQXQl28xG9mBOi2aYgNdMd IxAa5jDCWo/1Ff6ixzguTlhy4U6AeuZfX0B2O+35jP5liS6dizN2VS+lcmB+HM+l++xF10 P1M0rWDKhiRvwmrai7r0rX3gpuPPFs5kTO0FT5BYkHUelkNvOrUNeaQ5NhJ5kbFEy/GPn0 sKi79m4l3xan+Pg9OPnZ0bzCHoG+C2nqRtqRhoGr8a6T7N7kC4EaSSUF4nAkqQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651918830; a=rsa-sha256; cv=none; b=fGeJvEqrR6btOEDy1H1bz7FNyQ1U9UBS8FFwtQ2vk/WpwLquGcxmyW5cdh2jKaGmspuU0k Wdd8FYEwUIm9uMhu2VlAswiPO6JQtOr/8sqSOgCx9kNegYiI4ryjGkwQWtH0bTmospk0dY /xUYrtJxc3z0CRU04bGpFvzZ5dF4T5VI3M+U1ecyhccRH3ozutyoN/3h5a63hp9BkvCtSq HWretNdRb/pQaxv00JR27R72Lq4J0OoGXG1/H6VvNoPiM427lt4HulB9WMaRE9sHeNJVR8 ptT5KLcQyAC+AMnixKu7yPjhyZtr9fjmsv+HY0n745TUTXgcQ5IQwjblTcyZoA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by br: URL: https://cgit.FreeBSD.org/src/commit/?id=7d0bbf43fd3bfd8d8ac6457cb4ff4574142f3574 commit 7d0bbf43fd3bfd8d8ac6457cb4ff4574142f3574 Author: Ruslan Bukin AuthorDate: 2022-05-07 10:11:27 +0000 Commit: Ruslan Bukin 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 #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);