# Resume not working on Skylake



## birbignano (Jul 28, 2016)

Hi to all. I am new to FreeBSD and I have installed the 10.3 on my laptop. Everything ( except wifi ) seems to work for now, but there is a problem regarding suspend/resume. The machine suspends correctly, but on resuming it is stuck with a black screen and nothing more. Also the machine powers down itself after a dozen of seconds or so, then restarts and the screen remains black. Only after powering it down pressing the power button and then powering it on, it restarts working correctly.

The hardware in question is as follows


```
hostb0@pci0:0:0:0:    class=0x060000 card=0x65401558 chip=0x19108086 rev=0x07 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Skylake Host Bridge/DRAM Registers'
    class      = bridge
    subclass   = HOST-PCI
pcib1@pci0:0:1:0:    class=0x060400 card=0x65401558 chip=0x19018086 rev=0x07 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'Skylake PCIe Controller (x16)'
    class      = bridge
    subclass   = PCI-PCI
vgapci1@pci0:0:2:0:    class=0x030000 card=0x65401558 chip=0x191b8086 rev=0x06 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'HD Graphics 530'
    class      = display
    subclass   = VGA
xhci0@pci0:0:20:0:    class=0x0c0330 card=0x65401558 chip=0xa12f8086 rev=0x31 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Sunrise Point-H USB 3.0 xHCI Controller'
    class      = serial bus
    subclass   = USB
none0@pci0:0:20:2:    class=0x118000 card=0x65401558 chip=0xa1318086 rev=0x31 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Sunrise Point-H Thermal subsystem'
    class      = dasp
none1@pci0:0:22:0:    class=0x078000 card=0x65401558 chip=0xa13a8086 rev=0x31 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Sunrise Point-H CSME HECI'
    class      = simple comms
ahci0@pci0:0:23:0:    class=0x010601 card=0x65401558 chip=0xa1038086 rev=0x31 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Sunrise Point-H SATA Controller [AHCI mode]'
    class      = mass storage
    subclass   = SATA
pcib2@pci0:0:28:0:    class=0x060400 card=0x65401558 chip=0xa1148086 rev=0xf1 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'Sunrise Point-H PCI Express Root Port'
    class      = bridge
    subclass   = PCI-PCI
pcib3@pci0:0:28:5:    class=0x060400 card=0x65401558 chip=0xa1158086 rev=0xf1 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'Sunrise Point-H PCI Express Root Port'
    class      = bridge
    subclass   = PCI-PCI
pcib4@pci0:0:29:0:    class=0x060400 card=0x65401558 chip=0xa1188086 rev=0xf1 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'Sunrise Point-H PCI Express Root Port'
    class      = bridge
    subclass   = PCI-PCI
isab0@pci0:0:31:0:    class=0x060100 card=0x65401558 chip=0xa14e8086 rev=0x31 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Sunrise Point-H LPC Controller'
    class      = bridge
    subclass   = PCI-ISA
none2@pci0:0:31:2:    class=0x058000 card=0x65401558 chip=0xa1218086 rev=0x31 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Sunrise Point-H PMC'
    class      = memory
hdac0@pci0:0:31:3:    class=0x040300 card=0x65401558 chip=0xa1708086 rev=0x31 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Sunrise Point-H HD Audio'
    class      = multimedia
    subclass   = HDA
none3@pci0:0:31:4:    class=0x0c0500 card=0x65401558 chip=0xa1238086 rev=0x31 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Sunrise Point-H SMBus'
    class      = serial bus
    subclass   = SMBus
vgapci0@pci0:1:0:0:    class=0x030000 card=0x67831558 chip=0x161810de rev=0xa1 hdr=0x00
    vendor     = 'NVIDIA Corporation'
    device     = 'GM204M [GeForce GTX 970M]'
    class      = display
    subclass   = VGA
none4@pci0:2:0:0:    class=0xff0000 card=0x65401558 chip=0x528710ec rev=0x01 hdr=0x00
    vendor     = 'Realtek Semiconductor Co., Ltd.'
re0@pci0:2:0:1:    class=0x020000 card=0x67801558 chip=0x816810ec rev=0x12 hdr=0x00
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller'
    class      = network
    subclass   = ethernet
none5@pci0:3:0:0:    class=0x028000 card=0x10108086 chip=0x24f38086 rev=0x3a hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Wireless 8260'
    class      = network
nvme0@pci0:4:0:0:    class=0x010802 card=0xa801144d chip=0xa802144d rev=0x01 hdr=0x00
    vendor     = 'Samsung Electronics Co Ltd'
    device     = 'NVMe SSD Controller'
    class      = mass storage
    subclass   = NVM
```

The output of dmesg is


```
Copyright (c) 1992-2016 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
    The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.3-STABLE #1: Wed Jul 27 15:25:14 CEST 2016
    root@kirika:/usr/obj/usr/src/sys/CUSTOM amd64
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
VT(efifb): resolution 800x600
info: [drm] Initialized drm 1.1.0 20060810
CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz (2592.13-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=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=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
real memory  = 17179869184 (16384 MB)
avail memory = 16353533952 (15595 MB)
Event timer "LAPIC" quality 600
ACPI APIC Table: <ALASKA A M I >
FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs
FreeBSD/SMP: 1 package(s) x 4 core(s) x 2 SMT threads
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
 cpu2 (AP): APIC ID:  2
 cpu3 (AP): APIC ID:  3
 cpu4 (AP): APIC ID:  4
 cpu5 (AP): APIC ID:  5
 cpu6 (AP): APIC ID:  6
 cpu7 (AP): APIC ID:  7
random: <Software, Yarrow> initialized
ioapic0 <Version 2.0> irqs 0-119 on motherboard
kbd1 at kbdmux0
cryptosoft0: <software crypto> on motherboard
aesni0: <AES-CBC,AES-XTS> on motherboard
acpi0: <ALASKA A M I > on motherboard
acpi0: Power Button (fixed)
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
cpu2: <ACPI CPU> on acpi0
cpu3: <ACPI CPU> on acpi0
cpu4: <ACPI CPU> on acpi0
cpu5: <ACPI CPU> on acpi0
cpu6: <ACPI CPU> on acpi0
cpu7: <ACPI CPU> on acpi0
hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
Timecounter "HPET" frequency 24000000 Hz quality 950
Event timer "HPET" frequency 24000000 Hz quality 550
atrtc0: <AT realtime clock> port 0x70-0x77 irq 8 on acpi0
atrtc0: Warning: Couldn't map I/O.
Event timer "RTC" frequency 32768 Hz quality 0
attimer0: <AT timer> port 0x40-0x43,0x50-0x53 irq 0 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1808-0x180b on acpi0
acpi_ec0: <Embedded Controller: GPE 0x3> port 0x62,0x66 on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pcib1: <ACPI PCI-PCI bridge> at device 1.0 on pci0
pci1: <ACPI PCI bus> on pcib1
vgapci0: <VGA-compatible display> port 0xe000-0xe07f mem 0xde000000-0xdeffffff,0xc0000000-0xcfffffff,0xd0000000-0xd1ffffff at device 0.0 on pci1
vgapci1: <VGA-compatible display> port 0xf000-0xf03f mem 0xdd000000-0xddffffff,0xa0000000-0xbfffffff at device 2.0 on pci0
vgapci1: Boot video device
xhci0: <XHCI (generic) USB 3.0 controller> mem 0xdf410000-0xdf41ffff at device 20.0 on pci0
xhci0: 32 bytes context size, 64-bit DMA
usbus0: waiting for BIOS to give up control
usbus0 on xhci0
pci0: <simple comms> at device 22.0 (no driver attached)
ahci0: <AHCI SATA controller> port 0xf090-0xf097,0xf080-0xf083,0xf060-0xf07f mem 0xdf428000-0xdf429fff,0xdf42c000-0xdf42c0ff,0xdf42b000-0xdf42b7ff at device 23.0 on pci0
ahci0: AHCI v1.31 with 2 6Gbps ports, Port Multiplier not supported
ahcich2: <AHCI channel> at channel 2 on ahci0
ahcich3: <AHCI channel> at channel 3 on ahci0
ahciem0: <AHCI enclosure management bridge> on ahci0
pcib2: <ACPI PCI-PCI bridge> at device 28.0 on pci0
pci2: <ACPI PCI bus> on pcib2
pci2: <unknown> at device 0.0 (no driver attached)
re0: <RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet> port 0xd000-0xd0ff mem 0xdf314000-0xdf314fff,0xdf310000-0xdf313fff at device 0.1 on pci2
re0: Using 1 MSI-X message
re0: turning off MSI enable bit.
re0: ASPM disabled
re0: Chip rev. 0x5c800000
re0: MAC rev. 0x00000000
miibus0: <MII bus> on re0
rgephy0: <RTL8251 1000BASE-T media interface> PHY 1 on miibus0
rgephy0:  none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT-FDX, 1000baseT-FDX-master, 1000baseT-FDX-flow, 1000baseT-FDX-flow-master, auto, auto-flow
re0: Using defaults for TSO: 65518/35/2048
re0: Ethernet address: 80:fa:5b:28:77:2e
pcib3: <ACPI PCI-PCI bridge> at device 28.5 on pci0
pci3: <ACPI PCI bus> on pcib3
pci3: <network> at device 0.0 (no driver attached)
pcib4: <ACPI PCI-PCI bridge> at device 29.0 on pci0
pci4: <ACPI PCI bus> on pcib4
nvme0: <Generic NVMe Device> port 0xc000-0xc0ff mem 0xdf100000-0xdf103fff at device 0.0 on pci4
isab0: <PCI-ISA bridge> at device 31.0 on pci0
isa0: <ISA bus> on isab0
pci0: <memory> at device 31.2 (no driver attached)
hdac0: <Intel (0xa170) HDA Controller> mem 0xdf420000-0xdf423fff,0xdf400000-0xdf40ffff at device 31.3 on pci0
acpi_button0: <Power Button> on acpi0
acpi_button1: <Sleep Button> on acpi0
acpi_lid0: <Control Method Lid Switch> on acpi0
acpi_acad0: <AC Adapter> on acpi0
battery0: <ACPI Control Method Battery> on acpi0
acpi_tz0: <Thermal Zone> on acpi0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: model Generic PS/2 mouse, device ID 0
ppc0: cannot reserve I/O port range
est0: <Enhanced SpeedStep Frequency Control> on cpu0
est1: <Enhanced SpeedStep Frequency Control> on cpu1
est2: <Enhanced SpeedStep Frequency Control> on cpu2
est3: <Enhanced SpeedStep Frequency Control> on cpu3
est4: <Enhanced SpeedStep Frequency Control> on cpu4
est5: <Enhanced SpeedStep Frequency Control> on cpu5
est6: <Enhanced SpeedStep Frequency Control> on cpu6
est7: <Enhanced SpeedStep Frequency Control> on cpu7
random: unblocking device.
usbus0: 5.0Gbps Super Speed USB v3.0
ZFS filesystem version: 5
ZFS storage pool version: features support (5000)
Timecounters tick every 1.000 msec
ugen0.1: <0x8086> at usbus0
uhub0: <0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
nvd0: <SAMSUNG MZVPV256HDGL-00000> NVMe namespace
nvd0: 244198MB (500118192 512 byte sectors)
hdacc0: <Realtek ALC892 HDA CODEC> at cad 0 on hdac0
hdaa0: <Realtek ALC892 Audio Function Group> at nid 1 on hdacc0
pcm0: <Realtek ALC892 (Internal Analog)> at nid 20 and 18 on hdaa0
pcm1: <Realtek ALC892 (Rear Analog)> at nid 23 and 24 on hdaa0
pcm2: <Realtek ALC892 (Rear Analog Headphones)> at nid 27 on hdaa0
pcm3: <Realtek ALC892 (Rear Digital)> at nid 30 on hdaa0
hdacc1: <Intel (0x2809) HDA CODEC> at cad 2 on hdac0
hdaa1: <Intel (0x2809) Audio Function Group> at nid 1 on hdacc1
pcm4: <Intel (0x2809) (HDMI/DP 8ch)> at nid 3 on hdaa1
ada0 at ahcich3 bus 0 scbus1 target 0 lun 0
ada0: <Samsung SSD 850 EVO 500GB EMT01B6Q> ACS-2 ATA SATA 3.x device
ada0: Serial Number S21JNXAG731929J
ada0: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 512bytes)
ada0: Command Queueing enabled
ada0: 476940MB (976773168 512 byte sectors)
ada0: quirks=0x1<4K>
ada0: Previously was known as ad6
ses0 at ahciem0 bus 0 scbus2 target 0 lun 0
ses0: <AHCI SGPIO Enclosure 1.00 0001> SEMB S-E-S 2.00 device
ses0: SEMB SES Device
SMP: AP CPU #1 Launched!
SMP: AP CPU #2 Launched!
SMP: AP CPU #7 Launched!
SMP: AP CPU #6 Launched!
SMP: AP CPU #3 Launched!
SMP: AP CPU #5 Launched!
SMP: AP CPU #4 Launched!
Timecounter "TSC-low" frequency 1296064118 Hz quality 1000
uhub0: 24 ports with 24 removable, self powered
ugen0.2: <Logitech> at usbus0
ukbd0: <Logitech Gaming Mouse G402, class 0/0, rev 2.00/90.02, addr 1> on usbus0
kbd2 at ukbd0
Enter passphrase for ada0p4: ugen0.3: <EgisTec> at usbus0
ugen0.4: <vendor 0x8087> at usbus0
GEOM_ELI: Device ada0p4.eli created.
GEOM_ELI: Encryption: AES-XTS 256
GEOM_ELI:     Crypto: hardware
Trying to mount root from zfs:zroot/ROOT/default []...
re0: link state changed to DOWN
re0: link state changed to UP
ums0: <Logitech Gaming Mouse G402, class 0/0, rev 2.00/90.02, addr 1> on usbus0
ums0: 16 buttons and [XYZT] coordinates ID=0
ubt0: <vendor 0x8087 product 0x0a2b, class 224/1, rev 2.00/0.01, addr 3> on usbus0
WARNING: attempt to domain_add(bluetooth) after domainfinalize()
WARNING: attempt to domain_add(netgraph) after domainfinalize()
```

The kernel modules loaded are


```
Id Refs Address            Size     Name
 1   55 0xffffffff80200000 17afc70  kernel
 2    1 0xffffffff819b0000 300598   zfs.ko
 3    2 0xffffffff81cb1000 6040     opensolaris.ko
 4    1 0xffffffff81cb8000 21598    geom_eli.ko
 5    3 0xffffffff81cda000 35238    crypto.ko
 6    1 0xffffffff81d11000 59e0     aesni.ko
 7    1 0xffffffff81d18000 ceab8    i915kms.ko
 8    2 0xffffffff81de7000 5570     iicbb.ko
 9    5 0xffffffff81ded000 6298     iicbus.ko
10    2 0xffffffff81df4000 4470     iic.ko
11    2 0xffffffff81df9000 829d0    drm2.ko
12    1 0xffffffff821e6000 3584     ums.ko
13    1 0xffffffff821ea000 4e8b     ng_ubt.ko
14    5 0xffffffff821ef000 b9fa     netgraph.ko
15    1 0xffffffff821fb000 93a8     ng_hci.ko
16    3 0xffffffff82205000 1074     ng_bluetooth.ko
17    1 0xffffffff82207000 c32e     ng_l2cap.ko
18    1 0xffffffff82214000 1a6ed    ng_btsocket.ko
19    1 0xffffffff8222f000 3829     ng_socket.ko
```

Currently I have a NVMe ssd on which there is Linux and a SATA ssd on which I have installed FreeBSD. 

Also the machine implements Nvidia optimus. I have tried booting with the IGP enabled and disabled, same result.

I have tried the debugging methods described in the wiki too.

So, is there a way to have working resume? Maybe someone can point me to effective debugging methodologies?

Thanks in advance.


----------



## birbignano (Jul 28, 2016)

P.S. I have read on the net the vesa(4) option of the vga(4) driver could be the culprit, so I recompiled a kernel without it. Same result unfortunately.


----------



## drhowarddrfine (Jul 28, 2016)

I decided to resume not working on everything today.


----------



## birbignano (Jul 29, 2016)

Ok, so someone have ideas? What is the current state of the Skylake support in FreeBSD? Online I read contrasting opinions. Phoronix says FreeBSD 10.3 has Skylake support, but I don't have informations about the details.


----------



## tobik@ (Jul 31, 2016)

birbignano said:


> Ok, so someone have ideas? What is the current state of the Skylake support in FreeBSD? Online I read contrasting opinions. Phoronix says FreeBSD 10.3 has Skylake support, but I don't have informations about the details.


There is no Skylake support on FreeBSD 10.3 and I believe there won't be in FreeBSD 11.0 either. You can check https://wiki.freebsd.org/Graphics for currently supported GPUs.

Your best option for graphics is https://wiki.freebsd.org/Graphics/SCFB (requires booting from UEFI to get an EFI framebuffer), which is a little faster than VESA.

Suspend/resume is AFAIK only going to be possible when i915kms.ko supports Skylake.


----------



## birbignano (Jul 31, 2016)

tobik said:


> There is no Skylake support on FreeBSD 10.3 and I believe there won't be in FreeBSD 11.0 either. You can check https://wiki.freebsd.org/Graphics for currently supported GPUs.



Humm but http://news.softpedia.com/news/free...support-zfs-boot-capability-more-502526.shtml

Also I have read that drm-next contains support for Skylake IGP, so maybe I could try using it.



tobik said:


> Your best option for graphics is https://wiki.freebsd.org/Graphics/SCFB (requires booting from UEFI to get an EFI framebuffer), which is a little faster than VESA.



Fortunately I have no problem with this, because the machine has a discrete Nvidia gpu, so I can use it. The only problem is resume not working.


----------

