[GSOC] bhyve port on ARM - weekly status report

Mihai Carabas mihai.carabas at gmail.com
Sat Aug 22 14:04:00 UTC 2015

Hello everyone,

This is my final status report on this years's GSoC. I'm giving it today
because the next week I will be away at a conference in Czech Replubic. In
the last week I did work a little in the distributor emulation on the code
handling the memory accesses, but the code isn't ready for commit. I've
completed the wiki page [1] with the results where I've described every
mechanism implemented in bhyve on ARM. I've also added some instruction on
how to run FreeBSD on FastModels. I will continue my work on finishing the
distributor emulation and using virtual timers for the Guests. I will come
with some e-mails out of GSoC when the work will be ready to run easily on

Thank you all,

[1] https://wiki.freebsd.org/SummerOfCode2015/PortingBhyveToArm

On Mon, Aug 17, 2015 at 8:42 PM, Mihai Carabas <mihai.carabas at gmail.com>

> Hello everyone,
>> 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).
>>  In the last week I've started coding on ARM VGIC infrastructure:
>> - I've created a new header file gic.h to export current registers to be
>> used by the VGIC
>> - I've exported the arm_gic_softc which is used to probe the VGIC
>> specific registers (I know it's unclean, but until I find a cleaner method,
>> I will go this way -> it's not so clear yet how much of the gic.c internals
>> I will need in the vgic.c)
>> - I've created in sys/arm/vmm/vgic.c the vgic_hyp_init function which is
>> probing the VGIC specific addresses from the DTS file, I've mapped the
>> virtual cpu control interface into hyp-mode (to be able to save/restore
>> these at each context switch) and saved the virtual cpu interface base for
>> later use
>> - I've created a new userspace ioctl VMM_ATTACH_VGIC which is sending the
>> physical address for the distributor that needs to be emulated and for the
>> cpu interface that will be mapped on top of the virtual cpu interface
>> - I've created a new function vgic_attach in sys/arm/vmm/vgic.c which is
>> called by the previous ioctl which is saving the userspace data, it's
>> initializing some structures and maps the cpu control interface
>> - We need to do an in-kernel emulation for the VGIC distributor. Further
>> I've created a new function called vgic_emulate_distributor which is called
>> in the vmm.c code (I know it's unclean, but I wanted to ressemble with x86
>> in-kernel emulation and here I didn't have any defines for the emulated
>> addresses, I needed the struct hyp). The vgic_emulate_distributor is
>> calling vmm_emulate_instruction which specific handlers for read/write
>> emulation.
>> I will push the code tomorrow. Right now I'm adding some printfs to check
>> that the flow for vgic distributor is working ok.
> Further I've registered the MMIO callbacks for read/write the distributor
> memory ranges and added some prints in there (all the values are ok - now I
> have to take some actions based on them). Also I've saved and restore the
> VGIC state in the context switch code between Host-OS and VM. Right now the
> VM passes the Interrupt Controller initialization, initialize the directly
> mapped SP804 timer and after that I get some "spurious  interrupts" in the
> guest due to lack of distributor emulation implementation. In the next week
> I try to implement some of the distributor operations.
> Thank you,
> Mihai

More information about the soc-status mailing list