powerpc: fix compile error on 64K pages on 40x, 44x
PATCH v3 1/1 powerpc: fix compile error on 64K pages on 40x, 44x
The mmu context on the 40x, 44x does not define pte_frag entry. This causes gcc abort the compilation due to:
setup-common.c: In function ‘setup_arch’:
setup-common.c:908: error: ‘mm_context_t’ has no ‘pte_frag’
This patch fixes the issue by removing the pte_frag initialization in setup-common.c.
This is possible, because the compiler will do the initialization, since the mm_context is a sub struct of init_mm. init_mm is declared in mm_types.h as external linkage. according to C99 6.2.4.3:
"An object whose identifier is declared with external linkage [...] has static storage duration."
C99 defines in 6.7.8.10 that: "
If an object that has static storage duration is not initialized explicitly, then:
- if it has pointer type, it is initialized to a null pointer [...]
"
--- arch/powerpc/kernel/setup-common.c | 3 --- 1 file changed, 3 deletions(-)
arch/powerpc/kernel/setup-common.c +0 -3
@@ -904,9 +904,6 @@ void __init setup_arch(char **cmdline_p)#endif #endif -#ifdef CONFIG_PPC_64K_PAGES - init_mm.context.pte_frag =NULL ; -#endif #ifdef CONFIG_SPAPR_TCE_IOMMU mm_iommu_init (&init_mm);#endif
Signature · 1 line
2.14.2
Le 01/10/2017 à 16:33, Christian Lamparter a écrit :
Quoted 16 lines
The mmu context on the 40x, 44x does not define
pte_fragentry. This causes gcc abort the compilation due to:
setup-common.c: In function ‘setup_arch’:
setup-common.c:908: error: ‘mm_context_t’ has no ‘pte_frag’This patch fixes the issue by removing the
pte_fraginitialization insetup-common.c.This is possible, because the compiler will do the initialization, since the
mm_contextis a sub struct ofinit_mm.init_mmis declared inmm_types.has external linkage. according to C99 6.2.4.3:
"An object whose identifier is declared with external linkage [...] has static storage duration."
Quoted 8 lines
C99 defines in 6.7.8.10 that: "
If an object that has static storage duration is not initialized explicitly, then:
- if it has pointer type, it is initialized to a null pointer [...]
"Signed-off-by Christian Lamparter <[email protected]>
Quoted 19 lines
--- arch/powerpc/kernel/setup-common.c | 3 --- 1 file changed, 3 deletions(-)arch/powerpc/kernel/setup-common.c +0
-3@@ -904,9 +904,6 @@ void __init setup_arch(char **cmdline_p)#endif #endif -#ifdef CONFIG_PPC_64K_PAGES - init_mm.context.pte_frag =NULL ; -#endif #ifdef CONFIG_SPAPR_TCE_IOMMU mm_iommu_init (&init_mm);#endif
Michael Ellerman
AppliedQuoted 23 lines · Christian Lamparter
The mmu context on the 40x, 44x does not define
pte_fragentry. This causes gcc abort the compilation due to:
setup-common.c: In function ‘setup_arch’:
setup-common.c:908: error: ‘mm_context_t’ has no ‘pte_frag’This patch fixes the issue by removing the
pte_fraginitialization insetup-common.c.This is possible, because the compiler will do the initialization, since the
mm_contextis a sub struct ofinit_mm.init_mmis declared inmm_types.has external linkage. according to C99 6.2.4.3:
"An object whose identifier is declared with external linkage [...] has static storage duration."C99 defines in 6.7.8.10 that: "
If an object that has static storage duration is not initialized explicitly, then:
- if it has pointer type, it is initialized to a null pointer [...]
"
Quoted 2 lines
Signed-off-by Christian Lamparter <[email protected]>Reviewed-by Christophe Leroy <[email protected]>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/070e004912fed099263408bf2ff1bb
cheers