From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com [209.85.217.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6990740B6F0 for ; Wed, 4 Feb 2026 13:52:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770213148; cv=none; b=laRKKq3byGorA4SEJiAwJJSPlL+qCi6YBbYBeNoDHJ03vf+9NOMXONGoj6i7fhwBEjM/Q06rc5iFDF/HIujr3wyL9NKC3nye2DwQLOm8Z0uNPWRbZp0fCNNxqFTxCX1C59fGCnOKLtN7bFST1OUuthdaQH2KPbXtG7EEiEbjkck= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770213148; c=relaxed/simple; bh=DPTlv27GH8Xv5pvXArXxgTELgMTBE7G65MJ518UTtF4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=jtlYjLYwSGQI+Az30RCogVICjrES0UCARVg0ksfbzSUfVe3hA7OrKvQW4haW19KwEbd+rmhMcDIjHiFRS/5NA4zUd7pnNUCQS6yb07TkGJ5qPBJXc7R5kV7WwIITldqffGM5uC2m1Wt6DRgO3CnpI/jN+QI8hIUbStGWCBvH1/0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.217.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-vs1-f54.google.com with SMTP id ada2fe7eead31-5eea35e808dso1848661137.2 for ; Wed, 04 Feb 2026 05:52:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770213147; x=1770817947; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MjQ6qUG2HLYgzsYnXuZnUfhc6ZoDRghKpOikRD3m81Y=; b=fvFil12x6bReqSuDYSe0TzqjeGA/Mz/1q4Lq6+cDjxIaSwfOTEBHkXsy9EbL0bS3Je 3IcdEbBDmB7WtuPoXSdLoI5PAORuDZW++FWR6xY4tqO7M9awxaT6+aqu+6b1wS5TRgNB Idtd11Swa7FQhPYFYQeOhDTO6pCZR0vsreCiEXtfRoLWX5rmmaeUZwC8Zx+6XjILGY4K Znxg2zj8kOgKxBpQzqEIqFBD1Gbypz8wIDLporo/eQVFxjsnqzOV09yu4wiJzP/t396H Jap7HyucovAC8+TdpjcRLwXt3vuprC6RdnHc2kywRkWWFp2hZ7LfdDj6e0QI2LUuAtCP V+5A== X-Forwarded-Encrypted: i=1; AJvYcCXXZBwwPy0FZN7PQcFk0Dw55IRwlCqUMbmqJyn9Dx5BqwGC0rfcvaxusWQ0OKz9OmpX4gco1YzEo6u/qdo=@vger.kernel.org X-Gm-Message-State: AOJu0YxqtKjKcvgkHsaxI6YHnuZQ+LMvx4ebmS4SzpCZ4uYRD5MJS9pR 7xXak1hvETjIPiq/mM+CJpQAMJiCH/bXiPhSDswAxtF9VF5lPKIhjoLV65S7ho1T X-Gm-Gg: AZuq6aJYvcstJrl9MqrxzDsJfiwARJ/vQYtTeNhi5AZHl5WPu25/zB4hnLlL0k3jK9t Mpzq0ohjfIc81yfhdyKnW/ySfHpOrzreTQ4OSPqtwz4iulZ8346ei2N9CeHQkYwxy9xlSuMwn2t RBlAErz2jjsnZX8yZzH4Bxaj5xlgiW51i2PxQgrE6CPFGbOCL5HQqFxt87mLYvKUDggpTDG8LIx p4ODWCdIJzYuQFiPkhi03FTz98qikZTOhhPfLr4Jypf01vPq2SL60hkOGjH5/06N+p9QEJMt+ee h46WzNLnro0EafdILa8d33OVgwuUA2AaR1fY5vLRtNw06hm2M9Ymss+PIVuCkAve2EU14QELLP7 YDgwtnS1Cw/yy9GZXfd7h30hooNRdYg2OViwGKp0+AHGZIUAUXP4RVejSrC032DzFOXQHgi0HaB FEW0TXEM3+OTGHMM1bdk+dTlTVgYN4wJ/WIhelpk5GVU963iub X-Received: by 2002:a05:6102:5092:b0:5f5:5857:35c0 with SMTP id ada2fe7eead31-5f9394de26emr865902137.13.1770213146992; Wed, 04 Feb 2026 05:52:26 -0800 (PST) Received: from mail-vs1-f41.google.com (mail-vs1-f41.google.com. [209.85.217.41]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-948dfe58acbsm799090241.2.2026.02.04.05.52.25 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Feb 2026 05:52:25 -0800 (PST) Received: by mail-vs1-f41.google.com with SMTP id ada2fe7eead31-5f539e05d63so1975273137.0 for ; Wed, 04 Feb 2026 05:52:25 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUGNNYP/xXBN4vI4H+dm7pJutp02zuGDFmo3D3qLRVpMhb5SuvmaCJq7rybzsF06/B9iEHHJWHXS9R31KM=@vger.kernel.org X-Received: by 2002:a05:6102:5092:b0:5f5:5857:35c0 with SMTP id ada2fe7eead31-5f9394de26emr865883137.13.1770213145469; Wed, 04 Feb 2026 05:52:25 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <86v7gf9z92.wl-maz@kernel.org> In-Reply-To: From: Geert Uytterhoeven Date: Wed, 4 Feb 2026 14:52:14 +0100 X-Gmail-Original-Message-ID: X-Gm-Features: AZwV_QjvQAenbz8M6GyIuU3AA1rYHVlHp80RpCsN_vKYNyL9vHaPjvqPcHo9OuY Message-ID: Subject: Re: [PATCH v2 0/2] ARM: decompressor: support AUTO_ZRELADDR and appended DTB To: "Russell King (Oracle)" Cc: Linus Walleij , Marc Zyngier , "Christian Marangi (Ansuel)" , Linus Walleij , Arnd Bergmann , Andrew Morton , Geert Uytterhoeven , "Kirill A. Shutemov" , Thomas Gleixner , Jonathan Corbet , "Mike Rapoport (IBM)" , Eric DeVolder , Nathan Chancellor , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Konrad Dybcio , John Crispin Content-Type: text/plain; charset="UTF-8" Hi Russell, On Wed, 4 Feb 2026 at 14:29, Russell King (Oracle) wrote: > On Wed, Feb 04, 2026 at 01:58:21PM +0100, Geert Uytterhoeven wrote: > > On Wed, 4 Feb 2026 at 13:48, Russell King (Oracle) > > wrote: > > > On Wed, Feb 04, 2026 at 11:54:59AM +0000, Russell King (Oracle) wrote: > > > > On Wed, Feb 04, 2026 at 11:53:30AM +0100, Geert Uytterhoeven wrote: > > > > > On Wed, 4 Feb 2026 at 02:27, Russell King (Oracle) > > > > > wrote: > > > > > > On Wed, Feb 04, 2026 at 01:36:29AM +0100, Linus Walleij wrote: > > > > > > > However, I think it is a thick requirement to put on hobbyist > > > > > > > contributors to go and write entite boot loaders from scratch, > > > > > > > I think it's a fine requirement to put on Qualcomm or Renesas > > > > > > > paid maintainers. > > > > > > > > > > > > If we're talking about older boards, then why have they only recently > > > > > > became a problem, when, presumably, they've been working fine for a > > > > > > decade or so? > > > > > > > > > > These boards may have been working fine, given the right "legacy" > > > > > kernel config options were used. However, some of these option make > > > > > the resulting kernel limited to that platform or even to a specific > > > > > board (e.g. when CONFIG_CMDLINE needs to be used). > > > > > > > > The 32-git ARM kernel has had a way to pass the command line to the > > > > kernel from the boot loader since day one. > > > > > > > > First it was the struct param_struct. > > > > Then it was the ATAGs that was introduced pre-git. > > > > Now it is DT. > > > > > > > > The kernel retains code to parse all three methods of passing data > > > > from the boot loader to the kernel. The decompressor has support > > > > for merging the ATAGs into the appended DTB, which includes merging > > > > the command line into the DTB. > > > > > > > > Without an appended DTB, the pointer to one of the above will be > > > > passed to the kernel, the kernel will figure out what it has and > > > > parse one of the three ways, and use the command line there. > > > > > > > > The only case where CONFIG_CMDLINE should be used is when there is > > > > no command line passed, no way to change it, etc. At that point > > > > there are two options: > > > > > > > > 1. Augment the kernel's generated FDT with the command line node > > > > and load that modified FDT or append it to the compressed image. > > > > > > > > 2. Use CONFIG_CMDLINE, which means that the kernel _will_ become > > > > specific to the platform that needs those arguments. No getting > > > > away from that in this case. > > > > > > > > Maybe you haven't explained the problem very well, but I don't see > > > > any issue with this. > > > > > > > > > The KZM-A9-GT I "need" this for never had upstream U-Boot (I don't > > > > > think I ever had any U-Boot sources). I can boot a shmobile_defconfig > > > > > multi-platform kernel[*] fine, iff the first patch is applied. > > > > > > > > So, what have you been doing for the last 14 years to boot this > > > > platform (merged in 2012) without this patch? > > > > > > > > Please explain: > > > > > > > > - how it worked before - I want to know how the DTB is passed to the > > > > kernel, what information is provided from the boot loader, whether > > > > that gets merged into the DTB, etc. All the fine nitty gritty of > > > > how it worked and what doesn't work, what the problems were etc. > > > > > > > > - what changed (it sounds like you want extra features) > > > > > > > > - why (in detail) it doesn't work now. > > > > > > I want to know: > > > > > > - Where RAM is located. > > > - Where the kernel is being loaded. > > > > tftp 0x43000000 kzm9g/zImage.dtb > > bootz > > > > > - Whether the platform reserves any RAM that may overlap with the kernel > > > or where the kernel wants to locate itself in RAM. > > > > > > From what I can see from arch/arm/boot/dts/renesas/sh73a0-kzm9g.dts, > > > memory is at 0x4000000..0x5fffffff - 512MiB. > > > > Correct. > > > > > So, provided you load and execute the compressed kernel image within > > > the first 128Mi of memory (0x40000000 - 0x48000000), then it will select > > > 0x40008000 to decompress itself. I can find no mention of any reserved > > > memory regions in the DT file, so this should be fine. > > > > > > If you're loading the compressed kernel at some wildly different > > > address, then yes, it probably won't work. > > > > It also works when loaded at e.g. 0x42000000 or 0x44000000, > > but not at 0x41000000 (all with [PATCH 1/2] applied). > > So let's assume the kernel is loaded at 0x43000000. > > mov r0, pc > and r0, r0, #0xf8000000 > > This will result in r0 being 0x40000000. This becomes the mem_start > argument in fdt_check_mem_start(). > > We look for an appended DTB, and skip the validation that > fdt_check_mem_start() does. If this were to go ahead, then this would > find that 0x40000000 is within the memory@40000000 node, and thus this > would return "mem_start". > > Then: > > /* Determine final kernel image address. */ > add r4, r0, #TEXT_OFFSET > > will place the decompressed kernel at 0x40008000. > > However, as placing the kernel at 0x41000000 doesn't boot, that > suggests some memory is being removed from the kernel. If adding a > call to fdt_check_mem_start() after the ATAG-to-FDT parsing has > been performed fixes this, it suggests the ATAGs change this. > > So, with a booted kernel, what does: > > $ hexdump -e '"%8.8_ax " 8/4 "%08x " "\n"' /sys/firmware/devicetree/base/memory\@40000000/reg > > say? Has this been modified from 00000040 00000020 ? I think it > will be. Thank you. Output is: 00000000 00000041 0000001f So the first 16 MiB was indeed removed. > That means there's a simple fix: as there is likely reserved memory > at the start of RAM, reflecting that in this platform's .dts would > fix this issue without needing to change the decompressor. Unfortunately that does not seem to work. > If you don't want to change the reg in the memory@ node, then there's > /chosen/linux,usable-memory-range which can be used to specify the > usable memory base and size (same format as reg). Neither does this... > Another option would be to add linux,usable-memory to the memory@ > node that specifies the range of usable memory while still specifying > the full memory range in the reg property. ... or this. Don't all of these methods rely on fdt_check_mem_start() operating on the appended DTB, i.e. on what [PATCH v2 1/2] does? Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds