From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1qIvhq-00036S-R6 for mharc-grub-devel@gnu.org; Mon, 10 Jul 2023 14:33:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIvhg-00035B-MZ for grub-devel@gnu.org; Mon, 10 Jul 2023 14:33:50 -0400 Received: from mail-vk1-xa2d.google.com ([2607:f8b0:4864:20::a2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIvhd-0006LT-99 for grub-devel@gnu.org; Mon, 10 Jul 2023 14:33:44 -0400 Received: by mail-vk1-xa2d.google.com with SMTP id 71dfb90a1353d-471b3ad20e1so1309817e0c.1 for ; Mon, 10 Jul 2023 11:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20221208.gappssmtp.com; s=20221208; t=1689014017; x=1691606017; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=I3qMvcPX3BCFgkELpHZhgkDPLsBXg3CJhTM5sZJOQLc=; b=dx3ub+sL7eAqVfdSxwScv3aYS7c/9oUGjhWmuq/WUWDL/mITHhlERPnwsVoVaDV+jm W5ijijPo0sdxbW5ZWwr/bPGUAx7mWdrK424NuY1HijJW/5B9PPnaEhC6lVb7axnXC+5k pzSzBnqOirC499I45E51pmQuh4Muk63EE9HU1Q+v1M8W16xudrJwG7Jvo2SBarMQYKYz v5DMwyt/3GqsnbP/zHxwdKN8ftzahW0Gu4v1T+GsPClW6TAbltilnVMjlWgIB77gPdVA F8tSL8WuWtb8oj1jD0imDJWyKs8wg0eWFrRbQGn9bHxv7mYA20jlnNX9KvUNBao+5Yqe NhGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689014017; x=1691606017; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=I3qMvcPX3BCFgkELpHZhgkDPLsBXg3CJhTM5sZJOQLc=; b=b+WLeoE23MY/QriUmvZKzm3zTFZ3C/seJumZj+BEoY5FGImEl1w4gDtMuVPGaBG2uP dJB2I7sTbqARCVM3Ur4JzsehhB1j1j7sFdOtPkeAhZ6qru/8KlL2ZOH7O0m3OgcNKxq/ 1Za6xoJTFh70PrOukKptHlnd0LPAZUvcdguj70iTLoI1wrok+wNqSa8MXIl7kjgh3Z3K JYJy8fM1XzwAQWv/BXcEI/9wKfi5XU+KmrHfD0a6J8ESHcSgVbWzavqqA1dFqF5CjzV1 3xmDiNNIXPh/mCEZliJjFbRjJVQY6oDmiVtZuS/zoCZep6uDIKEQm/q+0Djgmib5rUB2 9dAw== X-Gm-Message-State: ABy/qLbgJMv9rPc6MI4MWfi8It11SSmsY4yoy058w6i6GvDjqfpQzJ7N PIc9dCeusaSVa9F6GKWaE7PHFx1V/nT07Q0+cr8= X-Google-Smtp-Source: APBJJlGSofsVSNtFhpqU5s3mEraWF6iKGsv0eHfauZKYQGErLj1HeGW3guVjmg57qsozr+/kPVvbVw== X-Received: by 2002:a1f:6086:0:b0:471:8787:2c6c with SMTP id u128-20020a1f6086000000b0047187872c6cmr4369462vkb.6.1689014017191; Mon, 10 Jul 2023 11:33:37 -0700 (PDT) Received: from localhost.localdomain ([37.218.244.249]) by smtp.gmail.com with ESMTPSA id d28-20020ac5c55c000000b0045a9340a704sm50139vkl.42.2023.07.10.11.33.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jul 2023 11:33:36 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper , Ard Biesheuvel , Atish Patra , Nikita Ermakov , Xiaotian Wu , "Vladimir 'phcoder' Serbinenko" Cc: Glenn Washburn Subject: [RFC PATCH] efi: Add build error for new EFI arches that do not specify INITRD_MAX_ADDRESS_OFFSET Date: Mon, 10 Jul 2023 13:33:29 -0500 Message-Id: <20230710183329.1452486-1-development@efficientek.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::a2d; envelope-from=development@efficientek.com; helo=mail-vk1-xa2d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2023 18:33:52 -0000 Non-x86 EFI architectures were using a INITRD_MAX_ADDRESS_OFFSET defined by the aarch64 architecture. This seems to generally work, as in no one has complained about this. However, the code is misleading. Architectures should explicitly set INITRD_MAX_ADDRESS_OFFSET. To avoid breaking current EFI architectures, set to GRUB_EFI_MAX_USABLE_ADDRESS, effectively allowing the entire address range. New architectures will fail to build until this macro is set. Signed-off-by: Glenn Washburn --- My reading of a reply on the list[1] is that RISCV has no limit for the initrd. But I think it would be good to point to documentation describing limitations as in the ARM comments. Glenn [1] https://lists.gnu.org/archive/html/grub-devel/2021-07/msg00001.html --- grub-core/loader/efi/linux.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c index ab8fb35adb05..8f5460ba11e0 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -290,21 +291,30 @@ grub_linux_unload (void) } #if !defined(__i386__) && !defined(__x86_64__) +#if defined (__arm__) /* * As per linux/Documentation/arm/Booting * ARM initrd needs to be covered by kernel linear mapping, * so place it in the first 512MB of DRAM. - * + */ +#define INITRD_MAX_ADDRESS_OFFSET (512U * 1024 * 1024) +#elif defined (__aarch64__) +/* * As per linux/Documentation/arm64/booting.txt * ARM64 initrd needs to be contained entirely within a 1GB aligned window * of up to 32GB of size that covers the kernel image as well. * Since the EFI stub loader will attempt to load the kernel near start of * RAM, place the buffer in the first 32GB of RAM. */ -#ifdef __arm__ -#define INITRD_MAX_ADDRESS_OFFSET (512U * 1024 * 1024) -#else /* __aarch64__ */ #define INITRD_MAX_ADDRESS_OFFSET (32ULL * 1024 * 1024 * 1024) +#elif defined (__ia64__) || defined (__riscv) || defined (__loongarch_lp64) +/* + * There has been no investigation into constraints on the initrd address + * for these platforms. Allow all the available address space for now. + */ +#define INITRD_MAX_ADDRESS_OFFSET GRUB_EFI_MAX_USABLE_ADDRESS +#else +#error "Unknown INITRD_MAX_ADDRESS_OFFSET for architecture" #endif /* -- 2.34.1