Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp191759ybs; Sun, 24 May 2020 02:18:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeC6w0VKOWITSvj5HsDpG++nETd1aVS25si7Twu352h8OgDEaEuvbIvv209xoB0MU/ITp1 X-Received: by 2002:a17:906:4bc1:: with SMTP id x1mr14062106ejv.13.1590311908977; Sun, 24 May 2020 02:18:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590311908; cv=none; d=google.com; s=arc-20160816; b=y7y44/zzUeMn/7mHnvWMJEdIlpoZvtr87eEgdilzunijein+AOgcbt7hPknrMwf+lq cflBCLBr7afllqlX6HhyQjBe17k2q1zQDNL0PEIzBV244aIOTFmQLLXXLyWpH40c8D95 mWGybN/Kiq0JwtUrR1Z+66P7sHET6sTVBgh16sY4w3mtXO/2YqafSv+tXkOIFfSL8iE/ aphfzWg1csnVupPQyG9xb2Ik6CCw8j3Lzf7NqWt4/3GcElY/S22xaTusBOQRebm+NiAY CAove2EuHWqv7Mna96a1Z8IoRydY8P98TGmpQJsY9BK8duhTRopXpFfV04sXGlQaGG5v irOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ikSEorYImvsnCfhV52g/imsO0WWRMxJoVSePrAF+9nA=; b=ZkOIIZZbS3eNJ/S6TTJzH8VeN8kWj7MJUgmxxv1P4Palb/mKxYtjJPkfsg0RRzYZmr hYd7nMEEexR4o6v3+uxAV36yeapZXV16888Zebd4nJg0ZSw2POzZzV44vECZEuiZdC/+ gY91t2s6xAyikDgmskdZJWOQTyXhdlOskluxqm015DtKBUGq/S2foSIa7mmzYkkb9mNG VB4K5grRnp3nhpS12MYHViE7Sz1fvdUXpYOTVAxK0csnp0rU1aLZXcoWYHw4lLL8P7Wp 0+K1xDFnOOHbV5+Ii3hSTyTUag1gTuMJvc+P0722kmgfEUiCoVQUY3gznQ+Yr1qdEClS VtcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v12si7613321ejj.109.2020.05.24.02.18.06; Sun, 24 May 2020 02:18:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728971AbgEXJOV (ORCPT + 99 others); Sun, 24 May 2020 05:14:21 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:47995 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728502AbgEXJOU (ORCPT ); Sun, 24 May 2020 05:14:20 -0400 X-Originating-IP: 90.112.45.105 Received: from localhost.localdomain (lfbn-gre-1-325-105.w90-112.abo.wanadoo.fr [90.112.45.105]) (Authenticated sender: alex@ghiti.fr) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id E91F0C0009; Sun, 24 May 2020 09:14:17 +0000 (UTC) From: Alexandre Ghiti To: Paul Walmsley , Palmer Dabbelt , Zong Li , Anup Patel , Christoph Hellwig , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH 4/8] riscv: Prepare ptdump for vm layout dynamic addresses Date: Sun, 24 May 2020 05:10:04 -0400 Message-Id: <20200524091008.25587-5-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200524091008.25587-1-alex@ghiti.fr> References: <20200524091008.25587-1-alex@ghiti.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a preparatory patch for sv48 support that will introduce dynamic PAGE_OFFSET. Dynamic PAGE_OFFSET implies that all zones (vmalloc, vmemmap, fixaddr...) whose addresses depend on PAGE_OFFSET become dynamic and can't be used to statically initialize the array used by ptdump to identify the different zones of the vm layout. Signed-off-by: Alexandre Ghiti --- arch/riscv/mm/ptdump.c | 49 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/arch/riscv/mm/ptdump.c b/arch/riscv/mm/ptdump.c index 7eab76a93106..7d9386a7f5c2 100644 --- a/arch/riscv/mm/ptdump.c +++ b/arch/riscv/mm/ptdump.c @@ -49,22 +49,41 @@ struct addr_marker { const char *name; }; +enum address_markers_idx { +#ifdef CONFIG_KASAN + KASAN_SHADOW_START_NR, + KASAN_SHADOW_END_NR, +#endif + FIXMAP_START_NR, + FIXMAP_END_NR, + PCI_IO_START_NR, + PCI_IO_END_NR, +#ifdef CONFIG_SPARSEMEM_VMEMMAP + VMEMMAP_START_NR, + VMEMMAP_END_NR, +#endif + VMALLOC_START_NR, + VMALLOC_END_NR, + PAGE_OFFSET_NR, + END_OF_SPACE_NR +}; + static struct addr_marker address_markers[] = { #ifdef CONFIG_KASAN {KASAN_SHADOW_START, "Kasan shadow start"}, {KASAN_SHADOW_END, "Kasan shadow end"}, #endif - {FIXADDR_START, "Fixmap start"}, - {FIXADDR_TOP, "Fixmap end"}, - {PCI_IO_START, "PCI I/O start"}, - {PCI_IO_END, "PCI I/O end"}, + {0, "Fixmap start"}, + {0, "Fixmap end"}, + {0, "PCI I/O start"}, + {0, "PCI I/O end"}, #ifdef CONFIG_SPARSEMEM_VMEMMAP - {VMEMMAP_START, "vmemmap start"}, - {VMEMMAP_END, "vmemmap end"}, + {0, "vmemmap start"}, + {0, "vmemmap end"}, #endif - {VMALLOC_START, "vmalloc() area"}, - {VMALLOC_END, "vmalloc() end"}, - {PAGE_OFFSET, "Linear mapping"}, + {0, "vmalloc() area"}, + {0, "vmalloc() end"}, + {0, "Linear mapping"}, {-1, NULL}, }; @@ -304,6 +323,18 @@ static int ptdump_init(void) { unsigned int i, j; + address_markers[FIXMAP_START_NR].start_address = FIXADDR_START; + address_markers[FIXMAP_END_NR].start_address = FIXADDR_TOP; + address_markers[PCI_IO_START_NR].start_address = PCI_IO_START; + address_markers[PCI_IO_END_NR].start_address = PCI_IO_END; +#ifdef CONFIG_SPARSEMEM_VMEMMAP + address_markers[VMEMMAP_START_NR].start_address = VMEMMAP_START; + address_markers[VMEMMAP_END_NR].start_address = VMEMMAP_END; +#endif + address_markers[VMALLOC_START_NR].start_address = VMALLOC_START; + address_markers[VMALLOC_END_NR].start_address = VMALLOC_END; + address_markers[PAGE_OFFSET_NR].start_address = PAGE_OFFSET; + for (i = 0; i < ARRAY_SIZE(pg_level); i++) for (j = 0; j < ARRAY_SIZE(pte_bits); j++) pg_level[i].mask |= pte_bits[j].mask; -- 2.20.1