mbox series

[v3,00/25] x86: Enhance MTRR functionality to support multiple CPUs

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

Message

Simon Glass July 6, 2020, 3:37 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.

Changes in v3:
- Update bsp_do_flight_plan() to say 'on the BSP'
- s/slow/slot/
- Use C code instead of assembler to read/write callback pointers
- Update commit message to mention dropping of cpu_map
- Rename flag to GD_FLG_SMP_READY
- Rename flag to GD_FLG_SMP_READY
- Add a comment to run_ap_work()
- Rename flag to GD_FLG_SMP_READY
- Update the comment for run_ap_work() to explain logical_cpu_number
- Clarify meaning of @cpu_select in mp_run_on_cpus() comment
- Update the comment for mp_park_aps()
- Add more comments on how the iterators work
- Mention that the CPU number is in hex
- Remove stray asterisk from comments
- Drop mention of cpu_map which was handled in a previous patch

Changes in v2:
- Add comments to explain what start_aps() does
- Drop change to include/dm/uclass.h
- Mention error return in get_bsp()
- Add more comments
- Rename mtrr_save_all() to mtrr_read_all()
- Add a new patch to avoid enabling SMP in SPL
- Add new patch to add AP_DEFAULT_BASE to coral's memory map
- Rename function to mtrr_write_all()
- Keep things building by temporarily renaming the function in cmd/
- Drop the renamed mtrr_set_valid_() instead of mtrr_set_valid()
- Add a new patch with more comments

Simon Glass (25):
  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: Don't enable SMP in SPL
  x86: coral: Update the memory map
  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: mp: Add more comments to the module
  x86: mtrr: Enhance 'mtrr' command to list MTRRs on any CPU

 arch/x86/cpu/Makefile                 |   2 +-
 arch/x86/cpu/cpu.c                    |  63 ++--
 arch/x86/cpu/i386/cpu.c               |  26 +-
 arch/x86/cpu/mp_init.c                | 514 ++++++++++++++++++++++----
 arch/x86/cpu/mtrr.c                   | 149 ++++++++
 arch/x86/include/asm/mp.h             | 134 ++++++-
 arch/x86/include/asm/mtrr.h           |  51 +++
 cmd/x86/mtrr.c                        | 148 +++++---
 doc/board/google/chromebook_coral.rst |   1 +
 include/asm-generic/global_data.h     |   1 +
 10 files changed, 900 insertions(+), 189 deletions(-)

Comments

Bin Meng July 7, 2020, 8:54 a.m. UTC | #1
Hi Simon,

On Mon, Jul 6, 2020 at 11:37 AM Simon Glass <sjg at chromium.org> 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.
>

Testing this series on Minnowmax, the "mtrr" command fails:

=> mtrr
CPU 0:
Failed to read CPU 0 (err=-110)

Could you please take a look?

Regards,
Bin
Simon Glass July 8, 2020, 1:36 a.m. UTC | #2
Hi Bin,

On Tue, 7 Jul 2020 at 02:54, Bin Meng <bmeng.cn at gmail.com> wrote:
>
> Hi Simon,
>
> On Mon, Jul 6, 2020 at 11:37 AM Simon Glass <sjg at chromium.org> 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.
> >
>
> Testing this series on Minnowmax, the "mtrr" command fails:
>
> => mtrr
> CPU 0:
> Failed to read CPU 0 (err=-110)
>
> Could you please take a look?

Somehow I missed that sorry. I've had to make it optional, and enable
it only on coral for now. I suspect it might work on other boards but
they will need to be tested.

Will send v4 with a small number of changes.

Regards,
SImon