Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5362509pxv; Wed, 28 Jul 2021 09:01:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVQW8rjuYmT3qrg+UDO6nJJ7gVbBocJih8YQ7vSO4Ck29pSw5oqIKNvI6W23RuTG5BMHsV X-Received: by 2002:a05:600c:154a:: with SMTP id f10mr10032261wmg.139.1627488116217; Wed, 28 Jul 2021 09:01:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627488116; cv=none; d=google.com; s=arc-20160816; b=1CAJM1EZYX1Sj8JlypQd6kREWOBvs94PMgLd8oMArD19pTZjfArKdgl8kTaOpIDMSk fbv8HiU0iQXqEPhORzzEyNWdddWl2omrCQTpIhiybUz8N9XmcXqVmqoTdMlw5sTg8zlV 0jytyMKynk1PAGY49b9BuOrcpl9NSmVhyK5tXplZz+v+CByv6ZIqFWIHAPNXAjNks2qI oG7S2+nzGQ2Fal1XeEhpv3cfb0+b4agCEnKVDb+6VDRCZmlL9esbv3t6W5ez4lg7Z4Fh ChXjSX9wVSHMA50EVF2UqrMDOwmrMWYGo6A8hqP70X/i9KO3QYz4R6Q2fg8/3cWA1mDb 5HsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=JzXNmlP4DkIBkTTlvG9GXX22eq0NSSaVHOKJ1cOln4w=; b=bV1DvmkTFXVueYJMHd9xFn98SfXXL+mAJt0HNPNrrVkPAUo+wejNv4jx4dLTwX/K6x ybCicNaLmbU4UBrAW4uQ/rzkIMYA6Rp/dUPh35wcdqAcOh7+zFMOX1/FEzc7xNHGth8z gz/6kL6kAbHLoFHX9IRmXmbrNcLy4hRkA+br9uFzqd/QBYueiMxthlg9EzLwR0dijSKU rUirQighCHafLpRMbNKO9uv0SfOBKRKVuQdZLtTYHF3TrfsO8PfLpnfTpP9vTu6UAURp MlE3+g1+5UcWE9OOXPmgHWQnzVYs+qcwd88vI/tdOHlrhB8GEttr1/kRYQF3LpVRksZd jcug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 21si82205ejz.246.2021.07.28.09.01.32; Wed, 28 Jul 2021 09:01:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237456AbhG1P7h (ORCPT + 99 others); Wed, 28 Jul 2021 11:59:37 -0400 Received: from foss.arm.com ([217.140.110.172]:59402 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237419AbhG1P73 (ORCPT ); Wed, 28 Jul 2021 11:59:29 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4B0F1106F; Wed, 28 Jul 2021 08:59:27 -0700 (PDT) Received: from 010265703453.arm.com (unknown [10.57.36.146]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C8F363F70D; Wed, 28 Jul 2021 08:59:25 -0700 (PDT) From: Robin Murphy To: joro@8bytes.org, will@kernel.org Cc: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, suravee.suthikulpanit@amd.com, baolu.lu@linux.intel.com, john.garry@huawei.com, dianders@chromium.org Subject: [PATCH v2 12/24] iommu/dma: Unexport IOVA cookie management Date: Wed, 28 Jul 2021 16:58:33 +0100 Message-Id: <697a7c5da18c58e61e6b9a98b97775a2934a6358.1627468309.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org IOVA cookies are now got and put by core code, so we no longer need to export these to modular drivers. The export for getting MSI cookies stays, since VFIO can still be a module, but it was already relying on someone else putting them, so that aspect is unaffected. Signed-off-by: Robin Murphy --- drivers/iommu/dma-iommu.c | 7 ------- drivers/iommu/iommu.c | 3 +-- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 98ba927aee1a..10067fbc4309 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -98,9 +98,6 @@ static struct iommu_dma_cookie *cookie_alloc(enum iommu_dma_cookie_type type) /** * iommu_get_dma_cookie - Acquire DMA-API resources for a domain * @domain: IOMMU domain to prepare for DMA-API usage - * - * IOMMU drivers should normally call this from their domain_alloc - * callback when domain->type == IOMMU_DOMAIN_DMA. */ int iommu_get_dma_cookie(struct iommu_domain *domain) { @@ -113,7 +110,6 @@ int iommu_get_dma_cookie(struct iommu_domain *domain) return 0; } -EXPORT_SYMBOL(iommu_get_dma_cookie); /** * iommu_get_msi_cookie - Acquire just MSI remapping resources @@ -151,8 +147,6 @@ EXPORT_SYMBOL(iommu_get_msi_cookie); * iommu_put_dma_cookie - Release a domain's DMA mapping resources * @domain: IOMMU domain previously prepared by iommu_get_dma_cookie() or * iommu_get_msi_cookie() - * - * IOMMU drivers should normally call this from their domain_free callback. */ void iommu_put_dma_cookie(struct iommu_domain *domain) { @@ -172,7 +166,6 @@ void iommu_put_dma_cookie(struct iommu_domain *domain) kfree(cookie); domain->iova_cookie = NULL; } -EXPORT_SYMBOL(iommu_put_dma_cookie); /** * iommu_dma_get_resv_regions - Reserved region driver helper diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index ea5a9ea8d431..fa8109369f74 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -1947,8 +1947,7 @@ static struct iommu_domain *__iommu_domain_alloc(struct bus_type *bus, /* Assume all sizes by default; the driver may override this later */ domain->pgsize_bitmap = bus->iommu_ops->pgsize_bitmap; - /* Temporarily ignore -EEXIST while drivers still get their own cookies */ - if (type == IOMMU_DOMAIN_DMA && iommu_get_dma_cookie(domain) == -ENOMEM) { + if (type == IOMMU_DOMAIN_DMA && iommu_get_dma_cookie(domain)) { iommu_domain_free(domain); domain = NULL; } -- 2.25.1