From patchwork Mon Dec 4 14:13:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 10090479 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 959BC60327 for ; Mon, 4 Dec 2017 14:17:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85DDC288CF for ; Mon, 4 Dec 2017 14:17:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A4DE28917; Mon, 4 Dec 2017 14:17:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CF508288CF for ; Mon, 4 Dec 2017 14:17:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=K1mU+FctfXr+O69tNg+B2jMO7UhgAG3cMu1az1wH7ms=; b=l5mi5QdcftMI88morRnoOb7jPD coh6ckle645ydZ49ZYhbK0H/zB/xyFbZq0YaLPKZuuy0eqYRx9B3GSVmzq6POYx0nhfB1HLjqTyij bcJp9hcn2cdZ9uFfm4c5qE83Y8a5Eu78WMcnyaFXmEyCXEbFUAUO+3LX1V/mX2W9E8GSYg7nwcJ8m TSSoBRduVW61zpT9Z1PGGvt4IuRztFV8W5utsnNxHhiCSOWlnLKyfmiJdixzTCT2i3/b49iFPoIfb DXQQMnoxLTFy7eFfbaoUEhEosMNXt0aObHDabSL0EtyrhrMk5WPjNSmDc+KgAhRmF2m6h/XABe3pd er28B5uw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eLrYu-0001Xv-Sx; Mon, 04 Dec 2017 14:17:37 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eLrVh-0004kK-Ku for linux-arm-kernel@lists.infradead.org; Mon, 04 Dec 2017 14:14:57 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E226E19F6; Mon, 4 Dec 2017 06:13:45 -0800 (PST) Received: from capper-debian.emea.arm.com (unknown [10.37.7.145]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BA4003F236; Mon, 4 Dec 2017 06:13:44 -0800 (PST) From: Steve Capper To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH 09/12] arm64: dump: Make kernel page table dumper dynamic again Date: Mon, 4 Dec 2017 14:13:10 +0000 Message-Id: <20171204141313.31604-10-steve.capper@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171204141313.31604-1-steve.capper@arm.com> References: <20171204141313.31604-1-steve.capper@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171204_061418_560041_86A5B3CE X-CRM114-Status: GOOD ( 10.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: catalin.marinas@arm.com, ard.biesheuvel@linaro.org, Steve Capper , Suzuki.Poulose@arm.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The kernel page table dumper assumes that the placement of VA regions is constant and determined at compile time. As we are about to introduce variable VA logic, we need to be able to determine certain regions at boot time. This patch adds logic to the kernel page table dumper s.t. these regions can be computed at boot time. Signed-off-by: Steve Capper --- arch/arm64/mm/dump.c | 51 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c index e5d1b5f432fe..c50af666c407 100644 --- a/arch/arm64/mm/dump.c +++ b/arch/arm64/mm/dump.c @@ -29,18 +29,42 @@ #include #include -static const struct addr_marker address_markers[] = { - { PAGE_OFFSET, "Linear Mapping start" }, - { VA_START, "Linear Mapping end" }, + +enum address_markers_idx { + PAGE_OFFSET_NR = 0, + VA_START_NR, #ifdef CONFIG_KASAN - { KASAN_SHADOW_START, "Kasan shadow start" }, + KASAN_START_NR, + KASAN_END_NR, +#endif + VMALLOC_START_NR, + VMALLOC_END_NR, +#ifdef CONFIG_SPARSEMEM_VMEMMAP + VMEMMAP_START_NR, + VMEMMAP_END_NR, +#endif + FIXADDR_START_NR, + FIXADDR_END_NR, + PCI_START_NR, + PCI_END_NR, + MODULES_START_NR, + MODULES_END_NR, + KIMAGE_NR, + END_NR +}; + +static struct addr_marker address_markers[] = { + { 0 /* PAGE_OFFSET */, "Linear Mapping start" }, + { 0 /* VA_START */, "Linear Mapping end" }, +#ifdef CONFIG_KASAN + { 0 /* KASAN_SHADOW_START */, "Kasan shadow start" }, { KASAN_SHADOW_END, "Kasan shadow end" }, #endif - { VMALLOC_START, "vmalloc() Area" }, + { 0 /* VMALLOC_START */, "vmalloc() Area" }, { VMALLOC_END, "vmalloc() End" }, #ifdef CONFIG_SPARSEMEM_VMEMMAP - { VMEMMAP_START, "vmemmap start" }, - { VMEMMAP_START + VMEMMAP_SIZE, "vmemmap end"}, + { 0 /* VMEMMAP_START */, "vmemmap start" }, + { 0 /*VMEMMAP_START + VMEMMAP_SIZE */, "vmemmap end"}, #endif { FIXADDR_START, "Fixmap start" }, { FIXADDR_TOP, "Fixmap end" }, @@ -377,7 +401,6 @@ static void ptdump_initialize(void) static struct ptdump_info kernel_ptdump_info = { .mm = &init_mm, .markers = address_markers, - .base_addr = PAGE_OFFSET, }; void ptdump_check_wx(void) @@ -403,6 +426,18 @@ void ptdump_check_wx(void) static int ptdump_init(void) { ptdump_initialize(); + kernel_ptdump_info.base_addr = PAGE_OFFSET; + address_markers[PAGE_OFFSET_NR].start_address = PAGE_OFFSET; + address_markers[VA_START_NR].start_address = VA_START; +#ifdef CONFIG_KASAN + address_markers[KASAN_START_NR].start_address = KASAN_SHADOW_START; +#endif + address_markers[VMALLOC_START_NR].start_address = VMALLOC_START; +#ifdef CONFIG_SPARSEMEM_VMEMMAP + address_markers[VMEMMAP_START_NR].start_address = VMEMMAP_START; + address_markers[VMEMMAP_END_NR].start_address = VMEMMAP_START + + VMEMMAP_SIZE; +#endif return ptdump_debugfs_register(&kernel_ptdump_info, "kernel_page_tables"); }