Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Aug 2015 20:42:21 +0300
From:      Mihai Carabas <mihai.carabas@gmail.com>
To:        soc-status@freebsd.org
Subject:   Re: [GSOC] bhyve port on ARM - weekly status report
Message-ID:  <CANg1yUvQZA2q=PT_xTPF9CRFKwd6Cbi5W3JghODmi5UWizoJ9Q@mail.gmail.com>
In-Reply-To: <CANg1yUtme9BWdr1xBQ0919EVzSTxv_w00p13_O1uob8Mgo2Rkw@mail.gmail.com>
References:  <CANg1yUspT8uHtX4bu0kO5dWLssvv-5457kSBovdyNKpi-OQ1kw@mail.gmail.com> <CANg1yUvgvtp5asPXLmtjwkROZ4Kf=mrOxXFcwvwdseYoQkcivA@mail.gmail.com> <CANg1yUsT=RRiNffq6cEXZArR4dYg9RiRc3dgc%2BCXMaY8JYir2Q@mail.gmail.com> <CANg1yUvyjTezxURAJi2EnYh6WLGVwSJbMSQNUEV0A2Un7kKNjA@mail.gmail.com> <CANg1yUsAifBweEKHBZbMrEpYmTd60ACq-H6aJ9Px%2BRb6ZK8moQ@mail.gmail.com> <CANg1yUt4tGB%2Bh6ZBQPqvQcbt66PM3qZmTdrCTKHQYREhz3P4aw@mail.gmail.com> <CANg1yUscFhh1C=ny4NS9sXQANFd5gc_am1re4-k2e-aErQ0NwA@mail.gmail.com> <CANg1yUuMOjZjgrHDyyMfrLr64VngY%2BNYr1tSM2oUYtGvtFDS6A@mail.gmail.com> <CANg1yUugRgoRc2Z80Jz9gGnUcJ-LZeLvAtvt%2BmkcB%2BbRqwyN1g@mail.gmail.com> <CANg1yUsLVOiWnRsOPBtnK-A%2BA98Uvr0a1mi7OMc6n37G6%2BzMyA@mail.gmail.com> <CANg1yUtme9BWdr1xBQ0919EVzSTxv_w00p13_O1uob8Mgo2Rkw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANg1yUvQZA2q=PT_xTPF9CRFKwd6Cbi5W3JghODmi5UWizoJ9Q>