From owner-freebsd-virtualization@FreeBSD.ORG Thu Jan 24 19:52:41 2013 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AED52C4C for ; Thu, 24 Jan 2013 19:52:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 89F2113F for ; Thu, 24 Jan 2013 19:52:41 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D9C76B93E; Thu, 24 Jan 2013 14:52:40 -0500 (EST) From: John Baldwin To: freebsd-virtualization@freebsd.org Subject: Re: Getting enlightened drivers to load only when Hyper-V (or Azure) is detected Date: Thu, 24 Jan 2013 11:45:00 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201301241145.00836.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 24 Jan 2013 14:52:40 -0500 (EST) Cc: Tom Hanrahan , Nick Meier , "Abhishek Gupta \(LIS\)" , Peter Grehan X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2013 19:52:41 -0000 On Thursday, January 24, 2013 9:50:54 am Larry Melia (Insight Global) wrote: > We're preparing our Hyper-V, enlightened drivers to be included in the CURRENT build, but need some help with the loader configuration. The drivers should only load or remain resident when Hyper-V is present. On Linux, the installer program was modified to detect the presence of Hyper-V/Azure, and only then are the Hyper-V drivers installed (starting with the VM Bus driver). What's the best way to do this on FreeBSD? Any help would be greatly appreciated! > Thanks in advance! > Larry Melia > Enlightened driver team for FreeBSD on Hyper-V Currently the approach we seem to be taking with these sorts of things is either to use a custom kernel config (such as XENHVM), or to include drivers by default (such as with virtio now being in the default x86 kernels). We do have a mechanism in place for auto-loading drivers post-boot (devd), but you need to have your root filesystem in place, and I suspect you want to use an enlightened driver for your root filesystem. :) Currently we don't really autoload any drivers at the boot loader stage. We did do that for ACPI for a while but have since moved to just including ACPI by default. The place to do this would be in the /boot/loader code. You can see an example of triggering this in sys/boot/i386/libi386/biosacpi.c. The way this was achieved for ACPI was to have code that was run during /boot/loader's startup set the 'acpi_load' variable if ACPI was detected. The loader will auto-load any module 'foo' if the 'foo_load' variable is set before it boots the kernel. If you want to go the dynamic route (vs having a HYPERV kernel config, or just including the relevant drivers in GENERIC), then that is what you will need to do. -- John Baldwin