[Kernel-packages] [Bug 1728238] Re: update-initramfs not adding i915 GuC firmware for Kaby Lake, firmware fails to load

2019-04-05 Thread ericb
Complement :

loading a previous version (from the same sources) of the kernel, but
without being patched, seems to work:


me@MyMachine~ $ dmesg | grep i915
[2.016454] i915 :00:02.0: vgaarb: changed VGA decodes: 
olddecodes=io+mem,decodes=io+mem:owns=io+mem
[2.016960] [drm] Finished loading DMC firmware i915/kbl_dmc_ver1_01.bin 
(v1.1)
[2.029825] [drm] HuC: Loaded firmware i915/kbl_huc_ver02_00_1810.bin 
(version 2.0)
[2.040335] [drm] GuC: Loaded firmware i915/kbl_guc_ver9_14.bin (version 
9.14)
[2.054780] i915 :00:02.0: GuC submission enabled (firmware 
i915/kbl_guc_ver9_14.bin [version 9.14])
[2.055282] [drm] Initialized i915 1.6.0 20171023 for :00:02.0 on minor 0
[2.514905] i915 :00:02.0: fb0: inteldrmfb frame buffer device
[9.433635] snd_hda_intel :00:1f.3: bound :00:02.0 (ops 
i915_audio_component_bind_ops [i915])

=> i915/kbl_guc_ver9_14.bin
=> i915/kbl_huc_ver02_00_1810.bin


So, IMHO, the Intel blob had no problem at all, and it was maybe simply an 
issue caused by the server on Intel site

uname -a : Linux MintPro 4.15.21 #2 SMP Thu Apr 4 00:38:03 CEST 2019
x86_64 x86_64 x86_64 GNU/Linux

HTH


-- 
qɔᴉɹə

L'association EducOOo : http://www.educoo.org (dérivé d'OpenOffice)

https://framagit.org/ericb/miniDart (logiciel Handball)

https://github.com/ebachard (logiciels variés)

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1728238

Title:
  update-initramfs not adding i915 GuC firmware for Kaby Lake, firmware
  fails to load

Status in initramfs-tools:
  Invalid
Status in linux package in Ubuntu:
  Fix Released
Status in linux source package in Bionic:
  Fix Released

Bug description:
  == SRU Justification ==
  This firmware was optional when the MODULE_FIRMWARE statements were
  removed in bug 1626740 by Bionic commit dc0f16f9b50.  The firmware is now
  available and in use, so these statements need to be added back.

  Without these statements, The i915 Kabylake GuC firmware is failing to load
  on boot, and generating dmesg errors.

  == Fix ==
  Revert Bionic commit dc0f16f9b5084e6be2b8c79f8c6cd499a3451791.

  == Regression Potential ==
  Low.  Adding a statement back that was removed by a SAUCE patch.

  == Test Case ==
  A test kernel was built with this patch and tested by the original bug 
reporter.
  The bug reporter states the test kernel resolved the bug.

  
  == Original Bug Report ==
  The i915 Kabylake GuC firmware is failing to load on boot, and generating 
dmesg errors.  The Kabylake HuC firmware succeeds.  All files exist.  I've also 
verified the Kabylake GuC firmware matches the correct file size and md5 listed 
on 01.org.

  I then ran update-initramfs verbosely, and see that only
  /lib/firmware/i915/skl_guc_ver6_1.bin is being added.
  /lib/firmware/i915/bxt_guc_ver8_7.bin and
  /lib/firmware/i915/kbl_guc_ver9_14.bin seem to be ignored.

  I'm running a Dell XPS 13 9360 w/ Kabylake on Ubuntu 17.10 and
  initramfs-tools 0.125ubuntu12.  Perhaps Broxton systems might have the
  same issue?

  Output and logs:
  -

  ls -al /lib/firmware/i915/kbl_*

  -rw-r--r-- 1 root root   8616 Aug 17 11:08 
/lib/firmware/i915/kbl_dmc_ver1_01.bin
  lrwxrwxrwx 1 root root 19 Aug 17 11:08 
/lib/firmware/i915/kbl_dmc_ver1.bin -> kbl_dmc_ver1_01.bin
  -rw-r--r-- 1 root root 142656 Oct 20 21:12 
/lib/firmware/i915/kbl_guc_ver9_14.bin
  -rw-r--r-- 1 root root 218688 Aug 17 11:09 
/lib/firmware/i915/kbl_huc_ver02_00_1810.bin

  sudo cat /sys/kernel/debug/dri/0/i915_guc_load_status

  GuC firmware status:
  path: i915/kbl_guc_ver9_14.bin
  fetch: FAIL
  load: NONE
  version wanted: 9.14
  version found: 0.0
  header: offset is 0; size = 0
  uCode: offset is 0; size = 0
  RSA: offset is 0; size = 0

  GuC status 0x0001:
  Bootrom status = 0x0
  uKernel status = 0x0
  MIA Core status = 0x0

  Scratch registers:
  0: 0x0
  1: 0x0
  2: 0x0
  3: 0x0
  4: 0x0
  5: 0x0
  6: 0x0
  7: 0x0
  8: 0x0
  9: 0x0
  10: 0x0
  11: 0x0
  12: 0x0
  13: 0x0
  14: 0x0
  15: 0x0

  sudo cat /sys/kernel/debug/dri/0/i915_huc_load_status

  HuC firmware status:
  path: i915/kbl_huc_ver02_00_1810.bin
  fetch: SUCCESS
  load: SUCCESS
  version wanted: 2.0
  version found: 2.0
  header: offset is 0; size = 128
  uCode: offset is 128; size = 218304
  RSA: offset is 218432; size = 256

  HuC status 0x6000:

  dmesg

  [1.052879] hidraw: raw HID events driver (C) Jiri Kosina
  [1.056426] wmi_bus wmi_bus-PNP0C14:01: WQBC data block query control 
method not found
  [1.080320] rtsx_pci :3b:00.0: enabling device ( -> 0002)
  [1.082308] nvme nvme0: pci function :3c:00.0
  [1.095073] Setting dangerous option enable_guc_loading - tainting kernel
  [1.095075] Setting dangerous option enable_guc_submission - tainting 
kernel
  [1.097867] [drm] Memory usable by graphics device =

[Kernel-packages] [Bug 1728238] Re: update-initramfs not adding i915 GuC firmware for Kaby Lake, firmware fails to load

2019-04-05 Thread ericb
Disclaimer : what I did concerns 4.15.0 kernel only, on Intel machine
(Assus Zenbook pro, x86_64, model: UX410UAR)

Hello,

Sorry for coming late, but I had the same issue some days ago (never
tested before):something like  Guc not loading, while Huc did. Of course
I hit this page, and some other without find a complete solution.

**But** after one day searching, I finaly make it work (!!) , and I'll
try to explain what I did (I do not recommend to do the same, but I'll
attach a patch (under MIT license, or whatever you need, just ask).

The problems:

1. when you download the kbl_guc_ver9_14.bin blob from Intel site, looks like 
the downloaded file is an .xml file in fact, but not a binary at all. Maybe the 
site has an issue ? (sorry, not a website specialist)  // Can someone verify 
btw ?
 
2. IIRC Intel made kbl_guc_ver9_xy.bin for Kabylake, and I simply tried to make 
the kbl_guv_ver9_39.bin work.   

Important: I found kbl_guv_ver9_39.bin blob there :
http://archive.ubuntu.com/ubuntu/pool/main/l/linux-firmware/


What I did : 

- I extracted kbl_guv_ver9_39.bin from linux-firmware_1.178_all.deb, and
put it in /lib/firmware/i915

After that, I downloaded the most recent 4.15.0 kernel sources (on my
LinuxMint 18.3) :

=>  apt-get source linux-source-4.15.0 provided :

Réception de :1 http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu 
xenial-updates/main linux-hwe 4.15.0-47.50~16.04.1 (dsc) [6 511 B]
Réception de :2 http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu 
xenial-updates/main linux-hwe 4.15.0-47.50~16.04.1 (tar) [158 MB]

After I downloaded the sources, I copied initrd.img-4.15.0-34-generic as 
.config in the kernel tree, and I simply patched the following files (in 
drivers/gpu/drm/i915 : 
- intel_guc_fw.c
- intel_uc.c

Comments :
- In the first one, I simply modified the binary version (changing KBL_FW_MINOR 
from 14 to 39)
- In the second one, I followed Robert M. Fosha advice (link : 
https://patchwork.kernel.org/patch/10877903/), allowing to avoind timeout and 
retry when trying to load the blob

=> see the attached patch.

For the record, my current /etc/modprobe.d/i915.conf contains :


options i915 enable_fbc=1 fastboot=1 enable_guc_loading=1 
enable_guc_submission=1




 
Next step was to build the kernel, the Debian way (using make -j8 deb-pkg), and 
after installing the debs, I got everything working at the end, including the 
9_34 version of kbl_guc blob :-) :


me@MyMachine ~ $ dmesg | grep i915
[2.018994] i915 :00:02.0: vgaarb: changed VGA decodes: 
olddecodes=io+mem,decodes=io+mem:owns=io+mem
[2.019493] [drm] Finished loading DMC firmware i915/kbl_dmc_ver1_01.bin 
(v1.1)
[2.031452] [drm] HuC: Loaded firmware i915/kbl_huc_ver02_00_1810.bin 
(version 2.0)
[2.041847] [drm] GuC: Loaded firmware i915/kbl_guc_ver9_39.bin (version 
9.39)
[2.058753] i915 :00:02.0: GuC submission enabled (firmware 
i915/kbl_guc_ver9_39.bin [version 9.39])
[2.059299] [drm] Initialized i915 1.6.0 20171023 for :00:02.0 on minor 0
[2.519645] i915 :00:02.0: fb0: inteldrmfb frame buffer device
[9.408643] snd_hda_intel :00:1f.3: bound :00:02.0 (ops 
i915_audio_component_bind_ops [i915])



Conclusion : we can use kbl_guc_ver9_34 with 4.1.5.x kernel. Not sure it
is perfect, but

"# cat /sys/kernel/debug/dri/0/i915_huc_load_status"  returns :



HuC firmware: i915/kbl_huc_ver02_00_1810.bin
status: fetch SUCCESS, load SUCCESS
version: wanted 2.0, found 2.0
header: offset 0, size 128
uCode: offset 128, size 218304
RSA: offset 218432, size 256

HuC status 0x6080:


And  "# cat /sys/kernel/debug/dri/0/i915_guc_load_status" returns: 

GuC firmware: i915/kbl_guc_ver9_39.bin
status: fetch SUCCESS, load SUCCESS
version: wanted 9.39, found 9.39
header: offset 0, size 128
uCode: offset 128, size 147392
RSA: offset 147520, size 256

GuC status 0x800330ec:
Bootrom status = 0x76
uKernel status = 0x30
MIA Core status = 0x3

Scratch registers:
 0: 0xf000
 1: 0x1
 2: 0xfede7000
 3: 0x5f5e100
 4: 0x600
 5: 0xcdfd3
 6: 0x0
 7: 0x8
 8: 0x3
 9: 0x70240
10: 0x0
11: 0x0
12: 0x0
13: 0x0
14: 0x0
15: 0x0


Last but not least, thanks to Intel people for their work : the HD 620**
UHD works very well with mesa 19.1 devel / vulkan 1.1 !

(inxi -G returns  Card: Intel UHD Graphics 620)

-- 
qɔᴉɹə

L'association EducOOo : http://www.educoo.org (dérivé d'OpenOffice)

https://framagit.org/ericb/miniDart (logiciel Handball)

https://github.com/ebachard (logiciels variés)



** Patch added: "For testing purpose : this patch can break your machine. If 
you decice to use it, it is at your own risks."