ppc: restrict the use of the rfi instruction
PATCH 1/1 ppc: restrict the use of the rfi instruction
From: Benjamin Herrenschmidt <[email protected]>
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.
[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.') ]
--- target-ppc/translate.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
target-ppc/translate.c +6 -3
@@ -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 );
Quoted 31 lines · Cédric Le Goater
From: Benjamin Herrenschmidt <[email protected]>
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 <[email protected]>Reviewed-by David Gibson <[email protected]>[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 commit5cebd885d0d2('Update OpenBIOS images to b747b6a built from submodule.') ]Signed-off-by Cédric Le Goater <[email protected]>--- target-ppc/translate.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)Index:
qemu-dgibson-for-2.8.git/target-ppc/translate.c
===================================================================target-ppc/translate.c +0
-3@@ -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
target-ppc/translate.c static void gen_rfi(DisasContext *ctx) · line 3597
Quoted 10 lines
target-ppc/translate.c +6
-0+/* 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
AppliedQuoted 8 lines · Cédric Le Goater
From: Benjamin Herrenschmidt <[email protected]>
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.
Quoted 7 lines
Signed-off-by Benjamin Herrenschmidt <[email protected]>Reviewed-by David Gibson <[email protected]>[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 commit5cebd885d0d2('Update OpenBIOS images to b747b6a built from submodule.') ]Signed-off-by Cédric Le Goater <[email protected]>
Applied to ppc-for-2.8, thanks.
Quoted 26 lines
--- target-ppc/translate.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)Index:
qemu-dgibson-for-2.8.git/target-ppc/translate.c
===================================================================target-ppc/translate.c +6
-3@@ -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 );
Signature · 4 lines
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