From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Dominik Brodowski <linux@dominikbrodowski.net>,
Geoff Levand <geoff@infradead.org>, Jens Axboe <axboe@kernel.dk>,
Kumar Gala <galak@kernel.crashing.org>,
Li Yang <leoyang.li@nxp.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Paul Mackerras <paulus@samba.org>, Scott Wood <oss@buserror.net>,
aneesh.kumar@linux.vnet.ibm.com
Cc: linux-arm-kernel@lists.infradead.org,
linux-block@vger.kernel.org, linux-fbdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
dri-devel@lists.freedesktop.org
Subject: [PATCH v2 11/24] powerpc/mm: don't use _PAGE_EXEC for calling hash_preload()
Date: Wed, 12 Sep 2018 15:58:36 +0000 (UTC) [thread overview]
Message-ID: <4792a83ab79c6709d010ed4fec3b40242f46df33.1536692743.git.christophe.leroy@c-s.fr> (raw)
In-Reply-To: <cover.1536692743.git.christophe.leroy@c-s.fr>
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>
---
arch/powerpc/mm/hash_utils_64.c | 3 ++-
arch/powerpc/mm/mem.c | 9 +++++----
arch/powerpc/mm/mmu_decl.h | 2 +-
arch/powerpc/mm/pgtable_32.c | 2 +-
arch/powerpc/mm/ppc_mmu_32.c | 2 +-
5 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index f23a89d8e4ce..b8ce0e8cc608 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -1482,7 +1482,7 @@ static bool should_hash_preload(struct mm_struct *mm, unsigned long ea)
#endif
void hash_preload(struct mm_struct *mm, unsigned long ea,
- unsigned long access, unsigned long trap)
+ bool is_exec, unsigned long trap)
{
int hugepage_shift;
unsigned long vsid;
@@ -1490,6 +1490,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
pte_t *ptep;
unsigned long flags;
int rc, ssize, update_flags = 0;
+ unsigned long access = _PAGE_PRESENT | _PAGE_READ | (is_exec ? _PAGE_EXEC : 0);
BUG_ON(REGION_ID(ea) != USER_REGION_ID);
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 31bd9b53c358..0ba0cdb3f759 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -507,7 +507,8 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
* We don't need to worry about _PAGE_PRESENT here because we are
* called with either mm->page_table_lock held or ptl lock held
*/
- unsigned long access, trap;
+ unsigned long trap;
+ bool is_exec;
if (radix_enabled()) {
prefetch((void *)address);
@@ -529,16 +530,16 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
trap = current->thread.regs ? TRAP(current->thread.regs) : 0UL;
switch (trap) {
case 0x300:
- access = 0UL;
+ is_exec = false;
break;
case 0x400:
- access = _PAGE_EXEC;
+ is_exec = true;
break;
default:
return;
}
- hash_preload(vma->vm_mm, address, access, trap);
+ hash_preload(vma->vm_mm, address, is_exec, trap);
#endif /* CONFIG_PPC_STD_MMU */
#if (defined(CONFIG_PPC_BOOK3E_64) || defined(CONFIG_PPC_FSL_BOOK3E)) \
&& defined(CONFIG_HUGETLB_PAGE)
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index e5d779eed181..dd7f9b951d25 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -82,7 +82,7 @@ static inline void _tlbivax_bcast(unsigned long address, unsigned int pid,
#else /* CONFIG_PPC_MMU_NOHASH */
extern void hash_preload(struct mm_struct *mm, unsigned long ea,
- unsigned long access, unsigned long trap);
+ bool is_exec, unsigned long trap);
extern void _tlbie(unsigned long address);
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 0bbc7b7d8a05..01f348938328 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -261,7 +261,7 @@ static void __init __mapin_ram_chunk(unsigned long offset, unsigned long top)
map_kernel_page(v, p, ktext ? PAGE_KERNEL_TEXT : PAGE_KERNEL);
#ifdef CONFIG_PPC_STD_MMU_32
if (ktext)
- hash_preload(&init_mm, v, 0, 0x300);
+ hash_preload(&init_mm, v, false, 0x300);
#endif
v += PAGE_SIZE;
p += PAGE_SIZE;
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c
index bea6c544e38f..38a793bfca37 100644
--- a/arch/powerpc/mm/ppc_mmu_32.c
+++ b/arch/powerpc/mm/ppc_mmu_32.c
@@ -163,7 +163,7 @@ void __init setbat(int index, unsigned long virt, phys_addr_t phys,
* Preload a translation in the hash table
*/
void hash_preload(struct mm_struct *mm, unsigned long ea,
- unsigned long access, unsigned long trap)
+ bool is_exec, unsigned long trap)
{
pmd_t *pmd;
--
2.13.3
next prev parent reply other threads:[~2018-09-12 15:58 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-12 15:58 [PATCH v2 00/24] ban the use of _PAGE_XXX flags outside platform specific code Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 01/24] powerpc/32: Add ioremap_wt() and ioremap_coherent() Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 02/24] drivers/video/fbdev: use ioremap_wc/wt() instead of __ioremap() Christophe Leroy
2018-09-13 13:33 ` Daniel Vetter
2018-09-13 17:02 ` Bartlomiej Zolnierkiewicz
2018-09-12 15:58 ` [PATCH v2 03/24] drivers/block/z2ram: use ioremap_wt() instead of __ioremap(_PAGE_WRITETHRU) Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 04/24] soc/fsl/qbman: use ioremap_cache() instead of ioremap_prot(0) Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 05/24] powerpc: don't use ioremap_prot() nor __ioremap() unless really needed Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 06/24] powerpc/mm: properly set PAGE_KERNEL flags in ioremap() Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 07/24] powerpc: handover page flags with a pgprot_t parameter Christophe Leroy
2018-09-18 17:21 ` Christophe LEROY
2018-09-12 15:58 ` [PATCH v2 08/24] powerpc/mm: don't use _PAGE_EXEC in book3s/32 Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 09/24] powerpc/mm: move some nohash pte helpers in nohash/[32:64]/pgtable.h Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 10/24] powerpc/mm: add pte helpers to query and change pte flags Christophe Leroy
2018-09-12 15:58 ` Christophe Leroy [this message]
2018-09-17 7:59 ` [PATCH v2 11/24] powerpc/mm: don't use _PAGE_EXEC for calling hash_preload() Aneesh Kumar K.V
2018-09-12 15:58 ` [PATCH v2 12/24] powerpc/mm: use pte helpers in generic code Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 13/24] powerpc/mm: Split dump_pagelinuxtables flag_array table Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 14/24] powerpc/mm: drop unused page flags Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 15/24] powerpc/mm: move __P and __S tables in the common pgtable.h Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 16/24] powerpc/book3s/32: do not include pte-common.h Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 17/24] powerpc/mm: Move pte_user() into nohash/pgtable.h Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 18/24] powerpc/mm: Distribute platform specific PAGE and PMD flags and definitions Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 19/24] powerpc/nohash/64: do not include pte-common.h Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 20/24] powerpc/mm: Allow platforms to redefine some helpers Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 21/24] powerpc/mm: Define platform default caches related flags Christophe Leroy
2018-09-12 15:58 ` [PATCH v2 22/24] powerpc/mm: Get rid of pte-common.h Christophe Leroy
2018-09-12 15:59 ` [PATCH v2 23/24] powerpc/8xx: change name of a few page flags to avoid confusion Christophe Leroy
2018-09-12 15:59 ` [PATCH v2 24/24] powerpc/book3s64: Avoid multiple endian conversion in pte helpers Christophe Leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4792a83ab79c6709d010ed4fec3b40242f46df33.1536692743.git.christophe.leroy@c-s.fr \
--to=christophe.leroy@c-s.fr \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=axboe@kernel.dk \
--cc=b.zolnierkie@samsung.com \
--cc=benh@kernel.crashing.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=galak@kernel.crashing.org \
--cc=geoff@infradead.org \
--cc=leoyang.li@nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=oss@buserror.net \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).