From patchwork Tue Mar 7 14:04:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 65560 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2459326wrd; Tue, 7 Mar 2023 06:25:58 -0800 (PST) X-Google-Smtp-Source: AK7set8cMArWiIFJjKbOwHF5N47JUGrx90w4xeXzaQZ3D/IJ5pBagTteYcK6Fj0dE+lrEj8y1n0O X-Received: by 2002:a17:90b:1b10:b0:237:40a5:7acf with SMTP id nu16-20020a17090b1b1000b0023740a57acfmr16180531pjb.33.1678199158371; Tue, 07 Mar 2023 06:25:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678199158; cv=none; d=google.com; s=arc-20160816; b=hb06Ga7HnxCNQ7iqZTpU4GpLNM6d0lvUrDC9+RdT8nNrHQqSSaj31oYKWmVhHr3kCu YoQFUtov5zgUT2ucLZqi17sLHvH3WDTnUbsN0N3EK9YZ+54ltB1Uue2i2ls9dcqb3vB9 gVsxA80KxeegR1p1YEw42roWFWDrmv/GRv8CUAvuknCwXHg0w04dEx71DPjXEZ0Ml8ht QfjyUiOzDvD7V1fboPQY5KidAROhcmO6m0iJy8ZvqduB+vn0oQong+r3boWRL4VFpcFo z53eQmK31nyfqKjAFwKRriFjEPaLVigFKEtpybmGUjI4MCx++pUrjOwAtIOr9tU1mZlN UFpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mQYI55FgRl+bxo/DcYWYvGy06fertueEoNHy2TH439Q=; b=mJGqAdGv60dhj5UogFTsTJWYpBSKivgqn/FpDqZBwfF8TU+qcMsUGvTkR/2hYUsKKa lO1jrq8VF6a/dvBIGpb/UynWUOGOvuArwGLgixcZueqjJ5yYrOjqrBG3RUITEcRzCS7O rGsQnV71LDhKl3l0/pCaUEHnrQ37RZbXjFng5Of50q4Et+HQ55Z/c2dDiM7f43kb6/U2 j96A1XjroJH1ru2ymVZZCNifMMmQgcs5J9/mLQfr/w7v/Q5Q7vnijCBLTnYhJS2rsLq9 rpF3LPnkVRIP5zpT42OYGEt/ucqCY4oIeKQNL9IP+BujV74Cyh6CFpG/16n4eGFM/ZEn 7lLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gwp2La2i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m21-20020a656a15000000b00503a029385asi12897665pgu.849.2023.03.07.06.25.45; Tue, 07 Mar 2023 06:25:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gwp2La2i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230347AbjCGOHF (ORCPT + 99 others); Tue, 7 Mar 2023 09:07:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230272AbjCGOGu (ORCPT ); Tue, 7 Mar 2023 09:06:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06B3B84F4E for ; Tue, 7 Mar 2023 06:06:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 821566143F for ; Tue, 7 Mar 2023 14:06:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEBACC433A4; Tue, 7 Mar 2023 14:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678198007; bh=P/Q6t7rGGrSXbvlzWrWnoJP4iB2HWpKfFqCADdc1lgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gwp2La2iddTcaO5BMNNOPuVAT9WS4dmHFjHNfde5f+XzIcIDDocQ6b7xeVV/BTkm2 GpNCceBhgGyKYYDxDYcPHUM2yrdunOFUem7nz21/sxRscXFDPb+BG2A7fKawAhuepa po5n3+EWTmDlLXGwlavOftOm2dcOfe4C+TtFe9bAE8VZj81URGR9F6Vr6FQdLOERjd LuRel6uISFFS8Rs/C9XeSmUpH0DSHc8awSSTfOLUTYCjSrMXMgbjD5IsBefSWXybYT kbcq5jlHopdeuXXX5C43JmyrMKpYQawMQb2EJaqjcTAi+MlcdXlyPavNItmx7vO/b+ rU9DWdgh/T62g== From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Catalin Marinas , Will Deacon , Marc Zyngier , Mark Rutland , Ryan Roberts , Anshuman Khandual , Kees Cook Subject: [PATCH v3 04/60] arm64: mm: Move PCI I/O emulation region above the vmemmap region Date: Tue, 7 Mar 2023 15:04:26 +0100 Message-Id: <20230307140522.2311461-5-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307140522.2311461-1-ardb@kernel.org> References: <20230307140522.2311461-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1724; i=ardb@kernel.org; h=from:subject; bh=P/Q6t7rGGrSXbvlzWrWnoJP4iB2HWpKfFqCADdc1lgE=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIYXdhW3uwg7zyGrTWq2OPMntRVtTlS6qmjxWaKxpKQ6f9 XvR0fSOUhYGMQ4GWTFFFoHZf9/tPD1RqtZ5lizMHFYmkCEMXJwCMJFlvIwM13YKMulFrT+lrqrw blGp2iZ1j2Vc9SFW4aJsfLfObr/5i5FhW4ablmzFbSWN3SdCtHfu0v//PcO4wHqCwp472yR4pJn 4AQ== X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759719360762054035?= X-GMAIL-MSGID: =?utf-8?q?1759719360762054035?= Move the PCI I/O region above the vmemmap region in the kernel's VA space. This will permit us to reclaim the lower part of the vmemmap region for vmalloc/vmap allocations when running a 52-bit VA capable build on a 48-bit VA capable system. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/memory.h | 4 ++-- arch/arm64/mm/ptdump.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index a4e1d832a15a2d7a..6e321cc06a3c30f0 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -49,8 +49,8 @@ #define MODULES_VSIZE (SZ_128M) #define VMEMMAP_START (-(UL(1) << (VA_BITS - VMEMMAP_SHIFT))) #define VMEMMAP_END (VMEMMAP_START + VMEMMAP_SIZE) -#define PCI_IO_END (VMEMMAP_START - SZ_8M) -#define PCI_IO_START (PCI_IO_END - PCI_IO_SIZE) +#define PCI_IO_START (VMEMMAP_END + SZ_8M) +#define PCI_IO_END (PCI_IO_START + PCI_IO_SIZE) #define FIXADDR_TOP (VMEMMAP_START - SZ_32M) #if VA_BITS > 48 diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c index 9bc4066c5bf33a72..9d1f4cdc6672ed5f 100644 --- a/arch/arm64/mm/ptdump.c +++ b/arch/arm64/mm/ptdump.c @@ -47,10 +47,10 @@ static struct addr_marker address_markers[] = { { VMALLOC_END, "vmalloc() end" }, { FIXADDR_START, "Fixmap start" }, { FIXADDR_TOP, "Fixmap end" }, - { PCI_IO_START, "PCI I/O start" }, - { PCI_IO_END, "PCI I/O end" }, { VMEMMAP_START, "vmemmap start" }, { VMEMMAP_START + VMEMMAP_SIZE, "vmemmap end" }, + { PCI_IO_START, "PCI I/O start" }, + { PCI_IO_END, "PCI I/O end" }, { -1, NULL }, };