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 30C3FC00528 for ; Tue, 1 Aug 2023 14:30:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4332A86C88; Tue, 1 Aug 2023 16:30:16 +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="Z96JJQaJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E4E4086C8B; Tue, 1 Aug 2023 16:30:14 +0200 (CEST) Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 2C9BA86AFD for ; Tue, 1 Aug 2023 16:30:12 +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 fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 371EU2jg013614; Tue, 1 Aug 2023 09:30:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1690900202; bh=qW1TbpD6GTI3l4lcMczNW/lZ/CdaCb9vZ+Mvaghtygw=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=Z96JJQaJG8k6TJG0zhpzcuuSRSYHmPgN47Zdn6hx/tfTmlCpL8utrhT/4ofRLdCjW 0wegXagAu7x2skUPogzeMdZXKLsfyDUeG5AlRSgr0ll6/5/8wjjC9b5KYER6V4Tv3W 4K75nzp6MNpXeVJPVlVRNva/GEfFPVG0PwuidcqE= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 371EU2UW123409 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 1 Aug 2023 09:30:02 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 1 Aug 2023 09:30:00 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE102.ent.ti.com (10.64.6.23) 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; Tue, 1 Aug 2023 09:30:00 -0500 Received: from [172.24.227.6] (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 371ETuMq054901; Tue, 1 Aug 2023 09:29:57 -0500 Message-ID: Date: Tue, 1 Aug 2023 19:59:56 +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 v3 5/9] board_f: Fix corruption of relocaddr Content-Language: en-US To: Simon Glass , Tom Rini CC: U-Boot Mailing List , Bin Meng , Nikhil M Jain , Anatolij Gustschin , Michal Suchanek , Ovidiu Panait , =?UTF-8?Q?Pali_Roh=c3=a1r?= , Rasmus Villemoes , Stefan Roese , "Luthra, Jai" , "Bhatia, Aradhya" , "Raghavendra, Vignesh" , "Bajjuri, Praneeth" References: <20230731160008.82342-5-sjg@chromium.org> <20230731193212.GE3630934@bill-the-cat> <20230731204454.GG3630934@bill-the-cat> <20230731210642.GI3630934@bill-the-cat> From: Devarsh Thakkar In-Reply-To: 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 Tom, Simon, Thanks for sharing all the information. On 01/08/23 02:39, Simon Glass wrote: > Hi Tom, > > On Mon, 31 Jul 2023 at 15:06, Tom Rini wrote: >> >> On Mon, Jul 31, 2023 at 02:49:06PM -0600, Simon Glass wrote: >>> Hi Tom, >>> >>> On Mon, 31 Jul 2023 at 14:45, Tom Rini wrote: >>>> >>>> On Mon, Jul 31, 2023 at 02:37:04PM -0600, Simon Glass wrote: >>>>> Hi Tom, >>>>> >>>>> On Mon, 31 Jul 2023 at 13:32, Tom Rini wrote: >>>>>> >>>>>> On Mon, Jul 31, 2023 at 09:59:56AM -0600, 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 v3: >>>>>>> - Reword the Kconfig help as suggested >>>>>>> >>>>>>> Changes in v2: >>>>>>> - Add a Kconfig as the suggested conditional did not work >>>>>>> >>>>>>> common/board_f.c | 3 ++- >>>>>>> drivers/video/Kconfig | 9 +++++++++ >>>>>>> 2 files changed, 11 insertions(+), 1 deletion(-) >>>>>>> >>>>>>> diff --git a/common/board_f.c b/common/board_f.c >>>>>>> index 7d2c380e91e..5173d0a0c2d 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; >>>>>>> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig >>>>>>> index b41dc60cec5..f2e56204d52 100644 >>>>>>> --- a/drivers/video/Kconfig >>>>>>> +++ b/drivers/video/Kconfig >>>>>>> @@ -1106,6 +1106,15 @@ 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 framebuffer from being allocated by U-Boot proper, >>>>>>> + thus preventing any further memory reservations done by U-Boot proper >>>>>>> + from overwriting the framebuffer. >>>>>>> + >>>>>>> if SPL_SPLASH_SCREEN >>>>>>> >>>>>>> config SPL_SPLASH_SCREEN_ALIGN >>>>>> >>>>>> Nothing selects this and it's not offered as a choice, so now we've just >>>>>> broken the original case? >>>>> >>>>> Yes, I should have mentioned that. I'm not sure which board(s) need >>>>> this option selected. >>>>> >>>>> Devarsh, do you know? >>>> >>>> And shouldn't this just be part of the normal flow when we have >>>> SPL_BLOBLIST && BLOBLIST, and not need a new symbol? I feel like I'm >>>> missing something here. >>> >>> Most of the discussion was on the v1 patch. >>> >>> https://patchwork.ozlabs.org/project/uboot/patch/20230724145210.304917-5-sjg@chromium.org/ >> >> OK, yeah. It seems like something more needs to be done then since >> "don't flicker the screen" is pretty much always the case if we have >> splash screen / video set up in SPL. Perhaps the case where that's not >> true should just be treated as the uncommon one, so we can do the >> ram_top suggestion normally? > The gd->relocaddr points to ram_top at the start and framebuffer is not the first region, I think TLB table is reserved first and then the framebuffer, so I am not sure if it is good idea to move ram_top since old ram_top is already used for reserving page table. As per my opinion https://patchwork.ozlabs.org/project/uboot/patch/20230801140414.76216-1-devarsht@ti.com/ should suffice to fix this issue ? Simon, Could you please try with above patch once? ? In your case , gd->relocaddr=c0000000, ho->fb=d0000000 so the relocaddr is already below the framebuffer so condition won't hold true and relocaddr won't get updated. > Yes I think that would be best. Also the video info needs to be fully > filled out to fix the x86 problem. > Sorry I didn't get this, As i understand by the time video_reserve is called only driver is bound but not yet probed and I think below fields are only filled after driver is probed, this for most video drivers as I see. u32 size; u16 xsize; u16 ysize; u32 line_length; So all these fields are zero in the handoff structure. Kindly let me know if any queries or issues faced. Regards Devarsh > Regards, > Simon