[Bug 192487] cpucontrol uses unsafe procedure to detect current microcode version

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 27 Mar 2022 10:37:11 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192487

--- Comment #13 from moon300web@gmx.net ---
I'm updating my laptop's microcode as follows
pkg install devcpu-data-intel
vi /etc/loader.conf
  cpu_microcode_load="YES"
  cpu_microcode_name="/boot/firmware/06-8e-0c"
(06-8e-0c downloaded from
https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/tree/main/intel-ucode)

This seems to work:
dmesg | grep -C 4 microcode
    VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID
    TSC: P-state invariant, performance statistics
  real memory  = 8589934592 (8192 MB)
  avail memory = 7844245504 (7480 MB)
  CPU microcode: updated from 0xea to 0xec    <---- System runs BIOS version
1.75, version 0xea, which is updated
  Event timer "LAPIC" quality 600
  ACPI APIC Table: <LENOVO TP-N2I  >
  FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs
  FreeBSD/SMP: 1 package(s) x 4 core(s) x 2 hardware threads

cpupdate -i 
  Found CPU(s) from Intel
  Core 0 to 7: CPUID: 806ec  Fam 06  Mod 8e  Step 0c  Flag 80 uCode 000000ec

If cpucontrol is run manually it seems to try and load an incorrect microcode
file:
cpucontrol -vv -u /dev/cpuctl0 
  cpucontrol: found cpu type 0 family 0x6 model 0xe stepping 0xc.
  ..
  /usr/local/share/cpucontrol/06-86-05.01: updating cpu /dev/cpuctl0 from rev
0xec to rev 0xb00000f... failed.  <---- incorrect file!
  cpucontrol: ioctl(): File exists
  ..
  cpucontrol: skipping /usr/local/share/cpucontrol/06-8e-0c.94 of rev 0xea: up
to date
  ..
  cpucontrol: skipping /usr/local/share/cpucontrol/06-8e-0c of rev 0xec: up to
date

There still seems to be something wrong in the detection of Intel CPU revision
on FreeBSD 13.0

Running:
FreeBSD 13.0-RELEASE-p8
on Lenovo T590
kernel: CPU: Intel(R) Core(TM) i5-8365U CPU @ 1.60GHz (1896.11-MHz K8-class
CPU)
kernel:   Origin="GenuineIntel"  Id=0x806ec  Family=0x6  Model=0x8e 
Stepping=12

-- 
You are receiving this mail because:
You are the assignee for the bug.