Commit Graph
541 Commits
Author SHA1 Message Date
01e3 fac0e0b883 Avoid unnecessary screen writes
Calling clear_screen_region to erase the screen section and then
immediately calling printf/prints to write the new information is
sub-optimal as the screen gets updated twice.

This is especially expensive when Frame Buffer is used.

This also creates an unpleasant flickering effect with quickly changing
information, like test patterns.

Introduce printf_region and prints_region macros to call printf / prints
and then clear_screen_region to clear only the region outside the printed
area.

For consistency, also convert all display_cpu_topo_* macros.

Next, avoid redundant screen clearing in display_start_test:
 - display_test_number already takes care of padding,
 - test description gets updated immediately after, no need to clear
   that region.

Finally, simplify the code by adding SCREEN_MAX_COL to define the maximum
column of the screen, so it can be used instead of SCREEN_WIDTH - 1.
2026-07-20 09:30:48 +02:00
Lionel Debroux 2a04ce6a6b Improve the IMC reading code by including IMC support files into system/*/memctrl.c: the Makefile becomes simpler, the build becomes faster, the redundant includes can go away, the resulting binary is more optimized. 2026-07-20 09:30:42 +02:00
Lionel Debroux 7273d36c54 Inline several functions which are simple or have a single caller, to save a bit of space. 2026-07-20 09:30:42 +02:00
Sam Demeulemeester 6789cd5148 Fix random SMP hangs in x2APIC mode by fencing the ICR write
WRMSR to the x2APIC MSRs is not serializing, so an IPI could be sent
before older stores (eg: the barrier wakeup flags) are globally visible,
deadlocking the woken CPU on stale data.

Insert MFENCE;LFENCE before the ICR write, as required by the
Intel SDM (vol 3A, 11.12.3) and matching the linux kernerl
weak_wrmsr_fence(). The need for lfence is mostly black magic...
2026-07-19 17:16:21 +02:00
Sam Demeulemeester fdc7ffac49 la64: Add LASX Test (instead of the scalar fallback path) (#634) 2026-07-14 14:08:53 +02:00
Sam Demeulemeester 0738fdd2a0 Replace JEDEC code/pointer pairs with a code array + string table, saving 172 relocations and a few KB.
Suggested-by: Lionel Debroux <lionel_debroux@yahoo.fr>
Suggested-by: 01e3 <01e3@ans.pl>
2026-07-13 07:26:46 +02:00
Sam Demeulemeester 2dc40e0885 Add System/MB Serials to USB Report. Remove disabled tests 2026-07-12 23:55:07 +02:00
Sam Demeulemeester 115b98e922 Fix hang when the BSP is NOT the first CPU listed in the MADT
Find the boot CPU's APIC ID in the table and move it to slot 0, otherwise
smp_start() sends INIT-SIPI to the BSP itself and hangs the system.
Also skip entries whose APIC ID is already listed, as some firmwares
declare the same core as both a local APIC and an x2APIC entry.
This is a strict violation of the ACPI specs, but it happens...
2026-07-12 20:02:16 +02:00
Lionel Debroux d2c7cdfec9 Silence GCC 15+ warning on the GPT signature in a portable way, by using an array of bytes, like for the Basic Data Partition GUID. 2026-07-12 18:53:07 +02:00
Sam Demeulemeester d105c55e15 Normalize membw.c to LF and enforce LF endings via .gitattributes 2026-07-12 18:30:19 +02:00
Sam Demeulemeester 951cd58833 benchmark: account for RFO traffic in cached copies (fixes L3 speed too low) 2026-07-12 18:29:04 +02:00
Sam Demeulemeester fe06e5d641 Fix EPYC Temperature reporting (again) (#633)
Check CUR_TEMP_TJ_SEL for EPYC CPUs
2026-07-12 15:37:06 +02:00
Sam Demeulemeester 7fc312d5b0 Add support for aarch64 (ARM64) architecture (#626)
* Initial commit for ARM64 (header.S & startup.S)

* Add Aarch64 interrupt handler

* Adapt lib/ to Aarch64

* Small ASM addition for AArch64

* Rewrite Aarch64 system/
- cpuid.c/cpuinfo.c for CPU detection (Qualcomm, Apple, Nvidia, etc)
- Add ARM Power State Coordination Interface (PSCI) functions
- vmem.c for Virtual Memory MAnagement on ARM64
- Various functions placeholders

* Add pseudo-TSC correction for Aarch64

* Add pseudo-tsc measurement for Aarch64

* Add Aarch64 if/elif on basic IO/MMIO/MEM RW functions

* Add support for Surface 13 / Snapdragon X KB USB
Fix an issue with the XHCI.c drivers with packets > 8 bytes

* Add MMIO Serial support for ARM64

* Add ARM64 ASM for block_move & mov_inv_fixed. Fix VM start pointer

* Add ARM Serial MMIO configuration

* Revert previous commit & reintroduce ARM64 cache functions

* Add ACPI MCFG Table description & SMP parsing. This requires careful review/testing to avoid BC issues!

* Revert previous commmit and reintroduce relocation and heap change for ARM64

* ARM64 does not support CPU PNS. Use DMI type4 parsing instead. Add SMBIOS v3 support (ARM64 does not support v2)

* Fix typo in pci.h

* Move Aarch64 load-limit computation from main.c to pmem.c

* Add .arm64 to version string. Use PMU for clock computation display. Fix D5 Temp NULL not handled

* Add Makefile and linker scripts for aarch64. Set cross-compiler from x86 by default

* Attempt to add aarch64 to workflow

* Remove a remaining internal debug flag

* Correct typos

* Fix ARM64 SMP freeze
assign heap when RAM is one contiguous region, keep it below 3GB for DMA (RPi5), add DSB before SEV to avoid missed barrier wakeups
Sync I-cache with D-cache after program relocation to prevent stale instruction fetch

* Validate MADT entry lengths to avoid reading past the table (or looping forever) on malformed ACPI tables

* aarch64: add NEON kernels for the vector PRSG tests
Tests 3 (bus stress) and 5 (moving inversions, random) now dispatch to 128-bit NEON fill/scan instead of scalar.

* Fix ARM64 data abort from the per-second DMI check & fix unbounded strstr()

* Fix ARM64 data abort when saving results to USB after a relocation

* Update README.md with AArch64 (ARM64) support

* aarch64: shrink static string tables, harden MCFG/paging
 Replace pointer-based name tables with inline char arrays (saves ~1.5KB + relocs)
alidate MCFG length/bus ranges, and bound pm_map/vm_map fills against overflows

* Add NVIDIA & latest Apple ARM SoC to cpuid.c

* Fix stale pointers read by the report writer after a program relocation
cpu_model gets a static init (creates its reloc record)SPD type becomes an inline char array
2026-07-12 13:27:45 +02:00
Sam Demeulemeester 33a5eeeffa Add support for USB Mass Storage Devices (#607)
* Initial commit for USB Mass Storage Support

* Add support for SCSI_16 and various fixes by debrouxl

* Fix USB HCD registration to skip failed probes (when a mass storage device was already found)

* Fix xHCI bulk transfer completion matching & accept short packets for IN transfers

* Add USB BOT error recovery and match xHCI control events by slot/EP

* Add EHCI bulk timeout/size guard, fix per-controller MSD port handling, and make xHCI keyboard re-arm precise

* Harden FAT/GPT parsing (cluster validation & block-size check) and fix RTC read issue due to R/W race

* Fix report varargs on x86_64, truncate F6 drive label, and clean up failed FAT file writes

* Fix stale hub VID/PID read, refactor USB MSD detection to helper & tidy usbhcd/display/config layout

* Scan for USB drives on demand when saving a report
Keep EHCI/xHCI controllers registered when empty and rescan free root ports on F6.
Also fix xHCI keyboard re-arm losing a key release, dropping the next same-key press.
2026-07-11 11:49:41 +02:00
Sam Demeulemeester a557c9402c Display memory info from DMI when SPD is unavailable (#629)
* Display memory info from DMI when SPD is unavailable
* ARM64 does not support CPU PNS. Use DMI type4 parsing instead. Add SMBIOS v3 support (ARM64 does not support v2)
2026-07-11 11:24:23 +02:00
Sam Demeulemeester 13d15e95bf Hardened AP Stack Management (#631)
* Hardened AP Stack Management (see PR for details)

* Fix low-memory boot issues caused by the larger AP stack area
 Zero only _bss.._stacks at first boot (the full sweep wiped ACPI/SMBIOS anchors above 0xE0000 on writable-shadow platforms), verify relocation addresses against pm_map, and relocate before smp_start() when the enabled CPUs' stacks would extend beyond usable low RAM, setting up the AP trampoline at start time.
2026-07-11 11:23:26 +02:00
Sam Demeulemeester c21e2cfa00 Move bus stress test from test 9 to test 3 to minimise time to first fault 2026-07-11 11:22:01 +02:00
Sam Demeulemeester 80717a1c5b Invert the PRSG xorshift stages by repeated squaring (~25% faster) 2026-07-11 11:22:01 +02:00
Sam Demeulemeester 72d08688ba Add rowhammer test (new test 11), disabled by default
Blacksmith-style non-uniform, REFRESH-synchronised many-sided hammering with DRAMA-lite row-stride discovery and a blind-stride fallback
x86 clflush(opt) engine with a coarse whole-cache-flush fallback for other targets. LA64 TBT
2026-07-11 11:22:01 +02:00
Sam Demeulemeester eaeaff181b Add bus stress test with fine-grained R/W turnarounds (new test 9)
Two per-CPU streams alternate NT-store bursts of a fresh PRSG sequence with read-verify of the previous round, forcing write-to-read turnarounds and row conflicts; odd rounds insert idle gaps to provoke PMIC load steps. Targets DDR5-era interface faults (link SI, marginal XMP/EXPO training, voltage droop) that on-die ECC cannot correct
Moving PRSG vector kernels from mov_inv_rng.C to a shared module in tests/
2026-07-11 11:22:01 +02:00
Sam Demeulemeester 6639e5cfb8 Enhance bit fade test: solid + random rounds (4 x 120s), parallel fill/check 2026-07-11 11:22:01 +02:00
Sam Demeulemeester 7f281dc670 Slightly adjust test dispatch (NT Store faster than expected 2026-07-11 11:22:01 +02:00
Sam Demeulemeester 55d4508adc Reorder tests and rebalance iterations to reduce time-to-first-fault
Run the random sequence test (now #4) and Modulo-20 (now #6) before the 64-bit shifting pattern test (now #8), so that every fault class is probed early in the pass.
Trade the walker's redundant repetitions (3 -> 1 iteration, plus only every other offset on the fast first pass) for more never-repeating work (random sequence 24 -> 96 rounds, Modulo-20 6 -> 9), at unchanged pass time.
2026-07-11 11:22:01 +02:00
Sam Demeulemeester 4e76e517eb Add SIMD moving inversions test with random sequences (AVX2/SSE2)
Replace tests 5 & 8 with a single moving inversions test using per-lane
xorshift sequences and non-temporal stores. Kernels (inline asm) are picked
at runtime via the new system/simd module: AVX2, SSE2 or scalar, with the
tier shown in the test name.
Fix and enable the AVX/XCR0 startup code and decode the XSAVE/AVX/AVX2 CPUID flags.Suite shrinks from 11 to 10 tests.
2026-07-11 11:22:01 +02:00
Sam Demeulemeester 7ff45d9466 Early version bump to v9.00 2026-07-07 16:40:42 +02:00
Sam Demeulemeester ffe3890502 Add acknowlegdment for LA64 port in README.md 2026-07-07 16:39:56 +02:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> fa3b6e7811 Bump actions/checkout from 6 to 7 (#624)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-05 02:02:49 +02:00
Sam Demeulemeester dae548f804 Add .osrel section to the binary (#617)
Closes #265
2026-05-25 20:58:41 +02:00
Sam Demeulemeester badcf8a57c Add temperature quirks for AMD EPYCs (#616)
Closes #411
2026-05-25 20:57:38 +02:00
Sam Demeulemeester 997d4d2da2 Suppress GCC 12+ warnings from BIOS Direct Access 2026-05-22 15:34:56 +02:00
Nikolaos Barkas d3827673d7 Fix SiS 530 & ALi Aladdin IV/V motherboard cache detection
Adds external L2 cache size detection for Socket 7 boards with SiS 530
  northbridge, and extends the existing ALi quirk to also cover Aladdin IV
  (M1531) in addition to Aladdin V (M1541).

  Tested on: K6-II + SiS 530 with 512KB L2 cache.

  Closes #602
  Co-authored-by: Sam Demeulemeester <github@x86-secret.com>
2026-05-17 19:56:29 +02:00
Sam DemeulemeesterandBerbe f9a30b0fa6 Add ECC polling option (#615)
Add ECC polling option (originally #566)

---------

Co-authored-by: Berbe <4251220+Berbe@users.noreply.github.com>
2026-05-17 19:39:23 +02:00
Michael Bemmerl f2fa5c92b6 Fix double handling of key input (#610)
Prevent auto-reboot after banner close
2026-05-17 19:05:10 +02:00
Sam Demeulemeester 494689a7ac Add many JEDEC IDs for unknown DRAM manufacturers v8.10 2026-05-06 22:25:51 +02:00
Sam Demeulemeester 3139edc1bf Fix LA64-only linker RWX warnings (#609)
* Fix LA64 RWX complains from ld

* Fix clause order
2026-04-27 22:17:34 +02:00
Sam Demeulemeester eac97205ff Better Cache & DRAM Bandwidth measurement (+Enable SSE2 on x86_64) (#587)
* Enable SSE2 on x86_64 build

* Better Memory Bandwidth measurement
- Moved memory speed measurement to a dedicated file
- Use SSE2 on x86_64 for better DRAM BW measurements
- Add a lot of safeguards to avoid issue with very large L3 cache
- Add a more precise way to target a specific cache
- Change the iteration number from fixed to time-constrained so overall test time is always same
- Added many configuration parameters for fine-tuning

* Revert saving XMM registers to stack.
Instead, make sure to use only GPR for interrupt handling (so it won't touch SIMD regs)
2026-04-07 22:21:55 +02:00
Sam Demeulemeester f0ae889c7e Make Invalid Temperature Sentinel Agnostic
Do not display DDR5 Temperature when not available
2026-04-07 18:52:38 +02:00
Dongyan QianandSam Demeulemeester fb158cdc3e Better CPU temperature display & Fix LA64 temperature overflow (#593)
* system/loongarch: Decode CPU temperature as signed 8-bit

Interpret the low 8 bits of the CPU temperature register as a signed
value, apply the platform-specific offset, and reject readings when the
temperature-valid bit is clear.

At low temperatures the raw register value would otherwise be interpreted
as a large positive number, which breaks the displayed reading.

Reported-by: Mingcong Bai <jeffbai@aosc.io>
Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>

* Better display of CPU temp from -99°C to 999°C

* Add sentinel value for CPU_TEMP_INVALID to allow negative temperature

---------

Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
Co-authored-by: Sam Demeulemeester <github@x86-secret.com>
2026-04-03 15:48:30 +02:00
Sam Demeulemeester 5b867a1506 Fix PE/COFF W^X violation & set NX flag to fix recent AMI UEFI refusing to load Memtest86+ (#604)
Some modern UEFI refuse to load PE image when a section have both IMAGE_SCN_MEM_WRITE and IMAGE_SCN_MEM_EXECUTE flag set. The .text section was using both because relocation need to write in data area.

Split the .text PE section in two: .text with read-execute only for code and rodata, and .data with read-write for dynamic, data and got. Also set IMAGE_DLLCHARACTERISTICS_NX_COMPAT flag accordingly (we only need it for startup and not when Memtest86+ is running later).

For x86 and LoongArch headers:
- NumberOfSections go from 3 to 4
- Remove IMAGE_SCN_MEM_WRITE from .text section
- Add new .data section with RW flag, no execute
- Fix SizeOfInitializedData to include .data and .sbat
- Set IMAGE_DLLCHARACTERISTICS_NX_COMPAT flag
- BaseOfData now point to .data instead of .sbat (PE32)
- .dynamic moved after relocation tables (memtest_shared.lds)
- page-aligned _etext_ro symbol used as read-only/writable boundary (memtest_shared.lds)
2026-04-03 15:44:34 +02:00
Sam Demeulemeester dbdb534f84 Fix Secureboot to allow shim loading (#595)
* Correct the format of sbat.csv

* Use real size for sbat section to avoid issue with shim parsing

* Trying to find why shim doesn't load it...
No success yet...
2026-03-31 23:04:46 +02:00
Sam Demeulemeester 7eb2568dfe Add support for Intel Lunar Lake & Panther Lake CPUs 2026-03-23 17:52:55 +01:00
Sam Demeulemeester a90edd63ce Fix tRP measurement on Intel LPDDR5 laptop
Use tRPpb instead of tRPab
2026-03-23 17:52:02 +01:00
Sam Demeulemeester 82bb87a710 Early bump to v8.10 2026-03-17 00:37:45 +01:00
Sam Demeulemeester e486dde638 Fix shadowed var declaration and whitespaces issues in config.c 2026-03-17 00:37:18 +01:00
Sam Demeulemeester feeb7d2d01 Fix Core Topology Determination on some CPUs (eg: Intel PTL) 2026-03-17 00:15:46 +01:00
Sam Demeulemeester 4fa58699a9 Add support for x2APIC (#583)
* First commit to support x2APIC

* Keep apio_x2apic bool everywhere to avoid compilation issues on LA64.
x2APIC support on LA64 must be checked later (probably different MSRs)

* Various fixes
 - Fix flags in MADT x2APIC (CPU only has ENABLED, not ONLINE
 - Increased chunk index and related function from 8 to 16-bit
 - Increase MAX_APS and MAX_APIC_IDS to 512 (need an APs stack size evaluation to be sure we will not overflow)
2026-02-14 13:35:45 +01:00
Dongyan Qian 450961c81e system/loongarch: Fixes display issues for 2K3000/3B6000M (#589)
On LoongArch, PCIe MMIO space above 4 GiB must be mapped as uncached;
otherwise writes may not reach the device, so framebuffer updates are not visible.
Adjust the PCIe memory window layout according to the Loongson 2K series documentation.

Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
2026-01-29 11:05:07 +01:00
Jonathan Teh d39efcdcda hwquirks: Detect cache on VIA VP/VPX (#576)
Extend the existing quirk for VP3/MVP3 to VP/VPX.
2026-01-19 01:09:58 +01:00
Yao Zi 1c075f8cd0 system: loongarch: cpuinfo: Unroll memspeed copy loop (#578)
Unlike x86_64 where rep movsl/movsq could be turned into efficient uOP
to achieve a good performance, on LoongArch a simple loop that copies
only 8 bytes per iteration couldn't fully feed the pipeline.

This makes calculated cache bandwidth suspcious: on my Loongson 3A5000
laptop, memtest86plus reports the same bandwidth for L1 and L2, which is
obviously incorrect.

Let's unroll memspeed loop to copy 64-bytes per iteration, which fits
in a cacheline and should fully feed the pipeline for even future
generations of Loongson cores.

Signed-off-by: Yao Zi <me@ziyao.cc>
2026-01-19 01:09:19 +01:00
martinwhitaker 213285adab Work-arounds for issues with Fedora GRUB EFI "linux" command (#572)
* Extend the header size to 4KB align the code segment in the image file.

A recent change (commit e41655885) to the Fedora implementation of the
GRUB "linux" command for EFI boot means it now loads the entire image
(including the header) at the preferred load address instead of just
loading the code section. This means the code section is no longer 4KB
aligned. In our image, the code section contains the combined .text and
.data sections, so this means the .data section is also no longer 4kB
aligned, which results in a GPF when the startup code loads the new page
directory address into CR3.

Work around this issue by extending the header size to force the code to
start on a 4KB boundary.

* Disable memory write protection after EFI setup.

A recent change (commit e41655885) to the Fedora implementation of the
GRUB "linux" command for EFI boot means it now attempts to make the
loaded code section read-only, using the EFI_MEMORY_ATTRIBUTE_PROTOCOL.
In our image the code section contains the combined .text and .data
sections. Our startup code needs to write to the .data section before
we can switch to our own page descriptor table, so globally disable
write protection as soon as we return from efisetup().

Our page descriptor table makes all pages writable (we need to be able
to write to memory to test it), so there's no need to reenable the
write protection once we've made the switch.

I have no UEFI firmware that implements the EFI_MEMORY_ATTRIBUTE_PROTOCOL,
so this fix is not yet proven.
2026-01-19 00:51:27 +01:00