powerpc: fix compile error on 64K pages on 40x, 44x
PATCH v2 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 adding additional guard conditions, that limit the initialization to just platforms that define the pte_frag variable in the mmu context.
--- arch/powerpc/kernel/setup-common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/kernel/setup-common.c +2 -1
@@ -904,7 +904,8 @@ void __init setup_arch(char **cmdline_p)#endif #endif -#ifdef CONFIG_PPC_64K_PAGES +#if defined(CONFIG_PPC_64K_PAGES ) && \ + (defined(CONFIG_PPC_BOOK3S_64 ) || defined(CONFIG_PPC_BOOK3E_MMU )) init_mm.context.pte_frag =NULL ;#endif #ifdef CONFIG_SPAPR_TCE_IOMMU
Signature · 1 line
2.14.2
Le 28/09/2017 à 20:32, Christian Lamparter a écrit :
Quoted 10 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 adding additional guard conditions, that limit the initialization to just platforms that define the
pte_fragvariable in the mmu context.
Wouldn't it be better to amend mm_context_t with the following, just like other platforms, instead of a #ifdef in setup_arch() ?
#ifdef CONFIG_PPC_64K_PAGES /* for 4K PTE fragment support */ void *pte_frag;
#endif
Otherwise, since init_mm is defined in BSS, is setting pte_frag to NULL needed at all ? I think removing this line would be better.
Christophe
Quoted 12 lines
Signed-off-by Christian Lamparter <[email protected]>--- arch/powerpc/kernel/setup-common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/powerpc/kernel/setup-common.c +0
-0
arch/powerpc/kernel/setup-common.c void __init setup_arch(char **cmdline_p) · line 911
Quoted 9 lines
arch/powerpc/kernel/setup-common.c +2
-1@@ -904,7 +904,8 @@ void __init setup_arch(char **cmdline_p)#endif #endif -#ifdef CONFIG_PPC_64K_PAGES +#if defined(CONFIG_PPC_64K_PAGES ) && \ + (defined(CONFIG_PPC_BOOK3S_64 ) || defined(CONFIG_PPC_BOOK3E_MMU )) init_mm.context.pte_frag =NULL ;#endif #ifdef CONFIG_SPAPR_TCE_IOMMU
---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
Quoted 7 lines · CEST christophe leroy
=20
Le 28/09/2017 =C3=A0 20:32, Christian Lamparter a =C3=A9crit :Quoted 5 lines
The mmu context on the 40x, 44x does not define
pte_fragentry. This causes gcc abort the compilation due to:
=20setup-common.c: In function =E2=80=98setup_arch=E2=80=99:
setup-common.c:908: error: =E2=80=98mm_context_t=E2=80=99 has no =E2=80=
=98pte_frag=E2=80=99
Quoted 5 lines
Quoted 5 lines
=20
This patch fixes the issue by adding additional guard conditions, that limit the initialization to just platforms that define thepte_fragvariable in the mmu context.
Quoted 8 lines
=20
Wouldn't it be better to amendmm_context_twith the following, just=20 like other platforms, instead of a #ifdef insetup_arch()?#ifdef CONFIG_PPC_64K_PAGES /* for 4K PTE fragment support */ void *pte_frag;#endif
This would require to add this dead weight to the mm_context_t of asm/mmu-40x.h, asm/mmu-44x.h and asm/mmu-8xx.h.=20 asm/mmu-book3e.h already has the pte_frag defined.
But it is not used by any mmu-book3e/mmu-32 code as far as I can tell.
Quoted 3 lines
Otherwise, since
init_mmis defined in BSS, is settingpte_fragto NULL=20 needed at all ?
I think removing this line would be better.
Yes, in fact it's guaranteed to be NULL by C99.
This is because init_mm is of external linkage and this makes it of "static= =20
storage class" according to 6.2.4.3:
"An object whose identifier is declared with external or internal linkage, or with the storage-class specifier static has static storage duration."
And C99 defines in 6.7.8.10 Initialization that: "
If an object that has static storage duration is not initialized explicitly, then:
=E2=80=94 if it has pointer type, it is initialized to a null pointer; [...]
"
so yes, init_mm.context.pte_frag =3D NULL; can be dropped.=20
The question is what to do with BOOK3E mmu.h? After all the pte_frag serves no purpose there.
Regards,
Christian