mbox series

[00/22] x86: Enhance MTRR functionality to support multiple CPUs

Message ID 20200522022326.238388-1-sjg@chromium.org
Headers show
Series x86: Enhance MTRR functionality to support multiple CPUs | expand

Message

Simon Glass May 22, 2020, 2:23 a.m. UTC
At present MTRRs are mirrored to the secondary CPUs only once, as those
CPUs are started up. But U-Boot may add more MTRRs later, e.g. if it
decides that a video console must be set up.

This series enhances the x86 multi-processor support to allow MTRRs to
be updated at any time. It also updates the 'mtrr' command to support
setting the MTRRs on CPUs other than the boot CPU.


Simon Glass (22):
  x86: mp_init: Switch to livetree
  x86: Move MP code into mp_init
  x86: mp_init: Avoid declarations in header files
  x86: mp_init: Switch parameter names in start_aps()
  x86: mp_init: Drop the num_cpus static variable
  x86: mtrr: Fix 'ensable' typo
  x86: mp_init: Set up the CPU numbers at the start
  x86: mp_init: Adjust bsp_init() to return more information
  x86: cpu: Remove unnecessary #ifdefs
  x86: mp: Support APs waiting for instructions
  global_data: Add a generic global_data flag for SMP state
  x86: Set the SMP flag when MP init is complete
  x86: mp: Allow running functions on multiple CPUs
  x86: mp: Park CPUs before running the OS
  x86: mp: Add iterators for CPUs
  x86: mtrr: Use MP calls to list the MTRRs
  x86: mtrr: Update MTRRs on all CPUs
  x86: mtrr: Add support for writing to MTRRs on any CPU
  x86: mtrr: Update the command to use the new mtrr calls
  x86: mtrr: Restructure so command execution is in one place
  x86: mtrr: Update 'mtrr' to allow setting MTRRs on any CPU
  x86: mtrr: Enhance 'mtrr' command to list MTRRs on any CPU

 arch/x86/cpu/cpu.c                |  63 ++---
 arch/x86/cpu/i386/cpu.c           |  26 +--
 arch/x86/cpu/mp_init.c            | 377 +++++++++++++++++++++++++-----
 arch/x86/cpu/mtrr.c               | 149 ++++++++++++
 arch/x86/include/asm/mp.h         | 118 ++++++++--
 arch/x86/include/asm/mtrr.h       |  51 ++++
 cmd/x86/mtrr.c                    | 148 ++++++++----
 include/asm-generic/global_data.h |   1 +
 include/dm/uclass.h               |   2 +-
 9 files changed, 751 insertions(+), 184 deletions(-)

Comments

Andy Shevchenko May 22, 2020, 10:54 a.m. UTC | #1
On Thu, May 21, 2020 at 08:23:04PM -0600, Simon Glass wrote:
> At present MTRRs are mirrored to the secondary CPUs only once, as those
> CPUs are started up. But U-Boot may add more MTRRs later, e.g. if it
> decides that a video console must be set up.
> 
> This series enhances the x86 multi-processor support to allow MTRRs to
> be updated at any time. It also updates the 'mtrr' command to support
> setting the MTRRs on CPUs other than the boot CPU.

Hmm... Why do you need MTRR if CPU supports PAT?

> 
> 
> Simon Glass (22):
>   x86: mp_init: Switch to livetree
>   x86: Move MP code into mp_init
>   x86: mp_init: Avoid declarations in header files
>   x86: mp_init: Switch parameter names in start_aps()
>   x86: mp_init: Drop the num_cpus static variable
>   x86: mtrr: Fix 'ensable' typo
>   x86: mp_init: Set up the CPU numbers at the start
>   x86: mp_init: Adjust bsp_init() to return more information
>   x86: cpu: Remove unnecessary #ifdefs
>   x86: mp: Support APs waiting for instructions
>   global_data: Add a generic global_data flag for SMP state
>   x86: Set the SMP flag when MP init is complete
>   x86: mp: Allow running functions on multiple CPUs
>   x86: mp: Park CPUs before running the OS
>   x86: mp: Add iterators for CPUs
>   x86: mtrr: Use MP calls to list the MTRRs
>   x86: mtrr: Update MTRRs on all CPUs
>   x86: mtrr: Add support for writing to MTRRs on any CPU
>   x86: mtrr: Update the command to use the new mtrr calls
>   x86: mtrr: Restructure so command execution is in one place
>   x86: mtrr: Update 'mtrr' to allow setting MTRRs on any CPU
>   x86: mtrr: Enhance 'mtrr' command to list MTRRs on any CPU
> 
>  arch/x86/cpu/cpu.c                |  63 ++---
>  arch/x86/cpu/i386/cpu.c           |  26 +--
>  arch/x86/cpu/mp_init.c            | 377 +++++++++++++++++++++++++-----
>  arch/x86/cpu/mtrr.c               | 149 ++++++++++++
>  arch/x86/include/asm/mp.h         | 118 ++++++++--
>  arch/x86/include/asm/mtrr.h       |  51 ++++
>  cmd/x86/mtrr.c                    | 148 ++++++++----
>  include/asm-generic/global_data.h |   1 +
>  include/dm/uclass.h               |   2 +-
>  9 files changed, 751 insertions(+), 184 deletions(-)
> 
> -- 
> 2.27.0.rc0.183.gde8f92d652-goog
>
Simon Glass May 22, 2020, 1:42 p.m. UTC | #2
Hi Andy,

On Fri, 22 May 2020 at 04:55, Andy Shevchenko
<andriy.shevchenko at linux.intel.com> wrote:
>
> On Thu, May 21, 2020 at 08:23:04PM -0600, Simon Glass wrote:
> > At present MTRRs are mirrored to the secondary CPUs only once, as those
> > CPUs are started up. But U-Boot may add more MTRRs later, e.g. if it
> > decides that a video console must be set up.
> >
> > This series enhances the x86 multi-processor support to allow MTRRs to
> > be updated at any time. It also updates the 'mtrr' command to support
> > setting the MTRRs on CPUs other than the boot CPU.
>
> Hmm... Why do you need MTRR if CPU supports PAT?

I suspect U-Boot could move to PAT one day but the needs are small in firmware.

Regards,
Simon