Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp13966pxv; Wed, 21 Jul 2021 14:07:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXiwEtsFL2B8VozWvlfeDFbcl4Bwe1UYnCMq7BpA4xpOcCHilAm5JxMgcVAdB/hyStcVbv X-Received: by 2002:a05:6602:190:: with SMTP id m16mr28226287ioo.14.1626901522516; Wed, 21 Jul 2021 14:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626901522; cv=none; d=google.com; s=arc-20160816; b=YDWz3D4741ZY0eX/BLErLPHeQE2R0NlU5rANzRX4mjw6VlTQNoNmlV1MtCnPOEUSic gRx5abfwzZpkPDeQYJa/DSZntiTuxJQCBYjte+ef2yak3cxGoM/TboYyucLgHmSelSdH bALLZGawcXOrU0ty1fKkrTibigjrji8ISjlotmJ1nVnfehIENcyi77FVbW51Wkj2NivL XU4JbEdlyEpdDMAezc8H+Y7uTTcxUbFvxuUEnEi9quRH9ha+zdXfqJwRA7l1vrqAe9lC iAa5f+2vkwJx1r4yztIR3fNTBjX8v2hYkjr/X0tAU3FKjOfwi3qPWgFo6cRCZwEm2l9x zVuw== 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=1TheJqgvtMEd97jSRTYcWkJjS/rCCjc0ggi7T3x5KaA=; b=vHhu0VciptB6dX98FXv+WaDSVAE79Dkp8ygwJns8ndw4S3QEpszp4Fua8pUfS9f/3T /f3ksOXrzWZhWbOqTinzHovtltTFmDchI06ogP5MEhOtXvEYalMTIQJvbjC2otQ8KYdX +GYi7HIkpMODNl7TrnZ5Ks+h1bKlR7hlqkQpjcSc5R/S3LK8rh3bZrAvk4MvSXdm+W1U E4SNTPLou/2DroUXVy2EstkfN9mIrRFZNWvMV4WHHZef1OljHmugGfPbL6owrs8vPeQS uH+zyYDUGBUyp3Bb46y6KUnfQr7EB6aFZmeKagkqCfZSusd9/a5S9CApI3LH14RPyqAQ 5vxw== 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 j25si16384104jaj.93.2021.07.21.14.05.09; Wed, 21 Jul 2021 14:05:22 -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 S235233AbhGURk1 (ORCPT + 99 others); Wed, 21 Jul 2021 13:40:27 -0400 Received: from foss.arm.com ([217.140.110.172]:33214 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232456AbhGURkT (ORCPT ); Wed, 21 Jul 2021 13:40:19 -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 D4174113E; Wed, 21 Jul 2021 11:20:55 -0700 (PDT) Received: from 010265703453.arm.com (unknown [10.57.36.146]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5DC4E3F694; Wed, 21 Jul 2021 11:20:54 -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 06/23] iommu/ipmmu-vmsa: Drop IOVA cookie management Date: Wed, 21 Jul 2021 19:20:17 +0100 Message-Id: <1ca98c5c7ce4e6daf27803adc6f4b362362ce651.1626888444.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 The core code bakes its own cookies now. 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