xen: fix cpuid reporting on PVH Dom0
PATCH v2 1/1 xen: fix cpuid reporting on PVH Dom0
dab11417d also caused some problems regarding HVM guest creation on PVH Dom0, mainly the CR4 mask returned by hvm_cr4_guest_reserved_bits changed from 0xfffffffffffff800 to 0xfffffffffffff893, which means HVM guests created from a PVH Dom0 are unable to set VME, PVI, PSE or PGE CR4 flags.
This is because cpuid on PVH guests mask PSE, PGE, PSE36 and VME flags, so the white listing done in xc_cpuid_hvm_policy doesn't enable those features, and the guest ends up with a very restrictive cpuid policy.
---
Changes since RFC:
- Expose the cpuid flags to all PVH guests and not only hardware/control domains.
--- xen/arch/x86/traps.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
xen/arch/x86/traps.c +8 -4
@@ -803,12 +803,16 @@ void pv_cpuid(struct cpu_user_regs *regs)if ( (regs->eax &0x7fffffff ) ==0x00000001 ) {/* Modify Feature Information. */ -__clear_bit (X86_FEATURE_VME , &d);if ( !cpu_has_apic )__clear_bit (X86_FEATURE_APIC , &d); -__clear_bit (X86_FEATURE_PSE , &d); -__clear_bit (X86_FEATURE_PGE , &d); -__clear_bit (X86_FEATURE_PSE36 , &d); +if ( !is_pvh_vcpu (curr) ) + { +__clear_bit (X86_FEATURE_PSE , &d); +__clear_bit (X86_FEATURE_PGE , &d); +__clear_bit (X86_FEATURE_PSE36 , &d); +__clear_bit (X86_FEATURE_VME , &d); + } + } switch ( (uint32_t)regs->eax )
Signature · 7 lines
1.7.7.5 (Apple Git-26) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 27 lines · Roger Pau Monne
dab11417dalso caused some problems regarding HVM guest creation on PVH Dom0, mainly the CR4 mask returned byhvm_cr4_guest_reserved_bitschanged from0xfffffffffffff800to0xfffffffffffff893, which means HVM guests created from a PVH Dom0 are unable to set VME, PVI, PSE or PGE CR4 flags.This is because cpuid on PVH guests mask PSE, PGE, PSE36 and VME flags, so the white listing done in
xc_cpuid_hvm_policydoesn't enable those features, and the guest ends up with a very restrictive cpuid policy.Signed-off-by Roger Pau Monné <[email protected]>Cc Jan Beulich <[email protected]>Cc Andrew Cooper <[email protected]>---
Changes since RFC:
- Expose the cpuid flags to all PVH guests and not only hardware/control domains.--- xen/arch/x86/traps.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)xen/arch/x86/traps.c +0
-0
xen/arch/x86/traps.c void pv_cpuid(struct cpu_user_regs *regs) · line 811
Quoted 9 lines
xen/arch/x86/traps.c +0
-4@@ -803,12 +803,16 @@ void pv_cpuid(struct cpu_user_regs *regs)if ( (regs->eax &0x7fffffff ) ==0x00000001 ) {/* Modify Feature Information. */ -__clear_bit (X86_FEATURE_VME , &d);if ( !cpu_has_apic )__clear_bit (X86_FEATURE_APIC , &d); -__clear_bit (X86_FEATURE_PSE , &d); -__clear_bit (X86_FEATURE_PGE , &d); -__clear_bit (X86_FEATURE_PSE36 , &d);
Newline here...
xen/arch/x86/traps.c void pv_cpuid(struct cpu_user_regs *regs) · line 813
Quoted 6 lines
xen/arch/x86/traps.c +6
-0+if ( !is_pvh_vcpu (curr) ) + { +__clear_bit (X86_FEATURE_PSE , &d); +__clear_bit (X86_FEATURE_PGE , &d); +__clear_bit (X86_FEATURE_PSE36 , &d); +__clear_bit (X86_FEATURE_VME , &d);
Why do PVH guests care about VME? They can't use it as far as I am aware.
xen/arch/x86/traps.c void pv_cpuid(struct cpu_user_regs *regs) · line 815
Quoted 2 lines
xen/arch/x86/traps.c +2
-0+ } +
... and not here.
xen/arch/x86/traps.c void pv_cpuid(struct cpu_user_regs *regs) · line 818
Quoted 3 lines
xen/arch/x86/traps.c +0
-0} switch ( (uint32_t)regs->eax )
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 04.08.14 at 12:32, <[email protected]> wrote:
xen/arch/x86/traps.c void pv_cpuid(struct cpu_user_regs *regs) · line 811
Quoted 12 lines · Roger Pau Monne
xen/arch/x86/traps.c +0
-4@@ -803,12 +803,16 @@ void pv_cpuid(struct cpu_user_regs *regs)if ( (regs->eax &0x7fffffff ) ==0x00000001 ) {/* Modify Feature Information. */ -__clear_bit (X86_FEATURE_VME , &d);if ( !cpu_has_apic )__clear_bit (X86_FEATURE_APIC , &d); -__clear_bit (X86_FEATURE_PSE , &d); -__clear_bit (X86_FEATURE_PGE , &d); -__clear_bit (X86_FEATURE_PSE36 , &d);Newline here...
Quoted 8 lines
xen/arch/x86/traps.c void pv_cpuid(struct cpu_user_regs *regs) · line 813
Quoted 6 lines
xen/arch/x86/traps.c +6
-0+if ( !is_pvh_vcpu (curr) ) + { +__clear_bit (X86_FEATURE_PSE , &d); +__clear_bit (X86_FEATURE_PGE , &d); +__clear_bit (X86_FEATURE_PSE36 , &d); +__clear_bit (X86_FEATURE_VME , &d);Why do PVH guests care about VME? They can't use it as far as I am aware.
I don't think it particularly cares, but it also seems unnecessary and inconsistent to hide a feature from it without need.
Quoted 4 lines
xen/arch/x86/traps.c void pv_cpuid(struct cpu_user_regs *regs) · line 815
Quoted 2 lines
xen/arch/x86/traps.c +2
-0+ } +... and not here.
I've already taken care of these formatting issues in the to-be- committed version.
Jan