linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] x86: make pat and mtrr independent from each other
@ 2022-07-15 14:25 Juergen Gross
  2022-07-15 14:25 ` [PATCH 1/3] x86: move some code out of arch/x86/kernel/cpu/mtrr Juergen Gross
                   ` (4 more replies)
  0 siblings, 5 replies; 42+ messages in thread
From: Juergen Gross @ 2022-07-15 14:25 UTC (permalink / raw)
  To: xen-devel, x86, linux-kernel, linux-pm
  Cc: brchuckz, jbeulich, Juergen Gross, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, # 5 . 17,
	Rafael J. Wysocki, Pavel Machek, Andy Lutomirski, Peter Zijlstra,
	Boris Ostrovsky

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


^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2022-08-18 18:54 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-15 14:25 [PATCH 0/3] x86: make pat and mtrr independent from each other Juergen Gross
2022-07-15 14:25 ` [PATCH 1/3] x86: move some code out of arch/x86/kernel/cpu/mtrr Juergen Gross
2022-07-18 12:20   ` Borislav Petkov
2022-07-15 14:25 ` [PATCH 2/3] x86: add wrapper functions for mtrr functions handling also pat Juergen Gross
2022-07-15 16:41   ` Rafael J. Wysocki
2022-07-19 10:47   ` Borislav Petkov
2022-07-15 14:25 ` [PATCH 3/3] x86: decouple pat and mtrr handling Juergen Gross
2022-07-19 15:15   ` Borislav Petkov
2022-08-13 16:56     ` PING " Chuck Zmudzinski
2022-08-13 17:20       ` Borislav Petkov
2022-08-13 21:40         ` Chuck Zmudzinski
2022-08-13 21:48           ` Borislav Petkov
2022-08-13 22:41             ` Chuck Zmudzinski
2022-08-16 18:31               ` Chuck Zmudzinski
2022-08-17  9:17     ` Juergen Gross
2022-07-20  1:12   ` Chuck Zmudzinski
2022-07-16 11:32 ` [PATCH 0/3] x86: make pat and mtrr independent from each other Chuck Zmudzinski
2022-07-16 11:42   ` Borislav Petkov
2022-07-17  4:06     ` Chuck Zmudzinski
2022-07-16 12:01   ` Chuck Zmudzinski
2022-07-17  7:55 ` Thorsten Leemhuis
2022-07-18 11:32   ` Chuck Zmudzinski
2022-07-19 13:16     ` Chuck Zmudzinski
2022-08-13 16:56   ` Chuck Zmudzinski
2022-08-14  7:42     ` Chuck Zmudzinski
2022-08-14  8:08       ` Juergen Gross
2022-08-15  3:23         ` Chuck Zmudzinski
2022-08-15 16:56           ` Chuck Zmudzinski
2022-08-15 18:00             ` Thorsten Leemhuis
2022-08-15 18:17               ` Chuck Zmudzinski
2022-08-16 14:41                 ` Thorsten Leemhuis
2022-08-16 16:16                   ` Chuck Zmudzinski
2022-08-16 16:53                     ` Thorsten Leemhuis
2022-08-16 17:28                       ` Chuck Zmudzinski
2022-08-18 18:54                         ` Chuck Zmudzinski
2022-08-14  9:19       ` Chuck Zmudzinski
2022-08-14  9:50         ` Greg KH
2022-08-14 12:08           ` Chuck Zmudzinski
2022-08-14 13:01             ` Greg KH
2022-08-14 16:03               ` Chuck Zmudzinski
2022-08-14 19:52               ` Chuck Zmudzinski
2022-08-15 16:04               ` Chuck Zmudzinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).