From patchwork Thu May 18 17:33:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 13247177 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 C6ED6C7EE23 for ; Thu, 18 May 2023 17:34:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E1A3900011; Thu, 18 May 2023 13:34:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 591CC900003; Thu, 18 May 2023 13:34:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45901900011; Thu, 18 May 2023 13:34:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 3608D900003 for ; Thu, 18 May 2023 13:34:57 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 06739140271 for ; Thu, 18 May 2023 17:34:57 +0000 (UTC) X-FDA: 80804076234.29.0192D7C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id 48D4340013 for ; Thu, 18 May 2023 17:34:55 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf11.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=1684431295; a=rsa-sha256; cv=none; b=vJ40EeYksvC/y+Y0dqoSoJtwpCrS20EKew7zoaBTUREKF9mN28q1yZ0a3q7LhNg6fIQ4v9 BbWcZ6h1pXTWzCiQXDExj4q/zqmf+KBX4VURlEfmRVPhgusyhd6TT8LpNVoLL1roZukGvG JWLvjk+eHGoKdIkPdlIrXRZ5DaHgMN4= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf11.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=1684431295; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z/m1w3e8Po7xonc6XvWY7SoVtTJgRC1UKGOvdrhNCrg=; b=TABABr3Mg41JdWenY+7/jNzWOlI7rrOXEL78KDX0c2sXFEmhrxkz9MhbmMcC3+MxWkF5uZ iyzDDC7OTtjQGIXieMuOODkl9I5muCE00U6wQaOmPC+kSOcOQOT52OCRIuTWPTDJFH76Ve TliUV4U2atX3Cnp6/7uoS9RYhovtBHA= 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 71F7665097; Thu, 18 May 2023 17:34:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39C46C433EF; Thu, 18 May 2023 17:34:50 +0000 (UTC) From: Catalin Marinas To: Linus Torvalds , Arnd Bergmann , Christoph Hellwig , Greg Kroah-Hartman Cc: 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: [PATCH v4 11/15] scatterlist: Add dedicated config for DMA flags Date: Thu, 18 May 2023 18:33:59 +0100 Message-Id: <20230518173403.1150549-12-catalin.marinas@arm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230518173403.1150549-1-catalin.marinas@arm.com> References: <20230518173403.1150549-1-catalin.marinas@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 48D4340013 X-Stat-Signature: gst3kqoz4umboae4upqoejiqgntorm1c X-Rspam-User: X-HE-Tag: 1684431295-622609 X-HE-Meta: U2FsdGVkX19QXEqp8F8cFeDCTMzEgdElm/06G00OvUpR60kYPkhBY2vLUNRnTGs+FC5DTiGM/nUK5sEFfM918hmPziVI9AQPFnALMwNLaFKiNC8hXt2+b2cly3YQgRwNpN2TexKy96QxTB2sxzfx0v3aZOlNW6cGeNZv3wtcbynPWJ/yTrs7b63bOkuKHGPqnZ2sf1laYdjbeJfVlQMtyuN23ror2IYdw8vAD7Gml/TRz9lPbm/bPrwybyGoonbIzMhaTtlwBDufgS5QqqnNz33vYDnGyTSrP1cRbf0SQGmbl5HspcVypQwfZiWV4S9hSMp9L8iC4QT1mTh1MglyA0vpjrrfdJuWyICeLSFgWyWuaj+NmBsRMWB4ajrYxxAX/diDR0UXdOXSoSDNyvSw6dIaQlzQdvH5+pnoMh+3jcayx8hE25kGv7bQ19H8tAJ5+ysuSPP+ApFayc6MBYlaXMroolekOsVVidzV7gpKVPfGbfBlTVnZwuEQd6pLmYTO+Kgv13JI1DXVlJcDs8ObHJVlmtXGFi570X7VT7SYfZVw2XBiOnKTz1flokAjU8U26hsI80jeo4nuHoIzZnzcQl3Mj9qY6NJu+U+SSVAgXOyshboyWQ6/yk+xoB+IUlMuQpTiqnI6wYlPD6euLZHYWymMceq1e4DL8Z+1FhyUKcivVfWW8is1FwKVmsFWkGJOtN8GBrkGazwTruF0/wrWqLxI0PzBI2+BxJwwlnyUIcxwygvHdozWD9ZurwVjLQktWMnGyDV0DJZkWDBMefssZNsBC70gbrgGcgahXuEqgFuNq7OgnT3rjh0iAo+CgzT3lHPPMaFbkq/gOGUPIe4nTWakgJb2l0YexZnoxrZDmW/2zd/1DwGfI7dwT6zpbcSaA5U3ROMJsRZzMl1WYLSUkEtWLjE5HqUo6zYJVMrVjetH9k4tR1a/DU8Yf9jYM90ABzKOC3v0PwtOlizRU+c 9oySPbKf UI8ejFHix2qIUdL1h30/iqFC4pKkgwEjPdTifxMigDLCBjO6Zyvtuj5K4903N6kHZ6XrDJyg28MroWo95j/Z+z1StNIXgh6EogQRNNjx4LQ2OB2UgvC+6TTkwffNOYSE5FjjXVIougU97ADt88ozaWdJkKkhzD/5XKwrBqbp9LS3JcJJb1lZZVrtqR/XmfiA15aY5ffv5ZjNmvjzp5OIwUCu9pmpA3ydDWqa5CmUdgwjc/MKFY+oeM11zIz6qEHxxbfeMYVZykp1Zz/Dw6IMbzJprcL/AiSoMEdf7+ZQeTKlvDpEKCQ17zxYeS06up+KdRhktf/nlPvHUqVJPXlVJOCbUlD0omz4fApY7MtjpxmYV0kz401I4azB0CwRXsHhdHupV/7yYBqW55re6rUdVC+gRd8OBHAVla+HfNEU7MR9i7dV3Z/JvHkhNEDTKQWxcGXkpeR+0hlzp/tzArPoCc7F1C+H7X0uo+3PohRwo9y3jCyUIqKl3WT/dWoyR8TRa0oiD 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: From: Robin Murphy The DMA flags field will be useful for users beyond PCI P2P, so upgrade to its own dedicated config option. Signed-off-by: Robin Murphy Signed-off-by: Catalin Marinas Cc: Christoph Hellwig Reviewed-by: Christoph Hellwig --- drivers/pci/Kconfig | 1 + include/linux/scatterlist.h | 4 ++-- kernel/dma/Kconfig | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index 9309f2469b41..3c07d8d214b3 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig @@ -168,6 +168,7 @@ config PCI_P2PDMA # depends on 64BIT select GENERIC_ALLOCATOR + select NEED_SG_DMA_FLAGS help Enableѕ drivers to do PCI peer-to-peer transactions to and from BARs that are exposed in other devices that are the part of diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 375a5e90d86a..87aaf8b5cdb4 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -16,7 +16,7 @@ struct scatterlist { #ifdef CONFIG_NEED_SG_DMA_LENGTH unsigned int dma_length; #endif -#ifdef CONFIG_PCI_P2PDMA +#ifdef CONFIG_NEED_SG_DMA_FLAGS unsigned int dma_flags; #endif }; @@ -249,7 +249,7 @@ static inline void sg_unmark_end(struct scatterlist *sg) } /* - * CONFGI_PCI_P2PDMA depends on CONFIG_64BIT which means there is 4 bytes + * CONFIG_PCI_P2PDMA depends on CONFIG_64BIT which means there is 4 bytes * in struct scatterlist (assuming also CONFIG_NEED_SG_DMA_LENGTH is set). * Use this padding for DMA flags bits to indicate when a specific * dma address is a bus address. diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig index cc750062c412..3e2aab296986 100644 --- a/kernel/dma/Kconfig +++ b/kernel/dma/Kconfig @@ -24,6 +24,9 @@ config DMA_OPS_BYPASS config ARCH_HAS_DMA_MAP_DIRECT bool +config NEED_SG_DMA_FLAGS + bool + config NEED_SG_DMA_LENGTH bool