diff --git a/xen/arch/arm/include/asm/cache.h b/xen/arch/arm/include/asm/cache.h index 240b6ae0ea..029b2896fb 100644 --- a/xen/arch/arm/include/asm/cache.h +++ b/xen/arch/arm/include/asm/cache.h @@ -6,6 +6,7 @@ #define L1_CACHE_SHIFT (CONFIG_ARM_L1_CACHE_SHIFT) #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) +/* TODO: Phase out the use of this via cache.h */ #define __read_mostly __section(".data.read_mostly") #endif diff --git a/xen/arch/ppc/include/asm/cache.h b/xen/arch/ppc/include/asm/cache.h index 0d7323d789..13c0bf3242 100644 --- a/xen/arch/ppc/include/asm/cache.h +++ b/xen/arch/ppc/include/asm/cache.h @@ -3,6 +3,7 @@ #ifndef _ASM_PPC_CACHE_H #define _ASM_PPC_CACHE_H +/* TODO: Phase out the use of this via cache.h */ #define __read_mostly __section(".data.read_mostly") #endif /* _ASM_PPC_CACHE_H */ diff --git a/xen/arch/x86/include/asm/cache.h b/xen/arch/x86/include/asm/cache.h index e4770efb22..956c05493e 100644 --- a/xen/arch/x86/include/asm/cache.h +++ b/xen/arch/x86/include/asm/cache.h @@ -9,6 +9,7 @@ #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT) #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) +/* TODO: Phase out the use of this via cache.h */ #define __read_mostly __section(".data.read_mostly") #ifndef __ASSEMBLY__ diff --git a/xen/include/xen/cache.h b/xen/include/xen/cache.h index f52a0aedf7..55456823c5 100644 --- a/xen/include/xen/cache.h +++ b/xen/include/xen/cache.h @@ -15,6 +15,7 @@ #define __cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))) #endif +/* TODO: Phase out the use of this via cache.h */ #define __ro_after_init __section(".data.ro_after_init") #endif /* __LINUX_CACHE_H */ diff --git a/xen/include/xen/sections.h b/xen/include/xen/sections.h index b6cb5604c2..f2fac8d7fa 100644 --- a/xen/include/xen/sections.h +++ b/xen/include/xen/sections.h @@ -3,9 +3,30 @@ #ifndef __XEN_SECTIONS_H__ #define __XEN_SECTIONS_H__ +#include + /* SAF-0-safe */ extern char __init_begin[], __init_end[]; +/* + * Some data is expected to be written rarely (if at all). + * + * For performance reasons is it helpful to group such data in the build, to + * avoid the linker placing it adjacent to often-written data. + */ +#define __read_mostly __section(".data.read_mostly") + +/* + * Some data should be chosen during boot and be immutable thereafter. + * + * Variables annotated with __ro_after_init will become read-only after boot + * and suffer a runtime access fault if modified. + * + * For architectures/platforms which haven't implemented support, these + * variables will be treated as regular mutable data. + */ +#define __ro_after_init __section(".data.ro_after_init") + #endif /* !__XEN_SECTIONS_H__ */ /* * Local variables: