From owner-freebsd-virtualization@FreeBSD.ORG Mon Apr 29 19:25:01 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 D09BE45B; Mon, 29 Apr 2013 19:25:01 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) by mx1.freebsd.org (Postfix) with ESMTP id 6F7291ACB; Mon, 29 Apr 2013 19:25:00 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7A005B96C; Mon, 29 Apr 2013 15:24:59 -0400 (EDT) From: John Baldwin To: freebsd-virtualization@freebsd.org Subject: Re: Proposal for better support of hypervisors and their synthetic drivers at boot-time Date: Mon, 29 Apr 2013 13:45:50 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201304291345.50635.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 29 Apr 2013 15:24:59 -0400 (EDT) Cc: Alexander Motin , KY Srinivasan , "Abhishek Gupta \(LIS\)" 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: Mon, 29 Apr 2013 19:25:01 -0000 I know Alexander replied about the ATA bits already, but I wanted to reply to two of your other points below: On Tuesday, April 23, 2013 10:07:03 am Larry Melia wrote: > (1) Move the call to init_param1() (in sys/kern/subr_parm.c), which is used > for hypervisor detection, to an earlier point in the boot process. > Presently, it appears to be called after the ATA driver is selected, which > is too late in the boot process. (This was discovered after some testing > with the ATA driver.) Therefore, before the bus drivers and native > controllers are detected and selected, discovery of a host hypervisor > should be done first. > > (3) Upgrade the init_param1() function (in sys/kern/subr_parm.c) to use the > more recent approach to hypervisor detection. This approach uses the > CPU-identify functions to retrieve a unique signature consisting of a fixed > string of ASCII characters. This was done on Linux about five years. For > backward compatibility, however, the existing logic would be retained, but > augmented with this new approach. It would also be conditionally added only > for x86/AMD64 builds. I definitely agree with these proposals. In addition, our current hypervisor detection code is completely x86-specific and does not belong in MI code. The only bits that should be MI are the vm_guest variable and the VM_GUEST constants. I would argue that most of the VM_GUEST constants (for specific VMs which we do not have currently) should be MD as well. Each platform that supports hypervisors would install its own SYSINIT to set vm_guest instead of doing it directly from init_param1(). Making the VM_GUEST_FOO constants be MD macros means you can use #ifdef to test for them. Thus: #ifdef VM_GUEST_HYPERV /* Include a hyper-V specific driver. */ #endif The current enum approach doesn't allow for that. -- John Baldwin