Hi,
We need to provide support for CPU ID masking. Xen and VMware ESX are examples
of current hypervisors which support such masking.
My proposal is to define new 'cpuid' feature advertised in guest
capabilities:
<guest>
...
<features>
<cpuid/>
</feature>
</guest>
When a driver supports cpuid feature, one can use it to mask/check for
specific bits returned by CPU ID as follows:
<domain>
...
<features>
<cpuid>
<mask level='hex'
register='eax|ebx|ecx|edx'>MASK</mask>
</cpuid>
</features>
...
</domain>
Where
- level is a hexadecimal number used as an input to CPU ID (i.e. eax
register),
- register is one of eax, ebx, ecx or edx,
- and MASK is a string with the following format:
mmmm:mmmm:mmmm:mmmm:mmmm:mmmm:mmmm:mmmm with m being 1-bit mask for the
corresponding bit in the register.
There are three possibilities of specifying what values can be used for 'm':
- let it be driver-specific,
- define all possible values,
- define a common set of values and allow drivers to specify their own
additional values.
I think the third is the way to go as it lowers the confusion of different
values used by different drivers for the same purpose while maintaining the
flexibility to support driver-specific masks.
The following could be a good set of predefined common values:
- 1 force the bit to be 1
- 0 force the bit to be 0
- x don't care, i.e., use driver's default value
- T require the bit to be 1
- F require the bit to be 0
Some examples of what it could look like follow:
<capabilities>
...
<guest>
<os_type>xen</os_type>
...
<features>
<pae/>
<cpuid/>
</features>
</guest>
...
</capabilities>
<domain type='xen' id='42'>
...
<features>
<pae/>
<acpi/>
<apic/>
<cpuid>
<mask level='1' register='ebx'>
xxxx:xxxx:0000:1010:xxxx:xxxx:xxxx:xxxx
</mask>
<mask level='1' register='ecx'>
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xx1x:xxxx
</mask>
<mask level='1' register='edx'>
xxx1:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
</mask>
<mask level='80000001' register='ecx'>
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xx1x
</mask>
<mask level='80000008' register='ecx'>
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xx00:1001
</mask>
</cpuid>
</features>
...
</domain>
What are your opinions about this?
Thank for all comments.
Jirka