From patchwork Wed Dec 13 08:40:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13490545 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 B4AABC4332F for ; Wed, 13 Dec 2023 08:41:15 +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: Mime-Version:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=QlbSB2VEQsFq7Wm8mwnfzSHydobvBiqRK3U/7UiVNBA=; b=L7b e5OiMNS6pT/cWbDcHSl6w6/tpdBjGfZyytGMrYoLW4wqRh7hzQnVGTo/E1hIyRk33KXWMJFM4ufzG qVq+jJS1f2D+a4Dj97NV0BYFHTbggatbkn59bMxlN8gfDXyV6qdmNi2/14/tZLZ/nk567ndWQzR+P CYLpAbeLXJof5CDQFfNCOVnn8jF03R+VVS1SzbDvWHFwVN/ygM2EQH2Gvw+bv99i7pnXNce58yEAQ 5fH7RYdjRVoshKzREC9y9F35xSbPUFZ9jjeEKixbCmXnh0/VNkc797aPIJwfgErYE0LwBhyn3qBpI PP+oAj2pad/f3hJeiVRS2RKVjYepF1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDKnN-00E3GQ-0c; Wed, 13 Dec 2023 08:40:45 +0000 Received: from mail-wr1-x449.google.com ([2a00:1450:4864:20::449]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDKnJ-00E3Fb-1Y for linux-arm-kernel@lists.infradead.org; Wed, 13 Dec 2023 08:40:42 +0000 Received: by mail-wr1-x449.google.com with SMTP id ffacd0b85a97d-3335df64539so5488891f8f.3 for ; Wed, 13 Dec 2023 00:40:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702456837; x=1703061637; darn=lists.infradead.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=07+Q+LOaJNQKic/P3pgh31q4fVVTSMC/RPNc6l9DRSA=; b=XUR9Xu4hloLAAPon2jGotdzI0+1800+w+QDwRAfLt5Th+5j81WqRlHDpngGM6PPFEU ywP0IcZocgCOB/8xDpGpFHnCZelf3i33nXwBTBHx+L+1qnujp1vz8yysY84yd2qc8gfT uOlE2kwISU8OwMhrF6nC7CY+aU0nZAVh1onKWw8RHSQxTGn48n9VSa9Dt+ltcdWf0Zbp 9/+iTFY/CJ8kougPhYg5xGqRGauEiPuAb3nc97s4tcthUuYHZB3t5QhmECQtBmV/DyGt 94+MHH3TRw0zCk50hI3ErQ4qUoosjRv2QHjkz02EIT19+IWHfAjCqJGZiwKZ7Yj/lEgm CAYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702456837; x=1703061637; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=07+Q+LOaJNQKic/P3pgh31q4fVVTSMC/RPNc6l9DRSA=; b=JJLc2txgkjWZ36SR7QEW2LyeDxm7xmh9ewcBN5X35+zfkjygPiob3Bcy1e9mXhAGLk xnb4mLOsZ1l7I9cCB0qi6vQnVogZOYmHM4AFqijcy1UzRzVFYlkpPwLWPDIwSkFtyG1P xkfY0xxhZ3IUtB4v2apcAYwW3dG0aVPHVg5SGp5EFoGeq6Kzfm8nb6VieM8tlkykMB+r 1XSRJaGIOGaVsfvI2Bw2+oQ9mmVK4I1OekzPT/C2ltBUtsNWaODW5jPB2IBtNfFK13zx 6u/9lpuKokDxw4Ye1mOd7xEXV0bIqt7QN0gf4ip8hroF95M5f5yJip32rUZmHJYM2e/+ yKNA== X-Gm-Message-State: AOJu0Yy2hPURy/YgSoa1ziKfYTJM05zU/pEgXUqPy4AYJQqW2UjLFHet J3Kfrm6coUGcIEC++eEYH8rZC9edL1r8pOHMp5qnJy7MHm4jglughyiNsnXhPrrqp7IKSpWH3Re 5bMgnOugLDtePUjjn9ayAAtd/shQ5BkrUDi0lAbLrKloWPh2wE/95660TndgHnh+FDsux2wgips s= X-Google-Smtp-Source: AGHT+IHeMTBFu7bLaEvFoT3jdcDmrwWM4XisXG405miBFV9iAKDscgAojy35fnXysVPGiYx7gapY1Ph1 X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a05:6000:18a4:b0:336:105b:8495 with SMTP id b4-20020a05600018a400b00336105b8495mr39755wri.14.1702456836407; Wed, 13 Dec 2023 00:40:36 -0800 (PST) Date: Wed, 13 Dec 2023 09:40:25 +0100 Mime-Version: 1.0 X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=1631; i=ardb@kernel.org; h=from:subject; bh=O2iKGGp2uc6q0ARSKav1U9qOk2JdL2TPEImd/o3lSlY=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIbUy92f2sTNZd0TY903mcRacdC5czY19Vfmtri2n74Z8W 3b1v8PbjlIWBjEOBlkxRRaB2X/f7Tw9UarWeZYszBxWJpAhDFycAjAR0/sMPxmvHH2lkyXj/Tuz 9ePx7mczuNdM0X85w+tNwd9L/GIMU3sZ/vA4phWXcdydf7jrruPPe5KP/5wRE0/POvHmu5Fd5Jc pfgwA X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog Message-ID: <20231213084024.2367360-9-ardb@google.com> Subject: [PATCH v7 0/7] arm64: Reorganize kernel VA space From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Catalin Marinas , Will Deacon , Marc Zyngier , Mark Rutland X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_004041_542939_0A1154BF X-CRM114-Status: UNSURE ( 9.17 ) X-CRM114-Notice: Please train this message. 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 From: Ard Biesheuvel These seven patches were taken from [0] and tweaked to address the feedback by Mark Rutland. They reconfigure the upper region of the kernel VA space so that the vmemmap region can be resized dynamically on 52-bit builds running on 48-bit-only hardware. This is needed for LPA2 support. They can be applied onto the arm62 lpa2-prep branch. [0] https://lore.kernel.org/all/20231129111555.3594833-43-ardb@google.com v7: - add static assert to avoid the fixmap overlapping with the PCI I/O region - avoid deriving VMEMMAP_END from VMEMMAP_START+VMEMMAP_SIZE in ptdump.c - add ack from Mark Cc: Catalin Marinas Cc: Will Deacon Cc: Marc Zyngier Cc: Mark Rutland Ard Biesheuvel (7): arm64: mm: Move PCI I/O emulation region above the vmemmap region arm64: mm: Move fixmap region above vmemmap region arm64: ptdump: Allow all region boundaries to be defined at boot time arm64: ptdump: Discover start of vmemmap region at runtime arm64: vmemmap: Avoid base2 order of struct page size to dimension region arm64: mm: Reclaim unused vmemmap region for vmalloc use arm64: kaslr: Adjust randomization range dynamically arch/arm64/include/asm/memory.h | 14 ++--- arch/arm64/include/asm/pgtable.h | 10 ++-- arch/arm64/kernel/image-vars.h | 2 + arch/arm64/kernel/pi/kaslr_early.c | 11 ++-- arch/arm64/mm/fixmap.c | 3 ++ arch/arm64/mm/ptdump.c | 56 +++++++++----------- 6 files changed, 49 insertions(+), 47 deletions(-)