Skip to content

Commit 34eb138

Browse files
chleroympe
authored andcommitted
powerpc/mm: don't use _PAGE_EXEC for calling hash_preload()
The 'access' parameter of hash_preload() is either 0 or _PAGE_EXEC. Among the two versions of hash_preload(), only the PPC64 one is doing something with this 'access' parameter. In order to remove the use of _PAGE_EXEC outside platform code, 'access' parameter is replaced by 'is_exec' which will be either true of false, and the PPC64 version of hash_preload() creates the access flag based on 'is_exec'. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent daba790 commit 34eb138

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

arch/powerpc/mm/hash_utils_64.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,14 +1482,15 @@ static bool should_hash_preload(struct mm_struct *mm, unsigned long ea)
14821482
#endif
14831483

14841484
void hash_preload(struct mm_struct *mm, unsigned long ea,
1485-
unsigned long access, unsigned long trap)
1485+
bool is_exec, unsigned long trap)
14861486
{
14871487
int hugepage_shift;
14881488
unsigned long vsid;
14891489
pgd_t *pgdir;
14901490
pte_t *ptep;
14911491
unsigned long flags;
14921492
int rc, ssize, update_flags = 0;
1493+
unsigned long access = _PAGE_PRESENT | _PAGE_READ | (is_exec ? _PAGE_EXEC : 0);
14931494

14941495
BUG_ON(REGION_ID(ea) != USER_REGION_ID);
14951496

arch/powerpc/mm/mem.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,8 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
509509
* We don't need to worry about _PAGE_PRESENT here because we are
510510
* called with either mm->page_table_lock held or ptl lock held
511511
*/
512-
unsigned long access, trap;
512+
unsigned long trap;
513+
bool is_exec;
513514

514515
if (radix_enabled()) {
515516
prefetch((void *)address);
@@ -531,16 +532,16 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
531532
trap = current->thread.regs ? TRAP(current->thread.regs) : 0UL;
532533
switch (trap) {
533534
case 0x300:
534-
access = 0UL;
535+
is_exec = false;
535536
break;
536537
case 0x400:
537-
access = _PAGE_EXEC;
538+
is_exec = true;
538539
break;
539540
default:
540541
return;
541542
}
542543

543-
hash_preload(vma->vm_mm, address, access, trap);
544+
hash_preload(vma->vm_mm, address, is_exec, trap);
544545
#endif /* CONFIG_PPC_STD_MMU */
545546
#if (defined(CONFIG_PPC_BOOK3E_64) || defined(CONFIG_PPC_FSL_BOOK3E)) \
546547
&& defined(CONFIG_HUGETLB_PAGE)

arch/powerpc/mm/mmu_decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static inline void _tlbivax_bcast(unsigned long address, unsigned int pid,
8282
#else /* CONFIG_PPC_MMU_NOHASH */
8383

8484
extern void hash_preload(struct mm_struct *mm, unsigned long ea,
85-
unsigned long access, unsigned long trap);
85+
bool is_exec, unsigned long trap);
8686

8787

8888
extern void _tlbie(unsigned long address);

arch/powerpc/mm/pgtable_32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ static void __init __mapin_ram_chunk(unsigned long offset, unsigned long top)
261261
map_kernel_page(v, p, ktext ? PAGE_KERNEL_TEXT : PAGE_KERNEL);
262262
#ifdef CONFIG_PPC_STD_MMU_32
263263
if (ktext)
264-
hash_preload(&init_mm, v, 0, 0x300);
264+
hash_preload(&init_mm, v, false, 0x300);
265265
#endif
266266
v += PAGE_SIZE;
267267
p += PAGE_SIZE;

arch/powerpc/mm/ppc_mmu_32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ void __init setbat(int index, unsigned long virt, phys_addr_t phys,
163163
* Preload a translation in the hash table
164164
*/
165165
void hash_preload(struct mm_struct *mm, unsigned long ea,
166-
unsigned long access, unsigned long trap)
166+
bool is_exec, unsigned long trap)
167167
{
168168
pmd_t *pmd;
169169

0 commit comments

Comments
 (0)