Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1583640lqo; Sun, 12 May 2024 08:47:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX9kncgOP8haWrQenKArAeI6rM+Btt5PPkA/P4OsGGSsKgsMeXCvt45MBJtnVe4dAtP/MNP45c3sBTkg8eXAYGFqN8Qnc2I67rPtMBCYQ== X-Google-Smtp-Source: AGHT+IFQOomKC7RQ6PjIGaNsVBDh80q9z6Rudpg2wtF76Ht7DzBYnNNYiENwvv7XLMd2Im5SuUKl X-Received: by 2002:a50:d5dc:0:b0:572:7319:ab83 with SMTP id 4fb4d7f45d1cf-5734d5904c1mr5837615a12.6.1715528875613; Sun, 12 May 2024 08:47:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715528875; cv=pass; d=google.com; s=arc-20160816; b=bhDcJf1uWzKUfnfJFi7JZpD5N2NLp5oa/ad1lzh11bRyNoD5kfElfi8UqqLF76Ya90 7qR7YI4Erx8Xt/VTW6dS9swGATc/tOYISPJ/DryRk6DBGTSwFcZTX1qs0g6gGgIpBGQU aty1mwZgSfyYQX8uoXz92pvO+60DHm/TGc7uZdzLODXMCGMhZGnPN1fVAvKmoCGcuSOc MBK56k+077I/deRuLaQX0bDIlBOp7rPoA+TmKuPMCs2zEweH0nOELPRrRJvk8MiDT6wd A9LERS3qB7ObgSoA20YWgVaFfyDj2ipvvlhes1DH75iRqvmDjmf25EVFJwXsxCU6v5bU YZXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:from:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=12eoXzhRNLYneVVXRLstzzTjxfuHl8g8WW0LyMDfbtE=; fh=lgqf/2hPwG2M7gRtKgFgMgxVxmGbeZObC5Z3x8Y7aow=; b=x8sEOFxS3f3nGenL/tv04Q/TOvtWBpXkoVoMF7XpekhBvcu75INbFqJErpHHMKAYZW 1VzLfFNJ6QWTJvC8p+SDsVhJVUoURxgdCOID3PgCIE8e/f4KLpn1o4kYtCtk+tpFN5sI D2feaDZVlsRB3bqlBBTvPRoDt9wawAyamPBbNwlC3E39UXa3c/yv2+ep4rDFkrnI4k1W wDyDlJz2Ld8/NoyBm8WrcnmstJ/4bHBnNFwXaXfAM2AOcTVHEP87Ib3o5Rd2Yfo8euGT /58CP8EHqSuhMDOzYkjU1Z00fIpTe2FZ5jv3ge51+tgRL1/7/pGesLwmIvP72knCki4K qYpg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-176925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176925-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c379383si4137087a12.683.2024.05.12.08.47.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 08:47:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-176925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176925-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id EE3F51F21566 for ; Sun, 12 May 2024 15:47:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 09B4345BF3; Sun, 12 May 2024 15:47:48 +0000 (UTC) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 180BE3F8F1 for ; Sun, 12 May 2024 15:47:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715528867; cv=none; b=TPxYGG4waZNp1ZADCFrNiB+noM37xrAbnGglQC9kNraJJ+YHgIVyHnJ93IKieWhFFo95MEpAnZL6lejOUCTfxvjdDhC4MIYcZYNBaCOUOt1d+lU/CdGKu37c3koH0aa5m4ZS2ldeBovWFqWO315Fv6GaojcJie74Kti1xLzzToI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715528867; c=relaxed/simple; bh=JZCbtyH96U3ULD5+dHXMU9zi+LK4H2q6LB1Ry8GqQwc=; h=Message-ID:Date:MIME-Version:From:Subject:To:References: In-Reply-To:Content-Type; b=NvMghtVp5rY/aZdvBgJqQHDTsfh7a9Uh08ahuImzXkWMJrHgPo4yijRUSlwpYLvEqQCVtRa2r/PTY82NSLuDYvaoAZM/rrURZNN+Lwtmn33XtAjBPlpCku4ZwrjGrYMV1cmb01ZRaVZyLFCHY4ikiWnbWTyyw23Kd67klPWtuH8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr; spf=pass smtp.mailfrom=ghiti.fr; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ghiti.fr Received: by mail.gandi.net (Postfix) with ESMTPSA id 03BA41C0004; Sun, 12 May 2024 15:47:28 +0000 (UTC) Message-ID: <46c70799-87b1-4478-95bb-4d4c90519f5b@ghiti.fr> Date: Sun, 12 May 2024 17:47:24 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Alexandre Ghiti Subject: Re: [PATCH 0/7] remove size limit on XIP kernel To: Nam Cao , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-GND-Sasl: alex@ghiti.fr Hi Nam, On 10/05/2024 08:28, Nam Cao wrote: > Hi, > > For XIP kernel, the writable data section is always at offset specified in > XIP_OFFSET, which is hard-coded to 32MB. > > Unfortunately, this means the read-only section (placed before the > writable section) is restricted in size. This causes build failure if the > kernel gets too large. > > This series remove the use of XIP_OFFSET one by one, then remove this > macro entirely at the end, with the goal of lifting this size restriction. > > Also some cleanup and documentation along the way. > > This series depends on > https://lore.kernel.org/linux-riscv/20240508191917.2892064-1-namcao@linutronix.de/ > to apply cleanly, and also depends on > https://lore.kernel.org/linux-riscv/20240508173116.2866192-1-namcao@linutronix.de/ > which fixes a boot issue. > > Best regards, > Nam > > Nam Cao (7): > riscv: cleanup XIP_FIXUP macro > riscv: replace va_kernel_pa_offset with va_kernel_data_pa_offset on > XIP > riscv: drop the use of XIP_OFFSET in XIP_FIXUP_OFFSET > riscv: drop the use of XIP_OFFSET in XIP_FIXUP_FLASH_OFFSET > riscv: drop the use of XIP_OFFSET in kernel_mapping_va_to_pa() > riscv: drop the use of XIP_OFFSET in create_kernel_page_table() > riscv: remove limit on the size of read-only section for XIP kernel > > arch/riscv/include/asm/page.h | 25 ++++++++++++++++++------ > arch/riscv/include/asm/pgtable.h | 18 +++++++---------- > arch/riscv/include/asm/xip_fixup.h | 30 +++++++++++++++++++++++------ > arch/riscv/kernel/vmlinux-xip.lds.S | 4 ++-- > arch/riscv/mm/init.c | 11 +++++++---- > 5 files changed, 59 insertions(+), 29 deletions(-) > XIP kernels are intended for use with flash devices so the XIP_OFFSET restriction actually represents the size of the flash device: IIRC this 32MB was chosen because it would fit "most devices". I think it would be good to come up with a mechanism that allows to restrict the size at build time: a config? XIP kernels are custom kernels so the user could enter its flash size so that if kernel ends up being too large, it fails. And by default, we could a very large size to avoid kernel test robot build failures. Thanks, Alex