Setting the CPUID of a XEN guest
After some reading around I've discovered it is possible to configure the CPU vendor and model information that a XEN guest sees.
Most Linux sysadmins will be familiar with
cat /proc/cpuinfo to get information about the systems processors. This gives information about the CPU vendor, model and features. For example my desktop gives:
[cellis@cedesktop ~]$ cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 15 model : 67 model name : AMD Athlon(tm) 64 X2 Dual Core Processor 5200+ - snip -
This information is actually exposed via
. This instruction takes a command in the
EAX register and populates the
EDX registers with the requested data.
EAX is set to zero, the CPU vendor string is returned. This is a 12 byte ASCII string. Which is stored in the
ECX (that is certainly logical, I suspect a hangup from the circuit complexity).
The CPU model string is a little more complex, it is a 48 byte ASCII string.
This string is obtained by executing the
cpuid instruction 3 times, with
EAX set to:
XEN has the
cpuid config option
, which defines the values of
EDX for specific values of
Lets take the following XEN config:
This causes the XEN guest to see the CPU vendor string 'Intrbiz', by providing the cpuid register values when EAX = 0.
As such, my XEN VM now reports:
xenvm1:~ # cat /proc/cpuinfo processor : 0 vendor_id : Intrbiz cpu family : 0 model : 0 model name : Intrbiz XEN virtual CPU stepping : 0
The hard part of setting this, is working out the values of the registers. It takes time to convert the text to binary and get the orderings correct.
Instead, you can generate the XEN config right here:
Simply enter your desired CPU vendor and model string and the XEN config will be generated
CPU Vendor: Model: