From patchwork Mon Dec 18 21:47:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 10121915 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 306EC60327 for ; Mon, 18 Dec 2017 21:50:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2146E28D5E for ; Mon, 18 Dec 2017 21:50:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15ED728D61; Mon, 18 Dec 2017 21:50:52 +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 A1CC928D5E for ; Mon, 18 Dec 2017 21:50:51 +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=uc6dos7t39pX7msgibVsIrJ4BbPQZg/XN/S+vXJhZAw=; b=Ycu/meUhm+r/ty+3wYUZFTE2TA 1/LyMALj1hPbq/Hig5HPSDD5/yT3J+Oh+iNsxE1LFa3DxAJZ+Pr2HUZzfYpGvDs2zaXj/+YMuzjwC hZlkU6pJTEAd14+ATrma97B1fCtdhNRfD0GW0XrRuCd+FBjkHt9O9BsaiXS6eeqQxeNjWeKTA9O8A 9Q3d86DQ4A/qMgjqJ1g+O3cvOs6Wpd7RdPwZDulmMukCn1bOoi8JBBglBy5iBgDM3+DYuUmAtXoJt gOmEtpe13qgxunYP8IEYxed2XzuWQffN/Wub91lhN5qpFfyYkr9j3gM3iwqpK06fDw8WJWPwZBlXx M2he99LQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eR3J9-0003zq-3K; Mon, 18 Dec 2017 21:50:47 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eR3Gi-0002HJ-1r for linux-arm-kernel@lists.infradead.org; Mon, 18 Dec 2017 21:48:24 +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 56986164F; Mon, 18 Dec 2017 13:47:59 -0800 (PST) Received: from capper-debian.emea.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 30B7F3F41F; Mon, 18 Dec 2017 13:47:58 -0800 (PST) From: Steve Capper To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH V2 5/7] arm64: dump: Make kernel page table dumper dynamic again Date: Mon, 18 Dec 2017 21:47:34 +0000 Message-Id: <20171218214736.13761-6-steve.capper@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171218214736.13761-1-steve.capper@arm.com> References: <20171218214736.13761-1-steve.capper@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171218_134816_949898_D646B549 X-CRM114-Status: GOOD ( 10.65 ) 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, Steve Capper , ard.biesheuvel@linaro.org 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 | 58 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c index d1814b247d4b..4a3e71046cb2 100644 --- a/arch/arm64/mm/dump.c +++ b/arch/arm64/mm/dump.c @@ -29,23 +29,45 @@ #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_START_NR, + KASAN_END_NR, +#endif + MODULES_START_NR, + MODULES_END_NR, + VMALLOC_START_NR, + VMALLOC_END_NR, + FIXADDR_START_NR, + FIXADDR_END_NR, + PCI_START_NR, + PCI_END_NR, +#ifdef CONFIG_SPARSEMEM_VMEMMAP + VMEMMAP_START_NR, +#endif + END_NR +}; + +static struct addr_marker address_markers[] = { + { 0 /* PAGE_OFFSET */, "Linear Mapping start" }, + { 0 /* VA_START */, "Linear Mapping end" }, #ifdef CONFIG_KASAN - { KASAN_SHADOW_START, "Kasan shadow start" }, + { 0 /* KASAN_SHADOW_START */, "Kasan shadow start" }, { KASAN_SHADOW_END, "Kasan shadow end" }, #endif { MODULES_VADDR, "Modules start" }, { MODULES_END, "Modules end" }, { VMALLOC_START, "vmalloc() Area" }, - { 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" }, + { 0 /* VMALLOC_END */, "vmalloc() End" }, + { 0 /* FIXADDR_START */, "Fixmap start" }, + { 0 /* FIXADDR_TOP */, "Fixmap end" }, + { 0 /* PCI_IO_START */, "PCI I/O start" }, + { 0 /* PCI_IO_END */, "PCI I/O end" }, #ifdef CONFIG_SPARSEMEM_VMEMMAP - { VMEMMAP_START, "vmemmap" }, + { 0 /* VMEMMAP_START */, "vmemmap" }, #endif { -1, NULL }, }; @@ -375,7 +397,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) @@ -401,6 +422,21 @@ 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_END_NR].start_address = VMALLOC_END; + address_markers[FIXADDR_START_NR].start_address = FIXADDR_START; + address_markers[FIXADDR_END_NR].start_address = FIXADDR_TOP; + address_markers[PCI_START_NR].start_address = PCI_IO_START; + address_markers[PCI_END_NR].start_address = PCI_IO_END; +#ifdef CONFIG_SPARSEMEM_VMEMMAP + address_markers[VMEMMAP_START_NR].start_address = VMEMMAP_START; +#endif + return ptdump_debugfs_register(&kernel_ptdump_info, "kernel_page_tables"); }