[PATCH 2/5] mm: Add VM_FAULT_ARCH_* codes

From: Palmer Dabbelt
Date: Fri Dec 02 2022 - 22:05:55 EST


A handful of architectures (arm, s390, and soon RISC-V) define their
own internal fault codes, so instead dedicate a few standard codes as
being architecture-specific to avoid conflicts.

Signed-off-by: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
---
include/linux/mm_types.h | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 758eb70829cb..df1aa8d58444 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -880,6 +880,11 @@ enum vm_fault_reason {
VM_FAULT_NEEDDSYNC = (__force vm_fault_t)0x0002000,
VM_FAULT_COMPLETED = (__force vm_fault_t)0x0004000,
VM_FAULT_HINDEX_MASK = (__force vm_fault_t)0x00f0000,
+ VM_FAULT_ARCH_0 = (__force vm_fault_t)0x0100000,
+ VM_FAULT_ARCH_1 = (__force vm_fault_t)0x0200000,
+ VM_FAULT_ARCH_2 = (__force vm_fault_t)0x0400000,
+ VM_FAULT_ARCH_3 = (__force vm_fault_t)0x0800000,
+ VM_FAULT_ARCH_4 = (__force vm_fault_t)0x1000000,
};

/* Encode hstate index for a hwpoisoned large page */
@@ -903,7 +908,12 @@ enum vm_fault_reason {
{ VM_FAULT_RETRY, "RETRY" }, \
{ VM_FAULT_FALLBACK, "FALLBACK" }, \
{ VM_FAULT_DONE_COW, "DONE_COW" }, \
- { VM_FAULT_NEEDDSYNC, "NEEDDSYNC" }
+ { VM_FAULT_NEEDDSYNC, "NEEDDSYNC" }, \
+ { VM_FAULT_ARCH_0, "ARCH_0" }, \
+ { VM_FAULT_ARCH_1, "ARCH_1" }, \
+ { VM_FAULT_ARCH_2, "ARCH_2" }, \
+ { VM_FAULT_ARCH_3, "ARCH_3" }, \
+ { VM_FAULT_ARCH_4, "ARCH_4" }, \

struct vm_special_mapping {
const char *name; /* The name, e.g. "[vdso]". */
--
2.38.1