Opened 10 days ago

Last modified 8 days ago

#19198 new bug

microcode update for AMD CPUs possibly buggy?

Reported by: bipolar Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/Kernel Version: R1/beta5
Keywords: Cc:
Blocked By: Blocking:
Platform: x86

Description

While trying to test updates to the CPU microcode recipes, I got the following on the syslog:

[...]
KERN: Welcome to the Haiku boot loader!
KERN: Haiku revision: hrev58278
[...]
KERN: ucode_load: system/non-packaged/data/firmware/amd-ucode/microcode_amd.bin
KERN: ucode_load: microcode file read in memory
[...]
KERN: Welcome to kernel debugger output!
KERN: Haiku revision: hrev58278, debug level: 2
KERN: find_microcode_amd update cpu not found in equiv table
KERN: CPU 0: no update found
KERN: CPU 0: type 0 family 15 extended_family 1 model 4 extended_model 0 stepping 2, string 'AuthenticAMD'
KERN: CPU 0: vendor 'AMD' model name 'AMD Phenom(tm) II X4 925 Processor'
KERN: CPU 0: apic id 0, package 0, core 0, smt 0
KERN: CPU 0: features: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clfsh mmx fxsr sse sse2 htt sse3 monitor cx16 popcnt syscall nx mmxext ffxsr pdpe1gb long 3dnowext 3dnow hwpstate constant_tsc 
KERN: CPU 0: patch_level 0x10000c6

But if I use `amd_ucode_info.py` on the latest `microcode_amd.bin` file I get:

> python3 amd_ucode_info.py microcode_amd.bin
Microcode patches in microcode_amd.bin:
  Family=0x10 Model=0x02 Stepping=0x03: Patch=0x01000083 Length=960 bytes
  Family=0x10 Model=0x02 Stepping=0x02: Patch=0x01000083 Length=960 bytes
  Family=0x10 Model=0x02 Stepping=0x0a: Patch=0x01000084 Length=960 bytes
  Family=0x10 Model=0x06 Stepping=0x02: Patch=0x010000c7 Length=960 bytes
  Family=0x10 Model=0x04 Stepping=0x03: Patch=0x010000c8 Length=960 bytes
  Family=0x10 Model=0x06 Stepping=0x03: Patch=0x010000c8 Length=960 bytes
  Family=0x10 Model=0x05 Stepping=0x03: Patch=0x010000c8 Length=960 bytes
  Family=0x10 Model=0x08 Stepping=0x01: Patch=0x010000d9 Length=960 bytes
  Family=0x10 Model=0x09 Stepping=0x01: Patch=0x010000d9 Length=960 bytes
  Family=0x10 Model=0x08 Stepping=0x00: Patch=0x010000da Length=960 bytes
  Family=0x10 Model=0x04 Stepping=0x02: Patch=0x010000db Length=960 bytes
  Family=0x10 Model=0x05 Stepping=0x02: Patch=0x010000db Length=960 bytes
  Family=0x10 Model=0x0a Stepping=0x00: Patch=0x010000dc Length=960 bytes
  Family=0x11 Model=0x03 Stepping=0x01: Patch=0x02000032 Length=512 bytes
  Family=0x12 Model=0x01 Stepping=0x00: Patch=0x03000027 Length=960 bytes
  Family=0x14 Model=0x01 Stepping=0x00: Patch=0x05000029 Length=1568 bytes
  Family=0x14 Model=0x02 Stepping=0x00: Patch=0x05000119 Length=1568 bytes

That Family=0x10 Model=0x04 Stepping=0x02: Patch=0x010000db Length=960 bytes should match my Phenom II X4 CPU, no?

I haven't even tried before on this machine, because the (now clearly outdated) https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/amd-ucode/README didn't listed my CPU.

In any case, nothing critical, but I thought that providing some feedback wasn't a bad idea.

Change History (13)

comment:1 by korli, 10 days ago

Looks like I got this check wrong at src/system/kernel/arch/x86/arch_cpu.cpp#n1196

It should be:

if (signature == table[i].installed_cpu) {

comment:2 by bipolar, 9 days ago

Alright, progress! :-D

After applying that change over hrev58191 (sorry for the old hrev, didn't noticed till too late, and build times are too long here), I get:

KERN: Welcome to kernel debugger output!
KERN: Haiku revision: hrev58191+dirty, debug level: 2
KERN: find_microcode_amd found equiv cpu: 1041
KERN: find_microcode_amd update found rev_id 1022
KERN: find_microcode_amd update found rev_id 1020
KERN: find_microcode_amd update found rev_id 1062
KERN: find_microcode_amd update found rev_id 1043
KERN: find_microcode_amd update found rev_id 1081
KERN: find_microcode_amd update found rev_id 1080
KERN: find_microcode_amd incorrect alignment
KERN: find_microcode_amd update found rev_id 10a0
KERN: find_microcode_amd update found rev_id 2031
KERN: find_microcode_amd update found rev_id 3010
KERN: find_microcode_amd update found rev_id 5010
KERN: find_microcode_amd update found rev_id 5020
KERN: find_microcode_amd no fw update found for this cpu
KERN: CPU 0: no update found
KERN: CPU 0: type 0 family 15 extended_family 1 model 4 extended_model 0 stepping 2, string 'AuthenticAMD'
KERN: CPU 0: vendor 'AMD' model name 'AMD Phenom(tm) II X4 925 Processor'
KERN: CPU 0: apic id 0, package 0, core 0, smt 0
KERN: CPU 0: features: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clfsh mmx fxsr sse sse2 htt sse3 monitor cx16 popcnt syscall nx mmxext ffxsr pdpe1gb long 3dnowext 3dnow hwpstate constant_tsc 
KERN: CPU 0: patch_level 0x10000c6

comment:3 by korli, 9 days ago

So the one with "incorrect alignment" should be the one to be loaded. In this case, the incorrect alignment would probably trigger a GPE. We need to copy the microcode in a new aligned allocation.

Last edited 9 days ago by korli (previous) (diff)

comment:4 by korli, 9 days ago

Platform: Allx86

comment:7 by bipolar, 9 days ago

Hi korli! Did a local build via cherry-picking +8502 over hrev58285. Installed resulting haiku.hpkg... boot stops at icon screen, with no icons lit. :-(

Tried enabling onscreen syslog debug... nothing gets printed. Had to select previous state (hrev58283 currently).

Will try with the .hpkg from "movingborders", just in case my build went bad for some reason, and report back.

comment:8 by bipolar, 9 days ago

Same issue with the official test build, I'm afraid. Only managed to boot into hrev58285_8502_1, after mounting this partition from a different install, and renaming microcode_amd.bin to microcode_amd.bin.off.

While this PC does has an UART header I could try to use... I don't have any other machine to access the serial port, so I can't provide serial debug output from bootloader, sorry :-(

comment:9 by korli, 9 days ago

Thanks for the test. No idea yet. Do you happen to see an microcode update on Linux?

comment:10 by bipolar, 9 days ago

My old Ubuntu 18.04 didn't had amd-microcode installed (and its repos are now offline :-D), fortunatelly, some random EndeavourOS test install I had did. dmesg shows:

$ sudo dmesg | grep -i microcode
[    0.989335] microcode: microcode updated early to new patch_level=0x010000db
[    0.989383] microcode: CPU0: patch_level=0x010000db
[    0.989384] microcode: CPU1: patch_level=0x010000db
[    0.989386] microcode: CPU2: patch_level=0x010000db
[    0.989387] microcode: CPU3: patch_level=0x010000db
[    0.989402] microcode: Microcode Update Driver: v2.2.

where Ubuntu showed patch_level=0x010000c6 there instead.

comment:11 by korli, 9 days ago

Did you test with x86 or x86_64?

comment:12 by bipolar, 8 days ago

So far, I've only tested on x86_64. Will try and see if https://haiku.movingborders.es/testbuild/Ibc3c950213971363428df71a365d835fc3194a38/1/hrev58285/x86_gcc2h/ behaves differently.

comment:13 by bipolar, 8 days ago

After some boot issues on 32 bits bare-metal (hrev58265 failed to find boot partitions, hrev58179 booted fine, was able to update to hrev58285 and boot normally again)...

Tested hrev58285_8502_1 on 32 bits (by installing haiku.hpkg, haiku_x86.hpkg, and haiku_loader.hpkg from the link above, and manually placing microcode_amd.bin in the expected non-packaged location).

Boot halts on the bootsplash screen with no icons lit (and no Haiku logo visible, for some reason).

Using boot menu to select previous state worked fine.

Last edited 8 days ago by bipolar (previous) (diff)
Note: See TracTickets for help on using tickets.