From owner-soc-status@freebsd.org Tue Jul 21 16:06:27 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 970809A756E for ; Tue, 21 Jul 2015 16:06:27 +0000 (UTC) (envelope-from mihai.carabas@gmail.com) Received: from mail-wi0-x22a.google.com (mail-wi0-x22a.google.com [IPv6:2a00:1450:400c:c05::22a]) (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 1E74814F4 for ; Tue, 21 Jul 2015 16:06:27 +0000 (UTC) (envelope-from mihai.carabas@gmail.com) Received: by wibxm9 with SMTP id xm9so61966857wib.1 for ; Tue, 21 Jul 2015 09:06:24 -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=sNWpnyuMNXNkT4IrtEqBVEU0gVZoF0I2w3YDSCEV99U=; b=us4oaqhDHogYqmSjCCRkDIRb7I68d/XEbmZMoF6iscDOaViaVKckgfhntma4kvE/9u x5zIMiwerYiJcRjHjTe+eFoKRH+Kf/taZ7WC2kjOp919b0l3JD/iwiH4jQn0KbDYZyJa +7GVVeALFwv7Ir6KGd6pgrU5zROKMpUB8Ejs5v8IvZPFwSq0KX7YUklSbkPTEGM0e/hU Fh8yZ5SbyUlAp+QVT1Nt5vF/9eshOsOt8zUl1Afsw8oLu0BOlHDPplUNByygiYTqezK5 TspSs2inDSvNgjOsvGu5SoIHzryfZC/SHELXo3f+epuWobqHxP+Y43O4fGZk4z3UiJwU U3/A== MIME-Version: 1.0 X-Received: by 10.180.20.15 with SMTP id j15mr33252948wie.76.1437494784826; Tue, 21 Jul 2015 09:06:24 -0700 (PDT) Received: by 10.28.21.134 with HTTP; Tue, 21 Jul 2015 09:06:24 -0700 (PDT) In-Reply-To: References: Date: Tue, 21 Jul 2015 19:06:24 +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, 21 Jul 2015 16:06:27 -0000 Hi everyone, In the last week I've written the glue C code which is calling the ASM > methods to run a VM. The logic flow starts from userspace from bhyvearm > program (it's a duplicate of the normal bhyve due to its high dependency of > x86) using ioctl's to run the VM. > > I've also written a simplified bhyveloadarm which maps the desired memory > from the GPA indicated as a parameter (here I had to write the entire flow > from userspace to kernel because there were empty functions - the MMAP > ioctl). Than it loads the raw kernel image in the memory at a given > address. In the end I set up the PC using also an ioctl. > > I've created a new ramdisk containing the bhyvearm* programs and the > dynamic libraries they depend on. Then I've managed to make bhyveloadarm > to copy a file which contains the bytecode for the "wfi" instruction in the > guest memory and now I'm playing with bhyvearm to make the "guest" run that > instruction. I'm investigating a bug in restoring the host state after the > VM has run (the VM throws a data abort exception because I haven't > configured the VTCR yet and I'm trying to send this exception back in > bhyvearm userspace). > > Last week I fulfilled an important step: I've managed to execute an instruction in the VirtualMachine and returning back with the HYP expection caused by executing a "wfi" instruction (which is disabled by configuration). Than I've added two more operations: mov r0,1 and add r4, r0 , 4 and both are executing OK (tested even step-by-step in the debugger). Further, I've read the exception status registers (HSR, HIFAR, HDFAR, HPFAR) in hyp-mode just before returning to the host. I've read them all even some of them are in state unknown depending on the exception type. I will let the C code to verify this. I also had a design issue and I had to read these registers in "struct hypctx" first and when returning in the host, copy them back to the "vm_exit" structure which was stored in "struct vm" (which isn't mapped in HYP-mode and even if I map it, I have to do a lot of index calculation to place the values in the right place - so I've decided to duplicate the info). So right now, when executing the WFI instruction, it causes a HYP exception which sets VM_EXITCODE_HYP which will determine the userspace utility to exit. An issue that need to be tackled is the reset state of the coprocessor registers. I need to take them one-by-one and set this reset state probably using some state-table approach (like KVM is doing). Thank you, Mihai