thunderbolt: Fixes for v5.4

This includes three fixes for various issues people have reported:
 
   - Fix DP tunneling on some Light Ridge controllers
   - Fix for lockdep circular locking dependency warning
   - Drop unnecessary read on ICL
 -----BEGIN PGP SIGNATURE-----
 
 iQJUBAABCgA+FiEEVTdhRGBbNzLrSUBaAP2fSd+ZWKAFAl2gREggHG1pa2Eud2Vz
 dGVyYmVyZ0BsaW51eC5pbnRlbC5jb20ACgkQAP2fSd+ZWKCgpg//fDr4uRn7+SPe
 kCq5O8xWDwdKoJy9RhonV4PrVC6rHYaUC2WpffXPd7mfSOZoyoPtRpC8wDsecI4n
 qZYqGy3Jpj+89BteDudEMOXJeQ6Ht943ej64O6q/mMLV+TzFL8bhrax85+ubnUlO
 LOMIZAGUSCGyc7XeM/6MaMsR5uwGWANKU0T0YsQJnL+Kll4oUG1pW3U1z55ripMd
 Yb35EAV+qiy6tVY5fUy4TTjwOdqC/uOeG+s0FgqJpwJEgD7MlbPEQIpUldUx+hgN
 VKVUqiAOy4LdqeEigYf3t2FF9MN8YgtSbAhXjZFOJRV4kOVoNylMQi5HVSr42A4j
 Xv0Rxa2MTgmrsPxqErFwbFTG0pFhpWzI+DuxTzTYqIISRgHjyTsigeU2PxB6ppGI
 vlpJAIvUKrAVUu1Op/v0uZiSOX49QxS1UoFvjsn8o3rmdsjxhmKGL3AYdt/dJx0I
 yV7UTG4IWnF7DNif8YwsSezS5sCgo2OjHm2lVILDuzTsJGIhsi/LHGidwrGXbDST
 Egi5TDHsH83ZdKzGOo1/EL1Ev/xGzdZ2qgAo8RthLdyG0t1b2seAwAar+8CEMJxg
 WWzc5pLtRpX3fRiIOn1xSgzosuVAEO3tI3sEc3b26tbslPtWwWKbnZVF2sDngkgi
 MuhSmUL3l6kL5UQlkb77lwl4x1gyrOo=
 =liEu
 -----END PGP SIGNATURE-----

Merge tag 'thunderbolt-fixes-for-v5.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into char-misc-next

Mika writes:

thunderbolt: Fixes for v5.4

This includes three fixes for various issues people have reported:

  - Fix DP tunneling on some Light Ridge controllers
  - Fix for lockdep circular locking dependency warning
  - Drop unnecessary read on ICL

* tag 'thunderbolt-fixes-for-v5.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt:
  thunderbolt: Drop unnecessary read when writing LC command in Ice Lake
  thunderbolt: Fix lockdep circular locking depedency warning
  thunderbolt: Read DP IN adapter first two dwords in one go
This commit is contained in:
Greg Kroah-Hartman 2019-11-02 18:12:45 +01:00
commit 92fd9bf2c3
2 changed files with 11 additions and 18 deletions

View File

@ -80,7 +80,6 @@ static void icl_nhi_lc_mailbox_cmd(struct tb_nhi *nhi, enum icl_lc_mailbox_cmd c
{
u32 data;
pci_read_config_dword(nhi->pdev, VS_CAP_19, &data);
data = (cmd << VS_CAP_19_CMD_SHIFT) & VS_CAP_19_CMD_MASK;
pci_write_config_dword(nhi->pdev, VS_CAP_19, data | VS_CAP_19_VALID);
}

View File

@ -896,12 +896,13 @@ int tb_dp_port_set_hops(struct tb_port *port, unsigned int video,
*/
bool tb_dp_port_is_enabled(struct tb_port *port)
{
u32 data;
u32 data[2];
if (tb_port_read(port, &data, TB_CFG_PORT, port->cap_adap, 1))
if (tb_port_read(port, data, TB_CFG_PORT, port->cap_adap,
ARRAY_SIZE(data)))
return false;
return !!(data & (TB_DP_VIDEO_EN | TB_DP_AUX_EN));
return !!(data[0] & (TB_DP_VIDEO_EN | TB_DP_AUX_EN));
}
/**
@ -914,19 +915,21 @@ bool tb_dp_port_is_enabled(struct tb_port *port)
*/
int tb_dp_port_enable(struct tb_port *port, bool enable)
{
u32 data;
u32 data[2];
int ret;
ret = tb_port_read(port, &data, TB_CFG_PORT, port->cap_adap, 1);
ret = tb_port_read(port, data, TB_CFG_PORT, port->cap_adap,
ARRAY_SIZE(data));
if (ret)
return ret;
if (enable)
data |= TB_DP_VIDEO_EN | TB_DP_AUX_EN;
data[0] |= TB_DP_VIDEO_EN | TB_DP_AUX_EN;
else
data &= ~(TB_DP_VIDEO_EN | TB_DP_AUX_EN);
data[0] &= ~(TB_DP_VIDEO_EN | TB_DP_AUX_EN);
return tb_port_write(port, &data, TB_CFG_PORT, port->cap_adap, 1);
return tb_port_write(port, data, TB_CFG_PORT, port->cap_adap,
ARRAY_SIZE(data));
}
/* switch utility functions */
@ -1031,13 +1034,6 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val)
if (sw->authorized)
goto unlock;
/*
* Make sure there is no PCIe rescan ongoing when a new PCIe
* tunnel is created. Otherwise the PCIe rescan code might find
* the new tunnel too early.
*/
pci_lock_rescan_remove();
switch (val) {
/* Approve switch */
case 1:
@ -1057,8 +1053,6 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val)
break;
}
pci_unlock_rescan_remove();
if (!ret) {
sw->authorized = val;
/* Notify status change to the userspace */