diff mbox

target-arm: make smc behave as a nop

Message ID 1392160761-20752-1-git-send-email-robherring2@gmail.com
State New
Headers show

Commit Message

Rob Herring Feb. 11, 2014, 11:19 p.m. UTC
From: Rob Herring <rob.herring@linaro.org>

Several platforms make smc calls for things such as PL310 cache setup.
In these cases, making smc a nop rather than an illegal instruction
is sufficient for qemu to work.

Signed-off-by: Rob Herring <rob.herring@linaro.org>
---
 target-arm/translate.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

Comments

Peter Maydell Feb. 11, 2014, 11:29 p.m. UTC | #1
On 11 February 2014 23:19, Rob Herring <robherring2@gmail.com> wrote:
> From: Rob Herring <rob.herring@linaro.org>
>
> Several platforms make smc calls for things such as PL310 cache setup.
> In these cases, making smc a nop rather than an illegal instruction
> is sufficient for qemu to work.

I can't remember if we've had this discussion before. Anyway,
I think that making SMC NOP is too much of a platform-specific
hack. If we want to support these platforms we need to either
(a) implement TrustZone properly (b) implement some coherent
mechanism for handing off SMCs to a bit of board specific firmware.
(We might want the latter anyway for running these guests under
KVM.)

thanks
-- PMM
diff mbox

Patch

diff --git a/target-arm/translate.c b/target-arm/translate.c
index e701c0f..ab4cd56 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -7518,16 +7518,18 @@  static void disas_arm_insn(CPUARMState * env, DisasContext *s)
             store_reg(s, rd, tmp);
             break;
         case 7:
-            /* SMC instruction (op1 == 3)
-               and undefined instructions (op1 == 0 || op1 == 2)
-               will trap */
-            if (op1 != 1) {
-                goto illegal_op;
+            if (op1 == 3) {
+                ARCH(6K);
+                /* nop */
+                break;
+            } else if (op1 == 1) {
+                /* bkpt */
+                ARCH(5);
+                gen_exception_insn(s, 4, EXCP_BKPT);
+                break;
             }
-            /* bkpt */
-            ARCH(5);
-            gen_exception_insn(s, 4, EXCP_BKPT);
-            break;
+            /* Undefined instructions will trap */
+            goto illegal_op;
         case 0x8: /* signed multiply */
         case 0xa:
         case 0xc: