Date: Tue, 4 Aug 2015 14:17:30 +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: <CANg1yUsLVOiWnRsOPBtnK-A%2BA98Uvr0a1mi7OMc6n37G6%2BzMyA@mail.gmail.com> In-Reply-To: <CANg1yUugRgoRc2Z80Jz9gGnUcJ-LZeLvAtvt%2BmkcB%2BbRqwyN1g@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>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANg1yUsLVOiWnRsOPBtnK-A%2BA98Uvr0a1mi7OMc6n37G6%2BzMyA>