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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 9A8CFC433B4 for ; Tue, 11 May 2021 16:49:48 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 28AC961421 for ; Tue, 11 May 2021 16:49:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28AC961421 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id D5BF783C01; Tue, 11 May 2021 16:49:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sqb7RuEe8KZ6; Tue, 11 May 2021 16:49:47 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTP id C404983B9E; Tue, 11 May 2021 16:49:46 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A1A0CC000E; Tue, 11 May 2021 16:49:46 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id CD32AC0001 for ; Tue, 11 May 2021 16:49:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id BB9DF83661 for ; Tue, 11 May 2021 16:49:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KWzFW1OhrpkA for ; Tue, 11 May 2021 16:49:45 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by smtp1.osuosl.org (Postfix) with ESMTPS id 2D3C982560 for ; Tue, 11 May 2021 16:49:45 +0000 (UTC) Received: by mail-pj1-x1031.google.com with SMTP id z6-20020a17090a1706b0290155e8a752d8so688357pjd.4 for ; Tue, 11 May 2021 09:49:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=I574vs+oxpmw2RaQkdeqT3TmVa8C0vE6HCQzgLmVaEk=; b=EO4zcKQD13cnMpJi5k5sqZg36m/uhjFrv+x7tUEK/JnHkDgZTOULzljGCah93D1FN5 SwmaT+lt9As201TL9V65C0BiJShCnGyDe8UgjgY5Jm1YBpkuQxrN8+e9OJjS8RpeP4ih 4tasAkIoShr42ndvrMVih2QtviIwqYbb0WQHQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=I574vs+oxpmw2RaQkdeqT3TmVa8C0vE6HCQzgLmVaEk=; b=lF2o27zClqA7DTE3KoGuIysNtMFh4EYp3p89/ftAWMZ24qY1Ns/OgUc0PocWvE0FYb +gbUTjemfj1+TblbmmhykBdkxANq/7hrnkevkdVVuV6821ik3+EeBfcopX2OjMERfUkt rf9lzPCwIrFqpTStk6GxU0gAsiowFd6UkwcHHbGxiBsawjQssHQ/uoj1s+Hk37cYy1Ru 0Dea1NH/TLNebQVstweffobjTsCxQy6R4nYXzoMqHCmWknAOHjNWtIWOBU5gMWkdiC0B 5+jfU8gMQ4N+oQx4v6UZCSXegCag1zKYa0TmO71FLN3qblwsLMVt+TmWuCb2zhHEcKXr lBhA== X-Gm-Message-State: AOAM532dulDdFFEPNU04MKcmw0uH1T351rkgzuKzMPKW/9ePPRF1wpq3 7zU+HI6I0D6eR+maJ85OjAt8ajEy4x0eVQ== X-Google-Smtp-Source: ABdhPJyM+o9JBdTAQbsYBwujgIxGafDzR1TzRC+lLTJvBg2TcALpvWMY0/o1bFzhG/N+DHkeYuyEkQ== X-Received: by 2002:a17:902:264:b029:eb:3d3a:a09c with SMTP id 91-20020a1709020264b02900eb3d3aa09cmr30380004plc.0.1620751784370; Tue, 11 May 2021 09:49:44 -0700 (PDT) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com. [209.85.210.175]) by smtp.gmail.com with ESMTPSA id 23sm4319485pgv.90.2021.05.11.09.49.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 May 2021 09:49:44 -0700 (PDT) Received: by mail-pf1-f175.google.com with SMTP id k19so16514255pfu.5 for ; Tue, 11 May 2021 09:49:43 -0700 (PDT) X-Received: by 2002:a92:6804:: with SMTP id d4mr27241366ilc.5.1620751346868; Tue, 11 May 2021 09:42:26 -0700 (PDT) MIME-Version: 1.0 References: <20210510095026.3477496-1-tientzu@chromium.org> <20210510095026.3477496-9-tientzu@chromium.org> <20210510150516.GE28066@lst.de> In-Reply-To: <20210510150516.GE28066@lst.de> From: Claire Chang Date: Wed, 12 May 2021 00:42:15 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 08/15] swiotlb: Bounce data from/to restricted DMA pool if available To: Christoph Hellwig Cc: heikki.krogerus@linux.intel.com, thomas.hellstrom@linux.intel.com, peterz@infradead.org, benh@kernel.crashing.org, joonas.lahtinen@linux.intel.com, dri-devel@lists.freedesktop.org, chris@chris-wilson.co.uk, grant.likely@arm.com, paulus@samba.org, Frank Rowand , mingo@kernel.org, sstabellini@kernel.org, Saravana Kannan , mpe@ellerman.id.au, "Rafael J . Wysocki" , Bartosz Golaszewski , bskeggs@redhat.com, linux-pci@vger.kernel.org, xen-devel@lists.xenproject.org, Thierry Reding , intel-gfx@lists.freedesktop.org, matthew.auld@intel.com, linux-devicetree , Jianxiong Gao , Daniel Vetter , Will Deacon , Konrad Rzeszutek Wilk , maarten.lankhorst@linux.intel.com, airlied@linux.ie, Dan Williams , linuxppc-dev@lists.ozlabs.org, jani.nikula@linux.intel.com, Rob Herring , rodrigo.vivi@intel.com, Bjorn Helgaas , boris.ostrovsky@oracle.com, Andy Shevchenko , jgross@suse.com, Nicolas Boichat , nouveau@lists.freedesktop.org, Greg KH , Randy Dunlap , lkml , "list@263.net:IOMMU DRIVERS" , Jim Quinlan , xypron.glpk@gmx.de, Robin Murphy , bauerman@linux.ibm.com X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Mon, May 10, 2021 at 11:05 PM Christoph Hellwig wrote: > > > +static inline bool is_dev_swiotlb_force(struct device *dev) > > +{ > > +#ifdef CONFIG_DMA_RESTRICTED_POOL > > + if (dev->dma_io_tlb_mem) > > + return true; > > +#endif /* CONFIG_DMA_RESTRICTED_POOL */ > > + return false; > > +} > > + > > > /* If SWIOTLB is active, use its maximum mapping size */ > > if (is_swiotlb_active(dev) && > > - (dma_addressing_limited(dev) || swiotlb_force == SWIOTLB_FORCE)) > > + (dma_addressing_limited(dev) || swiotlb_force == SWIOTLB_FORCE || > > + is_dev_swiotlb_force(dev))) > > This is a mess. I think the right way is to have an always_bounce flag > in the io_tlb_mem structure instead. Then the global swiotlb_force can > go away and be replace with this and the fact that having no > io_tlb_mem structure at all means forced no buffering (after a little > refactoring). Will do in the next version. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu