From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BE22C4338F for ; Fri, 30 Jul 2021 09:35:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4345D60F5C for ; Fri, 30 Jul 2021 09:35:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4345D60F5C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=q3Z1AwvGC2Cut658ORQ8rzzJkTtIjrLdZwMp7dqUq6I=; b=sqbyZtjPXQhgY0 /w7+vYE98EmwWuG8H/Z3oExd/ojq1ze0jQLmgbA8fHrpqgnaQpxjt+iPhKGZXJC1SkE5efJkz9NFh 2tSzxOOICQ26LL2Zkc7NIvRjUVCv/tYpiWcsPFc8/LkvXHi7TaNarEu2uDBUtPABIkkSTfnIhhmaJ TLS1F9bafi6v9hAYTxvc+KFPvI15E1uvzOjB5bi8wWGz86Ps5tvgnCK+rZu5uI7SjNSJDgXkLNx4c WRX0S3I36YfkgAsqyeMmnoCbJ2mIAOAzqkNfmY3VabnhVV8y4CHW3aIHWxF17DowIhstdwcOY/4Va jFr0LUYWQ1NVAw8AtjNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9OtB-007uAY-ON; Fri, 30 Jul 2021 09:33:09 +0000 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9OsT-007ttR-RG for linux-arm-kernel@lists.infradead.org; Fri, 30 Jul 2021 09:32:27 +0000 Received: by mail-ej1-x631.google.com with SMTP id yk17so7995447ejb.11 for ; Fri, 30 Jul 2021 02:32:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=jXZmAj10YMwUuMQVsNud4Tjz/SN+TYKnCKl9JrvXlTs=; b=Ge8bGdXL7p43tS8UZ/M9cht7Pac8eSIv1YeU9Cgs/fe734gtfYaD+dzzM+tGKTwAXD 2vEt9rFv+3hFvIfILimXdyVg0X7rAZLwSV0aXVXeeq7Iy83xcvqJst5FM2VrpDvc+TTy bCjaQldsrKFyLFE5qwLU/qebZwG3N22cnNm9Cbvt+8xMNKxqvWMXvzhG1Q8qXzozTJKQ 6eNGHWJceAy0/9uMPenRhxWE8JalloYsKTHdoMF1jxOKZzwXljncjt+IVbDniWcPGe+4 s8QPV3p5Aim4ntUteJGR9nfFeyWC0Kkvv8zRC/rHSkmk6UuKQjeOTp5ChYVNLeY0X0l4 3TXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=jXZmAj10YMwUuMQVsNud4Tjz/SN+TYKnCKl9JrvXlTs=; b=brAqy4Ojzy7V7kdGXei0ZLXwd4OOumt8c9ViOJoNYSik/4u+o5YdumcW0YQ2HO/kBZ ZB//Bh/EmbDJSXO92vgg2tmTLAWxY1rGJfCxk9QYxIy+iblSTdmO05E+PlQ7xj/OGap4 hwNEN8fS8XLSbOhH5Dcd5bjzpeTs3+6qEu+HqCEiVNUDYtRRUrEUj6O9C5IRcknQH/we 854xBpJ+jg0xtW6pbOPljRQPwF8en8Xjjln2ofnEQmb5nVj4AuGxGunREtC1NLru7AuN TgO88ZxEPAjAcZ12kZej4Bp23GAXxx+Pv7oeZvbUCNp35z4s2gfk8qZp4mLoSa9NasDN neDQ== X-Gm-Message-State: AOAM532f/3f8buDW7TtMLMwCnEnPSvUTx4bfBmZ8tVKFevm4fQWvGlj3 7lN2hA45wL+tVvAj+bOWkKq3jTmi2ARyJA== X-Google-Smtp-Source: ABdhPJz2wmY/H4t/1qZqsTeLCI1roKsM30OsGoE5ghmW5W6XCOsgW22Tu/F3Y6tz5gBO8MV5MCIa+w== X-Received: by 2002:a17:906:1685:: with SMTP id s5mr1667118ejd.370.1627637543289; Fri, 30 Jul 2021 02:32:23 -0700 (PDT) Received: from myrica (adsl-84-226-111-173.adslplus.ch. [84.226.111.173]) by smtp.gmail.com with ESMTPSA id j22sm365079ejt.11.2021.07.30.02.32.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jul 2021 02:32:22 -0700 (PDT) Date: Fri, 30 Jul 2021 11:32:02 +0200 From: Jean-Philippe Brucker To: Robin Murphy Cc: joro@8bytes.org, will@kernel.org, Maxime Ripard , Heiko Stuebner , Geert Uytterhoeven , linux-kernel@vger.kernel.org, Chunyan Zhang , dianders@chromium.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 01/24] iommu: Pull IOVA cookie management into the core Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210730_023226_022202_B58AE328 X-CRM114-Status: GOOD ( 23.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jul 28, 2021 at 04:58:22PM +0100, Robin Murphy wrote: > Now that everyone has converged on iommu-dma for IOMMU_DOMAIN_DMA > support, we can abandon the notion of drivers being responsible for the > cookie type, and consolidate all the management into the core code. > > CC: Marek Szyprowski > CC: Yoshihiro Shimoda > CC: Geert Uytterhoeven > CC: Yong Wu > CC: Heiko Stuebner > CC: Chunyan Zhang > CC: Chunyan Zhang > CC: Maxime Ripard > CC: Jean-Philippe Brucker > Signed-off-by: Robin Murphy Reviewed-by: Jean-Philippe Brucker > --- > drivers/iommu/iommu.c | 7 +++++++ > include/linux/iommu.h | 3 ++- > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index f2cda9950bd5..ea5a9ea8d431 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -7,6 +7,7 @@ > #define pr_fmt(fmt) "iommu: " fmt > > #include > +#include > #include > #include > #include > @@ -1946,6 +1947,11 @@ 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) { > + iommu_domain_free(domain); > + domain = NULL; > + } > return domain; > } > > @@ -1957,6 +1963,7 @@ EXPORT_SYMBOL_GPL(iommu_domain_alloc); > > void iommu_domain_free(struct iommu_domain *domain) > { > + iommu_put_dma_cookie(domain); > domain->ops->domain_free(domain); > } > EXPORT_SYMBOL_GPL(iommu_domain_free); > diff --git a/include/linux/iommu.h b/include/linux/iommu.h > index 4997c78e2670..141779d76035 100644 > --- a/include/linux/iommu.h > +++ b/include/linux/iommu.h > @@ -40,6 +40,7 @@ struct iommu_domain; > struct notifier_block; > struct iommu_sva; > struct iommu_fault_event; > +struct iommu_dma_cookie; > > /* iommu fault flags */ > #define IOMMU_FAULT_READ 0x0 > @@ -86,7 +87,7 @@ struct iommu_domain { > iommu_fault_handler_t handler; > void *handler_token; > struct iommu_domain_geometry geometry; > - void *iova_cookie; > + struct iommu_dma_cookie *iova_cookie; > }; > > enum iommu_cap { > -- > 2.25.1 > > _______________________________________________ > iommu mailing list > iommu@lists.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/iommu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel