[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220715142549.25223-1-jgross@suse.com>
Date: Fri, 15 Jul 2022 16:25:46 +0200
From: Juergen Gross <jgross@...e.com>
To: xen-devel@...ts.xenproject.org, x86@...nel.org,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Cc: brchuckz@...scape.net, jbeulich@...e.com,
Juergen Gross <jgross@...e.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
"# 5 . 17" <stable@...r.kernel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Pavel Machek <pavel@....cz>, Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>
Subject: [PATCH 0/3] x86: make pat and mtrr independent from each other
Today PAT can't be used without MTRR being available, unless MTRR is at
least configured via CONFIG_MTRR and the system is running as Xen PV
guest. In this case PAT is automatically available via the hypervisor,
but the PAT MSR can't be modified by the kernel and MTRR is disabled.
As an additional complexity the availability of PAT can't be queried
via pat_enabled() in the Xen PV case, as the lack of MTRR will set PAT
to be disabled. This leads to some drivers believing that not all cache
modes are available, resulting in failures or degraded functionality.
The same applies to a kernel built with no MTRR support: it won't
allow to use the PAT MSR, even if there is no technical reason for
that, other than setting up PAT on all cpus the same way (which is a
requirement of the processor's cache management) is relying on some
MTRR specific code.
Fix all of that by:
- moving the function needed by PAT from MTRR specific code one level
up
- adding a PAT indirection layer supporting the 3 cases "no or disabled
PAT", "PAT under kernel control", and "PAT under Xen control"
- removing the dependency of PAT on MTRR
Juergen Gross (3):
x86: move some code out of arch/x86/kernel/cpu/mtrr
x86: add wrapper functions for mtrr functions handling also pat
x86: decouple pat and mtrr handling
arch/x86/include/asm/memtype.h | 13 ++-
arch/x86/include/asm/mtrr.h | 27 ++++--
arch/x86/include/asm/processor.h | 10 +++
arch/x86/kernel/cpu/common.c | 123 +++++++++++++++++++++++++++-
arch/x86/kernel/cpu/mtrr/generic.c | 90 ++------------------
arch/x86/kernel/cpu/mtrr/mtrr.c | 58 ++++---------
arch/x86/kernel/cpu/mtrr/mtrr.h | 1 -
arch/x86/kernel/setup.c | 12 +--
arch/x86/kernel/smpboot.c | 8 +-
arch/x86/mm/pat/memtype.c | 127 +++++++++++++++++++++--------
arch/x86/power/cpu.c | 2 +-
arch/x86/xen/enlighten_pv.c | 4 +
12 files changed, 289 insertions(+), 186 deletions(-)
--
2.35.3
Powered by blists - more mailing lists