From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A5C77F8 for ; Sat, 20 May 2023 05:42:22 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id AA2AC68CFE; Sat, 20 May 2023 07:42:09 +0200 (CEST) Date: Sat, 20 May 2023 07:42:09 +0200 From: Christoph Hellwig To: Catalin Marinas Cc: Linus Torvalds , Arnd Bergmann , Christoph Hellwig , 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" , Robin Murphy , linux-mm@kvack.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4 02/15] dma: Allow dma_get_cache_alignment() to return the smaller cache_line_size() Message-ID: <20230520054209.GA319@lst.de> References: <20230518173403.1150549-1-catalin.marinas@arm.com> <20230518173403.1150549-3-catalin.marinas@arm.com> Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230518173403.1150549-3-catalin.marinas@arm.com> User-Agent: Mutt/1.5.17 (2007-11-01) On Thu, May 18, 2023 at 06:33:50PM +0100, Catalin Marinas wrote: > On architectures like arm64, ARCH_DMA_MINALIGN is larger than most cache > line size configurations deployed. However, the single kernel binary > requirement doesn't allow the smaller ARCH_DMA_MINALIGN. Permit an > architecture to opt in to dma_get_cache_alignment() returning > cache_line_size() which can be probed at run-time. > > Signed-off-by: Catalin Marinas > Cc: Christoph Hellwig > Cc: Robin Murphy > Cc: Will Deacon > --- > include/linux/dma-mapping.h | 2 ++ > kernel/dma/Kconfig | 7 +++++++ > 2 files changed, 9 insertions(+) > > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h > index 3288a1339271..b29124341317 100644 > --- a/include/linux/dma-mapping.h > +++ b/include/linux/dma-mapping.h > @@ -545,6 +545,8 @@ static inline int dma_set_min_align_mask(struct device *dev, > > static inline int dma_get_cache_alignment(void) > { > + if (IS_ENABLED(CONFIG_ARCH_HAS_DMA_CACHE_LINE_SIZE)) > + return cache_line_size(); > #ifdef ARCH_HAS_DMA_MINALIGN > return ARCH_DMA_MINALIGN; > #endif Maybe allowing architectures to simply override dma_get_cache_alignment would be a little cleaner rather than adding yet another abstraction? That might also be able to repace ARCH_DMA_MINALIGN in follow on cleanup. 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 BFA1CC77B7A for ; Sat, 20 May 2023 05:42:45 +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=t295ZMq0X4TDxp300wTbPqAIZiAedXA5q7Q5CmbeJP4=; b=fxeBNBXPuc0RBT 3pE1V33gDXAfZGlP6hQ+eBxIjTwlDk0TrAGl3urz1yavaETNPaSnXbDwaqQInsdebyX8K2tUoTciw aRiIJZiKCxtAt5YS8EzzUqbPKhPUzMd9K6txbFD0L14r1MzL0Dv2Vyh9+2+V3W8C/SI4zmRpHmxkP 8y54K+JsYslQyufuN4ZlUh+or/idCTzKEHQC6iJiPLrzH2JXb88xykGVDcdTKuay4uW9ps7nivr/S bMBnzz91kowsYjm7SXs+yc//nKTEhTE2Z9/oMUcrs1/VPVp58xNorLbgyxcAaMFUrVCkbc4t3vWqH 3NTWiXBnK+niD96jrcAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q0FMC-000mjK-0X; Sat, 20 May 2023 05:42:20 +0000 Received: from verein.lst.de ([213.95.11.211]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q0FM8-000mib-2h for linux-arm-kernel@lists.infradead.org; Sat, 20 May 2023 05:42:18 +0000 Received: by verein.lst.de (Postfix, from userid 2407) id AA2AC68CFE; Sat, 20 May 2023 07:42:09 +0200 (CEST) Date: Sat, 20 May 2023 07:42:09 +0200 From: Christoph Hellwig To: Catalin Marinas Cc: Linus Torvalds , Arnd Bergmann , Christoph Hellwig , 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" , Robin Murphy , linux-mm@kvack.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4 02/15] dma: Allow dma_get_cache_alignment() to return the smaller cache_line_size() Message-ID: <20230520054209.GA319@lst.de> References: <20230518173403.1150549-1-catalin.marinas@arm.com> <20230518173403.1150549-3-catalin.marinas@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230518173403.1150549-3-catalin.marinas@arm.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230519_224217_044653_B36DB8CD X-CRM114-Status: GOOD ( 21.58 ) 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 Thu, May 18, 2023 at 06:33:50PM +0100, Catalin Marinas wrote: > On architectures like arm64, ARCH_DMA_MINALIGN is larger than most cache > line size configurations deployed. However, the single kernel binary > requirement doesn't allow the smaller ARCH_DMA_MINALIGN. Permit an > architecture to opt in to dma_get_cache_alignment() returning > cache_line_size() which can be probed at run-time. > > Signed-off-by: Catalin Marinas > Cc: Christoph Hellwig > Cc: Robin Murphy > Cc: Will Deacon > --- > include/linux/dma-mapping.h | 2 ++ > kernel/dma/Kconfig | 7 +++++++ > 2 files changed, 9 insertions(+) > > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h > index 3288a1339271..b29124341317 100644 > --- a/include/linux/dma-mapping.h > +++ b/include/linux/dma-mapping.h > @@ -545,6 +545,8 @@ static inline int dma_set_min_align_mask(struct device *dev, > > static inline int dma_get_cache_alignment(void) > { > + if (IS_ENABLED(CONFIG_ARCH_HAS_DMA_CACHE_LINE_SIZE)) > + return cache_line_size(); > #ifdef ARCH_HAS_DMA_MINALIGN > return ARCH_DMA_MINALIGN; > #endif Maybe allowing architectures to simply override dma_get_cache_alignment would be a little cleaner rather than adding yet another abstraction? That might also be able to repace ARCH_DMA_MINALIGN in follow on cleanup. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel