From owner-soc-status@freebsd.org Tue Aug 4 11:17:32 2015 Return-Path: Delivered-To: soc-status@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C97359B2DEC for ; Tue, 4 Aug 2015 11:17:32 +0000 (UTC) (envelope-from mihai.carabas@gmail.com) Received: from mail-wi0-x233.google.com (mail-wi0-x233.google.com [IPv6:2a00:1450:400c:c05::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 58F2B1A29 for ; Tue, 4 Aug 2015 11:17:32 +0000 (UTC) (envelope-from mihai.carabas@gmail.com) Received: by wibud3 with SMTP id ud3so172235015wib.1 for ; Tue, 04 Aug 2015 04:17:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=IAPtAiQyiah6qFpoLWiM54iN0ZDjsgpOs9xsaslicQo=; b=WqCilyYq+DAYIIHK8lBu3WbHx66uJPLrBWbPHktCpOSoD1HlKrcpa598/b1Yg+dlaq NbroikwwGAjRWuXc8MimGdXBnB2l4snue26RiLiCbscjcwIdJ9UmD9aX0I6jdfJvD97d hZ9MxWcjUSTAlQK8N97aBTQVkM41o1n8ju6At4zDt1IndP2ocZ5cOWdQ9tIcltrBAswA UfrZlYE/dge6C7cALaKq7/MP/1Zfr84asqjNYpnPZEkdVzUQsmtUO2ZvzBO+cViAd7kx UyKBWBvy/jCwOXawfUKPt1ovk4XoJILforFJPshb5psqzK84SNeIMHgYcy4DpVEWrdy1 2smg== MIME-Version: 1.0 X-Received: by 10.195.12.6 with SMTP id em6mr6938049wjd.150.1438687050580; Tue, 04 Aug 2015 04:17:30 -0700 (PDT) Received: by 10.28.21.134 with HTTP; Tue, 4 Aug 2015 04:17:30 -0700 (PDT) In-Reply-To: References: Date: Tue, 4 Aug 2015 14:17:30 +0300 Message-ID: Subject: Re: [GSOC] bhyve port on ARM - weekly status report From: Mihai Carabas To: soc-status@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: soc-status@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Summer of Code Status Reports and Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2015 11:17:32 -0000 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: gic0: mem 0x2c001000-0x2c001fff,0x2c002000-0x 2c003fff,0x2c004000-0x2c005fff,0x2c006000-0x2c007fff on ofwbus0 Unhandled memory access to 0x2c001000 Failed to emulate instruction at 0xc0354ef