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 D5EF7C433ED for ; Tue, 11 May 2021 16:43:10 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 035B961182 for ; Tue, 11 May 2021 16:43:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 035B961182 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FfkHw4WSRz2ysp for ; Wed, 12 May 2021 02:43:08 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=EO4zcKQD; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=chromium.org (client-ip=2607:f8b0:4864:20::d2e; helo=mail-io1-xd2e.google.com; envelope-from=tientzu@chromium.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=EO4zcKQD; dkim-atps=neutral Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4FfkHQ3lXXz2y6F for ; Wed, 12 May 2021 02:42:42 +1000 (AEST) Received: by mail-io1-xd2e.google.com with SMTP id p11so18746031iob.9 for ; Tue, 11 May 2021 09:42:41 -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=lpVLS1oXlC5FaE79MjT88/XfAiQWQ+fhEuhxY/KrD+dBy1cChUrAZj8cWSu6VsxM4r MatszuleVShyAxPs6jCX5bvL2XywHrSRnmR2quMeOS6oaHbhvGInwR53fIWM3epeB486 hR3GqcYsEoPWnAKNQ+L5aO5N0uTaLp0W7n9n6revbL1Ftna5TkKNoW6BQye8itf2dTlH b20MKwVk0HNjDtpapF4zGa3pX65EmO9jFfC0ZfmGwyG4nTOYRdfm8CaTFoCXZnLF4F4n c6kqVwLwofCEpEfjFoi10Zwv69IGTFlieWN9l1ZJi+oVJJ6doHQCarGhxSiuNThX+UiE v4xQ== X-Gm-Message-State: AOAM530aJSTG0K3O+ZqzOsuJ59XlE/B4BFYHZU2VV9jMSFy5Ti2DBs8v VFPueXi4mbxyKTLKh+pONhFaCocaOYrC9g== X-Google-Smtp-Source: ABdhPJyffyAe2U0mFXD8aoJqVF2DGBtdrDHGFy1QLGa7+MnKSG87ZXYGW59Ns5jSBsrCXkQ/H0JmXg== X-Received: by 2002:a6b:ef1a:: with SMTP id k26mr20179690ioh.197.1620751358427; Tue, 11 May 2021 09:42:38 -0700 (PDT) Received: from mail-io1-f49.google.com (mail-io1-f49.google.com. [209.85.166.49]) by smtp.gmail.com with ESMTPSA id j19sm7702993iok.51.2021.05.11.09.42.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 May 2021 09:42:37 -0700 (PDT) Received: by mail-io1-f49.google.com with SMTP id d24so8899299ios.2 for ; Tue, 11 May 2021 09:42:37 -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 Content-Type: text/plain; charset="UTF-8" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heikki.krogerus@linux.intel.com, thomas.hellstrom@linux.intel.com, peterz@infradead.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, Marek Szyprowski , sstabellini@kernel.org, Saravana Kannan , Joerg Roedel , "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 , Tomasz Figa , "list@263.net:IOMMU DRIVERS" , Jim Quinlan , xypron.glpk@gmx.de, Robin Murphy , bauerman@linux.ibm.com Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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.