From patchwork Wed Nov 27 07:12:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 845746 Delivered-To: patch@linaro.org Received: by 2002:a5d:6989:0:b0:382:43a8:7b94 with SMTP id g9csp643381wru; Tue, 26 Nov 2024 23:13:15 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVesJFv6exQJLQrQZUultfT53oP8fSEMBZ+YOptxpO7Co8o+VXMnSnICJIaJlxVvkcwXr21gA==@linaro.org X-Google-Smtp-Source: AGHT+IE2bIAknFqR0GZ8wlhkQNmgOWOx2GAAZCQ4AJhlzph6EMGMjq6CD0t3hlAOsMpmtEV/j+0Z X-Received: by 2002:a17:906:cc56:b0:aa5:451c:ce20 with SMTP id a640c23a62f3a-aa58105980dmr113862166b.40.1732691594898; Tue, 26 Nov 2024 23:13:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732691594; cv=none; d=google.com; s=arc-20240605; b=B0ojq+UDB6Nw+e3JeJ4VCbHRzvLLJID1BIIBbNuWw7t3/pAF/ZqHbEb5vhiK51ePzv sRDzX++7gFsCBG+M8L+sZ+q/pmoxYIqJ4ywWLt6fpvHGHdCdK8M7KfLLCiS6NYW8jtHb tck0Mf0mPGhnD0bHiwHzVpoCojjNTxUMGlejVv3BM+RTIz10TXqAUBjhFYllOAN4LztL CTXUllpmsA+z9BSOWqam5aKOkLiYTV/MMkKbBE+u+hMivMEvWYkehbAYNQBYkJjQtR6O 8dTN8QKZ80dugfKz6uW3/ZxPNdgGyHj/Ng/poPH8CVEFnABgWuhU/Z4SW0d/bFaRnWmo s/Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=d2aF8E67n0YRJu+iNUN94nkCZZqiuGDagRDdnbmymyM=; fh=XQqClP2JY+Zsz5EjxBnUTa/Vp9x50nQR/jVjZleIhn4=; b=kvBdhvkmRyp1SiOXepqrEXnU3GpQq5pPqalrAlr/x7VsthK4c8Lp5pAUiSELA6UjOe YhEvZf7gBOpExRk3N0i80n49SiRlIAgh/NLCJLknq6YWgE4eJ9tGNO5CQcvMEd1F7DAi D3vjPZJiWp+Yz6flY/KQvENLHNvm3kJYxtgvfMCpySyGPg1nE5j8iG//2YU+AZWiF98D zgx5nYHX5Srw/VlTLcy1ZG7rHUM9s2zGA4RQLwaryZAfZbAmIyS8MVS1JdtKxc78m9U9 pkfNztsfYKgFyf45ppkheZyHUddURI9yGoUaQySkScu+Y5WKT7txzOA77ECqVGZas13s pOHg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aa57a87fc91si127050266b.64.2024.11.26.23.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 23:13:14 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BDA2D89CD6; Wed, 27 Nov 2024 08:13:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id E3D1E89794; Wed, 27 Nov 2024 08:13:07 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id E09B9896FF for ; Wed, 27 Nov 2024 08:13:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 33F012444; Tue, 26 Nov 2024 23:13:35 -0800 (PST) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5A1593F58B; Tue, 26 Nov 2024 23:13:02 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , E Shattow , Simon Glass , Tom Rini , Minda Chen , Hal Feng , Sughosh Ganu Subject: [PATCH 1/2] bouncebuf: allow for allocating bounce buffer frome heap Date: Wed, 27 Nov 2024 12:42:49 +0530 Message-Id: <20241127071250.736762-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241127071250.736762-1-sughosh.ganu@linaro.org> References: <20241127071250.736762-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The current bounce buffer logic checks if the user passed buffer is DMA aligned, and if so, the same buffer is used. This can be an issue on platforms which have certain IP's that are unable to access memory addresses above a certain point. Introduce a config symbol that can be used by such platforms which forces the bounce buffer logic to allocate the buffer from the heap which is part of the U-Boot image area. Signed-off-by: Sughosh Ganu --- common/bouncebuf.c | 2 +- drivers/core/Kconfig | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/bouncebuf.c b/common/bouncebuf.c index b2f87e4d93..f827378e5f 100644 --- a/common/bouncebuf.c +++ b/common/bouncebuf.c @@ -44,7 +44,7 @@ int bounce_buffer_start_extalign(struct bounce_buffer *state, void *data, state->len_aligned = roundup(len, alignment); state->flags = flags; - if (!addr_is_aligned(state)) { + if (CONFIG_IS_ENABLED(BOUNCE_BUFFER_ALLOC) || !addr_is_aligned(state)) { state->bounce_buffer = memalign(alignment, state->len_aligned); if (!state->bounce_buffer) diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index 6b4330fe4e..94258e8761 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -476,4 +476,11 @@ config BOUNCE_BUFFER A second possible use of bounce buffers is their ability to provide aligned buffers for DMA operations. +config BOUNCE_BUFFER_ALLOC + bool "Allocate memory for bounce buffer" + depends on BOUNCE_BUFFER + help + Certain platforms have IP's which are unable to access addresses above + a certain value. This symbol forces the bounce buffer to be allocated + from within the U-Boot image area for such platforms. endmenu From patchwork Wed Nov 27 07:12:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 845747 Delivered-To: patch@linaro.org Received: by 2002:a5d:6989:0:b0:382:43a8:7b94 with SMTP id g9csp643434wru; Tue, 26 Nov 2024 23:13:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUlRx+vXtT8QvcD8P6Q9z6wemmQQQ4PAuXdsxs0I6OObMcQJUxb9ZMsOvedsUlBAhd44H+S2w==@linaro.org X-Google-Smtp-Source: AGHT+IEUUskiYg4rgfg4/Z/bHUPRJEv1kVUauXAVhbOMLfBtQkP0aYnrEIroae0P+pVWo1aNVfYk X-Received: by 2002:a17:906:8a48:b0:aa5:451c:ce21 with SMTP id a640c23a62f3a-aa581054a20mr97871866b.40.1732691605829; Tue, 26 Nov 2024 23:13:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732691605; cv=none; d=google.com; s=arc-20240605; b=Uy9Uc5FyP94sA7soxgFZxxIGP7CkV8xVYJfr1+Y4grQo19yMpng0MvZ2ENBcmMOvPl p8CktRFIk7/kA9U7sG8U9C7zJ7etNFuMvYJFiROtJnpatK8oi89d32MOS3J50NxmDIzs F5KSelX77qvjHcXWZYUVzZZ4FyL/hzFkVWGp6GQgwVpnY4lg/MFIiagUPxJTHlECwPtG l1Xfc1KWfp9PL/HE9y5iQ9xG39PVOpx+urTi9MIbi9yuyDt/iZNxKBJsYOkw1WzbucaQ HgRBJVJ/upUBd72QIFaSEHIf77EaYwjyUT9gjbA/09ZDx3UY1tva+loOA5QeDo9YyxxY 0qYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=q7++C7WR1snnUiGgLU5CfaVQ2y+LlB2pDerxA0LledE=; fh=XQqClP2JY+Zsz5EjxBnUTa/Vp9x50nQR/jVjZleIhn4=; b=HyjyvrTOUP+5ZVUNXpJf2Zc9k8w+vc0ztiQydvMmje83Nu0DiS4OZDZVQylRemaEDj kthSoqPPCfsvb4z4UMiE3d4WM8o5H1yB734TttyHNSkJkx2Bwm6utdkA1cPQJbEHt07F IQxIVoMUSBSUR1nAXLaZzeNCg4j+NqI6KGF2bluu5+ldkP/CdLMELOq6RJ77YQtWeSxg djWIhJL5ZBH3AHVg3LXL+ny5BswOAeSPs/fQNy7yTjHWdKYp3Q/8UweiN8tePBUIlqNR JL4iKc9SZUf8xQVqSKtc265J9iIMmfyYHV2hor5Ii81Vf3oOhQQxmtv6xoA9fSDKW3/Y DLgA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-aa57a87f034si126618666b.100.2024.11.26.23.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 23:13:25 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 30B6689CD7; Wed, 27 Nov 2024 08:13:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 1C19489789; Wed, 27 Nov 2024 08:13:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 1A24E896FF for ; Wed, 27 Nov 2024 08:13:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8D7D7244B; Tue, 26 Nov 2024 23:13:38 -0800 (PST) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B3B6E3F58B; Tue, 26 Nov 2024 23:13:05 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , E Shattow , Simon Glass , Tom Rini , Minda Chen , Hal Feng , Sughosh Ganu Subject: [PATCH 2/2] configs: starfive_visionfive2: allocate bounce buffer from heap Date: Wed, 27 Nov 2024 12:42:50 +0530 Message-Id: <20241127071250.736762-3-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241127071250.736762-1-sughosh.ganu@linaro.org> References: <20241127071250.736762-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The boards using this config have a mmc controller IP which is unable to access memory regions above 4GB. Enable the CONFIG_BOUNCE_BUFFER_ALLOC config for these platforms. This symbol forces the allocation of the bounce buffer to be done from the U-Boot heap area. Signed-off-by: Sughosh Ganu --- configs/starfive_visionfive2_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig index 20f89ae679..bd071880aa 100644 --- a/configs/starfive_visionfive2_defconfig +++ b/configs/starfive_visionfive2_defconfig @@ -86,6 +86,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_REGMAP=y CONFIG_SYSCON=y +CONFIG_BOUNCE_BUFFER_ALLOC=y CONFIG_SPL_CLK_COMPOSITE_CCF=y CONFIG_CLK_COMPOSITE_CCF=y CONFIG_SPL_CLK_JH7110=y