From patchwork Wed May 24 17:19:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 13254350 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 4774BC77B7C for ; Wed, 24 May 2023 17:19:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB26690000E; Wed, 24 May 2023 13:19:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D6289900002; Wed, 24 May 2023 13:19:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2B8390000E; Wed, 24 May 2023 13:19:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B14FC900002 for ; Wed, 24 May 2023 13:19:58 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8017316028D for ; Wed, 24 May 2023 17:19:58 +0000 (UTC) X-FDA: 80825811276.27.0935B58 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf14.hostedemail.com (Postfix) with ESMTP id BE4A0100018 for ; Wed, 24 May 2023 17:19:56 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf14.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=1684948796; 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=jcO3Jclmw9mB7L7BfaIYzVvXEyR0RpDGNHlTTAHR8/g=; b=GVGobseF3qb+2BnW275/ZTpStHiitUluhJw0G8KChV3ixH9otec99UzuAgRTMnz7xGM7gb GCIvxEFq1v4taeN648FArGdrwpEgQmTVR/ZqxRMIT+6SGU1zE3UFMmKBVbGGCh1KBLeTEy 1rdpVWn/uDOS3iuIJxvWKWQEx5HtJ54= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf14.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=1684948796; a=rsa-sha256; cv=none; b=oSv9Y0MhAUUdGy99AZ7dP9T1qJElyYc+Oo6tdi4neYXfz5ux+f7XrjZwdkvpKfE1f0P8OX HRIiT44Ipd+LE6vnwayNd+Zu5UdJH3M65ZSNitE+9ftyk+y3Y1EwKTg4CtrBL7AgXCcDgq t5LUB5k8OwaEBzjwjnY4f/TmqJV9hmc= 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 EA09D63C6C; Wed, 24 May 2023 17:19:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 768AFC433A8; Wed, 24 May 2023 17:19:51 +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" , linux-mm@kvack.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 11/15] scatterlist: Add dedicated config for DMA flags Date: Wed, 24 May 2023 18:19:00 +0100 Message-Id: <20230524171904.3967031-12-catalin.marinas@arm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230524171904.3967031-1-catalin.marinas@arm.com> References: <20230524171904.3967031-1-catalin.marinas@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: BE4A0100018 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: ztpo9xx1hb1nfg8pzi3xa15myenhob93 X-HE-Tag: 1684948796-956292 X-HE-Meta: U2FsdGVkX1/B5gf3QQ8WbkgSMsOn7Lx38cH+/mBm21ckxcs0m/pDNTM0pbP5RuSTL6ax6X3MTi3oC3OFXoLBRJX2SXQK0owDbgXBrul3fo8BEZGe5ow0Nk8WMuGYviBZ+8Zbk0Gk5nT2mvEzOKy3vNRk/vw1YHjbGQYx1E/RcdLhaLvYD9d+8sFDPNzgn5I2Z7dFLaUog3XijYZh2H0W1D0NlVF/SR/P2khmsb0blx3Mc+ZUqfu6kI6jOKg8TavTOWY3ViR6SRtLQY3albuyp4A3xX02Q1L+3MrQs8yhMKkipdf6kDnV2iUnpcu1oMnAyZuBxX07eg2OnU9G76Fuvzq3WhQNTnEQ9+jbFyBv/JUlsOLI9gO6lRSP4ahdthjsUGI6Ryx0tCraN4x4fROZN+LASL2lSnm2lJX15vOSGsbv2sn1zQWtUXXe25GSlaLyGfkHcf+bKr5l7fpbygTq0EeLFAdJWvlEp6ISC/qLFfiF8ENVzbUjaKM+WlWseQBU4gUt0zOisnv2VMq3IGxq7lb0G64G3wZ9fs39XTC5ADuvJcV0ImGVGFv4FQKa/2EqxNea7TDROkr9rxtpo1WvjmYYKnc19/VCPeO4NjJ8KBLwJspn5toQD81jTJ28Be3R2KNJ/dE77Eo2OwqZnMwpuBRtx+RQAN6CKnl+BiLfHxoePIg41UHcFDWb/CJR4diit2GKfOWnm+V5g2ACJJ6azS7IY0nh/z/nfjimPR0A9LqHxi0y0+f+Sftqg4AydjgFNB0i8OFyC/RE4KVy7q5P0urlAJvrjbbQDZWAX/o7JTOc1wB1DO31j7bUUH0SjfF5f9CKn2YaQshvcSvFa2AKF9Y1b9MHKFCGVaTrKe4UuEwoWO32ezHe8X4kfifYnRtQZhLzNs2JIZ0YY8v/VK/YV0lm8v4KlR1GQ+gNy8JpCdMS6sXNIFCmSurXK47/WWCpYsoHkmTrzvdd+FdLr1w OtRZ3E59 /7fIl2qm1cLtdKyDNsyqFPdeGXKc+5uarA0juxQf3CX32ytVGPwhFFRNfn3PMREdAsM4LQgs8qd75QH547ugw0tS663vwk0WbNfsXIwctZtuUIYEpbw6NplVKmufiLoqFyXbJ3ePA6oq/x3uds9+qWgsxBMy6WLQR0YEea9CGiQyRIn1DTIfs0z3f+iSA0iscY/iB/fMea0mNwoK7cmMUAb2I50qBN1Ej5rzeTdWC3c/4NLUvB5pcU/0+/Pn3sqmQX++A4SLO+Ul6pdXrG8CoK1I1gz5Fs3f7lZfQ+pGqtw5qOx/2+LNONAGX8QBCleA2cBIsLi+ymqfVBoW0sYUBLwBWcQmtBTQp64A7ZNKMJL6dVShnM0K4Rfku0V/rKs9IrROhIHRK1YX7iKB8VzDQ/stccSrl8l/UoeM8BGDS4Zbvvgxtm9DwNVePSqRixLDGzX5/mcn7XFWAxnojH2eFpYdceCnLLFFL9jjWSdEFPnOI9DXV/9u58Y1sNe3XVu8eolg6 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 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 6677d0e64d27..acc6f231259c 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