x86/cpuid: Introduce named feature bitfields
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 11 Jan 2017 11:59:02 +0000 (11:59 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 11 Jan 2017 11:59:02 +0000 (11:59 +0000)
commit8c6510fb66847ab7c0141078b335f1acb07d1341
tree8409d32573183d39c8022ae12550e30dcff431da
parentb51c43d70df3bbc8dc88c9a3e783a2d82afb3571
x86/cpuid: Introduce named feature bitfields

It greatly aids the readibility of code to express feature checks with their
direct name (e.g. p->basic.mtrr or p->extd.lm), rarther that by a field and a
bitmask.  gen-cpuid.py is augmented to calculate a suitable declaration to
live in a union with the underlying feature word.

gen-cpuid.py doesn't know Xen's choice of naming for the feature word indicies
(and arguably shouldn't care), so provides the declarations in terms of their
numeric feature word index.  The DECL_BITFIELD() macro (local to cpuid_policy)
takes a feature word index name and chooses the right declaration, to aid
clarity.

All X86_FEATURE_*'s are included in the naming, other than the features
fast-forwarded from other state (APIC, OSXSAVE, OSPKE), whose value cannot be
read out of the feature word.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/include/asm-x86/cpuid.h
xen/tools/gen-cpuid.py