Re: Use CPUID to communicate with the hypervisor.

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Jeremy Fitzhardinge <jeremy@...>
Cc: <akataria@...>, Ingo Molnar <mingo@...>, Thomas Gleixner <tglx@...>, LKML <linux-kernel@...>, the arch/x86 maintainers <x86@...>, <avi@...>, Rusty Russell <rusty@...>, Zachary Amsden <zach@...>, Dan Hecht <dhecht@...>, <Jun.Nakajima@...>, Tim Deegan <Tim.Deegan@...>
Date: Friday, September 26, 2008 - 9:28 pm

Jeremy Fitzhardinge wrote:

That's kind of iffy, although at least it does have a modicum of being 
controlled.

There is already a de facto standard for doing this: on a (currently) 
64K boundary, add a leaf with a vendor ID and a limit; the presence is 
detectable by the limit in EAX having the proper upper bits.

Then have each vendor pick a range that they maintain.  Intel uses 
0x0000xxxx (although they claim control of the entire numberspace), AMD 
uses 0x8000xxxx, VIA uses 0xC000xxxx, Transmeta used 0x8086xxxx, and 
0x4000xxxx is being reserved for "virtualization".  There are tools 
which use this as a way to try to dump all of CPUID without knowing details.

See the problem here?  This is in effect an unmanaged space.  This means 
that without the vendor ID it is going to be meaningless, unless at 
least the major players in the virtualization industry could agree with 
how to use it, and that would still leave other users out in the cold.

Now, that would still require a vendor numberspace registry.  The 
obvious one is to use the numbers issued by PCI-SIG, which would require 
16 bits -- that would presumably mean numbers of the form 0x40SSSSxx 
with SSSS being the vendor ID; this would require scanning on a 256-byte 
granularity for a generic tool.

Overall, though, *any* generic solution requires buyin from all 
significant players in the space, *AND* a way to distinguish 
noncompliant implementations.  Designing a functional solution is the 
easy part of that[*].  Getting sufficient buyin in the hard part.


Typically you'd define them to be zero unless usable, and define them so 
that a meaningful value would be nonzero.


Presumably you'd have to have some way to notify the VM, via an 
interrupt of some sort.

	-hpa

[*] Consider the following totally half-baked example:

CPUID leaf 0x40000000
	ECX-EDX-EBX	Vendor name
	EAX		Max CPUID level supported

	Motivation: existing practice

CPUID leaf 0x40000001...
	EAX		leaf number	Pointer
	ECX		DID:VID		PCI-style
	EDX		0xcc06ab0b	Magic number
	EBX		0x7ab3857a	Magic number

	This would use the PCI vendor ID and an arbitrary "device ID"
	to point to a leaf number, which would then contain information
	starting with an identification/count leaf.  The DID:VID would
	signal who defined the specification, not necessarily who wrote
	the hypervisor.  This is similar to how Intel uses AMD-defined
	CPUID levels, for example.

	-hpa
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Use CPUID to communicate with the hypervisor., Alok Kataria, (Fri Sep 26, 7:46 pm)
Re: Use CPUID to communicate with the hypervisor., Gerd Hoffmann, (Mon Sep 29, 4:24 am)
Re: Use CPUID to communicate with the hypervisor., Alok Kataria, (Mon Sep 29, 1:55 pm)
Re: Use CPUID to communicate with the hypervisor., Gerd Hoffmann, (Mon Sep 29, 2:46 pm)
Re: Use CPUID to communicate with the hypervisor., Alok Kataria, (Mon Sep 29, 3:38 pm)
Re: Use CPUID to communicate with the hypervisor., Gerd Hoffmann, (Mon Sep 29, 6:46 pm)
Re: Use CPUID to communicate with the hypervisor., Alok Kataria, (Mon Sep 29, 8:33 pm)
Re: Use CPUID to communicate with the hypervisor., Gerd Hoffmann, (Tue Sep 30, 4:11 am)
[Hypervisors] TSC frequency change, Alok Kataria, (Wed Oct 1, 12:35 am)
Re: [Hypervisors] TSC frequency change, Gerd Hoffmann, (Wed Oct 1, 5:47 am)
Re: Use CPUID to communicate with the hypervisor., Zachary Amsden, (Tue Sep 30, 12:42 pm)
Re: Use CPUID to communicate with the hypervisor., Avi Kivity, (Thu Oct 2, 7:52 am)
RE: Use CPUID to communicate with the hypervisor., Nakajima, Jun, (Mon Sep 29, 4:55 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 5:07 pm)
Re: Use CPUID to communicate with the hypervisor., Jeremy Fitzhardinge, (Mon Sep 29, 5:28 pm)
Re: Use CPUID to communicate with the hypervisor., Alok Kataria, (Mon Sep 29, 8:12 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 8:31 pm)
RE: Use CPUID to communicate with the hypervisor., Nakajima, Jun, (Mon Sep 29, 8:56 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 8:58 pm)
RE: Use CPUID to communicate with the hypervisor., Nakajima, Jun, (Mon Sep 29, 9:14 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 10:21 pm)
RE: Use CPUID to communicate with the hypervisor., Nakajima, Jun, (Mon Sep 29, 11:14 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 11:48 pm)
Re: Use CPUID to communicate with the hypervisor., Zachary Amsden, (Mon Sep 29, 7:20 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 8:33 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 5:49 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 4:31 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 1:58 pm)
Re: Use CPUID to communicate with the hypervisor., Gleb Natapov, (Mon Sep 29, 2:55 am)
Re: Use CPUID to communicate with the hypervisor., Avi Kivity, (Mon Sep 29, 3:37 am)
RE: Use CPUID to communicate with the hypervisor., Nakajima, Jun, (Mon Sep 29, 11:32 am)
Re: Use CPUID to communicate with the hypervisor., Avi Kivity, (Tue Sep 30, 5:16 am)
Re: Use CPUID to communicate with the hypervisor., Bernd Eckenfels, (Mon Sep 29, 5:08 am)
Re: Use CPUID to communicate with the hypervisor., Gleb Natapov, (Mon Sep 29, 5:33 am)
Re: Use CPUID to communicate with the hypervisor., Jeremy Fitzhardinge, (Fri Sep 26, 9:02 pm)
Re: Use CPUID to communicate with the hypervisor., Alok Kataria, (Fri Sep 26, 11:11 pm)
Re: Use CPUID to communicate with the hypervisor., Jeremy Fitzhardinge, (Sun Sep 28, 1:01 am)
Re: Use CPUID to communicate with the hypervisor., Tim Deegan, (Mon Sep 29, 5:28 am)
Re: Use CPUID to communicate with the hypervisor., Avi Kivity, (Mon Sep 29, 5:44 am)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Sat Sep 27, 12:20 am)
Re: Use CPUID to communicate with the hypervisor., Alok Kataria, (Sat Sep 27, 1:37 am)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Fri Sep 26, 9:28 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Fri Sep 26, 8:09 pm)
Re: Use CPUID to communicate with the hypervisor., Karel Zak, (Mon Sep 29, 4:56 pm)
Re: Use CPUID to communicate with the hypervisor., Alok Kataria, (Fri Sep 26, 8:30 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Fri Sep 26, 8:32 pm)
RE: Use CPUID to communicate with the hypervisor., Nakajima, Jun, (Fri Sep 26, 8:59 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Fri Sep 26, 9:55 pm)
RE: Use CPUID to communicate with the hypervisor., Nakajima, Jun, (Sat Sep 27, 12:52 am)