Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5361841pxv; Wed, 28 Jul 2021 09:01:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyDLNlWFcmxnaGJud1Ec134n3ZyPQwoGh3A2TUsVoslpXO5MPYBa6VW2Vsv/DjjixGhcvf X-Received: by 2002:a17:906:1e42:: with SMTP id i2mr221375ejj.76.1627488072663; Wed, 28 Jul 2021 09:01:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627488072; cv=none; d=google.com; s=arc-20160816; b=ddxWJTCYphpBwAmTH7/88rylaGHtMyk3ySX9XH4CWTCWMO0JMiAp2FzyXCRPVS6Iec lkzozgRx5DiBAu0KbcC5Q/Teg0mj5TOLZJJ9VhqxOxS6sNJpSWKOWPXnmU4UdFjKIU+I Z41Z9vc7ppUwVyCKCBC/3j+eb8Ct0qp8LZyJZG3GCvrtOSyGNcovtmB4PXBzsVdwEKyA ffG0EJtSm9S3ExzI5fKvIpW6i5B9fmkhNUTjlilqYlFy8yqc9cFHIJi49niUp/WXIOPY Z0+ZSwACYhTM1zpiMHtsfnGcp6Id6plu9RoRQhWHfxkrP686Cps3+DiFzazlgvH5w2y/ sWWQ== 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=NtHuSY9bhuxw7Ieo+hxfUYWqnykFtGTWPRkr+64sXCU=; b=Xp2orFoBCmD8+qeJq0G3KiwG+tYHLlb82aFMiJlxCcEhEg+m6/WFH4VoD6QPMryHdI 6ygRBkNB+nyRl3o/2Tc+74i2EzTDKTi8DqBxrV/Hg7GsJYBhslEJo4FYSJOWExTjkpFW nUM6gu7DnVIoW8cLJ47Sv+B8awGBF0JrYbcXzuYFdgX3WCRrkGiEyIN+ufkBUBA6GPPM jQlc//4k0U0ltw41rLY7LxuZV/s7nGA8Qfph5OMsiXhYC3RaptgCIxvVhmfrtspiyd6J VF2KgfptM4TDMRadZVQ5nnRtffv+azAJn9mAs80tNPLbdfrth8GX07vvEz0GfxH8zggf 1bSQ== 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 r11si176169ejs.394.2021.07.28.09.00.49; Wed, 28 Jul 2021 09:01:12 -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 S237314AbhG1P7V (ORCPT + 99 others); Wed, 28 Jul 2021 11:59:21 -0400 Received: from foss.arm.com ([217.140.110.172]:59280 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236909AbhG1P7R (ORCPT ); Wed, 28 Jul 2021 11:59:17 -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 CE4BC106F; Wed, 28 Jul 2021 08:59:15 -0700 (PDT) Received: from 010265703453.arm.com (unknown [10.57.36.146]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1D2923F70D; Wed, 28 Jul 2021 08:59:13 -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, Yoshihiro Shimoda , Geert Uytterhoeven Subject: [PATCH v2 06/24] iommu/ipmmu-vmsa: Drop IOVA cookie management Date: Wed, 28 Jul 2021 16:58:27 +0100 Message-Id: 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 The core code bakes its own cookies now. CC: Yoshihiro Shimoda CC: Geert Uytterhoeven Signed-off-by: Robin Murphy --- drivers/iommu/ipmmu-vmsa.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index 51ea6f00db2f..31252268f0d0 100644 --- a/drivers/iommu/ipmmu-vmsa.c +++ b/drivers/iommu/ipmmu-vmsa.c @@ -564,10 +564,13 @@ static irqreturn_t ipmmu_irq(int irq, void *dev) * IOMMU Operations */ -static struct iommu_domain *__ipmmu_domain_alloc(unsigned type) +static struct iommu_domain *ipmmu_domain_alloc(unsigned type) { struct ipmmu_vmsa_domain *domain; + if (type != IOMMU_DOMAIN_UNMANAGED && type != IOMMU_DOMAIN_DMA) + return NULL; + domain = kzalloc(sizeof(*domain), GFP_KERNEL); if (!domain) return NULL; @@ -577,27 +580,6 @@ static struct iommu_domain *__ipmmu_domain_alloc(unsigned type) return &domain->io_domain; } -static struct iommu_domain *ipmmu_domain_alloc(unsigned type) -{ - struct iommu_domain *io_domain = NULL; - - switch (type) { - case IOMMU_DOMAIN_UNMANAGED: - io_domain = __ipmmu_domain_alloc(type); - break; - - case IOMMU_DOMAIN_DMA: - io_domain = __ipmmu_domain_alloc(type); - if (io_domain && iommu_get_dma_cookie(io_domain)) { - kfree(io_domain); - io_domain = NULL; - } - break; - } - - return io_domain; -} - static void ipmmu_domain_free(struct iommu_domain *io_domain) { struct ipmmu_vmsa_domain *domain = to_vmsa_domain(io_domain); @@ -606,7 +588,6 @@ static void ipmmu_domain_free(struct iommu_domain *io_domain) * Free the domain resources. We assume that all devices have already * been detached. */ - iommu_put_dma_cookie(io_domain); ipmmu_domain_destroy_context(domain); free_io_pgtable_ops(domain->iop); kfree(domain); -- 2.25.1