* [Qemu-devel] [PATCH] ppc: restrict the use of the rfi instruction
@ 2016-09-08 7:32 Cédric Le Goater
2016-09-08 7:58 ` Thomas Huth
2016-09-12 1:37 ` David Gibson
0 siblings, 2 replies; 3+ messages in thread
From: Cédric Le Goater @ 2016-09-08 7:32 UTC (permalink / raw)
To: qemu-ppc
Cc: David Gibson, Benjamin Herrenschmidt, qemu-devel, Alexander Graf,
Cedric Le Goater, Thomas Huth, Mark Cave-Ayland
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Power ISA 2.x has deleted the rfi instruction and rfid shoud be used
instead on cpus following this instruction set or later.
This will raise an invalid exception when rfi is used on such
processors: Book3S 64-bit processors.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
[clg: the required fix in openbios, commit b747b6acc272 ('ppc: use
rfid when running under a CPU from the 970 family.'), is now
merged in qemu under commit 5cebd885d0d2 ('Update OpenBIOS
images to b747b6a built from submodule.') ]
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
target-ppc/translate.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
Index: qemu-dgibson-for-2.8.git/target-ppc/translate.c
===================================================================
--- qemu-dgibson-for-2.8.git.orig/target-ppc/translate.c
+++ qemu-dgibson-for-2.8.git/target-ppc/translate.c
@@ -3585,10 +3585,13 @@ static void gen_rfi(DisasContext *ctx)
#if defined(CONFIG_USER_ONLY)
GEN_PRIV;
#else
- /* FIXME: This instruction doesn't exist anymore on 64-bit server
- * processors compliant with arch 2.x, we should remove it there,
- * but we need to fix OpenBIOS not to use it on 970 first
+ /* This instruction doesn't exist anymore on 64-bit server
+ * processors compliant with arch 2.x
*/
+ if (ctx->insns_flags & PPC_SEGMENT_64B) {
+ gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL);
+ return;
+ }
/* Restore CPU state */
CHK_SV;
gen_update_cfar(ctx, ctx->nip - 4);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] ppc: restrict the use of the rfi instruction
2016-09-08 7:32 [Qemu-devel] [PATCH] ppc: restrict the use of the rfi instruction Cédric Le Goater
@ 2016-09-08 7:58 ` Thomas Huth
2016-09-12 1:37 ` David Gibson
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2016-09-08 7:58 UTC (permalink / raw)
To: Cédric Le Goater, qemu-ppc
Cc: David Gibson, Benjamin Herrenschmidt, qemu-devel, Alexander Graf,
Mark Cave-Ayland
On 08.09.2016 09:32, Cédric Le Goater wrote:
> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> Power ISA 2.x has deleted the rfi instruction and rfid shoud be used
> instead on cpus following this instruction set or later.
>
> This will raise an invalid exception when rfi is used on such
> processors: Book3S 64-bit processors.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> [clg: the required fix in openbios, commit b747b6acc272 ('ppc: use
> rfid when running under a CPU from the 970 family.'), is now
> merged in qemu under commit 5cebd885d0d2 ('Update OpenBIOS
> images to b747b6a built from submodule.') ]
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
> target-ppc/translate.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> Index: qemu-dgibson-for-2.8.git/target-ppc/translate.c
> ===================================================================
> --- qemu-dgibson-for-2.8.git.orig/target-ppc/translate.c
> +++ qemu-dgibson-for-2.8.git/target-ppc/translate.c
> @@ -3585,10 +3585,13 @@ static void gen_rfi(DisasContext *ctx)
> #if defined(CONFIG_USER_ONLY)
> GEN_PRIV;
> #else
> - /* FIXME: This instruction doesn't exist anymore on 64-bit server
> - * processors compliant with arch 2.x, we should remove it there,
> - * but we need to fix OpenBIOS not to use it on 970 first
> + /* This instruction doesn't exist anymore on 64-bit server
> + * processors compliant with arch 2.x
> */
> + if (ctx->insns_flags & PPC_SEGMENT_64B) {
> + gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL);
> + return;
> + }
> /* Restore CPU state */
> CHK_SV;
> gen_update_cfar(ctx, ctx->nip - 4);
>
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] ppc: restrict the use of the rfi instruction
2016-09-08 7:32 [Qemu-devel] [PATCH] ppc: restrict the use of the rfi instruction Cédric Le Goater
2016-09-08 7:58 ` Thomas Huth
@ 2016-09-12 1:37 ` David Gibson
1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2016-09-12 1:37 UTC (permalink / raw)
To: Cédric Le Goater
Cc: qemu-ppc, Benjamin Herrenschmidt, qemu-devel, Alexander Graf,
Thomas Huth, Mark Cave-Ayland
[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]
On Thu, Sep 08, 2016 at 09:32:42AM +0200, Cédric Le Goater wrote:
> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> Power ISA 2.x has deleted the rfi instruction and rfid shoud be used
> instead on cpus following this instruction set or later.
>
> This will raise an invalid exception when rfi is used on such
> processors: Book3S 64-bit processors.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> [clg: the required fix in openbios, commit b747b6acc272 ('ppc: use
> rfid when running under a CPU from the 970 family.'), is now
> merged in qemu under commit 5cebd885d0d2 ('Update OpenBIOS
> images to b747b6a built from submodule.') ]
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Applied to ppc-for-2.8, thanks.
> ---
> target-ppc/translate.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> Index: qemu-dgibson-for-2.8.git/target-ppc/translate.c
> ===================================================================
> --- qemu-dgibson-for-2.8.git.orig/target-ppc/translate.c
> +++ qemu-dgibson-for-2.8.git/target-ppc/translate.c
> @@ -3585,10 +3585,13 @@ static void gen_rfi(DisasContext *ctx)
> #if defined(CONFIG_USER_ONLY)
> GEN_PRIV;
> #else
> - /* FIXME: This instruction doesn't exist anymore on 64-bit server
> - * processors compliant with arch 2.x, we should remove it there,
> - * but we need to fix OpenBIOS not to use it on 970 first
> + /* This instruction doesn't exist anymore on 64-bit server
> + * processors compliant with arch 2.x
> */
> + if (ctx->insns_flags & PPC_SEGMENT_64B) {
> + gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL);
> + return;
> + }
> /* Restore CPU state */
> CHK_SV;
> gen_update_cfar(ctx, ctx->nip - 4);
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-12 1:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-08 7:32 [Qemu-devel] [PATCH] ppc: restrict the use of the rfi instruction Cédric Le Goater
2016-09-08 7:58 ` Thomas Huth
2016-09-12 1:37 ` David Gibson
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.