1
0
Fork 0
alistair23-linux/drivers/thunderbolt
Mika Westerberg 4f7c2e0d87 thunderbolt: Make sure device runtime resume completes before taking domain lock
When a device is authorized from userspace by writing to authorized
attribute we first take the domain lock and then runtime resume the
device in question. There are two issues with this.

First is that the device connected notifications are blocked during this
time which means we get them only after the authorization operation is
complete. Because of this the authorization needed flag from the
firmware notification is not reflecting the real authorization status
anymore. So what happens is that the "authorized" keeps returning 0 even
if the device was already authorized properly.

Second issue is that each time the controller is runtime resumed the
connection_id field of device connected notification may be different
than in the previous resume. We need to use the latest connection_id
otherwise the firmware rejects the authorization command.

Fix these by moving runtime resume operations to happen before the
domain lock is taken, and waiting for the updated device connected
notification from the firmware before we allow runtime resume of a
device to complete.

While there add missing locking to tb_switch_nvm_read().

Fixes: 09f11b6c99 ("thunderbolt: Take domain lock in switch sysfs attribute callbacks")
Reported-by: Pengfei Xu <pengfei.xu@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2019-06-12 13:30:46 +03:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
cap.c thunderbolt: Add dummy read after port capability list walk on Light Ridge 2019-04-18 11:18:51 +03:00
ctl.c thunderbolt: Make rest of the logging to happen at debug level 2019-04-18 11:18:53 +03:00
ctl.h thunderbolt: Add Intel as copyright holder 2018-10-02 15:52:08 -07:00
dma_port.c thunderbolt: Convert rest of the driver files to use SPDX identifier 2018-10-02 15:52:08 -07:00
dma_port.h thunderbolt: Convert rest of the driver files to use SPDX identifier 2018-10-02 15:52:08 -07:00
domain.c crypto: shash - remove shash_desc::flags 2019-04-25 15:38:12 +08:00
eeprom.c thunderbolt: Add Intel as copyright holder 2018-10-02 15:52:08 -07:00
icm.c thunderbolt: Make sure device runtime resume completes before taking domain lock 2019-06-12 13:30:46 +03:00
lc.c thunderbolt: Set sleep bit when suspending switch 2019-04-18 11:18:52 +03:00
nhi.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
nhi.h thunderbolt: Add Intel as copyright holder 2018-10-02 15:52:08 -07:00
nhi_regs.h thunderbolt: Add Intel as copyright holder 2018-10-02 15:52:08 -07:00
path.c thunderbolt: Reword output of tb_dump_hop() 2019-04-18 11:18:54 +03:00
property.c thunderbolt: property: Fix a missing check of kzalloc 2019-03-28 11:30:47 +03:00
switch.c thunderbolt: Make sure device runtime resume completes before taking domain lock 2019-06-12 13:30:46 +03:00
tb.c thunderbolt: Make rest of the logging to happen at debug level 2019-04-18 11:18:53 +03:00
tb.h thunderbolt: Make sure device runtime resume completes before taking domain lock 2019-06-12 13:30:46 +03:00
tb_msgs.h thunderbolt: Add XDomain UUID exchange support 2019-04-18 11:18:53 +03:00
tb_regs.h thunderbolt: Add support for DMA tunnels 2019-04-18 11:18:53 +03:00
tunnel.c thunderbolt: Make rest of the logging to happen at debug level 2019-04-18 11:18:53 +03:00
tunnel.h thunderbolt: Add support for DMA tunnels 2019-04-18 11:18:53 +03:00
xdomain.c thunderbolt: Add XDomain UUID exchange support 2019-04-18 11:18:53 +03:00