OSDN Git Service

target/i386: introduce generic feature dependency mechanism
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 1 Jul 2019 15:26:45 +0000 (17:26 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 4 Oct 2019 16:49:19 +0000 (18:49 +0200)
commit99e24dbdaa682c7b9d0bb5b463638c585bcee1c3
treed28609c713ac43d1ffe11125e1396a8b1ee10b20
parent245edd0cfb1481b7a0398cce45df23db50f00034
target/i386: introduce generic feature dependency mechanism

Sometimes a CPU feature does not make sense unless another is
present.  In the case of VMX features, KVM does not even allow
setting the VMX controls to some invalid combinations.

Therefore, this patch adds a generic mechanism that looks for bits
that the user explicitly cleared, and uses them to remove other bits
from the expanded CPU definition.  If these dependent bits were also
explicitly *set* by the user, this will be a warning for "-cpu check"
and an error for "-cpu enforce".  If not, then the dependent bits are
cleared silently, for convenience.

With VMX features, this will be used so that for example
"-cpu host,-rdrand" will also hide support for RDRAND exiting.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/cpu.c