From owner-freebsd-arm@FreeBSD.ORG Sun Nov 23 22:35:47 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 23FCF900 for ; Sun, 23 Nov 2014 22:35:47 +0000 (UTC) Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com [209.85.212.179]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC150FF1 for ; Sun, 23 Nov 2014 22:35:46 +0000 (UTC) Received: by mail-wi0-f179.google.com with SMTP id ex7so4071498wid.6 for ; Sun, 23 Nov 2014 14:35:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=+sQpCgU+qt991lh/coGETM1ZWjjILSKkoSL9AqfQqAE=; b=jpVMmCD67K7CJloboGu0mTHHKPih9laPg0H3pNCZgA8o481uBdlFrnOcG2fE35wDtw 7Bk76fhzVJ677CwH1EXFPt0g5+EKBNnD6Lu54IfymWO8+jErV8aZGuTCoKpMafjlSg1w Ht51mCUO3q+y2uUGN9toqWQ7rqzHq+s82KFJs+mg5iIKQE6dKm/2VR+3OK+9mBqvFTV5 08YMiCaE0QTTpkcyK8CfnSrggngmyT5zent2mCsFCvhHu7VoW2SPTDZ6cUMUMJhw5b2+ rM6kYBx8FEax9mfRxK1JOkMrkK3DbdjfNL9B0962IKNX9TBdw9RHPBwBxSUyTcOkJete vfsQ== X-Gm-Message-State: ALoCoQlc7x8mHtmgVJIzZ3FlAxy6q2VmG4dw+cIxDVr4umT7Jd1yl6Xk+Kcl4jktB19JTZ7EVj1f X-Received: by 10.180.84.98 with SMTP id x2mr4543548wiy.14.1416782138900; Sun, 23 Nov 2014 14:35:38 -0800 (PST) Received: from Juliens-MacBook-Pro.local (cpc12-cmbg15-2-0-cust92.5-4.cable.virginm.net. [86.30.247.93]) by mx.google.com with ESMTPSA id 4sm15024749wjs.24.2014.11.23.14.35.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Nov 2014 14:35:38 -0800 (PST) Message-ID: <54726138.3090003@linaro.org> Date: Sun, 23 Nov 2014 22:35:36 +0000 From: Julien Grall User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: freebsd-xen@freebsd.org, "xen-devel@lists.xen.org" , gibbs@freebsd.org, freebsd-arm@freebsd.org, roger.pau@citrix.com Subject: [RFC v2] Add support for Xen ARM guest on FreeBSD Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Denis Schneider , Ian Campbell , Stefano Stabellini X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2014 22:35:47 -0000 Hello all, At the beginning of the year, I have sent a first RFC to add support for FreeBSD on Xen ARM [1]. The first version was very primitive: hardcoded DTB, only single user-mode support,... Since then, I have improved the support and rebased everything on master. Thanks for the FreeBSD ARM team which did a great job and remove all most of my issues (Userspace hanging, Device Tree Bindings). Major changes in this new version: * Add Device Tree support via Linux Boot ABI * Add zImage support * Netfront support * Blkfront fixes * DOM0 support (separate branch see below) The former item is very hackish. I was wondering if there is another way to do it? Or maybe we should support FreeBSD Bootloader in ARM guest? The patch series is divided in X parts: * #1 - #14: Clean up and bug fixes for Xen. They can be applied without the rest of the series * #15 - #19: Update Xen interface to 4.4 and fix compilation. It's required for ARM. * #20 - #26: Update Xen code to support ARM * #27 - #33: Rework the event channel code for supporting ARM. I will work with Royger to come with a common interface with x86 * #34 - #36: Add support for ARM in Xen code * #37 - #46: ARM bug fixes and new features. Some of thoses patches (#37 - #40) could be applied without the rest of the series * #47 - #48: Add Xen ARM platform I don't really know how works patch review on Freebsd. Therefore, I provided the series in git format and file format. All based on Royger's pvh dom0 work v8: git://xenbits.xen.org/people/julieng/freebsd.git branch xen-arm-v2 http://xenbits.xen.org/people/julieng/xen-arm-v2.1/ As said above, there is a separate branch for DOM0, the patches are not part of this series. The support has been done and demoed for the Arndale (though I've been tested since a while), but there is lots of work to clean up (device tree stuff and hack in the code): git://xenbits.xen.org/people/julieng/freebsd.git branch dom0-arm-v0 http://xenbits.xen.org/people/julieng/dom0-arm-v0 TODO: * Add SMP/PSCI support in FreeBSD. Could be useful other platform too * Only FreeBSD to load anywhere. Currently there is a 2M alignment which require a patch in Xen. * ELF support in Xen ARM? Not sure it's useful. Any help, comments, questions are welcomed. Sincerely yours, [1] http://lists.freebsd.org/pipermail/freebsd-xen/2014-January/001974.html ============= Instruction to test FreeBSD on Xen on ARM =========== FreeBSD miss some support to fully boot on Xen ARM. This patch applied to Xen ARM help FreeBSD to boot correctly for the time being: * https://patches.linaro.org/32742/ To compile and boot Xen on your board, you can refer to the wiki page: http://wiki.xen.org/wiki/Xen_ARM_with_Virtualization_Extensions The instruction to compile FreeBSD for Xen on ARM: $ truncate -s 512 xenvm.img $ sudo mdconfig -f xenvm.img -u0 $ sudo newfs /dev/md0 $ sudo mount /dev/md0 /mnt $ sudo make TARGET_ARCH=armv6 kernel-toolchain $ sudo make TARGET_ARCH=armv6 KERNCONF=XENHVM buildkernel $ sudo make TARGET_ARCH=armv6 buildworld $ sudo make TARGET_ARCH=armv6 DESTDIR=/mnt installworld distribution $ echo "/dev/xbd0 / ufs rw 1 1" > /mnt/etc/fstab $ vi /mnt/etc/ttys (add the line 'xc0 "/usr/libexec/getty Pc" xterm on secure") $ sudo umount /mnt $ sudo mdconfig -d u0 Then you can copy the rootfs and the kernel to DOM 0 on your board. To boot the a FreeBSD your will required the following configuration file $ cat freebsd.xl kernel="kernel" memory=64 name="freebsd" vcpus=1 autoballon="off" disk=[ 'phy:/dev/loop0,xvda,w' ] $ losetup /dev/loop0 xenvm.img $ xl create freebsd.xl $ xl console freebsd -- Julien Grall