debuggers.hg
changeset 19682:ad59f1c032ec
x86 hvm viridian: Provide dummy support for APIC assist page to satisfy Win7.
From: Tim Deegan <tim.deegan@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
From: Tim Deegan <tim.deegan@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Tue May 26 10:13:43 2009 +0100 (2009-05-26) |
parents | 916331c26dc1 |
children | 9749e8f6e3d8 |
files | xen/arch/x86/hvm/viridian.c |
line diff
1.1 --- a/xen/arch/x86/hvm/viridian.c Tue May 26 10:05:27 2009 +0100 1.2 +++ b/xen/arch/x86/hvm/viridian.c Tue May 26 10:13:43 2009 +0100 1.3 @@ -22,6 +22,7 @@ 1.4 #define VIRIDIAN_MSR_EOI 0x40000070 1.5 #define VIRIDIAN_MSR_ICR 0x40000071 1.6 #define VIRIDIAN_MSR_TPR 0x40000072 1.7 +#define VIRIDIAN_MSR_APIC_ASSIST 0x40000073 1.8 1.9 /* Viridian Hypercall Status Codes. */ 1.10 #define HV_STATUS_SUCCESS 0x0000 1.11 @@ -49,14 +50,14 @@ int cpuid_viridian_leaves(unsigned int l 1.12 return 0; 1.13 1.14 leaf -= 0x40000000; 1.15 - if ( leaf > 5 ) 1.16 + if ( leaf > 6 ) 1.17 return 0; 1.18 1.19 *eax = *ebx = *ecx = *edx = 0; 1.20 switch ( leaf ) 1.21 { 1.22 case 0: 1.23 - *eax = 0x40000005; /* Maximum leaf */ 1.24 + *eax = 0x40000006; /* Maximum leaf */ 1.25 *ebx = 0x7263694d; /* Magic numbers */ 1.26 *ecx = 0x666F736F; 1.27 *edx = 0x76482074; 1.28 @@ -192,6 +193,30 @@ int wrmsr_viridian_regs(uint32_t idx, ui 1.29 vlapic_set_reg(vcpu_vlapic(current), APIC_TASKPRI, eax & 0xff); 1.30 break; 1.31 1.32 + case VIRIDIAN_MSR_APIC_ASSIST: 1.33 + /* 1.34 + * We don't support the APIC assist page, and that fact is reflected in 1.35 + * our CPUID flags. However, Windows 7 build 7000 has a bug which means 1.36 + * that it doesn't recognise that, and tries to use the page anyway. We 1.37 + * therefore have to fake up just enough to keep win7 happy. 1.38 + * Fortunately, that's really easy: just setting the first four bytes 1.39 + * in the page to zero effectively disables the page again, so that's 1.40 + * what we do. Semantically, the first four bytes are supposed to be a 1.41 + * flag saying whether the guest really needs to issue an EOI. Setting 1.42 + * that flag to zero means that it must always issue one, which is what 1.43 + * we want. Once a page has been repurposed as an APIC assist page the 1.44 + * guest isn't allowed to set anything in it, so the flag remains zero 1.45 + * and all is fine. The guest is allowed to clear flags in the page, 1.46 + * but that doesn't cause us any problems. 1.47 + */ 1.48 + if ( val & 1 ) /* APIC assist page enabled? */ 1.49 + { 1.50 + uint32_t word = 0; 1.51 + paddr_t page_start = val & ~1ul; 1.52 + hvm_copy_to_guest_phys(page_start, &word, sizeof(word)); 1.53 + } 1.54 + break; 1.55 + 1.56 default: 1.57 return 0; 1.58 }