Bug 197287

Summary: [BISECTED REG] tpm CLKRUN breaks PS/2 keyboard and touchpad on Braswell system
Product: Drivers Reporter: James Ettle (james)
Component: OtherAssignee: drivers_input-devices
Status: RESOLVED CODE_FIX    
Severity: normal CC: dmitry.torokhov, jarkko.sakkinen, javier, jefferym, peterhuewe
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 4.13 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg output immediately after boot, having pressed a few keys
dmesg after suspend/resume cycle

Description James Ettle 2017-10-16 20:48:16 UTC
Created attachment 260235 [details]
dmesg output immediately after boot, having pressed a few keys

After upgrading to 4.13.4 the integrated PS/2 keyboard and touchpad on one of my notebooks refuse to work immediately after boot. 4.12 works fine, and also the keyboard and touchpad start to work after a suspend/resume cycle.

I've attached dmesgs from immediately after starting (but having pressed a few keys), and the after a suspend/resume cycle.

I know this isn't much info to go on, please let me know what other debug to enable.
Comment 1 James Ettle 2017-10-16 20:49:16 UTC
Created attachment 260237 [details]
dmesg after suspend/resume cycle
Comment 2 James Ettle 2017-11-08 23:06:21 UTC
Still present in 4.13.11-300.fc27.x86_64. Now for some reason it takes longer between pressing suspend and the system actually sleeping. Caught this in dmesg:

[  540.832159] Suspending console(s) (use no_console_suspend to debug)
[  540.833628] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[  540.835799] sd 0:0:0:0: [sda] Stopping disk
[  549.834802] psmouse serio2: Failed to disable mouse on isa0060/serio2
[  551.092850] PM: suspend of devices complete after 10260.088 msecs
[  551.092861] PM: suspend devices took 10.261 seconds
[  551.092867] Component: suspend devices, time: 10261
[  551.092897] ------------[ cut here ]------------
[  551.092924] WARNING: CPU: 0 PID: 1579 at kernel/power/suspend_test.c:55 suspend_test_finish+0x76/0x80
[  551.092927] Modules linked in: ccm xt_CHECKSUM ipt_MASQUERADE nf_nat_masquerade_ipv4 tun nf_conntrack_netbios_ns nf_conntrack_broadcast xt_CT ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack libcrc32c iptable_mangle iptable_raw iptable_security ebtable_filter ebtables ip6table_filter ip6_tables cmac bnep vfat fat arc4 intel_rapl intel_powerclamp snd_hda_codec_hdmi coretemp iwlmvm snd_hda_codec_realtek kvm_intel btusb mac80211 snd_hda_codec_generic btrtl kvm btbcm uvcvideo iTCO_wdt iTCO_vendor_support snd_hda_intel btintel irqbypass videobuf2_vmalloc iwlwifi
[  551.093169]  bluetooth videobuf2_memops snd_hda_codec crct10dif_pclmul crc32_pclmul videobuf2_v4l2 cfg80211 videobuf2_core snd_hda_core ghash_clmulni_intel videodev intel_cstate snd_hwdep ecdh_generic snd_seq tpm_crb rfkill media snd_seq_device snd_pcm joydev rtsx_pci_ms memstick snd_timer wmi int3400_thermal mei_txe snd soundcore tpm_tis mei tpm_tis_core tpm shpchp acpi_thermal_rel processor_thermal_device int340x_thermal_zone intel_soc_dts_iosf lpc_ich i2c_i801 auth_rpcgss sunrpc btrfs xor i915 raid6_pq rtsx_pci_sdmmc mmc_core crc32c_intel i2c_algo_bit drm_kms_helper serio_raw r8169 drm rtsx_pci mii video bfq
[  551.093383] CPU: 0 PID: 1579 Comm: systemd-sleep Not tainted 4.13.11-300.fc27.x86_64 #1
[  551.093389] Hardware name: Novatech W510LU/W510LU, BIOS 5.11 07/05/2016
[  551.093398] task: ffff949e11b10000 task.stack: ffffbc0741a9c000
[  551.093410] RIP: 0010:suspend_test_finish+0x76/0x80
[  551.093416] RSP: 0018:ffffbc0741a9fcd8 EFLAGS: 00010286
[  551.093425] RAX: 0000000000000027 RBX: ffffffffa8c88996 RCX: ffffffffa8e591c8
[  551.093430] RDX: 0000000000000000 RSI: 0000000000000092 RDI: 0000000000000202
[  551.093436] RBP: ffffbc0741a9fce8 R08: 0000000000000027 R09: 000000000002e0e8
[  551.093441] R10: fffffffffff64c60 R11: 0000000000000366 R12: 0000000000002815
[  551.093449] R13: ffff949e09523878 R14: 0000000000000003 R15: ffffffffa93127a0
[  551.093504] FS:  00007fa376dd8940(0000) GS:ffff949e3fc00000(0000) knlGS:0000000000000000
[  551.093510] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  551.093516] CR2: 00007f434b47f91a CR3: 0000000273a1b000 CR4: 00000000001006f0
[  551.093522] Call Trace:
[  551.093548]  suspend_devices_and_enter+0xdb/0x7f0
[  551.093563]  pm_suspend+0x335/0x3a0
[  551.093575]  state_store+0x85/0xf0
[  551.093593]  kobj_attr_store+0xf/0x20
[  551.093606]  sysfs_kf_write+0x37/0x40
[  551.093616]  kernfs_fop_write+0x11c/0x1a0
[  551.093630]  __vfs_write+0x37/0x170
[  551.093646]  ? selinux_file_permission+0xfb/0x120
[  551.093661]  ? security_file_permission+0x3b/0xc0
[  551.093673]  vfs_write+0xb1/0x1a0
[  551.093682]  SyS_write+0x55/0xc0
[  551.093696]  entry_SYSCALL_64_fastpath+0x1a/0xa5
[  551.093706] RIP: 0033:0x7fa376900ea4
[  551.093711] RSP: 002b:00007ffcb654d768 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[  551.093721] RAX: ffffffffffffffda RBX: 00007fa376bd7c20 RCX: 00007fa376900ea4
[  551.093726] RDX: 0000000000000004 RSI: 000055d521be6ed0 RDI: 0000000000000004
[  551.093732] RBP: 00007fa376bd7c78 R08: 000055d521be5390 R09: 00007fa376dd8940
[  551.093737] R10: 000000000000000a R11: 0000000000000246 R12: 0000000000001010
[  551.093742] R13: 0000000000001000 R14: 00007fa376bd7c78 R15: 0000000000000000
[  551.093753] Code: e8 03 00 00 29 c1 e8 9b af 00 00 41 81 fc 10 27 00 00 77 05 5b 41 5c 5d c3 44 89 e2 48 89 de 48 c7 c7 fd 8b c8 a8 e8 7b af 00 00 <0f> ff 5b 41 5c 5d c3 90 90 90 0f 1f 44 00 00 55 0f b6 05 a7 70 
[  551.093942] ---[ end trace 6de4970ece505e87 ]---
[  551.113930] PM: late suspend of devices complete after 19.966 msecs
[  551.139593] PM: noirq suspend of devices complete after 25.644 msecs
[  551.139750] ACPI: Preparing to enter system sleep state S3
[  551.358263] ACPI: EC: event blocked
[  551.358267] ACPI: EC: EC stopped
Comment 3 James Ettle 2017-11-09 22:24:51 UTC
still present in 4.14.0-0.rc8
Comment 4 James Ettle 2017-11-28 21:35:19 UTC
Still broken in 4.13.15, notebook borderline unusable. Come on, how'd'ya break something as commonplace as PS/2 keyboard support?
Comment 5 James Ettle 2017-12-10 16:47:31 UTC
This looks like TPM's fault. I suspect '[5e572cab92f0bb56ca1e6e5ee4d807663a7ccbad] tpm: Enable CLKRUN protocol for Braswell systems' but I'm waiting on a git bisect.
Comment 6 James Ettle 2017-12-10 18:17:38 UTC
OK, bisected.

5e572cab92f0bb56ca1e6e5ee4d807663a7ccbad is the first bad commit
commit 5e572cab92f0bb56ca1e6e5ee4d807663a7ccbad
Author: Azhar Shaikh <azhar.shaikh@intel.com>
Date:   Sun Jun 18 19:17:59 2017 -0700

    tpm: Enable CLKRUN protocol for Braswell systems
    
    To overcome a hardware limitation on Intel Braswell systems,
    disable CLKRUN protocol during TPM transactions and re-enable
    once the transaction is completed.
    
    Signed-off-by: Azhar Shaikh <azhar.shaikh@intel.com>
    Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
    Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
    Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
    Signed-off-by: James Morris <james.l.morris@oracle.com>

:040000 040000 5437c91886cb62c497255f2c60dbedd7268ab50d 1863a1738ded35a817aad52f9f2b451bd43623d7 M	drivers

Confirmed by blacklisting tpm module(s).

The hardware is a Clevo W510LU with an N3160 CPU.
Comment 7 Dmitry Torokhov 2017-12-15 01:10:56 UTC
I'd recommend pinging linux-integrity@vger.kernel.org and maintainers (Jarkko) directly.
Comment 8 Javier Martinez Canillas 2018-01-03 10:05:22 UTC
FYI, a patch was merged on the TPM tree that fixes this issue:

http://git.infradead.org/users/jjs/linux-tpmdd.git/commit/8bb9926265c2caef27a0f49dd8f349df16c79214