From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ia6a1-0006xD-2s for qemu-devel@nongnu.org; Tue, 25 Sep 2007 05:19:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ia6Zz-0006x1-Ms for qemu-devel@nongnu.org; Tue, 25 Sep 2007 05:19:44 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ia6Zz-0006wy-K3 for qemu-devel@nongnu.org; Tue, 25 Sep 2007 05:19:43 -0400 Received: from bangui.magic.fr ([195.154.194.245]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ia6Zz-0006oI-5h for qemu-devel@nongnu.org; Tue, 25 Sep 2007 05:19:43 -0400 Subject: Re: [kvm-devel] [Qemu-devel] expose host CPU features to guests: Take 3 From: "J. Mayer" In-Reply-To: <46F8CE52.3080502@qumranet.com> References: <20070905174530.GA3945@karma.qumranet.com> <20070910074005.GA26869@karma.qumranet.com> <20070924174129.GA4507@karma.qumranet.com> <20070925084842.GA14221@karma.qumranet.com> <46F8CE52.3080502@qumranet.com> Content-Type: text/plain Date: Tue, 25 Sep 2007 11:19:30 +0200 Message-Id: <1190711970.30193.15.camel@rapid> Mime-Version: 1.0 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 Cc: Dan Kenigsberg , kvm-devel On Tue, 2007-09-25 at 11:01 +0200, Avi Kivity wrote: > Dan Kenigsberg wrote: > > On Tue, Sep 25, 2007 at 03:28:24AM +0200, andrzej zaborowski wrote: > > > >> Hi, > >> > >> On 24/09/2007, Dan Kenigsberg wrote: > >> > >>> As with previous "Takes" of this patch, its purpose is to expose host > >>> +{ > >>> + asm("cpuid" > >>> + : "=a" (*ax), > >>> + "=b" (*bx), > >>> + "=c" (*cx), > >>> + "=d" (*dx) > >>> + : "a" (function)); > >>> +} > >>> > >> 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. > >> > > > > I might be missing something here, but isn't not being on the > > TARGET_PATH of Makefile.target enough? I don't see #ifdef TARGET_I386 > > elsewhere under target-i386. I don't mind adding extra protection, I > > just be happy to better understand the whats and whys. > > > > target-i386 means the guest will run i386 instructions, but the host can > be something else (say, powerpc). > > Nothing else uses host instructions in that directory, so no protection > was necessary before. I've got a remark about this: why this has to be added to the Qemu code ? Imho, all is needed is an implementation of the -cpu option for x86/x86_64 target. Then, an external tool (even a shell script) can be used to determine what is the host CPU if you want to select the exact same CPU to be emulated in Qemu. It seems to me that trying to do so is out of the scope of Qemu code and just add unneeded complexity. Regards. -- J. Mayer Never organized