Skip to contentSkip to conversation

alpha: Add ARCH_HAS_PTE_SPECIAL support

PATCH In review Matt Turner 3 participants 3 messages Apr 3 – Apr 12 Alpha port

lore
Share & tools
lore

Matt Turner

author maintainer
#0 lore raw

PATCH 1/1 alpha: Add ARCH_HAS_PTE_SPECIAL support

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
---
 arch/alpha/Kconfig               | 1 +
 arch/alpha/include/asm/pgtable.h | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)
arch/alpha/Kconfig +1 -0
index a5feb98cc088..a29788e588ee 100644
@@ -8,6 +8,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
arch/alpha/include/asm/pgtable.h +4 -1
index 849abe2a1f98..832f29340ec6 100644
@@ -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,
@@ -260,6 +261,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
Signature · 1 line
2.52.0
#1 lore raw

Hi Matt,

Quoted 20 lines · Matt Turner

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
---
 arch/alpha/Kconfig               | 1 +
 arch/alpha/include/asm/pgtable.h | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)
arch/alpha/Kconfig +0 -0
index a5feb98cc088..a29788e588ee 100644

arch/alpha/Kconfig config ALPHA · line 14

Quoted 7 lines
arch/alpha/Kconfig +1 -0
@@ -8,6 +8,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

On what kernel does this patch apply? My master branch has none of:

ARCH_HAS_FAST_MULTIPLIER
ARCH_HAS_GCOV_PROFILE_ALL
ARCH_HAS_UBSAN

and they don't seem to be added at all in the other patches you sent.

Cheers,
Michael.

maintainer
#2 lore raw
Quoted 14 lines · Michael Cree

Hi Matt,

Quoted 10 lines · Matt Turner

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

Hi Matt,

These don’t apply cleanly to the current alpha tree here (v7.0-rc1-based). As Michael also noted, the Kconfig context doesn’t match upstream, and the index lines suggest the patches weren’t all generated from the same snapshot, so the intended base/order isn’t entirely clear.

For a quick check, from the different patches that you submitted, I folded in the following locally on top of current arch/alpha/Kconfig:

- ARCH_SUPPORTS_ATOMIC_RMW
- HAVE_ARCH_COMPILER_H
- ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
- ARCH_WANT_FRAME_POINTERS
- ARCH_WANT_IRQS_OFF_ACTIVATE_MM
- ARCH_HAS_PTE_SPECIAL

Built and booted fine on a UP2000+ (SMP), so the overall direction looks good from basic testing.

Might be worth respinning from a consistent base, perhaps as a series if that matches your intent?

Thanks,
Magnus