Message ID | 20240403101611.3204086-1-ruanjinjie@huawei.com (mailing list archive) |
---|---|
Headers | show |
Series | target/arm: Implement FEAT_NMI and FEAT_GICv3_NMI | expand |
On Wed, 3 Apr 2024 at 11:18, Jinjie Ruan <ruanjinjie@huawei.com> wrote: > > This patch set implements FEAT_NMI and FEAT_GICv3_NMI for ARMv8. These > introduce support for a new category of interrupts in the architecture > which we can use to provide NMI like functionality. Looking through the Arm ARM pseudocode at places where it handles NMI related features and bits, I noticed one corner case we don't handle in this patchseries: illegal exception return. In the pseudocode, AArch64.ExceptionReturn() calls SetPSTATEFromPSR(), which treats PSTATE.ALLINT as one of the bits which are reinstated from SPSR to PSTATE regardless of whether this is an illegal exception return or not. For QEMU that means we want to handle it the same way we do PSTATE_DAIF and PSTATE_NZCV in the illegal_return exit path of the exception_return helper: --- a/target/arm/tcg/helper-a64.c +++ b/target/arm/tcg/helper-a64.c @@ -904,8 +904,8 @@ illegal_return: */ env->pstate |= PSTATE_IL; env->pc = new_pc; - spsr &= PSTATE_NZCV | PSTATE_DAIF; - spsr |= pstate_read(env) & ~(PSTATE_NZCV | PSTATE_DAIF); + spsr &= PSTATE_NZCV | PSTATE_DAIF | PSTATE_ALLINT; + spsr |= pstate_read(env) & ~(PSTATE_NZCV | PSTATE_DAIF | PSTATE_ALLINT); pstate_write(env, spsr); if (!arm_singlestep_active(env)) { env->pstate &= ~PSTATE_SS; (I haven't thought about whether this fits particularly into any existing patch or should be a patch of its own.) thanks -- PMM
On Wed, 3 Apr 2024 at 11:18, Jinjie Ruan <ruanjinjie@huawei.com> wrote: > > This patch set implements FEAT_NMI and FEAT_GICv3_NMI for ARMv8. These > introduce support for a new category of interrupts in the architecture > which we can use to provide NMI like functionality. I think I'm now done with review on this series, so if you address the last handful of things I pointed out in replies to this series, I think v13 should be good to go in. (No rush, as 9.0 won't be out for another couple of weeks anyway and I won't start collecting up patches for 9.1 much before that.) thanks -- PMM