From owner-svn-src-all@freebsd.org Wed Oct 14 14:51:12 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5690443B2FE; Wed, 14 Oct 2020 14:51:12 +0000 (UTC) (envelope-from br@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CBFjD1fG8z45jp; Wed, 14 Oct 2020 14:51:12 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CBE1FC71; Wed, 14 Oct 2020 14:51:12 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09EEpBDC012647; Wed, 14 Oct 2020 14:51:11 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09EEpB24012645; Wed, 14 Oct 2020 14:51:11 GMT (envelope-from br@FreeBSD.org) Message-Id: <202010141451.09EEpB24012645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 14 Oct 2020 14:51:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366704 - in head/sys: dev/iommu i386/include X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: dev/iommu i386/include X-SVN-Commit-Revision: 366704 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Oct 2020 14:51:12 -0000 Author: br Date: Wed Oct 14 14:51:11 2020 New Revision: 366704 URL: https://svnweb.freebsd.org/changeset/base/366704 Log: Add a per-each macro IOMMU_DOMAIN_UNLOAD_SLEEP which allows to sleep during iommu guest address space entries unload. Suggested by: kib Sponsored by: Innovate DSbD Differential Revision: https://reviews.freebsd.org/D26722 Modified: head/sys/dev/iommu/busdma_iommu.c head/sys/i386/include/iommu.h Modified: head/sys/dev/iommu/busdma_iommu.c ============================================================================== --- head/sys/dev/iommu/busdma_iommu.c Wed Oct 14 14:29:56 2020 (r366703) +++ head/sys/dev/iommu/busdma_iommu.c Wed Oct 14 14:51:11 2020 (r366704) @@ -888,7 +888,7 @@ iommu_bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap struct bus_dmamap_iommu *map; struct iommu_ctx *ctx; struct iommu_domain *domain; -#if defined(__amd64__) +#ifndef IOMMU_DOMAIN_UNLOAD_SLEEP struct iommu_map_entries_tailq entries; #endif @@ -898,13 +898,13 @@ iommu_bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap domain = ctx->domain; atomic_add_long(&ctx->unloads, 1); -#if defined(__i386__) +#if defined(IOMMU_DOMAIN_UNLOAD_SLEEP) IOMMU_DOMAIN_LOCK(domain); TAILQ_CONCAT(&domain->unload_entries, &map->map_entries, dmamap_link); IOMMU_DOMAIN_UNLOCK(domain); taskqueue_enqueue(domain->iommu->delayed_taskqueue, &domain->unload_task); -#else /* defined(__amd64__) */ +#else TAILQ_INIT(&entries); IOMMU_DOMAIN_LOCK(domain); TAILQ_CONCAT(&entries, &map->map_entries, dmamap_link); Modified: head/sys/i386/include/iommu.h ============================================================================== --- head/sys/i386/include/iommu.h Wed Oct 14 14:29:56 2020 (r366703) +++ head/sys/i386/include/iommu.h Wed Oct 14 14:51:11 2020 (r366704) @@ -4,3 +4,5 @@ /* $FreeBSD$ */ #include + +#define IOMMU_DOMAIN_UNLOAD_SLEEP