Bug 214369 - FreeBSD-current, ioctl() invalid arguments on microcode update
Summary: FreeBSD-current, ioctl() invalid arguments on microcode update
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Many People
Assignee: freebsd-bugs mailing list
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2016-11-09 20:27 UTC by subbsd
Modified: 2016-11-11 21:26 UTC (History)
3 users (show)

See Also:
op: mfc-stable10?
op: mfc-stable11?


Attachments
0001-HBSD-increase-UCODE_SIZE_MAX-from-32kB-to-128kb-in-s.patch (1.27 KB, patch)
2016-11-09 21:09 UTC, op
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description subbsd 2016-11-09 20:27:43 UTC
Updating microcode broken on FreeBSD-current

Updating cpucodes...
/usr/local/share/cpucontrol/m36506e3_0000009d_0000009e.fw: updating
cpu /dev/cpuctl0 from rev 0x55 to rev 0x9e... failed.
cpucontrol: ioctl(): Invalid argument

I've tested on two FreeBSD 12.0-CURRENT r308381:

1) FreeBSD 12.0-CURRENT from svn://svn.freebsd.org/base/head r308381

CPU: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (3408.17-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x506e3  Family=0x6  Model=0x5e  Stepping=3
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x7ffafbff<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND>
  AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
  AMD Features2=0x121<LAHF,ABM,Prefetch>
  Structured Extended Features=0x29c6fbf<FSGSBASE,TSCADJ,SGX,BMI1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,NFPUSG,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PROCTRACE>
  XSAVE Features=0xf<XSAVEOPT,XSAVEC,XINUSE,XSAVES>
  VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID
  TSC: P-state invariant, performance statistics


2) FreeBSD 12.0 f16dfbd(drm-next-4.7)-dirty from https://github.com/FreeBSDDesktop/freebsd-base-graphics.git

CPU: Intel(R) Core(TM) i5-6260U CPU @ 1.80GHz (1800.08-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x406e3  Family=0x6  Model=0x4e  Stepping=3
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x7ffafbbf<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,SDBG,FMA,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND>
  AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
  AMD Features2=0x121<LAHF,ABM,Prefetch>
  Structured Extended Features=0x29c67af<FSGSBASE,TSCADJ,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,NFPUSG,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PROCTRACE>
  XSAVE Features=0xf<XSAVEOPT,XSAVEC,XINUSE,XSAVES>
  VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID
  TSC: P-state invariant, performance statistics

How to repeat:
% make -C /usr/ports/sysutils/devcpu-data install && service

https://lists.freebsd.org/pipermail/freebsd-current/2016-November/063752.html
Comment 1 op 2016-11-09 21:09:05 UTC
Created attachment 176831 [details]
0001-HBSD-increase-UCODE_SIZE_MAX-from-32kB-to-128kb-in-s.patch

Attached the proposed patch, which fixes the issue for me on skylake CPU.
Comment 2 op 2016-11-09 21:13:17 UTC
And the patch in phabricator: https://reviews.freebsd.org/D8486
Comment 3 subbsd 2016-11-10 09:53:54 UTC
(In reply to op from comment #2)


patch works for me too:

service microcode_update onestart
Updating cpucodes...
/usr/local/share/cpucontrol/mc0406e3_0000009d_0000009e.fw: updating cpu /dev/cpuctl0 from rev 0x8a to rev 0x9e... done.
/usr/local/share/cpucontrol/mc0406e3_0000009d_0000009e.fw: updating cpu /dev/cpuctl2 from rev 0x8a to rev 0x9e... done.
Done.
Comment 4 subbsd 2016-11-10 09:54:45 UTC
BTW, any plan to MFC into 10/11 ?