From: Michael Ellerman <mpe@ellerman.id.au>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc: Make set_endian() return EINVAL when not supporting little endian
Date: Thu, 26 Aug 2021 13:41:39 +1000 [thread overview]
Message-ID: <87bl5kc1os.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <b29c29d205737a833262df38e01c07139f1c3dec.1629899011.git.christophe.leroy@csgroup.eu>
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> There is no point in modifying MSR_LE bit on CPUs not supporting
> little endian.
Isn't that an ABI break?
set_endian(PR_ENDIAN_BIG) should work on a big endian CPU, even if it
does nothing useful.
cheers
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index 185beb290580..b2b9919795a2 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -1995,6 +1995,10 @@ int set_endian(struct task_struct *tsk, unsigned int val)
> {
> struct pt_regs *regs = tsk->thread.regs;
>
> + if (!cpu_has_feature(CPU_FTR_PPC_LE) &&
> + !cpu_has_feature(CPU_FTR_REAL_LE))
> + return -EINVAL;
> +
> if ((val == PR_ENDIAN_LITTLE && !cpu_has_feature(CPU_FTR_REAL_LE)) ||
> (val == PR_ENDIAN_PPC_LITTLE && !cpu_has_feature(CPU_FTR_PPC_LE)))
> return -EINVAL;
> --
> 2.25.0
WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc: Make set_endian() return EINVAL when not supporting little endian
Date: Thu, 26 Aug 2021 13:41:39 +1000 [thread overview]
Message-ID: <87bl5kc1os.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <b29c29d205737a833262df38e01c07139f1c3dec.1629899011.git.christophe.leroy@csgroup.eu>
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> There is no point in modifying MSR_LE bit on CPUs not supporting
> little endian.
Isn't that an ABI break?
set_endian(PR_ENDIAN_BIG) should work on a big endian CPU, even if it
does nothing useful.
cheers
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index 185beb290580..b2b9919795a2 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -1995,6 +1995,10 @@ int set_endian(struct task_struct *tsk, unsigned int val)
> {
> struct pt_regs *regs = tsk->thread.regs;
>
> + if (!cpu_has_feature(CPU_FTR_PPC_LE) &&
> + !cpu_has_feature(CPU_FTR_REAL_LE))
> + return -EINVAL;
> +
> if ((val == PR_ENDIAN_LITTLE && !cpu_has_feature(CPU_FTR_REAL_LE)) ||
> (val == PR_ENDIAN_PPC_LITTLE && !cpu_has_feature(CPU_FTR_PPC_LE)))
> return -EINVAL;
> --
> 2.25.0
next prev parent reply other threads:[~2021-08-26 3:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-25 13:43 [PATCH] powerpc: Make set_endian() return EINVAL when not supporting little endian Christophe Leroy
2021-08-25 13:43 ` Christophe Leroy
2021-08-26 3:41 ` Michael Ellerman [this message]
2021-08-26 3:41 ` Michael Ellerman
2021-08-26 4:55 ` Christophe Leroy
2021-08-26 4:55 ` Christophe Leroy
2021-08-26 14:23 ` Michael Ellerman
2021-08-26 14:23 ` Michael Ellerman
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=87bl5kc1os.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@csgroup.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--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 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.