Hi Mark,

I'm not touching bit 13 or 14 in HCR_EL2, they're both 0. HCR_EL2 is the same 
for 64 bit and 32 bit inmates when the crash happens, except for HCR_RW_BIT, 
obviously. HCR_EL2 value is 0x28001B at crash time.

@Jan: We're planning to submit patches, but I guess we'll have to make it more 
generic first, before we can submit something. Will have to try the QEMU setup.

Best regards,
Jan

-----Ursprüngliche Nachricht-----
Von: Mark Rutland [mailto:[email protected]] 
Gesendet: Montag, 22. Juli 2019 11:48
An: von Wiarda, Jan
Cc: JailhouseMailingListe
Betreff: Re: 64 bit Hypervisor crash at 32 bit WFI instruction

On Mon, Jul 22, 2019 at 09:19:50AM +0200, von Wiarda, Jan wrote:
> Hi all,
> 
> we implemented support for Jailhouse 32 bit inmates running on 64-bit
> Jailhouse on the i.MX 8M Mini and it works fine, GIC demo runs without
> problems. Now I have one problem, that just occurred. I'm trying to
> get the ivshmem demo running in 32 bit and it does work until it comes
> to the line
> 
> asm volatile("wfi" : : : "memory");
> 
> When I give the inmate CPUs 1-3 in 32 bit mode and the inmate accesses
> this line, the 64 bit inmate CPU 0 crashes. If I comment this line out
> 
> //asm volatile("wfi" : : : "memory");
> 
> both 64 bit root cell and 32 bit inmate run just fine. Now apparently
> the 64 bit Jailhouse Hypervisor has a problem with WFI beeing executed
> by a 32 bit inmate, as with a 64 bit inmate there is no problem. Is
> there an explanation for this behaviour? I guess I will now have to
> handle the WFI exception. How do I know the inmate is exiting because
> of a WFI, all exits I see are these:
> 
> #define ESR_EC_SMC64                  0x17
> #define ESR_EC_SYS64                  0x18
> #define ESR_EC_DABT_LOW                       0x24
> 
> In the ARMv8 manual it says, ESR_EL2 has an EC == 0b000001, that traps
> WFI and WFE and there is a define
> 
> #define  HSR_EC_WFI           0x01
> 
> but it's not used and it's for AArch32 only. Now I wonder, what's the
> best way to handle this?

AFAICT, jailhouse doesn't set HCR_EL2.{TWE,TWI}, so WFI should never be
trapped to EL2.

Are you setting those bits (or leaving them preserved) in your 32-bit
enablement code?

Thanks,
Mark.

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/95F51F4B902CAC40AF459205F6322F01C4EE0E3D14%40BMK019S01.emtrion.local.

<<attachment: winmail.dat>>

Reply via email to