Commit Graph

59 Commits

Author SHA1 Message Date
Sam Demeulemeester 7aeac7271f
Add Memory Controller Registers polling to get current DRAM Timings/Frequency (#306)
Read the memory controller configuration (instead of just relying on SPD data) to get the actual live settings.

Currently supported platforms:
* Intel SNB to RPL (Core 2nd Gen to Core 13th Gen) - Desktop only (no Server nor Mobile)
* AMD SMR to RPL (Zen to Zen4) - Desktop only (no Server, Mobile nor APU).


Individual commits below for archival:

* First functions skeleton for reading IMC/ECC Registers

* Change directory name from 'chipsets' to 'mch' (Memory Controller Hub)

* Add Intel HSW and fix new files encoding

* First Intel HSW IMC implementation

* Add an option to disable MCH registers polling

* Remove old include from Makefiles

* Better Makefile and padding fixes

* Statically init 'imc' struct to generate string relocation record

* Small typos & code fixes

* Add IMC support for Intel Core 6/7/8/9th Gen (SKL/KBL/CFL/CML) This is a bit more complex than Haswell and below because MMIO switched to 64-bit with Skylake (lot of) betatesting needed

* Add IMC read support for Intel SNB/IVB (2nd/3rd gen Core)

* Fix hard-lock on Intel SNB/IVB due to wrong access type on MCHBAR pointer

* Move AMD SMN Registers & offsets to a specific header file

* Add IMC Read support for AMD Zen/Zen2 CPUs

* Change 'IMC' to 'MCH' in Makefiles to match actual mch/ directory

* Add IMC Reading support for Intel ADL&RPL CPUs (Core Gen12&13)

* Add support for Intel Rocket Lake (Core 11th Gen) and AMD Vermeer

* Add IMC reading for AMD Zen4 'Raphael' AM5 CPUs

* Various Cleanup #1 
Change terminology from Intel-based 'MCH' (Memory Controller Hub) to more universal 'IMC' (Integrated Memory Controller) Integrate imc_type var into imc struct. Remove previously created AMD SNM header file

* Various Cleanup 2

* Change DDR5 display format for IMC specs
DDR5 Freq can be > 10000 and timings up to 63-127-127-127, which overwflow the available space.
This commit remove the raw frequency on DDR5 (which may be incorrect due to Gear mechanism) and leave a bit of space to display the Gear engaged in the future
2023-05-12 15:33:28 +02:00
Sam Demeulemeester 79bb781431 Better handling of big FAIL banned in case of errors 2023-03-29 18:29:59 +02:00
Sam Demeulemeester 22663f89bb
Add support for AMD K8 temperature reporting. (#268)
Add various quirks to handle AMD temp sensors erratas
2023-02-13 22:29:17 +01:00
Martin Whitaker 03cd8d1898 Fix disabling SMP using F2 at startup dialogue.
smp_init() used to be called after the startup dialogue, so F2 only
needed to change the enable_smp flag. Now smp_init() is called earlier,
we also need to reset num_available_cpus.
2023-01-03 11:38:55 +00:00
Sam Demeulemeester 034372f4bf
Add much bigger PASS/FAIL banner (#113)
The goal is to see the actual test result (PASS or FAIL) far away.
2022-07-17 20:20:52 +02:00
martinwhitaker e6e0f0c8e7
USB improvements (#116)
* Add new heap manager.

* Convert OHCI driver to use new heap manager.

* Convert UHCI driver to use new heap manager.

* Convert EHCI driver to use new heap manager.

* Convert XHCI driver to use new heap manager.

* Convert SMP to use new heap manager.

* Add a "usbinit" boot option to handle various buggy USB devices.

This replaces the "keyboard=buggy-usb" option, and adds a second
workaround to handle the problem seen in issue #107.
2022-07-16 13:34:08 +02:00
Sam Demeulemeester 89e2643de4
Add AP Enumeration to distinguish P-Core from E-Core on Hybrid CPUs (#62)
Add AP Enumeration to distinguish E-Core from P-Core on Intel Hybrid CPUs, and exclude them from the selected cores by default.  Including E-Cores slows down some tests and takes longer to catch memory errors.

A new exclude_ecores flag has been added in config.c to include E-Cores if needed.
2022-07-16 13:28:53 +02:00
Sam Demeulemeester a5576974cf Add ACPI Timer as the primary TSC correction source and PIT Timer as fallback 2022-06-19 16:39:03 +02:00
Sam Demeulemeester 221a66da1a Split ACPI Functions from SMP functions.
Add ACPI Table detection for FADT & HPET (as we need better timers)
2022-06-19 16:39:03 +02:00
Sam Demeulemeester 6cd356f831 Add External L2 detection for ALi Aladdin V Chipset (#87) 2022-06-06 19:56:04 +02:00
Sam Demeulemeester 0adcdfa160 Fix display issue when current temperature and/or max temperature >= 100°C 2022-05-22 18:02:54 +02:00
Sam Demeulemeester bc8235f50d
Add a way to handle hardware quirks at init or later in the code. Add ASUS TUSL2-C ASB100 Mux as (working) example (#77) 2022-05-20 13:23:25 +02:00
Sam Demeulemeester 722b1b2899 Fix console kernel parameters parsed too late at boot (#66). Reorder global init to start tty after config parsed. Allow a wider options for console argument (ie: console - console=ttySx - console=ttySx,115200 2022-05-12 16:55:52 +02:00
Martin Whitaker ef3f0bc1e5 Call cpuid_init() before the first call to map_region().
map_region() uses the long mode flag, so that must be initialised first.
2022-05-09 18:17:19 +01:00
Martin Whitaker af54067228 Execute smp_init() before keyboard_init() in case ACPI tables are overwritten.
When USB keyboard detection is enabled, physical memory pages are reserved
for use by the USB drivers. The physical memory map exposed by pmem.h does
not indicate where the ACPI tables reside, so we may end up using pages
that contain ACPI tables (or for that matter, the boot parameters and boot
command line). So rather than introduce a more complicated memory allocation
scheme, make sure we have finished with all the data passed to us by the
BIOS and/or boot loader before we start probing for USB devices.

The only downside to this is that it is no longer possible to interactively
disable parsing of the ACPI tables - that can now only be done by using the
"nosmp" boot option.
2022-05-04 22:42:31 +01:00
martinwhitaker 93c9c8ded5
Rework memory mapping to allow for larger program size (#54)
* Improve abstraction in vmem.h and limit memory benchmarking to first 2GB.

The third GB may get used for remapping memory regions that are only
accessed during startup, so it's not safe to use it for the memory
speed tests.

* Fix calculation of end limit for locating memory benchmark workspace.

* Document vmem.h.

* Use window number, not current start address, to detect first window.

* Increase the program low-load range from 1MB to 4MB and make more robust.

If the BIOS has reserved some parts of low memory, there may not be
enough contiguous space left to load the program there (issue #49).
So increase the low-load range to include the first 3MB of high
memory. Also guard against the program being initially loaded
straddling the new boundary.

Co-authored-by: Martin Whitaker <memtest@martin-whitaker.me.uk>
2022-04-28 23:04:01 +02:00
Martin Whitaker e0c0cd55c6 Tidy up code for performing reset via the EFI runtime sevices.
Make this entirely local to hwctrl.c.
2022-04-23 13:25:33 +01:00
Martin Whitaker 644a13c730 Add usbdebug command line option and conditionally pause at end of USB scan.
If the usbdebug option is present, pause at the end of the USB scan until
a key is pressed. Otherwise, if the keyboard=usb option is present and no
USB keyboards were discovered, pause for 10 seconds. Otherwise don't pause.
2022-04-17 22:46:17 +01:00
Sam Demeulemeester 2a994e7ff5 Various code cleanup following PR review 2022-04-16 13:31:28 +02:00
Sam Demeulemeester 6fca9bedc9 Rework Line 9. Add DDR1->DDR5 Timing Detection to display on this line 2022-04-16 13:31:28 +02:00
Sam Demeulemeester 979b85548d Rework Line #7 left block. Add preliminary CPUID function to detect CPU Topology 2022-04-16 13:31:28 +02:00
Sam Demeulemeester fac6e2a973 Rework the right block of lines 8/9 2022-04-16 13:31:28 +02:00
Sam Demeulemeester 5580f7562d Add tracking & display for maximum CPU Temperature. Make the enable_temperature flag working as expected 2022-04-16 13:31:28 +02:00
Sam Demeulemeester 2e048a7c61
Add support for Serial/TTY (#32)
* Add preliminary support for TTY Serial/UART (#15)

* Use shadow_buffer instead of VGA buffer to get a framebuffer-agnostic TTY supprot

* Added menu browsing & inputs from Serial TTY (#15)

* Add fix for degree symbol on TTY. Correct serial.c & serial.h file created with CRLF (#15)

* Move tty_error_redraw() to insure correct redraw when a error occurs

* Many reindent / cleanup

* Various optimization from @martinwhitaker comments
2022-04-04 18:31:54 +02:00
Sam Demeulemeester ee80684c4f Separate benchmark from smbus/smbios and add a separate flag to enable/disable it 2022-04-01 20:34:52 +02:00
Sam Demeulemeester bd5e6f3c6b Bring back the cache & memory benchmark feature (preliminary) 2022-03-24 21:49:56 +01:00
Sam DEMEULEMEESTER 2266151fe6 Early SMBUS functions (#2) & EFI Reset (#17) 2022-03-24 21:49:56 +01:00
Sam DEMEULEMEESTER 63904403b2 Added preliminary BIOS/EFI SMBIOS table parsing & basic printing (#1) 2022-03-24 21:49:56 +01:00
Martin Whitaker 4078b7760e Faster barrier implementation.
The old barrier implementation was very slow when running on a multi-socket
machine (pcmemtest issue 16).

The new implementation provides two options:

  - when blocked, spin on a thread-local flag
  - when blocked, execute a HLT instruction and wait for a NMI

The first option might be faster, but we need to measure it to find out. A
new boot command line option is provided to select between the two, with a
third setting that uses a mixture of the two.
2022-02-28 22:05:21 +00:00
Martin Whitaker 631cd553aa Make sure the cache is enabled on all CPU cores, not just the BSP. 2022-02-28 22:05:21 +00:00
Martin Whitaker 03464dce85 Make sure the bootparams structure remains accessible during startup.
Once we start remapping other regions, it's possible it could get overlaid.
2022-02-28 22:05:21 +00:00
Martin Whitaker 02bcec2418 Remove unnecessary volatile qualifiers from test state variables.
Thread safety is ensured by the barriers.
2022-02-19 12:44:14 +00:00
Martin Whitaker e032df50d2 Minor code improvement for efficiency. 2022-02-19 11:52:42 +00:00
Martin Whitaker e99a7aedb3 Revert to starting APs before doing the dummy runs.
That optimisation occasionally caused a hang if the CPU sequencing
mode was reconfigured after testing had started. It didn't make a
significant difference to the startup delay, so just drop it.
2022-02-18 20:35:36 +00:00
Martin Whitaker cadad583d7 Eliminate the spinlock used when halting inactive CPU cores.
This is a more efficient implementation.
2022-02-18 20:08:24 +00:00
Martin Whitaker 807c4153c1 Add tracing for AP startup.
Also comment out tracing of memory window starts to reduce verbosity.
2022-02-13 20:25:58 +00:00
Martin Whitaker efc9a9c16a Don't attempt to start the APs when restarting after a config change.
Leave the APs running whilst the BSP repeats the dummy runs. This means
we need to bypass the barriers during a dummy run. The APs will wait at
the first barrier until the BSP starts the first real run.
2022-02-12 19:37:58 +00:00
Martin Whitaker 2bf1623733 Halt CPU cores that are not active in a test.
This saves a lot of power when performing sequential tests.
2022-02-12 19:30:14 +00:00
Martin Whitaker 93343db711 Remove redundant barrier. 2022-02-07 18:50:22 +00:00
Martin Whitaker 3028cd31f9 Increase sleep time when polling for all other APs started.
Also fix warning about usleep not being defined.
2022-02-05 18:07:03 +00:00
Martin Whitaker 242bd77927 Remove unwanted debug code. 2022-02-05 18:04:38 +00:00
Martin Whitaker 503aea321d Remove redundant start_mutex.
The mutex is now implemented in the assembly language boot code.
2022-02-05 18:03:32 +00:00
Martin Whitaker 13efd906f1 Guard against an AP starting more than once. 2022-02-03 19:48:27 +00:00
Martin Whitaker dcac527068 Don't make assumptions about usable memory.
When using a legacy BIOS, the memory regions used by the BIOS are well
defined. This is not the case when using a UEFI BIOS. So include the
stack area in the BSS so the loader knows how much memory to allocate,
and check we have space to relocate the program to either low or high
memory.

There are still some assumptions in the USB driver code that need to
be fixed.
2022-02-02 12:20:39 +00:00
Martin Whitaker fb0f1a7fe5 Don't start APs until after dummy runs have finished.
This should significantly improve startup time on machines with many
cores, as the barriers become no-ops during the dummy runs.
2022-02-01 23:50:49 +00:00
Martin Whitaker ccab9ab081 Fix operation with a subset of CPU cores enabled.
The last commit removed too much - there are a couple of places where
we need to use a virtual CPU number rather than a physical CPU number.
2022-02-01 15:38:06 +00:00
Martin Whitaker 16d55b7dad Remove distinction between physical and virtual CPUs.
This is no longer needed, now we can display as many CPUs as we can
physically handle.
2022-01-31 22:59:14 +00:00
Martin Whitaker 4100a44b12 Properly protect the startup stack with a mutex.
Because we start the APs sequentially, it is unlikely they will coincide
for the brief period that they use the temporary startup stack, but we
should guard against it. This allows us to remove the mutex around the
restart of each AP when relocating, which should improve test times.
2022-01-31 21:54:24 +00:00
Martin Whitaker 17093a96f9 Optimise the AP startup code to reduce the startup delay. 2022-01-31 19:47:32 +00:00
Martin Whitaker ab278566e4 Bypass start barriers during dummy runs.
This should speed up the dummy runs on distributed SMP systems.
2022-01-29 17:11:46 +00:00