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 4 are the preliminary work and I would like them to be
accepted into upstream Xen. Patch 4 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 5 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 4 and 5 actually change Xen’s observable behavior.
Patch 1 is a prerequisite that removes the last place where Xen
hard-codes its current PAT value. Patch 2 is strictly cleanup. Patch 3
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 (5):
x86/mm: Avoid hard-coding PAT in get_page_from_l1e()
x86: Remove MEMORY_NUM_TYPES and NO_HARDCODE_MEM_TYPE
x86/mm: make code robust to future PAT changes
x86/mm: Reject invalid cacheability in PV guests by default
x86: Use Linux's PAT
docs/misc/xen-command-line.pandoc | 11 ++
xen/arch/x86/hvm/mtrr.c | 18 ++--
xen/arch/x86/include/asm/mtrr.h | 2 -
xen/arch/x86/include/asm/page.h | 4 +-
xen/arch/x86/include/asm/processor.h | 10 +-
xen/arch/x86/mm.c | 146 ++++++++++++++++++++++++---
xen/arch/x86/mm/shadow/multi.c | 2 +-
7 files changed, 162 insertions(+), 31 deletions(-)
--
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab