ARM: 8667/3: Fix memory attribute inconsistencies when using fixmap
To cope with the variety in ARM architectures and configurations, the pagetable attributes for kernel memory are generated at runtime to match the system the kernel finds itself on. This calculated value is stored in pgprot_kernel. However, when early fixmap support was added for ARM (commita5f4c561b3) the attributes used for mappings were hard coded because pgprot_kernel is not set up early enough. Unfortunately, when fixmap is used after early boot this means the memory being mapped can have different attributes to existing mappings, potentially leading to unpredictable behaviour. A specific problem also exists due to the hard coded values not include the 'shareable' attribute which means on systems where this matters (e.g. those with multiple CPU clusters) the cache contents for a memory location can become inconsistent between CPUs. To resolve these issues we change fixmap to use the same memory attributes (from pgprot_kernel) that the rest of the kernel uses. To enable this we need to refactor the initialisation code so build_mem_type_table() is called early enough. Note, that relies on early param parsing for memory type overrides passed via the kernel command line, so we need to make sure this call is still after parse_early_params(). [ardb: keep early_fixmap_init() before param parsing, for earlycon] Fixes:a5f4c561b3("ARM: 8415/1: early fixmap support for earlycon") Cc: <stable@vger.kernel.org> # v4.3+ Tested-by: afzal mohammed <afzal.mohd.ma@gmail.com> Signed-off-by: Jon Medhurst <tixy@linaro.org> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
This commit is contained in:
committed by
Russell King
parent
ea2d9a96b6
commit
b089c31c51
@@ -80,7 +80,7 @@ __setup("fpe=", fpe_setup);
|
||||
|
||||
extern void init_default_cache_policy(unsigned long);
|
||||
extern void paging_init(const struct machine_desc *desc);
|
||||
extern void early_paging_init(const struct machine_desc *);
|
||||
extern void early_mm_init(const struct machine_desc *);
|
||||
extern void adjust_lowmem_bounds(void);
|
||||
extern enum reboot_mode reboot_mode;
|
||||
extern void setup_dma_zone(const struct machine_desc *desc);
|
||||
@@ -1088,7 +1088,7 @@ void __init setup_arch(char **cmdline_p)
|
||||
parse_early_param();
|
||||
|
||||
#ifdef CONFIG_MMU
|
||||
early_paging_init(mdesc);
|
||||
early_mm_init(mdesc);
|
||||
#endif
|
||||
setup_dma_zone(mdesc);
|
||||
xen_early_init();
|
||||
|
||||
Reference in New Issue
Block a user