[GSOC] bhyve port on ARM - weekly status report

Mihai Carabas mihai.carabas at gmail.com
Tue Aug 4 11:17:32 UTC 2015


Hi everyone,



> After a discussion with Peter, the next step was implementing emulation
> for memory access, basically to be able to emulate MMIO devices.
>
> I've started by decoding the HSR (syndrome register) and put prints on
> each exception type. Than I've interpreted that Data Abort Exception (DABT)
> caused by a stage-2 translation to be able to decode the instruction. I've
> saved the decoded instruction (read/write, the register number, the access
> size [b,h,w]) and the fault address and sent it to bhyve userspace utility.
> Here I've used the MMIO infrastructure taken from X86 to find an emulated
> address and call the instruction emulation function
> (vmm_emulate_instruction). Further I've implemented the instruction
> emulation function in sys/arm/vmm/vmm_instruction_emul.c to get the
> register value and call the memread/memwrite callbacks accordingly.
>
> At this point I have a functional MMIO emulation. I've started modifying
> the bvm_console with some conditional code for ARM to replace the inl/outl
> calls with some memory acccesses. I've used the consport.c from X86 to
> emulate the bvm_console. I've added some instructions to write some
> characters to memory, and these are printed ok.
>
> Further I've compiled a FreeBSD guest with bvm_console and ran it in
> bhyve. Here are the first prints of a FreeBSD guest running on bhyve-arm
> [1] after solving some tedious bugs (I was trashing some temporary
> registers which were saving the SCTRL and I was disabling the MMU in the
> guest whenever I was context-switching between host and guest). Further I'm
> continuing with solving different guest exceptions this week.
>

In the past week I managed to boot the guest all the way down to Interrupt
Controller initialization [1]. There were minor bugs in the emulation code
I had to fix. After that I've start reading the GIC ARM manual and tried to
look at other vGIC implementations (virtualization of the Generic Interrupt
Controller). I didn't get to write any code yet, I'm still trying to get
the whole picture. This would be the last step before being able to run a
guest (without timer virtualization - we can use an auxiliary timer mapped
to the guest).

Thank you,
Mihai

[1]   0xc034d174(0)... ofwbus0: <Open Firmware Device Tree>
gic0: <ARM Generic Interrupt Controller> mem
0x2c001000-0x2c001fff,0x2c002000-0x
2c003fff,0x2c004000-0x2c005fff,0x2c006000-0x2c007fff on ofwbus0
Unhandled memory access to 0x2c001000
                                     Failed to emulate instruction at
0xc0354ef


More information about the soc-status mailing list