From patchwork Mon Aug 26 11:59:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 822446 Delivered-To: patch@linaro.org Received: by 2002:adf:e044:0:b0:367:895a:4699 with SMTP id w4csp1477210wrh; Mon, 26 Aug 2024 05:02:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVcDqhe6iKw5hmdWkFxHrg+jShklkwSlAc9TgCxm55BUXAjSRxpjD++Si4ViMkERssy7iwWYw==@linaro.org X-Google-Smtp-Source: AGHT+IEW+C4NpbIEp0hu+Ke4oi2UNHdzMHnEq+r3TsmzEx9T7tY6d/VWebpRUDMg1Jp7CQA0GQIa X-Received: by 2002:a5d:674f:0:b0:368:5042:25f3 with SMTP id ffacd0b85a97d-37311863b04mr7763350f8f.34.1724673732136; Mon, 26 Aug 2024 05:02:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724673732; cv=none; d=google.com; s=arc-20160816; b=GzjoLigA3Uh6gMU5SHMgrP4yzq5mJMhcb0QD58kL1BHjaontstR/egrntlb/eV0MLZ X2M5UAMp9c6nwrzMIhoJqcykBnm7YS9QF/UqddXjPzHkQoHhV9ket/inFNB1SGL47/yE TeccpX0f9SxLjnMLCBHArfbOWfWxSllocUyT36F7EsYKnloN/COsNsLjYmzZxfM04W3F gpCk/pzqwUcUiSEU/X4OGf2zhFP2d64Aa9ZkitWcwgVt412c0DG0phD5WMyLt3Kswm+F zewYNBrNwB11yj3b6Ng+rAc1V1DZehSe4VohGKvYUI/3xB5l3jO/vPzSChPLnRpywYqz SMzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=W+1tyRjIN3VLKzhjjIDrj3zh96BRKG4ELkJ/bjQ3/O0=; fh=8IbOOFAUJYCfGYrzM0jWqtoOP7AaZuPOmdHZ5mvNk1Q=; b=u5yFaY1hwGtbpPio5mJl2lhwdTf1xieczMdvfyHDRky4jDtHfa+EGdLLQe43iAKNPy Z5bC98ZxjhIDIbebewvhKyxVRpbyrwpHcGYul4KXjS2KFbehENP6rjs7lF2TvyrzvH5L 4ZJS21s/1DW+tDYoZnquUpKtHRwYhSDEioAHqKDyJeU8SATZ4hhcWYa8hLSwSFyTYIMr qdxC8UwZjkwYvA/fo/1iIWvA6PKWegdgzpm+cOhQyAf37mqA4nD4L4Rm3gnBVmog4taG GsiY+4OxiY5SGgQUXt5dfZPirqIZBOfBJ5B39ULGkmv0jFtJnmhlEpsTP2v/sOcKiV/W SsYA==; 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 ffacd0b85a97d-3730811fa4asi3708798f8f.204.2024.08.26.05.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 05:02:12 -0700 (PDT) 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 1AFCF88A8B; Mon, 26 Aug 2024 14:01:03 +0200 (CEST) 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 6FD6888B0C; Mon, 26 Aug 2024 14:01:01 +0200 (CEST) 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_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, SPF_HELO_NONE,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE 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 8DF1588B02 for ; Mon, 26 Aug 2024 14:00:57 +0200 (CEST) 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 3B90211FB; Mon, 26 Aug 2024 05:01:23 -0700 (PDT) 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 57C3D3F762; Mon, 26 Aug 2024 05:00:53 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Simon Glass , Tom Rini , Ilias Apalodimas , Heinrich Schuchardt , Marek Vasut , Mark Kettenis , Michal Simek , Patrick DELAUNAY , Patrice CHOTARD , =?utf-8?q?Marek_Beh=C3=BAn?= , Sughosh Ganu Subject: [PATCH v4 12/27] lmb: remove the lmb_init_and_reserve() function Date: Mon, 26 Aug 2024 17:29:25 +0530 Message-Id: <20240826115940.3233167-13-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240826115940.3233167-1-sughosh.ganu@linaro.org> References: <20240826115940.3233167-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 With the changes to make the LMB reservations persistent, the common memory regions are being added during board init. Remove the now superfluous lmb_init_and_reserve() function. Signed-off-by: Sughosh Ganu Reviewed-by: Simon Glass Reviewed-by: Ilias Apalodimas --- Changes since V3: None arch/arm/mach-apple/board.c | 2 -- arch/arm/mach-snapdragon/board.c | 2 -- arch/arm/mach-stm32mp/stm32mp1/cpu.c | 3 --- cmd/bdinfo.c | 1 - cmd/load.c | 2 -- fs/fs.c | 1 - include/lmb.h | 1 - lib/lmb.c | 13 ------------- net/tftp.c | 2 -- net/wget.c | 2 -- 10 files changed, 29 deletions(-) diff --git a/arch/arm/mach-apple/board.c b/arch/arm/mach-apple/board.c index 213390d6e8..0b6d290b8a 100644 --- a/arch/arm/mach-apple/board.c +++ b/arch/arm/mach-apple/board.c @@ -775,8 +775,6 @@ int board_late_init(void) { u32 status = 0; - lmb_init_and_reserve(gd->bd, (void *)gd->fdt_blob); - /* somewhat based on the Linux Kernel boot requirements: * align by 2M and maximal FDT size 2M */ diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c index a63c8bec45..22a7d2a637 100644 --- a/arch/arm/mach-snapdragon/board.c +++ b/arch/arm/mach-snapdragon/board.c @@ -282,8 +282,6 @@ int board_late_init(void) { u32 status = 0; - lmb_init_and_reserve(gd->bd, (void *)gd->fdt_blob); - /* We need to be fairly conservative here as we support boards with just 1G of TOTAL RAM */ status |= env_set_hex("kernel_addr_r", addr_alloc(SZ_128M)); status |= env_set_hex("ramdisk_addr_r", addr_alloc(SZ_128M)); diff --git a/arch/arm/mach-stm32mp/stm32mp1/cpu.c b/arch/arm/mach-stm32mp/stm32mp1/cpu.c index a913737342..64480da9f8 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/cpu.c +++ b/arch/arm/mach-stm32mp/stm32mp1/cpu.c @@ -141,9 +141,6 @@ int mach_cpu_init(void) void enable_caches(void) { - /* parse device tree when data cache is still activated */ - lmb_init_and_reserve(gd->bd, (void *)gd->fdt_blob); - /* I-cache is already enabled in start.S: icache_enable() not needed */ /* deactivate the data cache, early enabled in arch_cpu_init() */ diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index b31e0208df..3c40dee143 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -162,7 +162,6 @@ static int bdinfo_print_all(struct bd_info *bd) bdinfo_print_num_l("multi_dtb_fit", (ulong)gd->multi_dtb_fit); #endif if (IS_ENABLED(CONFIG_LMB) && gd->fdt_blob) { - lmb_init_and_reserve(gd->bd, (void *)gd->fdt_blob); lmb_dump_all_force(); if (IS_ENABLED(CONFIG_OF_REAL)) printf("devicetree = %s\n", fdtdec_get_srcname()); diff --git a/cmd/load.c b/cmd/load.c index 56da3a4c5d..20d802502a 100644 --- a/cmd/load.c +++ b/cmd/load.c @@ -153,8 +153,6 @@ static ulong load_serial(long offset) int line_count = 0; long ret; - lmb_init_and_reserve(gd->bd, (void *)gd->fdt_blob); - while (read_record(record, SREC_MAXRECLEN + 1) >= 0) { type = srec_decode(record, &binlen, &addr, binbuf); diff --git a/fs/fs.c b/fs/fs.c index 3fb00590be..4bc28d1dff 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -549,7 +549,6 @@ static int fs_read_lmb_check(const char *filename, ulong addr, loff_t offset, if (len && len < read_len) read_len = len; - lmb_init_and_reserve(gd->bd, (void *)gd->fdt_blob); lmb_dump_all(); if (lmb_alloc_addr(addr, read_len) == addr) diff --git a/include/lmb.h b/include/lmb.h index 70191456e5..04558724a7 100644 --- a/include/lmb.h +++ b/include/lmb.h @@ -63,7 +63,6 @@ struct lmb { */ int lmb_init(void); -void lmb_init_and_reserve(struct bd_info *bd, void *fdt_blob); void lmb_init_and_reserve_range(phys_addr_t base, phys_size_t size, void *fdt_blob); diff --git a/lib/lmb.c b/lib/lmb.c index 9b1854223d..de4d0d1803 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -227,19 +227,6 @@ static void lmb_reserve_common(void *fdt_blob) efi_lmb_reserve(); } -/* Initialize the struct, add memory and call arch/board reserve functions */ -void lmb_init_and_reserve(struct bd_info *bd, void *fdt_blob) -{ - int i; - - for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { - if (bd->bi_dram[i].size) - lmb_add(bd->bi_dram[i].start, bd->bi_dram[i].size); - } - - lmb_reserve_common(fdt_blob); -} - /* Initialize the struct, add memory and call arch/board reserve functions */ void lmb_init_and_reserve_range(phys_addr_t base, phys_size_t size, void *fdt_blob) diff --git a/net/tftp.c b/net/tftp.c index 99b2ab9fca..b5d227d8bc 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -718,8 +718,6 @@ static int tftp_init_load_addr(void) if (CONFIG_IS_ENABLED(LMB)) { phys_size_t max_size; - lmb_init_and_reserve(gd->bd, (void *)gd->fdt_blob); - max_size = lmb_get_free_size(image_load_addr); if (!max_size) return -1; diff --git a/net/wget.c b/net/wget.c index 241465b9b4..4a168641c6 100644 --- a/net/wget.c +++ b/net/wget.c @@ -75,8 +75,6 @@ static int wget_init_load_size(void) { phys_size_t max_size; - lmb_init_and_reserve(gd->bd, (void *)gd->fdt_blob); - max_size = lmb_get_free_size(image_load_addr); if (!max_size) return -1;