mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/mm: avoid hard-coding PAT in get_page_from_l1e()
get_page_from_l1e() relied on Xen's choice of PAT, which is brittle in the face of future PAT changes. Instead, compute the actual cacheability used by the CPU and switch on that, as this will work no matter what PAT Xen uses. No functional change intended. This code is itself questionable and may be removed in the future, but removing it would be an observable behavior change and so is out of scope for this patch series. Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
c1df06afe5
commit
40b05620e2
1 file changed
+9
-6
+9
-6
@@ -956,14 +956,17 @@ get_page_from_l1e(
|
||||
flip = _PAGE_RW;
|
||||
}
|
||||
|
||||
switch ( l1f & PAGE_CACHE_ATTRS )
|
||||
switch ( 0xFF & (XEN_MSR_PAT >> (8 * pte_flags_to_cacheattr(l1f))) )
|
||||
{
|
||||
case 0: /* WB */
|
||||
flip |= _PAGE_PWT | _PAGE_PCD;
|
||||
case X86_MT_UC:
|
||||
case X86_MT_UCM:
|
||||
case X86_MT_WC:
|
||||
/* not cacheable, allow */
|
||||
break;
|
||||
case _PAGE_PWT: /* WT */
|
||||
case _PAGE_PWT | _PAGE_PAT: /* WP */
|
||||
flip |= _PAGE_PCD | (l1f & _PAGE_PAT);
|
||||
|
||||
default:
|
||||
/* potentially cacheable, force to UC */
|
||||
flip |= ((l1f & PAGE_CACHE_ATTRS) ^ _PAGE_UC);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||