From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ia6jw-00028w-6T for qemu-devel@nongnu.org; Tue, 25 Sep 2007 05:30:00 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ia6jv-00028L-QJ for qemu-devel@nongnu.org; Tue, 25 Sep 2007 05:29:59 -0400 Received: from mx1.polytechnique.org ([129.104.30.34]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ia6jv-0000Dd-BX for qemu-devel@nongnu.org; Tue, 25 Sep 2007 05:29:59 -0400 Received: from [172.17.17.9] (gw.netgem.com [195.68.2.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTP id 5D9B033175 for ; Tue, 25 Sep 2007 11:29:56 +0200 (CEST) Message-ID: <46F8D512.5030905@bellard.org> Date: Tue, 25 Sep 2007 11:29:54 +0200 From: Fabrice Bellard MIME-Version: 1.0 Subject: Re: [Qemu-devel] expose host CPU features to guests: Take 3 References: <20070905174530.GA3945@karma.qumranet.com> <20070910074005.GA26869@karma.qumranet.com> <20070924174129.GA4507@karma.qumranet.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org andrzej zaborowski wrote: > Hi, > > On 24/09/2007, Dan Kenigsberg wrote: > >>As with previous "Takes" of this patch, its purpose is to expose host >>CPU features to guests. It proved rather helpful to KVM in various >>benchmarks, and it should similarly speed kqemu up. Note that it does >>not extend the set of emulated opcodes, only exposes what's supported by >>the host CPU. >> >>Another purpose for "Take 2" is to add the -cpu option to the x86 >>architecture, similarly to that of other architectures. >>-cpu 486, pentium, pentium2 and pentium3 are supported in addition to >>finer-grained features such as -cpu pentium,-mmx . As in Take 1, >>-cpu host exposes host features to guest. >> >>This patch exposes the requested CPU also right after RESET command, and >>not only in CPUID. >> >>Please let me know if you have more suggestions, >> >>Dan. >>[...] > I haven't really read through the rest of your code but this piece > appears to be outside any #ifdef/#endif so it will only build on x86. > > Regards A few remarks: 1) I cannot accept GPL code in target-i386, so the code from the Linux kernel must be removed or rewritten. 2) cpuid is already defined in kqemu.c, so it would be better to use it (I consider this is not a blocking point though). 3) For the future, I suggest that the function cpu_xxx_register() is removed and that the parameter xxx_def_t is added to cpu_xxx_init(). Rationale: I see no point in initializing a CPU without specifying its exact model and I am not sure that cpu_xxx_register() can be called once some code is executed. Regards, Fabrice.