From owner-soc-status@freebsd.org Mon Jul 6 15:00:37 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 8363DADE4 for ; Mon, 6 Jul 2015 15:00:37 +0000 (UTC) (envelope-from mihai.carabas@gmail.com) Received: from mail-wi0-x22b.google.com (mail-wi0-x22b.google.com [IPv6:2a00:1450:400c:c05::22b]) (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 0D0081FEF for ; Mon, 6 Jul 2015 15:00:37 +0000 (UTC) (envelope-from mihai.carabas@gmail.com) Received: by wiga1 with SMTP id a1so231442467wig.0 for ; Mon, 06 Jul 2015 08:00:35 -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=Zx9ABRP7lo13TOF+fRKEwAkk4FLpQGgznFEoqx8Qd+s=; b=vn0gWa8SwRB8dQ2NOb/fGw5xCgYWdnw2NCK62gzxDS5MfqFJ5em4r3ZcDKXOZn2n2E IlvBh00X6ZhiyZ/qw47H3J2c1hgd6Qv1I907av/DddSzbReYyYK/id3psmNPJnAev856 2wBSgWa4TQd/djNS1/YFQwB1Rwisai0Z+IOpg0LNbxR5DkEdmPdNSffNKcavEHCX2rpw STz48+kQ766cWVQrOW5I0byfGMnpYFZbrtvhW2zfvCwj7i2rTl8YL6YoOHcNelA8rBfg NQP+oAD7JKfkjyqYON1O0uXPnSqc7HXgen/Vd7+pHXjkrxCi3xMbuVenzr7W3JLtZvu1 v+/w== MIME-Version: 1.0 X-Received: by 10.194.77.179 with SMTP id t19mr99816250wjw.30.1436194835449; Mon, 06 Jul 2015 08:00:35 -0700 (PDT) Received: by 10.28.21.134 with HTTP; Mon, 6 Jul 2015 08:00:35 -0700 (PDT) In-Reply-To: References: Date: Mon, 6 Jul 2015 18:00:35 +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: Mon, 06 Jul 2015 15:00:37 -0000 Hi everyone, In the last week I copied the vmm code from amd64 platform and I stripped > it down to only basic operations (vmm init/cleanup, vminit/cleanup and > vmrun). I've written some code for mapping operation [1] (PL-2 stage1 > and PL1 stage-2 - combined) for LPAE format (this is the only format > supported in HYP-mode). Unfortunatelly the FreeBSD pmap code doesn't > support LPAE format and I couldn't integrate memory management in the PMAP > infrastructure (like it is currently in amd64 - this will be handled after > this basic implementation because is an entire project that needs to be > tackled). > > I've also been writing the low-level initialization code for the > hypervisor to replace the stub code installed at boot time. Right now we > are able to insert the vmm-arm.ko module which performs all the necesary > initialization (installs the new exception vector, activates the MMU). When > we remove the vmm-arm module the stub exception vector is reinstalled and > the MMU deactivated, bringing the host to the initial state. > > In the last week I've started writing low-level ASM code which is saving/restoring the guest/host state. I've created a logic for a full pass from the host to the guest and back [1]: - when the host is calling the "HYP" instruction, causes a trap in hyp-mode where it can run different functions specific to this mode. An example is hyp_enter_guest function which saves the host state, loads the guest state and jumps to the guest pc with an eret instruction (back to svc mode basically) - when the guest executes an instruction that causes a trap (e.g. wfi which was configured by us) the code is saving the guest state, loading the host state and than is returning to host svc-mode with the exception of the guest to manage it - I've also implemented a call to panic function in host if the abort exceptions in hyp-mode are raised. There are still some configuration registers that need to be tackled (like VCTBR - defines the guest configuration for the stage 2 address translation). In the next week I have to write the C code which is calling the ASM methods in arm_vmrun and the init code which allocates the context structure (arm_vminit) and maps it in HYP-Mode. I will try to integrate these operations with bhyve userspace tools to ease the development. Thank you, Mihai [1] https://svnweb.freebsd.org/socsvn/soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp.S?view=markup