Bug 229190

Summary: hdac0: Command timeout on address 2 (Intel Kabylake HDA CODEC)
Product: Base System Reporter: Danilo Egea Gondolfo <danilo>
Component: kernAssignee: freebsd-multimedia (Nobody) <multimedia>
Status: Closed FIXED    
Severity: Affects Only Me CC: 20.100, Scoobi_doo, agh, ben, brad, db, emaste, gleblanc, gmkousis, ihor, inbox, ish, jlduran, lme, maxim.usatov, ncakelic, rafi, rudolphfroger, sascha.folie, uqs
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=175688

Description Danilo Egea Gondolfo freebsd_committer freebsd_triage 2018-06-20 21:06:23 UTC
Hello, I'm seeing these messages bellow in my system.

Besides these messages, the audio work pretty well. Except when I use headphones (sysctl hw.snd.default_unit=1).
With headphones it is very low. If I increase the volume on the headphone the audio just get terrible, like if it's not getting enough power from the jack.

$ dmesg | grep hda 
hdac0: <Intel Kabylake-LP HDA Controller> mem 0xb4320000-0xb4323fff,0xb4310000-0xb431ffff irq 16 at device 31.3 on pci0
hdacc0: <Realtek ALC255 HDA CODEC> at cad 0 on hdac0
hdaa0: <Realtek ALC255 Audio Function Group> at nid 1 on hdacc0
pcm0: <Realtek ALC255 (Internal Analog)> at nid 20 and 18 on hdaa0
pcm1: <Realtek ALC255 (Front Analog Headphones)> at nid 33 on hdaa0
hdacc1: <Intel Kabylake HDA CODEC> at cad 2 on hdac0
hdaa1: <Intel Kabylake Audio Function Group> at nid 1 on hdacc1
pcm2: <Intel Kabylake (HDMI/DP 8ch)> at nid 3 on hdaa1
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdac0: Command timeout on address 2
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdac0: Command timeout on address 2
hdac0: Command timeout on address 2
hdac0: Command timeout on address 2
hdac0: Command timeout on address 2
hdac0: Command timeout on address 2
...

More information:

hdac0@pci0:0:31:3:	class=0x040300 card=0x108f1025 chip=0x9d718086 rev=0x21 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Sunrise Point-LP HD Audio'
    class      = multimedia
    subclass   = HDA


$ cat /dev/sndstat 
Installed devices:
pcm0: <Realtek ALC255 (Internal Analog)> (play/rec)
pcm1: <Realtek ALC255 (Front Analog Headphones)> (play) default
pcm2: <Intel Kabylake (HDMI/DP 8ch)> (play)
No devices installed from userspace.

$ mixer 
Mixer vol      is currently set to 100:100
Mixer pcm      is currently set to 100:100
Mixer igain    is currently set to 100:100
Mixer ogain    is currently set to 100:100

$ uname -a
FreeBSD capeta 12.0-CURRENT FreeBSD 12.0-CURRENT #23 r334923: Sun Jun 10 10:04:39 -03 2018     danilo@capeta:/usr/obj/usr/src/amd64.amd64/sys/CAPETA  amd64
Comment 1 Maxim Usatov 2018-11-19 15:46:28 UTC
I am seeing these messages too, on Thinkpad X1 Yoga (1st Gen). The system locks up for a few seconds, even mouse pointer is not moving when this happens:

...
Nov 19 16:43:45 freebsd kernel: hdac0: Command timeout on address 2
Nov 19 16:43:45 freebsd last message repeated 60 times
...

This happens once every 10-15 minutes on some days. On some days it happens once every few hours. Appears completely random. By the way, I don't have the sound volume problem. 

FreeBSD freebsd.my.domain 11.2-RELEASE-p2 FreeBSD 11.2-RELEASE-p2 #0: Tue Aug 14 21:45:40 UTC 2018     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
Comment 2 Brad Ackerman 2018-12-25 22:51:58 UTC
Also seeing this behavior, 12.0-RELEASE on an X1C5.

hdac0: <Intel Kabylake-LP HDA Controller> mem 0xe2340000-0xe2343fff,0xe2330000-0xe233ffff at device 31.3 on pci0
hdacc0: <Conexant (0x2008) HDA CODEC> at cad 0 on hdac0
hdaa0: <Conexant (0x2008) Audio Function Group> at nid 1 on hdacc0
pcm0: GEOM_ELI<Conexant (0x2008) (Analog)> at nid 23 and 26 on hdaa0
pcm1: <Conexant (0x2008) (Right Analog Headphones)> at nid 22 on hdaa0
hdacc1: <Intel Kabylake HDA CODEC> at cad 2 on hdac0
hdaa1: <Intel Kabylake Audio Function Group> at nid 1 on hdacc1
pcm2: <Intel Kabylake (HDMI/DP 8ch)> at nid 3 on hdaa1
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdac0: Command timeout on address 2
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdac0: Command timeout on address 2
hdac0: Command timeout on address 2

(and hundreds more of the last line)
Comment 3 Danilo Egea Gondolfo freebsd_committer freebsd_triage 2019-08-04 10:19:36 UTC
This fixed the headset audio for me https://reviews.freebsd.org/D19017
Comment 4 Ulrich Spörlein freebsd_committer freebsd_triage 2019-08-27 20:05:44 UTC
Same problem here on a Thinkpad T490
Comment 5 Diane Bruce freebsd_committer freebsd_triage 2019-08-27 20:44:19 UTC
I've been seeing hda not found on some boots and assuming the laptop is simply wearing out ;) on an old T420. I'm also seeing
hdac0: Unexpected unsolicited response from address 1: 00000000
but my kernel is old.
FreeBSD portable 13.0-CURRENT FreeBSD 13.0-CURRENT #27 r349534M: Wed Jul 31

I'll just follow this one for interest sake.
Comment 6 Masachika ISHIZUKA 2019-10-03 12:34:56 UTC
Dell xps 12 (9Q33) has the same error message for a long time.

hdac0: Unexpected unsolicited response from address 0: 00000000
hdac0: Reset setting timeout

% uname -a
FreeBSD carrot.ish.org 13.0-CURRENT FreeBSD 13.0-CURRENT #52 r352923M: Tue Oct  1 13:32:19 JST 2019     ishizuka@okra.ish.org:/usr/altlocal/freebsd-current/obj/usr/altlocal/freebsd-current/src/amd64.amd64/sys/GENERIC  amd64
Comment 7 Vincent DEFERT 2020-01-01 19:51:51 UTC
Same "hdac0: Command timeout on address 2" problem on a Lenovo Ideapad 120S.

I'm using FreeBSD 12.1-RELEASE-p1, but the problem was already present on 12.0.

When bursts of these error messages occur, the laptop becomes almost unresponsive.

The next message in the logs immediately following the above-mentioned is: pulseaudio[70160]: [(null)] pid.c: Daemon already running.

I don't know if it's related, though. 

Besides this, sound works correctly.
Comment 8 commit-hook freebsd_committer freebsd_triage 2020-04-10 18:39:01 UTC
A commit references this bug:

Author: emaste
Date: Fri Apr 10 18:38:42 UTC 2020
New revision: 359777
URL: https://svnweb.freebsd.org/changeset/base/359777

Log:
  hdac: show which command timed out

  There are several reports of "hdac0: Command timeout on address 2"
  messages emitted during playback on a variety of contemporary machines.
  Show the command that timed out in case it might provide a clue in
  finding the cause.

  PR:		229190
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/sys/dev/sound/pci/hda/hdac.c
Comment 9 commit-hook freebsd_committer freebsd_triage 2020-04-10 21:28:18 UTC
A commit references this bug:

Author: emaste
Date: Fri Apr 10 21:27:50 UTC 2020
New revision: 359781
URL: https://svnweb.freebsd.org/changeset/base/359781

Log:
  hda: if a CODEC is not responding, report which one

  PR:		229190
  MFC after:	1 week

Changes:
  head/sys/dev/sound/pci/hda/hdac.c
Comment 10 Ed Maste freebsd_committer freebsd_triage 2020-04-10 21:34:02 UTC
I can reproduce this on my Lenovo X1 Carbon 7th generation. It has the following:
hdac0: <Intel Cannon Lake HDA Controller> mem 0xea23c000-0xea23ffff,0xea000000-0
xea0fffff at device 31.3 on pci0
hdacc0: <Realtek ALC285 HDA CODEC> at cad 0 on hdac0
hdaa0: <Realtek ALC285 Audio Function Group> at nid 1 on hdacc0
pcm0: <Realtek ALC285 (Analog 3.1+HP/2.0)> at nid 20,23,33 and 25 on hdaa0
hdacc1: <Intel Kaby Lake HDA CODEC> at cad 2 on hdac0
hdaa1: <Intel Kaby Lake Audio Function Group> at nid 1 on hdacc1
pcm1: <Intel Kaby Lake (HDMI/DP 8ch)> at nid 3 on hdaa1

One interesting point, I removed snd_hda from GENERIC and loaded it as a module instead, after boot; in that case the HDMI audio codec times out at attach time instead:

hdac0: <Intel Cannon Lake HDA Controller> mem 0xea23c000-0xea23ffff,0xea000000-0xea0fffff at device 31.3 on pci0
hdac0: Command 0x200f0000 timeout on address 2
hdac0: Command 0x200f0002 timeout on address 2
hdac0: CODEC at address 2 not responding!
hdacc0: <Realtek ALC285 HDA CODEC> at cad 0 on hdac0
hdaa0: <Realtek ALC285 Audio Function Group> at nid 1 on hdacc0
pcm0: <Realtek ALC285 (Analog 3.1+HP/2.0)> at nid 20,23,33 and 25 on hdaa0

In this case there's no hdacc1, and no further command timeout messages.
Comment 11 Jose Luis Duran freebsd_committer freebsd_triage 2020-04-10 22:08:08 UTC
(In reply to Ed Maste from comment #10)

This is from a Lenovo T480:

    hdac0: <Intel Kaby Lake-LP HDA Controller> mem 0xe8348000-0xe834bfff,0xe8330000-0xe833ffff at device 31.3 on pci0
    hdacc0: <Realtek (0x0257) HDA CODEC> at cad 0 on hdac0
    hdaa0: <Realtek (0x0257) Audio Function Group> at nid 1 on hdacc0
    pcm0: <Realtek (0x0257) (Analog 2.0+HP/2.0)> at nid 20,33 and 18 on hdaa0
    pcm1: <Realtek (0x0257) (Right Analog Mic)> at nid 25 on hdaa0
    hdacc1: <Intel Kaby Lake HDA CODEC> at cad 2 on hdac0
    hdaa1: <Intel Kaby Lake Audio Function Group> at nid 1 on hdacc1
    pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> at nid 3 on hdaa1
    hdacc1: Unexpected unsolicited response with tag 63: ffffffff
    hdacc1: Unexpected unsolicited response with tag 63: ffffffff
    hdacc1: Unexpected unsolicited response with tag 63: ffffffff
    hdacc1: Unexpected unsolicited response with tag 63: ff000000
    hdacc1: Unexpected unsolicited response with tag 63: ffffffff
    hdac0: Command 0x2033b000 timeout on address 2
Comment 12 Jose Luis Duran freebsd_committer freebsd_triage 2020-04-10 22:25:04 UTC
(In reply to Danilo Egea Gondolfo from comment #0)

The volume part should have been fixed in review D19017 (Realtek ALC255)?
Comment 13 Danilo Egea Gondolfo freebsd_committer freebsd_triage 2020-04-10 22:56:36 UTC
(In reply to Jose Luis Duran from comment #12)

Yes, it's working fine now.
Comment 14 Ed Maste freebsd_committer freebsd_triage 2020-04-11 01:23:30 UTC
This might be a bug in i915kms; I found that after removing snd_hda from GENERIC I get the timeout messages and the codec fails to attach, but when I have a display connected to the HDMI port on my laptop the 2nd codec attaches and works.

This seems to be a similar issue: https://bugs.freedesktop.org/show_bug.cgi?id=102937

Can folks who have experienced this issue try reproducing it with a display attached to the HDMI port?
Comment 15 Ed Maste freebsd_committer freebsd_triage 2020-04-11 01:32:23 UTC
And/or try adding to /boot/loader.conf this configuration:
compat.linuxkpi.i915_disable_power_well="0"

I have not tested extensively but the command timed out messages appear not to occur with this setting.
Comment 16 Jose Luis Duran freebsd_committer freebsd_triage 2020-04-11 14:14:11 UTC
(In reply to Ed Maste from comment #15)
Yes, with this setting, timeout messages are gone.
Comment 17 Vincent DEFERT 2020-04-22 06:51:55 UTC
(In reply to Ed Maste from comment #15)

compat.linuxkpi.i915_disable_power_well="0"
also works fine for me on my Lenovo Ideapad.

I have the same sound and graphics hardware in an Intel NUC and didn't have the problem, but a display is connected to its HDMI port.

This seems to confirm your findings.
Comment 18 commit-hook freebsd_committer freebsd_triage 2020-04-25 15:29:20 UTC
A commit references this bug:

Author: emaste
Date: Sat Apr 25 15:29:07 UTC 2020
New revision: 360310
URL: https://svnweb.freebsd.org/changeset/base/360310

Log:
  MFC r359777: hdac: show which command timed out

  There are several reports of "hdac0: Command timeout on address 2"
  messages emitted during playback on a variety of contemporary machines.
  Show the command that timed out in case it might provide a clue in
  finding the cause.

  PR:		229190
  Sponsored by:	The FreeBSD Foundation

Changes:
_U  stable/12/
  stable/12/sys/dev/sound/pci/hda/hdac.c
Comment 19 commit-hook freebsd_committer freebsd_triage 2020-04-25 15:43:27 UTC
A commit references this bug:

Author: emaste
Date: Sat Apr 25 15:42:38 UTC 2020
New revision: 360314
URL: https://svnweb.freebsd.org/changeset/base/360314

Log:
  MFC r359781: hda: if a CODEC is not responding, report which one

  PR:		229190

Changes:
_U  stable/12/
  stable/12/sys/dev/sound/pci/hda/hdac.c
Comment 20 Lars Engels freebsd_committer freebsd_triage 2020-05-26 21:08:59 UTC
On a Thinkpad T450s:

hdac0: <Intel Broadwell HDA Controller> mem 0xe1230000-0xe1233fff at device 3.0 on pci0                                                                                                                              
hdac1: <Intel Broadwell HDA Controller> mem 0xe1234000-0xe1237fff at device 27.0 on pci0
hdacc0: <Intel Broadwell HDA CODEC> at cad 0 on hdac0
hdaa0: <Intel Broadwell Audio Function Group> at nid 1 on hdacc0
hdacc1: <Realtek ALC292 HDA CODEC> at cad 0 on hdac1
hdaa1: <Realtek ALC292 Audio Function Group> at nid 1 on hdacc1
hdac0: Unexpected unsolicited response from address 0: 00000000
hdac0: Command timeout on address 0
hdac0: Reset setting timeout
hdac0: Command timeout on address 0
hdac0: Device stuck in reset
hdac0: Command timeout on address 0
hdac0: Device stuck in reset
hdac0: Command timeout on address 0
hdac0: Reset setting timeout
hdac0: Command timeout on address 0
hdac0: <Intel Broadwell HDA Controller> mem 0xe1230000-0xe1233fff at device 3.0 on pci0
hdac1: <Intel Broadwell HDA Controller> mem 0xe1234000-0xe1237fff at device 27.0 on pci0
hdacc0: <Intel Broadwell HDA CODEC> at cad 0 on hdac0
hdaa0: <Intel Broadwell Audio Function Group> at nid 1 on hdacc0
hdacc1: <Realtek ALC292 HDA CODEC> at cad 0 on hdac1
hdaa1: <Realtek ALC292 Audio Function Group> at nid 1 on hdacc1
hdac0: Unexpected unsolicited response from address 0: 00000000
hdac0: Command 0x00220011 timeout on address 0
hdac0: Command 0x00270d01 timeout on address 0
hdac0: Command 0x00270610 timeout on address 0
hdac0: Command 0x00272d01 timeout on address 0
hdac0: Command 0x00373400 timeout on address 0
hdac0: Command 0x00373411 timeout on address 0
hdac0: Command 0x003734f2 timeout on address 0
hdac0: Command 0x003734f3 timeout on address 0
hdac0: Command 0x003734f4 timeout on address 0
hdac0: Command 0x003734f5 timeout on address 0
hdac0: Command 0x003734f6 timeout on addresmand 0x00370740 timeout on address 0
hdac0: Command 0x00373000 timeout on address 0
hdac0: Command 0x00373200 timeout on address 0
hdac0: Command 0x00373000 timeout on address 0
hdac0: Command 0x00373100 timeout on address 0
hdac0: Command 0x00373000 timeout on address 0
hdac0: Command 0x00373184 timeout on address 0
hdac0: Command 0x00373101 timeout on address 0
hdac0: Command 0x0037310a timeout on address 0
hdac0: Command 0x00373170 timeout on address 0
hdac0: Command 0x00373101 timeout on address 0
hdac0: Command 0x00373100 timeout on address 0
hdac0: Command 0x00373000 timeout on address 0
hdac0: Command 0x003732c0 timeout on address 0
hdac0: Reset setting timeout
hdac0: Command 0x00270d00 timeout on address 0
Comment 21 Ihor Antonov 2020-07-04 00:11:07 UTC
I also see this bug
ThinkPad T470
FreeBSD 13.0-CURRENT #0 r362882

# dmesg | grep hda
hdac0: <Intel Kaby Lake-LP HDA Controller> mem 0xdc240000-0xdc243fff,0xdc230000-0xdc23ffff at device 31.3 on pci0
hdacc0: <Realtek ALC298 HDA CODEC> at cad 0 on hdac0
hdaa0: <Realtek ALC298 Audio Function Group> at nid 1 on hdacc0
pcm0: <Realtek ALC298 (Analog 2.0+HP/2.0)> at nid 20,33 and 18 on hdaa0
hdacc1: <Intel Kaby Lake HDA CODEC> at cad 2 on hdac0
hdaa1: <Intel Kaby Lake Audio Function Group> at nid 1 on hdacc1
pcm1: <Intel Kaby Lake (HDMI/DP 8ch)> at nid 3 on hdaa1
hdac0: Command 0x2033b000 timeout on address 2
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 62: f8000000
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
Comment 22 Christopher 2021-05-01 19:12:01 UTC
Adding: compat.linuxkpi.i915_disable_power_well="0"
to /boot/loader.conf fixed this issue for me.

Thanks!
Comment 23 Mark Linimon freebsd_committer freebsd_triage 2021-05-21 00:26:27 UTC
^Triage: identification code has been committed; a workaround for it has been documented.