Skip to content

Commit a891c43

Browse files
chleroympe
authored andcommitted
powerpc/8xx: Prepare handlers for _PAGE_HUGE for 512k pages.
Prepare ITLB handler to handle _PAGE_HUGE when CONFIG_HUGETLBFS is enabled. This means that the L1 entry has to be kept in r11 until L2 entry is read, in order to insert _PAGE_HUGE into it. Also move pgd_offset helpers before pte_update() as they will be needed there in next patch. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/21fd1de8fba781bededa9474a5a9374aefb1f849.1589866984.git.christophe.leroy@csgroup.eu
1 parent d3efcd3 commit a891c43

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

arch/powerpc/include/asm/nohash/32/pgtable.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ static inline void pmd_clear(pmd_t *pmdp)
206206
}
207207

208208

209+
/* to find an entry in a kernel page-table-directory */
210+
#define pgd_offset_k(address) pgd_offset(&init_mm, address)
211+
212+
/* to find an entry in a page-table-directory */
213+
#define pgd_index(address) ((address) >> PGDIR_SHIFT)
214+
#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
209215

210216
/*
211217
* PTE updates. This function is called whenever an existing
@@ -348,13 +354,6 @@ static inline int pte_young(pte_t pte)
348354
pfn_to_page((__pa(pmd_val(pmd)) >> PAGE_SHIFT))
349355
#endif
350356

351-
/* to find an entry in a kernel page-table-directory */
352-
#define pgd_offset_k(address) pgd_offset(&init_mm, address)
353-
354-
/* to find an entry in a page-table-directory */
355-
#define pgd_index(address) ((address) >> PGDIR_SHIFT)
356-
#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
357-
358357
/* Find an entry in the third-level page table.. */
359358
#define pte_index(address) \
360359
(((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))

arch/powerpc/kernel/head_8xx.S

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ SystemCall:
196196

197197
InstructionTLBMiss:
198198
mtspr SPRN_SPRG_SCRATCH0, r10
199-
#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP)
199+
#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) || defined(CONFIG_HUGETLBFS)
200200
mtspr SPRN_SPRG_SCRATCH1, r11
201201
#endif
202202

@@ -235,16 +235,19 @@ InstructionTLBMiss:
235235
rlwinm r10, r10, 0, 20, 31
236236
oris r10, r10, (swapper_pg_dir - PAGE_OFFSET)@ha
237237
3:
238+
mtcr r11
238239
#endif
240+
#ifdef CONFIG_HUGETLBFS
241+
lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r10) /* Get level 1 entry */
242+
mtspr SPRN_MI_TWC, r11 /* Set segment attributes */
243+
mtspr SPRN_MD_TWC, r11
244+
#else
239245
lwz r10, (swapper_pg_dir-PAGE_OFFSET)@l(r10) /* Get level 1 entry */
240246
mtspr SPRN_MI_TWC, r10 /* Set segment attributes */
241-
242247
mtspr SPRN_MD_TWC, r10
248+
#endif
243249
mfspr r10, SPRN_MD_TWC
244250
lwz r10, 0(r10) /* Get the pte */
245-
#ifdef ITLB_MISS_KERNEL
246-
mtcr r11
247-
#endif
248251
#ifdef CONFIG_SWAP
249252
rlwinm r11, r10, 32-5, _PAGE_PRESENT
250253
and r11, r11, r10
@@ -263,7 +266,7 @@ InstructionTLBMiss:
263266

264267
/* Restore registers */
265268
0: mfspr r10, SPRN_SPRG_SCRATCH0
266-
#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP)
269+
#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) || defined(CONFIG_HUGETLBFS)
267270
mfspr r11, SPRN_SPRG_SCRATCH1
268271
#endif
269272
rfi

0 commit comments

Comments
 (0)