Message ID | 20240123145258.1462979-97-ardb+git@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 22718C47DDB for <linux-arm-kernel@archiver.kernel.org>; Tue, 23 Jan 2024 16:01:10 +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: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=04zfY9IzUlLoxTlQaA9sOSqFOPaE42qQiMDtO89ymAs=; b=LgrnXDa35EoZFfZNX9wjHZ09bI +xZfq0i6uN//CW/n70cvM/253DxevKEL2969f14yfEZEo0wczI9BlMj14L3iyepVmx561FQhEb2wq JYDUSUN9VFFJVh4FRSErYDC6qq7XZg+PCA7Yp0nAg9yVFvxmn8gmjo5c1w2gl6zdZ/iTt1iduSzhB +imnxDVqYD5yFp89qY4gQdIrMxpvUbxS/k0CRUEA7GN+g5jAL32At7ny5syZT1LukFee9FKUumOzv zrZNy2mxVaMePIxKcSnfU05/W7VbUMbZjkDb0d/Zg7lk3HJRbKpVk2kkV1JIs9YNFNHhZG0E/rCrN m2IV4+8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rSJCX-00HAwF-19; Tue, 23 Jan 2024 16:00:37 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rSICA-00GuWM-3B for linux-arm-kernel@bombadil.infradead.org; Tue, 23 Jan 2024 14:56:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Cc:To:From:Subject: Message-ID:References:Mime-Version:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=VMarVLfe4gjFngr6LcZaQg32BKdVjHDZTQiQmj2hzdg=; b=NDrdAF+/43nphl2oyMRTkirJ0q Vb3nD0DEeyhnOGE9a1pFhCh5smKnYJLBw513weNFDDPdA+K3sMJcBpPqXQF6VebB1vQNdfawY8cbL 1kDg3gHXGxK5JqCNM5bJXKw6CANg0Ou7hWNifIT1j5j3KKIBjNeiVU+XZl+hDPQHpi1i8SB+T0z8W NOXDzrKrEZV01ghlY0ZtHD4dEo9NoAgZoUyyY378WNp3QlWZlD36rA4jHqzA3/KnJVQUapsMHQtKx WedCqnmo88jeovLPkXmsyRhhkvHTZ+8lkpV2ia41hXyjb8kX+D6oSNIcs84/VIHr+RiS7pE8o9ooz FW1Lt9zg==; Received: from mail-wr1-x449.google.com ([2a00:1450:4864:20::449]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSIC8-00000003veK-0BpZ for linux-arm-kernel@lists.infradead.org; Tue, 23 Jan 2024 14:56:09 +0000 Received: by mail-wr1-x449.google.com with SMTP id ffacd0b85a97d-339221f285eso2403612f8f.2 for <linux-arm-kernel@lists.infradead.org>; Tue, 23 Jan 2024 06:56:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706021766; x=1706626566; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=VMarVLfe4gjFngr6LcZaQg32BKdVjHDZTQiQmj2hzdg=; b=KELBQ4YMwBZPldQesqz2qZEvNiwboJx5191tT9hQ7DqI+1EC9/mAI5zjPd0P09OHlL 7XkjICxoFLQWku65SaBkjCzh6Y6PuF6zky9iCyHrV1XWWKxTwxizSVJtksA2t7vzgnJB TJHpmM27zuDx1Pb8QlwaH7QjxTB8P0l94BeDTWJhmdh/5SP3LSTruCzcKutuk636xmOo b7/GrWiwh0jcxOnl0aap+yo7F/7drCCH8OQs6Tr3DAWGjoZF1w95kwAkRSTtDAdFDSuU QukDxd1mfCEqG2ZK2HdBJXr4xPnWx0Xw8htgPVi7gDGcf4EfaacQYCW+YRaApn41pf1w 1GTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706021766; x=1706626566; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VMarVLfe4gjFngr6LcZaQg32BKdVjHDZTQiQmj2hzdg=; b=OLPUvASWWD1nx3A12/Zq4prNqjGBBViLgTaMcvBXrpcmJrjyyfoa7DeA9FfRP05C2d RcW2wgaPaHLy3gLPqsaAPxPFKsGHF8/I7dWZ31/fxUiIc7w6xFzntT9j5qNWELBk+hC9 xv5ayebqB+hSJPsGidqRCeg/l2Uckn0eoJdu+tLbnp788aYQwoXvT34PwyU1n+mV+3gU /cx633kCMb1GUjUTBlAA+0vhyXie+B1Ex3VPCDmLprzhCjAHl49oHoYLt1RwKhxpTbrP /H2Av8qAeYdvCtDcoK9z7bKyqrjyFab9cyl3/UNB9HeVpFhexh4J9z0rW22Ro93+kWu0 k1Qg== X-Gm-Message-State: AOJu0YyhbH/hMHanPXU+Zmf2LGEZp8jFuZ5rJbTWgZaj83Ajbjf5pvJy wnZHFWWZyLzu8a5welOSSNWg8H8U6GUknUVjOngv47BDQwMZ+P3VJLh7yT9NKdmPIHV/nm2pDyK xKoh9u0CRF5vefFGwq1Pg+Q6RxeXxxZECae7EHyPEftG9srXpmQKeOq5QAHQI70uuATLUUXoBii 5EmuKRHfGITJb6qymENoYrM2CBHPctsOdIlLcL6Vj8 X-Google-Smtp-Source: AGHT+IFLBxD3pTIgQuEoHpVcE8uAL6jxcMp0MNMk99dpRnOWWPTx7qIZKoi+ZwMJrKBj2+scS20b/tS0 X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a5d:5a83:0:b0:339:4215:7043 with SMTP id bp3-20020a5d5a83000000b0033942157043mr3617wrb.14.1706021766622; Tue, 23 Jan 2024 06:56:06 -0800 (PST) Date: Tue, 23 Jan 2024 15:53:44 +0100 In-Reply-To: <20240123145258.1462979-52-ardb+git@google.com> Mime-Version: 1.0 References: <20240123145258.1462979-52-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=2891; i=ardb@kernel.org; h=from:subject; bh=Uu+Q3dt7LiHKYQlCeNuQ8VnMCmxBdnpZ5P40dLayepg=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIXX9pd8fnsjGvf7UEDahrOMb9+7lOxvWP7oZXc+sFztZI OZRnV91RykLgxgHg6yYIovA7L/vdp6eKFXrPEsWZg4rE8gQBi5OAZjI215Ght3VcyPv7nwXvC/l bPtnzxXZN0Iqst8Vnfy2JPlx2ibJ3lBGhmmr+CuTZUNyNk6Qu3jgzrt6I/fpIZvUGJdImZsq/pt tzwsA X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240123145258.1462979-97-ardb+git@google.com> Subject: [PATCH v7 45/50] arm64: ptdump: Deal with translation levels folded at runtime From: Ard Biesheuvel <ardb+git@google.com> To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel <ardb@kernel.org>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Marc Zyngier <maz@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Ryan Roberts <ryan.roberts@arm.com>, Anshuman Khandual <anshuman.khandual@arm.com>, Kees Cook <keescook@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240123_145608_259612_790AED55 X-CRM114-Status: GOOD ( 19.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
arm64: Add support for LPA2 and WXN at stage 1
|
expand
|
diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c index 16d0cf1d85c4..5b87f8d623f7 100644 --- a/arch/arm64/mm/ptdump.c +++ b/arch/arm64/mm/ptdump.c @@ -48,6 +48,7 @@ struct pg_state { struct ptdump_state ptdump; struct seq_file *seq; const struct addr_marker *marker; + const struct mm_struct *mm; unsigned long start_address; int level; u64 current_prot; @@ -144,12 +145,12 @@ static const struct prot_bits pte_bits[] = { struct pg_level { const struct prot_bits *bits; - const char *name; - size_t num; + char name[4]; + int num; u64 mask; }; -static struct pg_level pg_level[] = { +static struct pg_level pg_level[] __ro_after_init = { { /* pgd */ .name = "PGD", .bits = pte_bits, @@ -159,11 +160,11 @@ static struct pg_level pg_level[] = { .bits = pte_bits, .num = ARRAY_SIZE(pte_bits), }, { /* pud */ - .name = (CONFIG_PGTABLE_LEVELS > 3) ? "PUD" : "PGD", + .name = "PUD", .bits = pte_bits, .num = ARRAY_SIZE(pte_bits), }, { /* pmd */ - .name = (CONFIG_PGTABLE_LEVELS > 2) ? "PMD" : "PGD", + .name = "PMD", .bits = pte_bits, .num = ARRAY_SIZE(pte_bits), }, { /* pte */ @@ -227,6 +228,11 @@ static void note_page(struct ptdump_state *pt_st, unsigned long addr, int level, static const char units[] = "KMGTPE"; u64 prot = 0; + /* check if the current level has been folded dynamically */ + if ((level == 1 && mm_p4d_folded(st->mm)) || + (level == 2 && mm_pud_folded(st->mm))) + level = 0; + if (level >= 0) prot = val & pg_level[level].mask; @@ -288,6 +294,7 @@ void ptdump_walk(struct seq_file *s, struct ptdump_info *info) st = (struct pg_state){ .seq = s, .marker = info->markers, + .mm = info->mm, .level = -1, .ptdump = { .note_page = note_page,