From patchwork Wed May 31 15:48:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 13262455 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C938C77B73 for ; Wed, 31 May 2023 15:48:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B1F508E0006; Wed, 31 May 2023 11:48:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ACFF08E0001; Wed, 31 May 2023 11:48:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9BE1C8E0006; Wed, 31 May 2023 11:48:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 8E5BE8E0001 for ; Wed, 31 May 2023 11:48:53 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 6AC2816024F for ; Wed, 31 May 2023 15:48:53 +0000 (UTC) X-FDA: 80850983346.17.EA589CA Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id CA84E80012 for ; Wed, 31 May 2023 15:48:51 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf02.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685548131; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qms+9sEtyjEiS/3cZZb5NgzaCqfRLp/F+aac0bZ7Tw0=; b=x9OVG9SXlba3eX8My0mqfcKjfXmKeYtYG1RrfoptQcuZTDQ0i3H8vjB0BZjMLhn6lQKgaH jGMZAxmzCDBvwzRViop10XW38cNaYRgGTqFe9FDWARJsoMaUM+k57IWGeyLaXkrYgOrpSF pjxsywzJWARuv7v9k4LHarmx/MLH3Ss= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf02.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685548131; a=rsa-sha256; cv=none; b=I4VauLwTLvHjY6och43sO0o1Lgt0KBsIKnc4KuIlY5KdrGRXldvcMfflHyGM+2dnBgx7Mb Akq7SEl1ahBChtqT0/mV8crLxLPd4NPUpS6fx7Y74GLpLJD3QHE4cTtoPb4Pmc0AXqRZ6J ZjSN97ruyuTtFqJHdadWwwXoPmZWfyk= 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 CF557638F6; Wed, 31 May 2023 15:48:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84008C433AA; Wed, 31 May 2023 15:48:46 +0000 (UTC) From: Catalin Marinas To: Linus Torvalds , Christoph Hellwig , Robin Murphy Cc: 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" , Jonathan Cameron , linux-mm@kvack.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 02/17] dma: Allow dma_get_cache_alignment() to be overridden by the arch code Date: Wed, 31 May 2023 16:48:21 +0100 Message-Id: <20230531154836.1366225-3-catalin.marinas@arm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230531154836.1366225-1-catalin.marinas@arm.com> References: <20230531154836.1366225-1-catalin.marinas@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 6bfgurhmdhosrpjsismy64tcrmy1gx7z X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: CA84E80012 X-HE-Tag: 1685548131-213327 X-HE-Meta: U2FsdGVkX19vDfMbBMYqHU0Xx1tBMshqFktZbiH5JSGsaBQUZpUZkKsqP/GoOxIFc04xI3WXBswj2Gdg/2xH5SOuCz0wgGlVNd3Vg9nht3BkqOhKf37rsywgRNNt6QC2sgflLhi+So4zxqU0Q7Ejvmt9OL2IbxeGYlBhapoQVnaecxmgtEWWGHVr+L2hYAMeHVIcAl/B1peChIOTQ3hheC+AXZS1g9XCQhwezkukps2O2U48xmgw+0YLA1Vig131xNOb5BRziLYEgKOj6j/t6qnISbNIerLGpQU+xIzoblXbeGL48MPswL08gntB+c6NnwhDT+F6LQE9Q3zR3VD6VmcUepor9lzOwtfYug8K0tREfDVxLrZ6w6rQBkHv97YSVZzhR3cN5lLACbl/609qyAewD2S0v3feIvzclfPwJO5W2r2mvUxv43ZefLSEikxEDQn0T/dU8BZAfyNEX+70Pi8ejD/HWiVaYpyyVt8ZCQ1iJ9yXPyji4nm+ZyXKdCmdaqjqbV43tmnD6lyg4C97aj4oeoLfthct0/CLuvNL3KAyRcFaQcIKagEBSL+uNewVos0zoLUTtmW7sboBN0Hm5WB/6PJw8bAUE1cfNlFAtbO5XZkjlA0dGx+44rYvTjp7W5WbtwqnK2ggFzAVWEdnza7l6V9rdpjQW2D7UXzCx7ZGz/YjlpZZ4w5PhDudXbPPTd9XOdjigkd+0gHLOcnouITRBhjv2TEO9IZJzavLXHwEIRdz3oW5yLVWXOniW3pNiFwDeKssz4bxjBQ3ykQKBtkuXiSwM+qsy9nNDNqt/heiZUrDYyht/dNIHIWGN4ANd3i3jCRVIiBBnPlMzHgtjl0aGAq2g3MkH9s7TafK0oDOewVSVF42TkB7qclNKZxfK5zGQEcUUOTF46IRhCMeJMkyLACYzDqUBtqlWX7GpajHR1DS9OzcFqpcnpC+0vd+Z5JCp/ddzy39dVoJYe+ MrKA6dye TbT+vbn340CKWChS5LgvkEoYkoxYbYCRwmO87Eap5chEa+o8oBFTRjD24EnYct4WfQDmeAtMhVciOG4GfB03ourhaxoCR4lP2pmJbrd1EqaC51+753xki/IVEUxR4tJyEWYbQwPyPM5NpEaYAfhAkQOjPM3D1X+OuP25BCn2UbdT549+4rA/69P0f3suctgdKPqWtWlgC1cTKq8DViK7HoUrD71KaBpTj26FVv/M0LLjzbPhT7O+Bqhy8gd89GVcbj0V+IRwTFKTgCWGJO5tP06Tt0cTqBKfNo2szNSQnmEjuQdSCVVlpOVV/uIbkcafgQ7Cix1MGsbs9c9s5bRxeRvBL0bkiiF0sfB9FEpbm+rmTalYooJLCZ0fhDOD0jwKUP0NhnH6+UsPm6+EziTNwuLlpz+q7Xp62uHtvTEIt5V/B0AItrncoNLanPSKebeeVwdVKC9N9NxY3Zu7BIrmuaPrDB4babbgkg3lUMwHqooUUcPObxuHhWwfLCh5tUi1PJsO171gr0KCvaRB+At5RBRO9jWzfXDcC5y0KKTCCSEIkljLR6/AT0UhwJoOPcsN4C/mP X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On arm64, ARCH_DMA_MINALIGN is larger than most cache line size configurations deployed. Allow an architecture to override dma_get_cache_alignment() in order to return a run-time probed value (e.g. cache_line_size()). Signed-off-by: Catalin Marinas Reviewed-by: Christoph Hellwig Cc: Robin Murphy Cc: Will Deacon --- include/linux/dma-mapping.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 3288a1339271..c41019289223 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -543,6 +543,7 @@ static inline int dma_set_min_align_mask(struct device *dev, return 0; } +#ifndef dma_get_cache_alignment static inline int dma_get_cache_alignment(void) { #ifdef ARCH_HAS_DMA_MINALIGN @@ -550,6 +551,7 @@ static inline int dma_get_cache_alignment(void) #endif return 1; } +#endif static inline void *dmam_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp)