From owner-freebsd-current@FreeBSD.ORG Wed Jan 2 16:15:26 2008 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B728116A417; Wed, 2 Jan 2008 16:15:26 +0000 (UTC) (envelope-from emaste@freebsd.org) Received: from gw.sandvine.com (gw.sandvine.com [199.243.201.138]) by mx1.freebsd.org (Postfix) with ESMTP id 49FC213C46E; Wed, 2 Jan 2008 16:15:26 +0000 (UTC) (envelope-from emaste@freebsd.org) Received: from labgw2.phaedrus.sandvine.com ([192.168.3.11]) by gw.sandvine.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 2 Jan 2008 11:03:23 -0500 Received: by labgw2.phaedrus.sandvine.com (Postfix, from userid 12627) id 271AC116DA; Wed, 2 Jan 2008 11:03:23 -0500 (EST) Date: Wed, 2 Jan 2008 11:03:23 -0500 From: Ed Maste To: Mike Silbersack Message-ID: <20080102160322.GA83957@sandvine.com> Mail-Followup-To: Ed Maste , Mike Silbersack , "Bruce M. Simpson" , Robert Watson , current@freebsd.org References: <20071228015651.X1565@odysseus.silby.com> <20071228095539.F45653@fledge.watson.org> <20071229180004.O6052@odysseus.silby.com> <477A627A.8010601@FreeBSD.org> <20080101222654.A8764@odysseus.silby.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="t0UkRYy7tHLRMCai" Content-Disposition: inline In-Reply-To: <20080101222654.A8764@odysseus.silby.com> User-Agent: Mutt/1.4.2.1i X-OriginalArrivalTime: 02 Jan 2008 16:03:23.0378 (UTC) FILETIME=[00600520:01C84D59] Cc: Robert Watson , "Bruce M. Simpson" , current@freebsd.org Subject: Re: [patch] Auto-setting hz to 100 inside QEMU/VMWare X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2008 16:15:26 -0000 --t0UkRYy7tHLRMCai Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jan 01, 2008 at 10:27:28PM -0600, Mike Silbersack wrote: > It looks like we're going to go with an alternate implementation that > resides in the loader instead. The effect will be the same, and it should > be committed within a few days. I've attached a proof of concept patch that does this in forth in the loader. I've been using something similar for a while; this patch isi cleaned up somewhat and I've added the kenv strings from Mike's patch. I've only tried it out with qemu so far. I'd appreciate reports of any testing with other emulators, and comments from loader/forth gurus. -Ed --t0UkRYy7tHLRMCai Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="loader_vm.diff" Index: sys/boot/forth/vm.4th =================================================================== RCS file: sys/boot/forth/vm.4th diff -N sys/boot/forth/vm.4th --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sys/boot/forth/vm.4th 2 Jan 2008 15:38:41 -0000 @@ -0,0 +1,35 @@ +: check-env? ( addr len addr len -- flag ) + getenv + dup -1 <> if + compare 0= if + true exit + then + else + drop + 2drop + then + false +; + +: is-vm? ( -- flag ) + s" QEMU " s" hint.acpi.0.oem" check-env? if + true exit + then + s" VBOX " s" hint.acpi.0.oem" check-env? if + true exit + then + s" VMware, Inc." s" smbios.system.maker" check-env? if + true exit + then + s" Parallels Software International Inc." s" smbios.bios.vendor" + check-env? if + true exit + then + false +; + +: setup-vm + is-vm? if + s" 100" s" hz" setenv + then +; Index: sys/boot/i386/loader/Makefile =================================================================== RCS file: /usr/cvs/src/sys/boot/i386/loader/Makefile,v retrieving revision 1.85 diff -u -r1.85 Makefile --- sys/boot/i386/loader/Makefile 29 May 2007 14:35:57 -0000 1.85 +++ sys/boot/i386/loader/Makefile 2 Jan 2008 15:48:06 -0000 @@ -84,7 +84,7 @@ .PATH: ${.CURDIR}/../../forth FILES= loader loader.help loader.4th support.4th loader.conf -FILES+= screen.4th frames.4th beastie.4th +FILES+= screen.4th frames.4th beastie.4th vm.4th # XXX INSTALLFLAGS_loader= -b FILESMODE_loader= ${BINMODE} -b FILESDIR_loader.conf= /boot/defaults Index: sys/boot/i386/loader/loader.rc =================================================================== RCS file: /usr/cvs/src/sys/boot/i386/loader/loader.rc,v retrieving revision 1.4 diff -u -r1.4 loader.rc --- sys/boot/i386/loader/loader.rc 30 Oct 2005 05:41:42 -0000 1.4 +++ sys/boot/i386/loader/loader.rc 2 Jan 2008 15:38:52 -0000 @@ -4,6 +4,10 @@ \ Includes additional commands include /boot/loader.4th +\ Virtual machine detection +include /boot/vm.4th +setup-vm + \ Reads and processes loader.conf variables start --t0UkRYy7tHLRMCai--