In the AArch64 architecture on Linux, the default shareability attribute for normal memory is Inner Shareable, not Outer Shareable. This configuration ensures that memory accesses are coherent among all processors within the same inner shareability domain, which typically includes all cores managed by a single operating system.
The shareability attribute is specified in the translation table entries, particularly in the SH (Shareability) field. For normal cacheable memory, the SH field can be set as follows:
00: Non-shareable
10: Outer Shareable
11: Inner Shareable
By default, Linux sets this field to 11 (Inner Shareable) for normal memory regions. This setting ensures that all cores within the inner shareability domain maintain data coherency without the need for explicit software interventions.
It's important to note that the definitions of inner and outer shareability domains are system-specific and depend on the SoC (System on Chip) design. Typically, the inner shareability domain encompasses all cores running the same OS, while the outer shareability domain may include additional processors or devices. Therefore, the default Inner Shareable setting is appropriate for ensuring coherency among cores within the same OS-managed domain.
In the Linux kernel source code, the default memory attributes, including shareability, are defined in the architecture-specific code for AArch64. Specifically, these attributes are set in the page table entry definitions and memory management initialization routines. The exact location can vary between kernel versions, but generally, you can find these definitions in files related to memory management within the arch/arm64 directory of the kernel source.
For instance, the memory layout and attributes are often defined in files like arch/arm64/include/asm/pgtable.h and arch/arm64/mm/mmu.c. These files contain macros and functions that set up the page table entries with the appropriate attributes, including the shareability settings.
To locate the exact definitions in your specific kernel version, you can search for terms like PTE_ATTRINDX (which sets the memory attribute index) and PTE_SH (which sets the shareability attribute) within the arch/arm64 directory of the kernel source code.
Please note that modifying these attributes requires a thorough understanding of the memory management subsystem and the implications of changing memory attributes on system behavior and performance.