Skip to contentSkip to conversation

powerpc: fix compile error on 64K pages on 40x, 44x

PATCH Applied Christian Lamparter 3 participants 3 messages Oct 1, 2017 – Oct 5, 2017 PowerPC

lore
Share & tools
lore
#0 lore raw

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
index 0ac741fae90e..2e3bc16d02b2 100644
@@ -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
Reviewed-by on v3 1/1
#1 lore raw

Le 01/10/2017 à 16:33, Christian Lamparter a écrit :

Quoted 16 lines

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."

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 [...]
"

Quoted 19 lines
---
  arch/powerpc/kernel/setup-common.c | 3 ---
  1 file changed, 3 deletions(-)
arch/powerpc/kernel/setup-common.c +0 -3
index 0ac741fae90e..2e3bc16d02b2 100644
@@ -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
#2 lore raw
In reply to Christian Lamparter
Quoted 23 lines · Christian Lamparter

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 [...]
"

Quoted 2 lines

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/070e004912fed099263408bf2ff1bb

cheers