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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 57E82C001DC for ; Mon, 31 Jul 2023 11:10:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3D6F986988; Mon, 31 Jul 2023 13:10:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="Zf6Ohy9M"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BAEB5865BC; Mon, 31 Jul 2023 13:10:08 +0200 (CEST) Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id ECF69865BC for ; Mon, 31 Jul 2023 13:10:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=devarsht@ti.com Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 36VB9thb091544; Mon, 31 Jul 2023 06:09:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1690801795; bh=xceBfMvDSdoNE24suOrdUwQcZxelkYfydyJPOliGrqg=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=Zf6Ohy9MxAkJAe5k/7gwSijkKWQcqRmBjSCF3ZXDDPWcd8G+gVvce5dXH8xPFxt4+ anogxO4bQvVzL30VDCvorfoSiaUgWROlmhVqT2uBcASMirg0d6F07ETBhksHZXH6Bj 7am37LqrZuFe2CTYFbSkNm+P60W8hC/Wh3p5VAOM= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 36VB9tQE111508 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 31 Jul 2023 06:09:55 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 31 Jul 2023 06:09:55 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 31 Jul 2023 06:09:55 -0500 Received: from [172.24.227.6] (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 36VB9pEs042361; Mon, 31 Jul 2023 06:09:52 -0500 Message-ID: <714bd128-cbd9-15e1-eb19-a868ad86581d@ti.com> Date: Mon, 31 Jul 2023 16:39:51 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v2 5/9] board_f: Fix corruption of relocaddr Content-Language: en-US To: Simon Glass , U-Boot Mailing List CC: Bin Meng , Nikhil M Jain , Anatolij Gustschin , Michal Suchanek , Ovidiu Panait , =?UTF-8?Q?Pali_Roh=c3=a1r?= , Rasmus Villemoes , Stefan Roese References: <20230730171619.915576-1-sjg@chromium.org> <20230730171619.915576-5-sjg@chromium.org> From: Devarsh Thakkar In-Reply-To: <20230730171619.915576-5-sjg@chromium.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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 Hi Simon, Thanks for the patch. On 30/07/23 22:46, Simon Glass wrote: > When the video framebuffer comes from the bloblist, we should not change > relocaddr to this address, since it interfers with the normal memory > allocation. > > This fixes a boot loop in qemu-x86_64 > > Signed-off-by: Simon Glass > Fixes: 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot") > Suggested-by: Nikhil M Jain > --- > > Changes in v2: > - Add a Kconfig as the suggested conditional did not work Overall this approach looks fine too but just curious to know, what is the ho->fb and gd->relocaddr in your case, so that we could understand your scenario better and maybe devise a more generic condition as a later-on patch since you mentioned that shared condition did not work for you. > > common/board_f.c | 3 ++- > drivers/video/Kconfig | 8 ++++++++ > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/common/board_f.c b/common/board_f.c > index 7d2c380e91e2..5173d0a0c2d5 100644 > --- a/common/board_f.c > +++ b/common/board_f.c > @@ -419,7 +419,8 @@ static int reserve_video(void) > if (!ho) > return log_msg_ret("blf", -ENOENT); > video_reserve_from_bloblist(ho); > - gd->relocaddr = ho->fb; > + if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL)) > + gd->relocaddr = ho->fb; > } else if (CONFIG_IS_ENABLED(VIDEO)) { > ulong addr; > int ret; Ok, so as I understand in your case you have enabled CONFIG_SPL_VIDEO but not calling reserve_video in SPL stage ? > diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig > index b41dc60cec59..e0e07ed0cda5 100644 > --- a/drivers/video/Kconfig > +++ b/drivers/video/Kconfig > @@ -1106,6 +1106,14 @@ config SPL_VIDEO_REMOVE > if this option is enabled video driver will be removed at the end of > SPL stage, beforeloading the next stage. > > +config VIDEO_RESERVE_SPL > + bool > + help > + This adjusts reserve_video() to redirect memory reservation when it > + sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the > + memory used for video being allocated to U-Boot, thus having some {some minor suggestion for correction on above text} avoids the memory used for framebuffer from being allocated to u-boot, thus preventing any further memory reservations done by u-boot from overwriting the framebuffer ? I think as mentioned earlier, overall this approach looks ok to me too, maybe later on we can add some conditions to check validity of passed framebuffer address and move the relocaddr pointer more intelligently. Regards Devarsh > + data structures overwrite the framebuffer. > + > if SPL_SPLASH_SCREEN > > config SPL_SPLASH_SCREEN_ALIGN