Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus-4.12b-rc0c-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:
"This contains two fixes for booting under Xen introduced during this
merge window and two fixes for older problems, where one is just much
more probable due to another merge window change"

* tag 'for-linus-4.12b-rc0c-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xen: adjust early dom0 p2m handling to xen hypervisor behavior
x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS when running under Xen
xen/x86: Do not call xen_init_time_ops() until shared_info is initialized
x86/xen: fix xsave capability setting

+23 -31
+3 -2
arch/x86/kernel/cpu/amd.c
··· 799 799 if (cpu_has(c, X86_FEATURE_3DNOW) || cpu_has(c, X86_FEATURE_LM)) 800 800 set_cpu_cap(c, X86_FEATURE_3DNOWPREFETCH); 801 801 802 - /* AMD CPUs don't reset SS attributes on SYSRET */ 803 - set_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS); 802 + /* AMD CPUs don't reset SS attributes on SYSRET, Xen does. */ 803 + if (!cpu_has(c, X86_FEATURE_XENPV)) 804 + set_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS); 804 805 } 805 806 806 807 #ifdef CONFIG_X86_32
+15 -25
arch/x86/xen/enlighten_pv.c
··· 277 277 278 278 static bool __init xen_check_xsave(void) 279 279 { 280 - unsigned int err, eax, edx; 280 + unsigned int cx, xsave_mask; 281 281 282 - /* 283 - * Xen 4.0 and older accidentally leaked the host XSAVE flag into guest 284 - * view, despite not being able to support guests using the 285 - * functionality. Probe for the actual availability of XSAVE by seeing 286 - * whether xgetbv executes successfully or raises #UD. 287 - */ 288 - asm volatile("1: .byte 0x0f,0x01,0xd0\n\t" /* xgetbv */ 289 - "xor %[err], %[err]\n" 290 - "2:\n\t" 291 - ".pushsection .fixup,\"ax\"\n\t" 292 - "3: movl $1,%[err]\n\t" 293 - "jmp 2b\n\t" 294 - ".popsection\n\t" 295 - _ASM_EXTABLE(1b, 3b) 296 - : [err] "=r" (err), "=a" (eax), "=d" (edx) 297 - : "c" (0)); 282 + cx = cpuid_ecx(1); 298 283 299 - return err == 0; 284 + xsave_mask = (1 << (X86_FEATURE_XSAVE % 32)) | 285 + (1 << (X86_FEATURE_OSXSAVE % 32)); 286 + 287 + /* Xen will set CR4.OSXSAVE if supported and not disabled by force */ 288 + return (cx & xsave_mask) == xsave_mask; 300 289 } 301 290 302 291 static void __init xen_init_capabilities(void) 303 292 { 304 - setup_clear_cpu_cap(X86_BUG_SYSRET_SS_ATTRS); 305 293 setup_force_cpu_cap(X86_FEATURE_XENPV); 306 294 setup_clear_cpu_cap(X86_FEATURE_DCA); 307 295 setup_clear_cpu_cap(X86_FEATURE_APERFMPERF); ··· 305 317 else 306 318 setup_clear_cpu_cap(X86_FEATURE_MWAIT); 307 319 308 - if (xen_check_xsave()) { 309 - setup_force_cpu_cap(X86_FEATURE_XSAVE); 310 - setup_force_cpu_cap(X86_FEATURE_OSXSAVE); 311 - } else { 320 + if (!xen_check_xsave()) { 312 321 setup_clear_cpu_cap(X86_FEATURE_XSAVE); 313 322 setup_clear_cpu_cap(X86_FEATURE_OSXSAVE); 314 323 } ··· 973 988 #endif 974 989 975 990 xen_setup_mfn_list_list(); 991 + 992 + /* 993 + * Now that shared info is set up we can start using routines that 994 + * point to pvclock area. 995 + */ 996 + if (system_state == SYSTEM_BOOTING) 997 + xen_init_time_ops(); 976 998 } 977 999 978 1000 /* This is called once we have the cpu_possible_mask */ ··· 1277 1285 x86_init.resources.memory_setup = xen_memory_setup; 1278 1286 x86_init.oem.arch_setup = xen_arch_setup; 1279 1287 x86_init.oem.banner = xen_banner; 1280 - 1281 - xen_init_time_ops(); 1282 1288 1283 1289 /* 1284 1290 * Set up some pagetable state before starting to set any ptes.
+4 -3
arch/x86/xen/mmu_pv.c
··· 2025 2025 2026 2026 /* 2027 2027 * Translate a virtual address to a physical one without relying on mapped 2028 - * page tables. 2028 + * page tables. Don't rely on big pages being aligned in (guest) physical 2029 + * space! 2029 2030 */ 2030 2031 static phys_addr_t __init xen_early_virt_to_phys(unsigned long vaddr) 2031 2032 { ··· 2047 2046 sizeof(pud))); 2048 2047 if (!pud_present(pud)) 2049 2048 return 0; 2050 - pa = pud_pfn(pud) << PAGE_SHIFT; 2049 + pa = pud_val(pud) & PTE_PFN_MASK; 2051 2050 if (pud_large(pud)) 2052 2051 return pa + (vaddr & ~PUD_MASK); 2053 2052 ··· 2055 2054 sizeof(pmd))); 2056 2055 if (!pmd_present(pmd)) 2057 2056 return 0; 2058 - pa = pmd_pfn(pmd) << PAGE_SHIFT; 2057 + pa = pmd_val(pmd) & PTE_PFN_MASK; 2059 2058 if (pmd_large(pmd)) 2060 2059 return pa + (vaddr & ~PMD_MASK); 2061 2060
+1 -1
arch/x86/xen/time.c
··· 406 406 pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier); 407 407 } 408 408 409 - void __init xen_init_time_ops(void) 409 + void __ref xen_init_time_ops(void) 410 410 { 411 411 pv_time_ops = xen_time_ops; 412 412