While working on Qubes OS Marek found out that there were some PAT hacks
in the Linux i195 driver. I decided to make Xen use Linux’s PAT to see
if it solved the graphics glitches that were observed; it did. This
required a substantial amount of preliminary work that is useful even
without using Linux’s PAT.
Patches 1 through 9 are the preliminary work and I would like them to be
accepted into upstream Xen. Patch 9 does break ABI by rejecting the
unused PAT entries, but this will only impact buggy PV guests and can be
disabled with a Xen command-line option. Patch 10 actually switches to
Linux’s PAT and is NOT intended to be merged (at least for now) as it
would at a minimum break migration of PV guests from hosts that do not
have the patch.
Only patches 9 and 10 actually change Xen’s observable behavior.
Patches 1, 2, and 7 are prerequisites, and patches 3 through 6 are
cleanups. Patch 8 makes changing the PAT much less error-prone, as
problems with the PAT or with the associated _PAGE_* constants will
be detected at compile time.
Demi Marie Obenour (10):
x86: Add memory type constants
x86/mm: Avoid hard-coding PAT in get_page_from_l1e()
x86: Replace PAT_* with X86_MT_*
x86: Replace MTRR_* constants with X86_MT_* constants
x86: Replace EPT_EMT_* constants with X86_MT_*
x86: Remove MEMORY_NUM_TYPES and NO_HARDCODE_MEM_TYPE
x86: Derive XEN_MSR_PAT from its individual entries
x86/mm: make code robust to future PAT changes
x86/mm: Reject invalid cacheability in PV guests by default
x86: Use Linux's PAT
xen/arch/x86/cpu/mtrr/generic.c | 10 +-
xen/arch/x86/cpu/mtrr/main.c | 26 +++---
xen/arch/x86/e820.c | 4 +-
xen/arch/x86/hvm/hvm.c | 12 +--
xen/arch/x86/hvm/mtrr.c | 100 ++++++++++----------
xen/arch/x86/hvm/vmx/vmcs.c | 2 +-
xen/arch/x86/hvm/vmx/vmx.c | 18 ++--
xen/arch/x86/include/asm/hvm/vmx/vmcs.h | 2 +-
xen/arch/x86/include/asm/hvm/vmx/vmx.h | 9 --
xen/arch/x86/include/asm/mtrr.h | 22 +----
xen/arch/x86/include/asm/page.h | 4 +-
xen/arch/x86/include/asm/processor.h | 11 ++-
xen/arch/x86/include/asm/x86-defns.h | 11 +++
xen/arch/x86/mm.c | 118 ++++++++++++++++++++++--
xen/arch/x86/mm/hap/nested_ept.c | 4 +-
xen/arch/x86/mm/p2m-ept.c | 51 +++++-----
xen/arch/x86/mm/shadow/multi.c | 8 +-
17 files changed, 253 insertions(+), 159 deletions(-)
--
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab