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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id F1D49C77B7C for ; Fri, 26 May 2023 19:22:52 +0000 (UTC) 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=bKA2d612Z7urb2C4xqh5hvczSB+EljWKwv4hqTzi9Ew=; b=yu6xfCpl2RLuwm /c48UTIzDoNYZQWLHHDsPWXZYhtB+i45bf4mQRpKSllWPnxGp+LZBqol5XRwKvySCMn6D2k4+uo9W p2PwL3COrAn5VhnybnnKu3GmwzxY8QK5nUHaygxF37mILFBvVR1GADql/9kCR4KNJTBlYFpky2dW2 U3RkSSP/f9ZtrqaGZpdEcgNjR+14K97BnwvJRzIx8UYqUD6QdmKBacpXmcFDo1yK1awQhohJg4jfb 3f/YeFBdZjackwi9AaL3Yte5EY0WE5f7gdYNbNF3SfPX/bSOk7MqnLLyjH+sERPV24VDn3EzQdq4+ 3U33b23tAJB1DO0ugKmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q2d16-003dMe-2t; Fri, 26 May 2023 19:22:24 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q2d13-003dLv-2v for linux-arm-kernel@lists.infradead.org; Fri, 26 May 2023 19:22:23 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EC35F652AE; Fri, 26 May 2023 19:22:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FB83C433EF; Fri, 26 May 2023 19:22:16 +0000 (UTC) Date: Fri, 26 May 2023 20:22:14 +0100 From: Catalin Marinas To: Jisheng Zhang Cc: Linus Torvalds , Christoph Hellwig , Robin Murphy , Arnd Bergmann , Greg Kroah-Hartman , Will Deacon , Marc Zyngier , Andrew Morton , Herbert Xu , Ard Biesheuvel , Isaac Manjarres , Saravana Kannan , Alasdair Kergon , Daniel Vetter , Joerg Roedel , Mark Brown , Mike Snitzer , "Rafael J. Wysocki" , linux-mm@kvack.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v5 13/15] iommu/dma: Force bouncing if the size is not cacheline-aligned Message-ID: References: <20230524171904.3967031-1-catalin.marinas@arm.com> <20230524171904.3967031-14-catalin.marinas@arm.com> 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-20230526_122221_990901_D449AB1F X-CRM114-Status: GOOD ( 17.91 ) 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 Sat, May 27, 2023 at 12:36:30AM +0800, Jisheng Zhang wrote: > On Wed, May 24, 2023 at 06:19:02PM +0100, Catalin Marinas wrote: > > diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h > > index 87aaf8b5cdb4..330a157c5501 100644 > > --- a/include/linux/scatterlist.h > > +++ b/include/linux/scatterlist.h > > @@ -248,6 +248,29 @@ static inline void sg_unmark_end(struct scatterlist *sg) > > sg->page_link &= ~SG_END; > > } > > > > +#define SG_DMA_BUS_ADDRESS (1 << 0) > > +#define SG_DMA_USE_SWIOTLB (1 << 1) > > + > > +#ifdef CONFIG_SWIOTLB > > s/CONFIG_SWIOTLB/CONFIG_NEED_SG_DMA_FLAGS ? > Otherwise, there's compiler error if SWIOTLB=y but IOMMU=n Yes, I pushed a fixup to the kmalloc-minalign branch. > > +static inline bool sg_is_dma_use_swiotlb(struct scatterlist *sg) > > +{ > > + return sg->dma_flags & SG_DMA_USE_SWIOTLB; > > +} > > + > > +static inline void sg_dma_mark_use_swiotlb(struct scatterlist *sg) > > +{ > > + sg->dma_flags |= SG_DMA_USE_SWIOTLB; > > +} > > +#else > > +static inline bool sg_is_dma_use_swiotlb(struct scatterlist *sg) > > +{ > > + return false; > > +} > > +static inline void sg_dma_mark_use_swiotlb(struct scatterlist *sg) > > +{ > > +} > > +#endif And I wonder whether we should keep these accessors in the scatterlist.h file. They are only used by the dma-iommu.c code. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel