From: Lars Persson <lars.persson@axis.com>
To: Paul Burton <paul.burton@imgtec.com>, <linux-mips@linux-mips.org>,
Ralf Baechle <ralf@linux-mips.org>
Cc: Lars Persson <larper@axis.com>, <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Jerome Marchand <jmarchan@redhat.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH 2/2] MIPS: Flush highmem pages from dcache in __flush_icache_page
Date: Wed, 24 Feb 2016 09:02:46 +0100 [thread overview]
Message-ID: <56CD63A6.5090305@axis.com> (raw)
In-Reply-To: <1456164585-26910-2-git-send-email-paul.burton@imgtec.com>
On 02/22/2016 07:09 PM, Paul Burton wrote:
> When a page is to be mapped executable for userspace, we can presume
> that the icache doesn't contain anything valid for its address range but
> we cannot be sure that its content has been written back from the dcache
> to L2 or memory further out. If the icache fills from those memories,
> ie. does not fill from the dcache, then we need to ensure that content
> has been flushed from the dcache. This was being done for lowmem pages
> but not for highmem pages. Fix this by mapping the page & flushing its
> content from the dcache in __flush_icache_page, before the page is
> provided to userland.
>
Reviewed-by: Lars Persson <larper@axis.com>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
>
> ---
>
> arch/mips/mm/cache.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
> index 3f159ca..734cb2f 100644
> --- a/arch/mips/mm/cache.c
> +++ b/arch/mips/mm/cache.c
> @@ -16,6 +16,7 @@
> #include <linux/mm.h>
>
> #include <asm/cacheflush.h>
> +#include <asm/highmem.h>
> #include <asm/processor.h>
> #include <asm/cpu.h>
> #include <asm/cpu-features.h>
> @@ -124,10 +125,14 @@ void __flush_icache_page(struct vm_area_struct *vma, struct page *page)
> unsigned long addr;
>
> if (PageHighMem(page))
> - return;
> + addr = (unsigned long)kmap_atomic(page);
> + else
> + addr = (unsigned long)page_address(page);
>
> - addr = (unsigned long) page_address(page);
> flush_data_cache_page(addr);
> +
> + if (PageHighMem(page))
> + __kunmap_atomic((void *)addr);
> }
> EXPORT_SYMBOL_GPL(__flush_icache_page);
>
>
WARNING: multiple messages have this Message-ID (diff)
From: Lars Persson <lars.persson@axis.com>
To: Paul Burton <paul.burton@imgtec.com>,
linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>
Cc: Lars Persson <larper@axis.com>,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Jerome Marchand <jmarchan@redhat.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH 2/2] MIPS: Flush highmem pages from dcache in __flush_icache_page
Date: Wed, 24 Feb 2016 09:02:46 +0100 [thread overview]
Message-ID: <56CD63A6.5090305@axis.com> (raw)
Message-ID: <20160224080246.zXYDhl6d_4zH1jaOcr8RO47-KfYrw5kkbWLxf1hs6Bs@z> (raw)
In-Reply-To: <1456164585-26910-2-git-send-email-paul.burton@imgtec.com>
On 02/22/2016 07:09 PM, Paul Burton wrote:
> When a page is to be mapped executable for userspace, we can presume
> that the icache doesn't contain anything valid for its address range but
> we cannot be sure that its content has been written back from the dcache
> to L2 or memory further out. If the icache fills from those memories,
> ie. does not fill from the dcache, then we need to ensure that content
> has been flushed from the dcache. This was being done for lowmem pages
> but not for highmem pages. Fix this by mapping the page & flushing its
> content from the dcache in __flush_icache_page, before the page is
> provided to userland.
>
Reviewed-by: Lars Persson <larper@axis.com>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
>
> ---
>
> arch/mips/mm/cache.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
> index 3f159ca..734cb2f 100644
> --- a/arch/mips/mm/cache.c
> +++ b/arch/mips/mm/cache.c
> @@ -16,6 +16,7 @@
> #include <linux/mm.h>
>
> #include <asm/cacheflush.h>
> +#include <asm/highmem.h>
> #include <asm/processor.h>
> #include <asm/cpu.h>
> #include <asm/cpu-features.h>
> @@ -124,10 +125,14 @@ void __flush_icache_page(struct vm_area_struct *vma, struct page *page)
> unsigned long addr;
>
> if (PageHighMem(page))
> - return;
> + addr = (unsigned long)kmap_atomic(page);
> + else
> + addr = (unsigned long)page_address(page);
>
> - addr = (unsigned long) page_address(page);
> flush_data_cache_page(addr);
> +
> + if (PageHighMem(page))
> + __kunmap_atomic((void *)addr);
> }
> EXPORT_SYMBOL_GPL(__flush_icache_page);
>
>
next prev parent reply other threads:[~2016-02-24 8:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 18:09 [PATCH 1/2] MIPS: Add barriers between dcache & icache flushes Paul Burton
2016-02-22 18:09 ` Paul Burton
2016-02-22 18:09 ` [PATCH 2/2] MIPS: Flush highmem pages from dcache in __flush_icache_page Paul Burton
2016-02-22 18:09 ` Paul Burton
2016-02-24 8:02 ` Lars Persson [this message]
2016-02-24 8:02 ` Lars Persson
2016-02-22 23:39 ` [PATCH 1/2] MIPS: Add barriers between dcache & icache flushes Joshua Kinard
2016-03-01 2:23 ` Paul Burton
2016-03-01 2:23 ` Paul Burton
2016-02-23 0:02 ` Florian Fainelli
2016-03-01 2:27 ` Paul Burton
2016-03-01 2:27 ` Paul Burton
2023-03-06 10:28 ` Sven Eckelmann
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=56CD63A6.5090305@axis.com \
--to=lars.persson@axis.com \
--cc=akpm@linux-foundation.org \
--cc=jmarchan@redhat.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=larper@axis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=paul.burton@imgtec.com \
--cc=ralf@linux-mips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.