From mboxrd@z Thu Jan 1 00:00:00 1970 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 DF362C48BC4 for ; Wed, 14 Feb 2024 13:30:56 +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:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=EDoKJS3bRCRKjAUm6cgAQXT8sjexNrT4+Ye933naiPk=; b=eO8fFM3GrPrpkwezrp3r8GLO7M kwcCgFLUuQHtBsfjhdw9JMXEkRMCdQ/4IJcu4l/TAYwCklLkeYA7svxLlIzQbfrcUjCSjzW+cNS3s b1irwFSaCoc0LQk3RkRB7ZPTwQhT8+oz/60FL74l9qgepRsE4EQUufeRujqzOy1jxZRZgB8lQ6XAD YlIvY5YDtvbKRbJeZI/D9MYGHhEpozRBmhSoioCXB2e0c4zEp0X9PHyXaU+MaJFLv3nA4HfgIynuP cU1zcMynHYrcPLL0KsxHfcnfYC7yn4NH9qpbCvHFPm8Rf1qtquFoVRrvQr1tICg0+Wfg2wd+fOw7B ZmVc1ScQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raFLb-0000000D1mF-3I1E; Wed, 14 Feb 2024 13:30:47 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1raEOx-0000000CoS2-331m for linux-arm-kernel@lists.infradead.org; Wed, 14 Feb 2024 12:30:16 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-dcdc3db67f0so67567276.1 for ; Wed, 14 Feb 2024 04:30:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707913810; x=1708518610; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=9Rh7J9+kc1jH+ZATGNo3sjM+R+6H3pGkV8VVVSJtZCs=; b=ca0R9biLn/P5AwMhDf9TYuA6YwxcIRZGvzfojtmQlvG1aw6RcNOa1V+Plc7qAdhBKv DqY3AtOHADBPV9ovTEsERpk2xoaJwbf1Dvdet+WakijYca5Upg2e+PLOTacTgktGcbHA oU/wGS8n6kMlHuX1ICUnyo5jn7PII8/NdLW6Rph0cKe5DzeJplz6uL95Nnd1M3ofL/DR F73XDWt+08wcT3w52BtWV3KuF3927RAEVl+ZpxPZFiO6iDjqayM3TIcpottbUqSkpjLR iqHpsdlQ9HaJ08wEhHxFb85s1ftWLxc4e1dtqGWqKoB+a7VfI/EhQ6okLV/Gcomo1efR XYLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707913810; x=1708518610; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9Rh7J9+kc1jH+ZATGNo3sjM+R+6H3pGkV8VVVSJtZCs=; b=U8znu2Sm8KQyVxE2SgnKYWYWthEHJnMkGzfFtGdU8u0N2vN6hDwbAlx0kIX8n5VA/T oFpUKKYVQYh2umEzHUg7ExqUiogTLUNyImBVlPLc0cBlj2MZfZTJZPFca1bwUuo0z9Yw w7/llE4o7IAiwzFHdU9hiJU5MaW74iVU2kChsP9a1hektU5f9C3bAHu9Zwdv6OOFXfVj OYRojHA3PdY1QdKmUcvJ62jaKhx6ean5YMaDTCL/2FXZjRt4XCW3GZdXndDQVVADLhjR zxO8c+wQDOJuSftn4o0o1UmDKCINa4kvChovzB3I5M3G0Gq5BqcE6uSsWwyURKGwdNwV axNg== X-Gm-Message-State: AOJu0Yz1FzY9CCrRhjcxoTCNaqes5YuiYNRCVbYXA4Wv0GwIMe4HCOBH 0jAbFvDExCP3rdfVNmWM6KTlr/Y+zle2aKjdDB2TWi62wmVL/GlvpjTycM9R2juEqs50LDvq3fW 6t79Nuv6OwjNh8TObSkRy5p7KhX+Tx6b2C7eZSmNjZVKJDOb9BM54h5LBEuBGM7ij91ctWZqjFh X8FPDHzi31G6ibvCIQ92Ok5Yhjb10B02IuZzI8/GHX X-Google-Smtp-Source: AGHT+IGnfW24f+Yz1lHGMfiACTuuKnWu9SLnEXYKx9gq2mhQ59zByJdlRdcvE+gtHMTJ4hvya2rlVL7N X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a05:6902:1884:b0:dbd:ee44:8908 with SMTP id cj4-20020a056902188400b00dbdee448908mr475936ybb.0.1707913810466; Wed, 14 Feb 2024 04:30:10 -0800 (PST) Date: Wed, 14 Feb 2024 13:29:00 +0100 In-Reply-To: <20240214122845.2033971-45-ardb+git@google.com> Mime-Version: 1.0 References: <20240214122845.2033971-45-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=1834; i=ardb@kernel.org; h=from:subject; bh=xWYZgHk/D2BgZ7XwkPHxJSDXujQ5g/J/prtVcRWgTdo=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIfXMJt5s17ULPr1OuOcqc9jmI4OjiDZzesi/PV1c2TJJL vFPWao6SlkYxDgYZMUUWQRm/3238/REqVrnWbIwc1iZQIYwcHEKwERKshgZNn5w/XHmrJRWs9+N Y3ucJ/z1c9S3vaeSv0BJ2P8vo/imPkaGSabe/Ed3bLDqttn/Lfm9Yf6j4G2/Oipvps1ZrD2Fo0m NDwA= X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Message-ID: <20240214122845.2033971-59-ardb+git@google.com> Subject: [PATCH v8 14/43] arm64: head: allocate more pages for the kernel mapping From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Catalin Marinas , Will Deacon , Marc Zyngier , Mark Rutland , Ryan Roberts , Anshuman Khandual , Kees Cook X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240214_043011_957077_AF29096F X-CRM114-Status: GOOD ( 13.82 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ard Biesheuvel In preparation for switching to an early kernel mapping routine that maps each segment according to its precise boundaries, and with the correct attributes, let's allocate some extra pages for page tables for the 4k page size configuration. This is necessary because the start and end of each segment may not be aligned to the block size, and so we'll need an extra page table at each segment boundary. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/kernel-pgtable.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h index 83ddb14b95a5..0631604995ee 100644 --- a/arch/arm64/include/asm/kernel-pgtable.h +++ b/arch/arm64/include/asm/kernel-pgtable.h @@ -68,7 +68,7 @@ + EARLY_PGDS((vstart), (vend), add) /* each PGDIR needs a next level page table */ \ + EARLY_PUDS((vstart), (vend), add) /* each PUD needs a next level page table */ \ + EARLY_PMDS((vstart), (vend), add)) /* each PMD needs a next level page table */ -#define INIT_DIR_SIZE (PAGE_SIZE * EARLY_PAGES(KIMAGE_VADDR, _end, EXTRA_PAGE)) +#define INIT_DIR_SIZE (PAGE_SIZE * (EARLY_PAGES(KIMAGE_VADDR, _end, EXTRA_PAGE) + EARLY_SEGMENT_EXTRA_PAGES)) /* the initial ID map may need two extra pages if it needs to be extended */ #if VA_BITS < 48 @@ -89,6 +89,15 @@ #define SWAPPER_TABLE_SHIFT PMD_SHIFT #endif +/* The number of segments in the kernel image (text, rodata, inittext, initdata, data+bss) */ +#define KERNEL_SEGMENT_COUNT 5 + +#if SWAPPER_BLOCK_SIZE > SEGMENT_ALIGN +#define EARLY_SEGMENT_EXTRA_PAGES (KERNEL_SEGMENT_COUNT + 1) +#else +#define EARLY_SEGMENT_EXTRA_PAGES 0 +#endif + /* * Initial memory map attributes. */ -- 2.43.0.687.g38aa6559b0-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel