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 A6085C636D6 for ; Mon, 20 Feb 2023 22:47:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 254E785841; Mon, 20 Feb 2023 23:47:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=xs4all.nl Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; secure) header.d=xs4all.nl header.i=@xs4all.nl header.b="RxaU6SIv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 062DB85905; Mon, 20 Feb 2023 23:47:14 +0100 (CET) Received: from ewsoutbound.kpnmail.nl (ewsoutbound.kpnmail.nl [195.121.94.169]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 70C708338B for ; Mon, 20 Feb 2023 23:47:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=xs4all.nl Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mark.kettenis@xs4all.nl X-KPN-MessageId: 801fe7ae-b170-11ed-afdd-005056abad63 Received: from smtp.kpnmail.nl (unknown [10.31.155.37]) by ewsoutbound.so.kpn.org (Halon) with ESMTPS id 801fe7ae-b170-11ed-afdd-005056abad63; Mon, 20 Feb 2023 23:47:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=xs4all01; h=subject:to:from:message-id:date; bh=4NZLFm8RuIGrr11jO/VJFfDiNw2brFIQOrG9ZgzN56w=; b=RxaU6SIvu1RP5zACRFbG1nRccxW9tiAdnA5DXagfAVIS37Lry9fw6bEebeeUEwD5DaMZ1vTTQ126Y bQzHiAN/Ucxk20DlR946VaYQhCYFf0OzAt2YaZUoQvMbS/IssMOcqpJQ7bRSIch7wc8CzFYv16GrAw I72gAH84JUbUE7DyMm9xFczdOVD3TbufWNVZHn9Y24M4SMXQoD7HIH5weCsa2///qJ4wBjWd1XO8rZ 6Im5Pd345TnO0ukxUB9mxNlSealv29+GatnWb4N24adgUwurGo6AfaWDHuRSU7wgX6+lv/PPIrun13 cW3TnsE29tjewof1w7atc+i2qwgwmxQ== X-KPN-MID: 33|RauPvjeCiHvUj1OFDzV9f1HjTAsbTlvjwfsULV+WIMo7vZrgbAaJWGk8xBIeHSe B6hVqavFdqPZ1QG5WVy4PyWDOgg51it1PeDxpFP/B16Q= X-KPN-VerifiedSender: Yes X-CMASSUN: 33|iYs65S94yjGRfywaLSU1EJ4SUniiV+Sfs9e5n6Y0kFKZoXQZm4AV7xgaG04UVuN dHnpojKUT5u3w4Zc8nsI/Wg== X-Originating-IP: 80.61.163.207 Received: from bloch.sibelius.xs4all.nl (80-61-163-207.fixed.kpn.net [80.61.163.207]) by smtp.xs4all.nl (Halon) with ESMTPSA id 81065962-b170-11ed-ae07-005056ab1411; Mon, 20 Feb 2023 23:47:08 +0100 (CET) Date: Mon, 20 Feb 2023 23:47:07 +0100 Message-Id: <875ybwt0no.fsf@bloch.sibelius.xs4all.nl> From: Mark Kettenis To: Eugen Hristev Cc: jagan@edgeble.ai, jonas@kwiboo.se, sjg@chromium.org, philipp.tomsich@vrull.eu, kever.yang@rock-chips.com, u-boot@lists.denx.de, eugen.hristev@collabora.com In-Reply-To: <20230216132905.333332-2-eugen.hristev@collabora.com> (message from Eugen Hristev on Thu, 16 Feb 2023 15:29:05 +0200) Subject: Re: [PATCH 2/2] board: rock5b-rk3588: add memory gaps into kernel's DTB References: <20230216132905.333332-1-eugen.hristev@collabora.com> <20230216132905.333332-2-eugen.hristev@collabora.com> 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.6 at phobos.denx.de X-Virus-Status: Clean > From: Eugen Hristev > Date: Thu, 16 Feb 2023 15:29:05 +0200 > > RK3588 has two memory gaps when using 16 GiB DRAM size: > [0x3fc000000 , 0x3fc500000] > and > [0x3fff00000 , 0x3ffffffff] > > If the kernel is agnostic to these gaps, accessing the area causes > a SError panic. > > Hence, add reserved memory areas in kernel's DTB before booting. I can confirm that using the full 16GB of memory on the rock5b causes prolems for OpenBSD as well. Was wondering whether excluding these regions was better done by adding reserved-memory nodes in the device tree though like what is done in the meson-g12-common.dtsi file for example. > Signed-off-by: Eugen Hristev > --- > > Hi, > > These memory gaps are required because the kernel crashes with a SError if > accessing that area. > It appears the ATAGs provide DDR banks that do not include those specific > two regions. > To be able to boot the kernel, those areas have to be reserved. > Maybe someone from Rockchip could have an explanation to this behavior? > Otherwise we have to block them at this level. > If those memory ranges are reserved for a dedicated purpose we can come up > with a better solution, w.r.t. the purpose of the regions. > > Thanks ! > Eugen > > board/radxa/rock5b-rk3588/rock5b-rk3588.c | 35 +++++++++++++++++++++++ > configs/rock5b-rk3588_defconfig | 1 + > 2 files changed, 36 insertions(+) > > diff --git a/board/radxa/rock5b-rk3588/rock5b-rk3588.c b/board/radxa/rock5b-rk3588/rock5b-rk3588.c > index b5d74798f3b9..5c3b52b94898 100644 > --- a/board/radxa/rock5b-rk3588/rock5b-rk3588.c > +++ b/board/radxa/rock5b-rk3588/rock5b-rk3588.c > @@ -2,3 +2,38 @@ > /* > * Copyright (c) 2023 Collabora Ltd. > */ > + > +#include > +#include > + > +#ifdef CONFIG_OF_BOARD_SETUP > +int rock5b_add_reserved_memory_fdt_nodes(void *new_blob) > +{ > + struct fdt_memory gap1 = { > + .start = 0x3fc000000, > + .end = 0x3fc4fffff, > + }; > + struct fdt_memory gap2 = { > + .start = 0x3fff00000, > + .end = 0x3ffffffff, > + }; > + unsigned long flags = FDTDEC_RESERVED_MEMORY_NO_MAP; > + unsigned int ret; > + > + /* > + * Inject the reserved-memory nodes into the DTS > + */ > + ret = fdtdec_add_reserved_memory(new_blob, "gap1", &gap1, NULL, 0, > + NULL, flags); > + if (ret) > + return ret; > + > + return fdtdec_add_reserved_memory(new_blob, "gap2", &gap2, NULL, 0, > + NULL, flags); > +} > + > +int ft_board_setup(void *blob, struct bd_info *bd) > +{ > + return rock5b_add_reserved_memory_fdt_nodes(blob); > +} > +#endif > diff --git a/configs/rock5b-rk3588_defconfig b/configs/rock5b-rk3588_defconfig > index 9b7db7de64be..f3026c7ea166 100644 > --- a/configs/rock5b-rk3588_defconfig > +++ b/configs/rock5b-rk3588_defconfig > @@ -26,6 +26,7 @@ CONFIG_FIT=y > CONFIG_FIT_VERBOSE=y > CONFIG_SPL_FIT_SIGNATURE=y > CONFIG_SPL_LOAD_FIT=y > +CONFIG_OF_BOARD_SETUP=y > CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-rock-5b.dtb" > # CONFIG_DISPLAY_CPUINFO is not set > CONFIG_DISPLAY_BOARDINFO_LATE=y > -- > 2.34.1 > >