mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Turner <mattst88@gmail.com>
To: Richard Henderson <richard.henderson@linaro.org>,
	 Magnus Lindholm <linmag7@gmail.com>, Kees Cook <kees@kernel.org>,
	 Marco Elver <elver@google.com>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	 Andrey Ryabinin <ryabinin.a.a@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	 Shuah Khan <skhan@linuxfoundation.org>,
	 Randy Dunlap <rdunlap@infradead.org>
Cc: linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org,
	 kasan-dev@googlegroups.com, linux-hardening@vger.kernel.org,
	 linux-doc@vger.kernel.org, Matt Turner <mattst88@gmail.com>
Subject: [PATCH v2 12/22] alpha: add ARCH_HAS_PTE_SPECIAL support
Date: Sat, 05 Sep 2026 15:29:33 -0400	[thread overview]
Message-ID: <20260905-arch-kconfig-options-v2-v2-12-83e8245761a2@gmail.com> (raw)
In-Reply-To: <20260905-arch-kconfig-options-v2-v2-0-83e8245761a2@gmail.com>

Add _PAGE_SPECIAL using bit 19 (0x80000), which is unused in the Alpha
PTE layout. This enables pte_special()/pte_mkspecial() for marking PTEs
that are not backed by struct page (VDSO mappings, zero page,
io_remap_pfn_range, etc.).

Include _PAGE_SPECIAL in _PAGE_CHG_MASK so it is preserved across
pte_modify() calls.

Assisted-by: Claude:claude-opus-4-6
Signed-off-by: Matt Turner <mattst88@gmail.com>

Also mark Alpha as "ok" in the pte_special feature matrix.
Tested-by: Magnus Lindholm <linmag7@gmail.com>
Reviewed-by: Magnus Lindholm <linmag7@gmail.com>
---
 Documentation/features/vm/pte_special/arch-support.txt | 2 +-
 arch/alpha/Kconfig                                     | 1 +
 arch/alpha/include/asm/pgtable.h                       | 5 ++++-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Documentation/features/vm/pte_special/arch-support.txt b/Documentation/features/vm/pte_special/arch-support.txt
index 3f777f8b67d5..1485bb7c73eb 100644
--- a/Documentation/features/vm/pte_special/arch-support.txt
+++ b/Documentation/features/vm/pte_special/arch-support.txt
@@ -6,7 +6,7 @@
     -----------------------
     |         arch |status|
     -----------------------
-    |       alpha: | TODO |
+    |       alpha: |  ok  |
     |         arc: |  ok  |
     |         arm: |  ok  |
     |       arm64: |  ok  |
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index cc69f94a1c5b..1d28fa8d3b66 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -10,6 +10,7 @@ config ALPHA
 	select ARCH_HAS_FAST_MULTIPLIER
 	select ARCH_HAS_GCOV_PROFILE_ALL
 	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
+	select ARCH_HAS_PTE_SPECIAL
 	select ARCH_HAS_UBSAN
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_MIGHT_HAVE_PC_SERIO
diff --git a/arch/alpha/include/asm/pgtable.h b/arch/alpha/include/asm/pgtable.h
index 8e00cf9dc39d..bdff33b505bc 100644
--- a/arch/alpha/include/asm/pgtable.h
+++ b/arch/alpha/include/asm/pgtable.h
@@ -73,6 +73,7 @@ struct vm_area_struct;
 /* .. and these are ours ... */
 #define _PAGE_DIRTY	0x20000
 #define _PAGE_ACCESSED	0x40000
+#define _PAGE_SPECIAL	0x80000
 
 /* We borrow bit 39 to store the exclusive marker in swap PTEs. */
 #define _PAGE_SWP_EXCLUSIVE	0x8000000000UL
@@ -94,7 +95,7 @@ struct vm_area_struct;
 #define _PFN_MASK	0xFFFFFFFF00000000UL
 
 #define _PAGE_TABLE	(_PAGE_VALID | __DIRTY_BITS | __ACCESS_BITS)
-#define _PAGE_CHG_MASK	(_PFN_MASK | __DIRTY_BITS | __ACCESS_BITS)
+#define _PAGE_CHG_MASK	(_PFN_MASK | __DIRTY_BITS | __ACCESS_BITS | _PAGE_SPECIAL)
 
 /*
  * All the normal masks have the "page accessed" bits on, as any time they are used,
@@ -238,6 +239,8 @@ extern inline pte_t pte_mkold(pte_t pte)	{ pte_val(pte) &= ~(__ACCESS_BITS); ret
 extern inline pte_t pte_mkwrite_novma(pte_t pte){ pte_val(pte) &= ~_PAGE_FOW; return pte; }
 extern inline pte_t pte_mkdirty(pte_t pte)	{ pte_val(pte) |= __DIRTY_BITS; return pte; }
 extern inline pte_t pte_mkyoung(pte_t pte)	{ pte_val(pte) |= __ACCESS_BITS; return pte; }
+extern inline int pte_special(pte_t pte)	{ return pte_val(pte) & _PAGE_SPECIAL; }
+extern inline pte_t pte_mkspecial(pte_t pte)	{ pte_val(pte) |= _PAGE_SPECIAL; return pte; }
 
 /*
  * The smp_rmb() in the following functions are required to order the load of

-- 
2.54.0


  parent reply	other threads:[~2026-09-05 19:29 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-05 19:29 [PATCH v2 00/22] alpha: catch up on architecture Kconfig options Matt Turner
2026-09-05 19:29 ` [PATCH v2 01/22] alpha: enter hardirq context before looking up the irq descriptor Matt Turner
2026-09-06  8:53   ` Magnus Lindholm
2026-09-05 19:29 ` [PATCH v2 02/22] alpha: select ARCH_HAS_UBSAN Matt Turner
2026-09-05 19:29 ` [PATCH v2 03/22] alpha: select ARCH_HAS_GCOV_PROFILE_ALL Matt Turner
2026-09-05 19:29 ` [PATCH v2 04/22] alpha: select HAVE_DEBUG_KMEMLEAK Matt Turner
2026-09-05 19:29 ` [PATCH v2 05/22] alpha: select EDAC_SUPPORT Matt Turner
2026-09-05 19:29 ` [PATCH v2 06/22] alpha: select ARCH_SUPPORTS_ATOMIC_RMW Matt Turner
2026-09-05 19:29 ` [PATCH v2 07/22] alpha: select ARCH_HAS_FAST_MULTIPLIER Matt Turner
2026-09-05 19:29 ` [PATCH v2 08/22] alpha: select ARCH_SUPPORTS_INT128 Matt Turner
2026-10-09  6:52   ` Magnus Lindholm
2026-10-10  2:20     ` [PATCH] alpha: add 128-bit shift helpers Matt Turner
2026-10-10 15:55       ` Magnus Lindholm
2026-10-12 12:37       ` David Laight
2026-10-13  3:24         ` Matt Turner
2026-09-05 19:29 ` [PATCH v2 09/22] alpha: select HAVE_ARCH_COMPILER_H Matt Turner
2026-09-05 19:29 ` [PATCH v2 10/22] alpha: select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE Matt Turner
2026-09-05 19:29 ` [PATCH v2 11/22] alpha: add HAVE_ARCH_THREAD_STRUCT_WHITELIST support Matt Turner
2026-09-05 19:29 ` Matt Turner [this message]
2026-09-05 19:29 ` [PATCH v2 13/22] alpha: add ARCH_SUPPORTS_PAGE_TABLE_CHECK support Matt Turner
2026-09-06 19:53   ` Magnus Lindholm
2026-09-05 19:29 ` [PATCH v2 14/22] alpha: select ARCH_HAS_DEBUG_VM_PGTABLE Matt Turner
2026-09-05 19:29 ` [PATCH v2 15/22] alpha: select HAVE_GUP_FAST Matt Turner
2026-09-05 19:29 ` [PATCH v2 16/22] alpha: select ARCH_USE_MEMTEST Matt Turner
2026-09-05 19:29 ` [PATCH v2 17/22] alpha: select SYSCTL_EXCEPTION_TRACE Matt Turner
2026-09-05 19:29 ` [PATCH v2 18/22] alpha: discard .eh_frame and the relocation sections Matt Turner
2026-09-05 19:29 ` [PATCH v2 19/22] alpha: select ARCH_WANT_LD_ORPHAN_WARN Matt Turner
2026-09-05 19:29 ` [PATCH v2 20/22] alpha: select ARCH_WANT_IRQS_OFF_ACTIVATE_MM Matt Turner
2026-09-05 19:29 ` [PATCH v2 21/22] alpha: add HAVE_PERF_REGS and HAVE_PERF_USER_STACK_DUMP support Matt Turner
2026-09-06 20:44   ` Magnus Lindholm
2026-09-06 20:48     ` Matt Turner
2026-09-05 19:29 ` [PATCH v2 22/22] alpha: select SPARSE_IRQ Matt Turner
2026-09-06 21:18 ` [PATCH v2 00/22] alpha: catch up on architecture Kconfig options Magnus Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260905-arch-kconfig-options-v2-v2-12-83e8245761a2@gmail.com \
    --to=mattst88@gmail.com \
    --cc=andreyknvl@gmail.com \
    --cc=corbet@lwn.net \
    --cc=elver@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kees@kernel.org \
    --cc=linmag7@gmail.com \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=richard.henderson@linaro.org \
    --cc=ryabinin.a.a@gmail.com \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®