Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp257697pxt; Wed, 4 Aug 2021 10:19:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxCwpmKIJaPwg2z7D5w2OjLYJHJ84rBxPn53hQSNyy/hOHy3wqVkIt7SMZ9Ga0r8NSHCq2 X-Received: by 2002:a6b:e016:: with SMTP id z22mr306134iog.187.1628097568906; Wed, 04 Aug 2021 10:19:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628097568; cv=none; d=google.com; s=arc-20160816; b=mIEkkuGvUViXfMkK5CxDoiD0JvPGMQFFYVMBTDJ3NlpzE3etddfrSBsgbSfX7K5bRm c3dTPYhmoBq1/yUJluU/+M67Uw1+Qb+0BNESDJgu7AL+N0uOJKp+DWKoe1oxXuxccIVD c2zb0vtGn0m6YTYUhEPz2Sx5mJ6q5JJ/1dGB3kVtpfI7xYeum6ZxgZag5tYy8rPcefIw nVMEZQJqnlz6mNLbXMpAsFyb/GGh0BL88weVUBS1uuD7q9zGRLEGouE3Vf+0hj3wqlfW pz3Kc6KmqQTrTQgtaHKv537xsRmTCaV2LXYujI1G2fkpuBZO03u8FLW8LJqBFqb1YFNj /SKw== 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=4LBa7wzAeMnNgR+2i9wTJBMKW56gB48YIit+oK9K+lM=; b=mzIqdRAlfP0nxFUq3qLlcERf7kLdTzOkwKdF0Mett3ufRniKENwimh++JyOFvMeTt2 e907O4LiiZYFVhLUbPCI5kdQPEGhiZ5nBzUUKrFmtV82PDihL3DhAb1oLTo4M9w4VeqV YGENEcWKO/8odHKaHnM0KJv6EMFgqFzsKujnB3WGG7CLTsBRZFZV1r2Xx5rpokT24wWB 7DSLbBv3me7lZGZpXNP+Sz8BPga9nDI325sacGQDburwQPzr1mjKGlv+n4SpEC4cfeQz gRkR4Fo6k0+o+CNQ/Y6IA0S1h84KdZB0CUPA0SDuz1SMVGp4GpuqM7OF7AfeAz2c//yB t28w== 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 j17si2563957jaj.70.2021.08.04.10.19.15; Wed, 04 Aug 2021 10:19:28 -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 S230089AbhHDRRG (ORCPT + 99 others); Wed, 4 Aug 2021 13:17:06 -0400 Received: from foss.arm.com ([217.140.110.172]:35040 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239916AbhHDRQr (ORCPT ); Wed, 4 Aug 2021 13:16:47 -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 ECA6411FB; Wed, 4 Aug 2021 10:16:33 -0700 (PDT) Received: from 010265703453.arm.com (unknown [10.57.36.146]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 174D23F66F; Wed, 4 Aug 2021 10:16:31 -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, rajatja@google.com, chenxiang66@hisilicon.com, Jean-Philippe Brucker Subject: [PATCH v3 12/25] iommu/dma: Unexport IOVA cookie management Date: Wed, 4 Aug 2021 18:15:40 +0100 Message-Id: <9c989539c8465bdb34fd2f2eb49773b0b76655dd.1628094601.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. Reviewed-by: Lu Baolu Reviewed-by: Jean-Philippe Brucker 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 b65fcc66ffa4..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 avoid -EEXIST while drivers still get their own cookies */ - if (type == IOMMU_DOMAIN_DMA && !domain->iova_cookie && iommu_get_dma_cookie(domain)) { + if (type == IOMMU_DOMAIN_DMA && iommu_get_dma_cookie(domain)) { iommu_domain_free(domain); domain = NULL; } -- 2.25.1