[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <e3b03750-f76a-0a70-69ff-3767382859c6@linux.ibm.com>
Date: Wed, 17 Oct 2018 17:23:38 +0530
From: "Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>
To: Christophe Leroy <christophe.leroy@....fr>,
Michael Ellerman <mpe@...erman.id.au>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Dominik Brodowski <linux@...inikbrodowski.net>,
Geoff Levand <geoff@...radead.org>,
Jens Axboe <axboe@...nel.dk>,
Kumar Gala <galak@...nel.crashing.org>,
Li Yang <leoyang.li@....com>,
Nicholas Piggin <npiggin@...il.com>,
Paul Mackerras <paulus@...ba.org>,
Scott Wood <oss@...error.net>, aneesh.kumar@...ux.vnet.ibm.com
Cc: linux-arm-kernel@...ts.infradead.org, linux-block@...r.kernel.org,
linux-fbdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, dri-devel@...ts.freedesktop.org
Subject: Re: Crash on FSL Book3E due to pte_pgprot()? (was Re: [PATCH v3
12/24] powerpc/mm: use pte helpers in generic code)
On 10/17/18 4:42 PM, Christophe Leroy wrote:
>
>
> On 10/17/2018 10:32 AM, Michael Ellerman wrote:
>> Christophe Leroy <christophe.leroy@....fr> writes:
>>> On 10/17/2018 12:59 AM, Michael Ellerman wrote:
>> ...
>>>> The question is what's the right way to fix it? Should pte_pgprot() not
>>>> be filtering those bits out on book3e?
>>>
>>> I think we should not use pte_pggrot() for that then. What about the
>>> below fix ?
>>
>> Thanks, that almost works.
>>
>> pte_mkprivileged() also needs to not strip _PAGE_BAP_SR.
>
> Oops, I missed it allthough I knew it. Patch below.
>
> From: Christophe Leroy <christophe.leroy@....fr>
> Date: Wed, 17 Oct 2018 10:46:24 +0000
> Subject: [PATCH] powerpc/book3e: redefine pte_mkprivileged() and
> pte_mkuser()
> To: Benjamin Herrenschmidt <benh@...nel.crashing.org>, Paul Mackerras
> <paulus@...ba.org>, Michael Ellerman <mpe@...erman.id.au>
> Cc: linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
>
> Book3e defines both _PAGE_USER and _PAGE_PRIVILEGED, so the nohash
> default pte_mkprivileged() and pte_mkuser() are not usable.
>
> This patch redefines them for book3e.
>
> Fixes: a0da4bc166f2 ("powerpc/mm: Allow platforms to redefine some
> helpers")
> Signed-off-by: Christophe Leroy <christophe.leroy@....fr>
> ---
> arch/powerpc/include/asm/nohash/pte-book3e.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/nohash/pte-book3e.h
> b/arch/powerpc/include/asm/nohash/pte-book3e.h
> index 58eef8cb569d..fb4297dff3e2 100644
> --- a/arch/powerpc/include/asm/nohash/pte-book3e.h
> +++ b/arch/powerpc/include/asm/nohash/pte-book3e.h
> @@ -109,5 +109,19 @@
> #define PAGE_READONLY __pgprot(_PAGE_BASE | _PAGE_USER)
> #define PAGE_READONLY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC)
>
> +static inline pte_t pte_mkprivileged(pte_t pte)
> +{
> + return __pte((pte_val(pte) & ~_PAGE_USER) | _PAGE_PRIVILEGED);
> +}
> +
> +#define pte_mkprivileged pte_mkprivileged
> +
> +static inline pte_t pte_mkuser(pte_t pte)
> +{
> + return __pte((pte_val(pte) & ~_PAGE_PRIVILEGED) | _PAGE_USER);
> +}
> +
> +#define pte_mkuser pte_mkuser
> +
I was build testing a similar patch. We would need to put #ifndef
__ASSEMBLY__ around it.
-aneesh
Powered by blists - more mailing lists