From patchwork Sun Jan 21 20:29:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13524671 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 339ACC47422 for ; Sun, 21 Jan 2024 20:30:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=LQpOwbgFPMYn5nhI/i3gVIEBmd26Qh8s6uHWTfKlsIs=; b=DsavnG9MXDJ9Yd MPqi2xwja0qcuDjLluyl+KDDxXoIFHV23orODC5R2C9Jr5RN5z7nlbRaBihbSbVgke9EhbPgriskH Dt/P2xRtNqH5IGT2mTrP3Lri33ng/qRDiAquW/TbOdsHhK/FD7/sQZnrbHpQrNawY2147G4dHfFrD N19dAkfUnqa0IdRkvBqJiWc1r3kNUhw8UB12zPsqMgBXO097jIgKWHe94BrSdqVXx00FOQu3+5m7F xRJGb2G0UDpUbxOaU4SIelKJ1WgqLhVu4NGHtZW+Q1b7wlIh3EgD/4WVOfshagCDg5fz5VqsApBD4 z2jzMgVWEGQC1ss2raUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rReSc-00A0BF-0f; Sun, 21 Jan 2024 20:30:30 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rReSZ-00A0AS-13 for linux-arm-kernel@lists.infradead.org; Sun, 21 Jan 2024 20:30:28 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40ea5654271so14734385e9.0 for ; Sun, 21 Jan 2024 12:30:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705869023; x=1706473823; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=4kWLX6UP/f8j7PC87iA+ocN+7ezu0AHr8NQjFXggguQ=; b=bftatU/0deWo4a3JyHSKaAmvX0rr6jGpBaaA4tKnT41na4U0F9sC+3jMr1EcRcF4S3 F4hUWxPwiUIK3+GjwyUHmRR79Wop6gqhanvCgwsgWyUm91Zpu3V4ufls/2WTe+CJ5VrP jygFctXlMdqc79P8f9TlxXv3fLKbFdmJZ4H9nG/ytWMdBqzwkpoJhKNRy4uiGpEovd6j fYcP49ku6yPDPEWCIxWp2MeABBWH354AV9jEaONvG1kHwOp61MR5bNUBbPUc/Tbe7EaC pJF/HiRFsQyMaJSmv/5xswHods/n7ghwYyng0aC0xqkZoJEWrgi62mU64UEXstHJzt69 h29g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705869023; x=1706473823; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4kWLX6UP/f8j7PC87iA+ocN+7ezu0AHr8NQjFXggguQ=; b=qYhfPKYPga9VxCQxLGt1NnhiXNn8Cq0Rm6BTTfs2H/NAa3fIYBhsv6uWX7+qVLN4Vk KaBIl9SbV/pBIRze0cSo8ljyF//sf5byrF7+y9fNfnSEPxyg1ErUA9/n63sl407vb114 ONfIBsaQrahFHvi3aXXyEHNkvnkg4vWORoA0c5nI0p6Xzt8b2cEi7m/vGx0GEub2ktXr yf6/SFDBsJBeUXOXNuMCgLGsphUS+P+YMPEGNY7QLgRXp1wwuTZ7fnf3VTFvnNJPdCvI 64JqMm4FLZE5d4QITzkH3IcO/yKR7+kxxw6OhFHDVv3HU5QiCMDcN8jXxJqFYxUCV/Uw qQHA== X-Gm-Message-State: AOJu0YxhCbPoyww7fXI9wiEdtKshIqbFN01iRYaNa5+l9ZKSCAc1tCUB NT062sVWI/6NSjxgA+B55GUOiKy01O+uuuFmGkicLl4hmYRbobKV X-Google-Smtp-Source: AGHT+IEfYnzr4yVRgG6iZg16P/KMLlpVOmCErhK0dUK6S5bUecgiMXK+wucZ4OO1xL/VHTPmYNPPkA== X-Received: by 2002:a05:600c:2d11:b0:40e:6247:5f7 with SMTP id x17-20020a05600c2d1100b0040e624705f7mr1681171wmf.45.1705869023163; Sun, 21 Jan 2024 12:30:23 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id j5-20020a05600c1c0500b0040e9f7dadc6sm9021967wms.25.2024.01.21.12.30.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 12:30:22 -0800 (PST) From: Christian Marangi To: Russell King , Arnd Bergmann , Andrew Morton , Geert Uytterhoeven , Linus Walleij , "Kirill A. Shutemov" , Thomas Gleixner , Jonathan Corbet , Marc Zyngier , Christian Marangi , "Mike Rapoport (IBM)" , Eric DeVolder , Nathan Chancellor , Kees Cook , "Russell King (Oracle)" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Konrad Dybcio , John Crispin Subject: [PATCH v2 0/2] ARM: decompressor: support AUTO_ZRELADDR and appended DTB Date: Sun, 21 Jan 2024 21:29:32 +0100 Message-ID: <20240121203009.9257-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240121_123027_369315_F428C40E X-CRM114-Status: GOOD ( 18.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This series try to address a long lasting problem with legacy device that require an appended DTB and the use of AUTO_ZRELADDR. With these device AUTO_ZRELADDR is not possible if for some reason at the start of the RAM it's needed to reserve some space. (example qcom SoC that allocate reserved space for SMEM) In the current implementation with appended DTB and AUTO_ZRELADDR, the memory start is only derived from the PC register and it can't be changed by declaring additional info in the DTS. In a normal setup, we have an intentional undocumented chosen property to handle this and the memory node to declare the start of the memory. With this applied and ARM_ATAG_DTB_COMPAT_IGNORE_MEM enabled (more info in the related patch) ipq806x can boot right away with AUTO_ZRELADDR enabled and a correct memory node defined in DTS. It's needed to ignore MEM ATAGs as most of the time the values from the bootloader are hardcoded and OEM didn't care to actually provide them resulting in funny situation where a Netgear R7800 with 512Mb of RAM have Uboot passing 1.7GB of RAM with ATAGS. While MEM ATAG may be broken, other ATAG like serial number or bootargs might still be useful for partition declaration (cmdlinepart) or other info hence DTB_COMPAT is still needed in these case and can't be disabled. I'm open to any suggestion on how this can be improved and I would love some additional testing on other legacy platform but I assume this will permit many legacy device to be correctly supported without having to hardcode address. Changes v2: - Add Review and Ack Tags - Use IS_ENABLED instead of global variable Christian Marangi (2): ARM: decompressor: support memory start validation for appended DTB ARM: decompressor: add option to ignore MEM ATAGs arch/arm/Kconfig | 12 ++++++++++++ arch/arm/boot/compressed/atags_to_fdt.c | 4 ++++ arch/arm/boot/compressed/head.S | 22 ++++++++++++++++++++++ 3 files changed, 38 insertions(+)