target-arm: make smc behave as a nop
PATCH 1/1 target-arm: make smc behave as a nop
From: Rob Herring <[email protected]>
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.
--- target-arm/translate.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
target-arm/translate.c +11 -9
@@ -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 :
Signature · 1 line
1.8.3.2
Quoted 5 lines · Rob Herring
From: Rob Herring <[email protected]>
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
Quoted 7 lines · Peter Maydell
Quoted 5 lines · Rob Herring
From: Rob Herring <[email protected]>
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.
Quoted 7 lines
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.)
I don't disagree and that is coming in some form with PSCI support, but what do you gain in the meantime by platforms not booting. There is no real usecase for faulting on smc's. I rather see code that works on actual h/w work than correctly model in qemu code that doesn't work on actual h/w.
Rob