Skip to content

Commit 9d9bbd0

Browse files
author
Herton R. Krzesinski
committed
Merge: Add Important AMD BZs to RHEL9.2
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/2014 Bugzilla: http://bugzilla.redhat.com/2130063 Bugzilla: http://bugzilla.redhat.com/2139486 Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=50484649 Tested: HP ZBook 15 G5/80D5 Laptop ThinkPad P1 Gen5 TB4 HP zBook Fury Signed-off-by: Torez Smith <torez@redhat.com> Torez Smith (2): thunderbolt: Explicitly enable lane adapter hotplug events at startup xhci-pci: Set runtime PM as default policy on all xHC 1.2 or later devices drivers/thunderbolt/switch.c | 24 ++++++++++++++++++++++++ drivers/thunderbolt/tb.h | 1 + drivers/thunderbolt/tb_regs.h | 1 + drivers/thunderbolt/usb4.c | 20 ++++++++++++++++++++ drivers/usb/host/xhci-pci.c | 32 ++++---------------------------- 5 files changed, 50 insertions(+), 28 deletions(-) Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2 parents 7eab143 + b725098 commit 9d9bbd0

File tree

5 files changed

+50
-28
lines changed

5 files changed

+50
-28
lines changed

drivers/thunderbolt/switch.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2822,6 +2822,26 @@ static void tb_switch_credits_init(struct tb_switch *sw)
28222822
tb_sw_info(sw, "failed to determine preferred buffer allocation, using defaults\n");
28232823
}
28242824

2825+
static int tb_switch_port_hotplug_enable(struct tb_switch *sw)
2826+
{
2827+
struct tb_port *port;
2828+
2829+
if (tb_switch_is_icm(sw))
2830+
return 0;
2831+
2832+
tb_switch_for_each_port(sw, port) {
2833+
int res;
2834+
2835+
if (!port->cap_usb4)
2836+
continue;
2837+
2838+
res = usb4_port_hotplug_enable(port);
2839+
if (res)
2840+
return res;
2841+
}
2842+
return 0;
2843+
}
2844+
28252845
/**
28262846
* tb_switch_add() - Add a switch to the domain
28272847
* @sw: Switch to add
@@ -2891,6 +2911,10 @@ int tb_switch_add(struct tb_switch *sw)
28912911
return ret;
28922912
}
28932913

2914+
ret = tb_switch_port_hotplug_enable(sw);
2915+
if (ret)
2916+
return ret;
2917+
28942918
ret = device_add(&sw->dev);
28952919
if (ret) {
28962920
dev_err(&sw->dev, "failed to add device: %d\n", ret);

drivers/thunderbolt/tb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,7 @@ int usb4_switch_add_ports(struct tb_switch *sw);
11741174
void usb4_switch_remove_ports(struct tb_switch *sw);
11751175

11761176
int usb4_port_unlock(struct tb_port *port);
1177+
int usb4_port_hotplug_enable(struct tb_port *port);
11771178
int usb4_port_configure(struct tb_port *port);
11781179
void usb4_port_unconfigure(struct tb_port *port);
11791180
int usb4_port_configure_xdomain(struct tb_port *port);

drivers/thunderbolt/tb_regs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ struct tb_regs_port_header {
308308
#define ADP_CS_5 0x05
309309
#define ADP_CS_5_LCA_MASK GENMASK(28, 22)
310310
#define ADP_CS_5_LCA_SHIFT 22
311+
#define ADP_CS_5_DHP BIT(31)
311312

312313
/* TMU adapter registers */
313314
#define TMU_ADP_CS_3 0x03

drivers/thunderbolt/usb4.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,26 @@ int usb4_port_unlock(struct tb_port *port)
10461046
return tb_port_write(port, &val, TB_CFG_PORT, ADP_CS_4, 1);
10471047
}
10481048

1049+
/**
1050+
* usb4_port_hotplug_enable() - Enables hotplug for a port
1051+
* @port: USB4 port to operate on
1052+
*
1053+
* Enables hot plug events on a given port. This is only intended
1054+
* to be used on lane, DP-IN, and DP-OUT adapters.
1055+
*/
1056+
int usb4_port_hotplug_enable(struct tb_port *port)
1057+
{
1058+
int ret;
1059+
u32 val;
1060+
1061+
ret = tb_port_read(port, &val, TB_CFG_PORT, ADP_CS_5, 1);
1062+
if (ret)
1063+
return ret;
1064+
1065+
val &= ~ADP_CS_5_DHP;
1066+
return tb_port_write(port, &val, TB_CFG_PORT, ADP_CS_5, 1);
1067+
}
1068+
10491069
static int usb4_port_set_configured(struct tb_port *port, bool configured)
10501070
{
10511071
int ret;

drivers/usb/host/xhci-pci.c

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,13 @@
5858
#define PCI_DEVICE_ID_INTEL_CML_XHCI 0xa3af
5959
#define PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI 0x9a13
6060
#define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI 0x1138
61-
#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI 0x461e
62-
#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI 0x464e
63-
#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI 0x51ed
64-
#define PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI 0xa71e
65-
#define PCI_DEVICE_ID_INTEL_METEOR_LAKE_XHCI 0x7ec0
61+
#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI 0x51ed
6662

6763
#define PCI_DEVICE_ID_AMD_RENOIR_XHCI 0x1639
6864
#define PCI_DEVICE_ID_AMD_PROMONTORYA_4 0x43b9
6965
#define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba
7066
#define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb
7167
#define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc
72-
#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1 0x161a
73-
#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2 0x161b
74-
#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 0x161d
75-
#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 0x161e
76-
#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 0x15d6
77-
#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 0x15d7
78-
#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_7 0x161c
79-
#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_8 0x161f
8068

8169
#define PCI_DEVICE_ID_ASMEDIA_1042_XHCI 0x1042
8270
#define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142
@@ -268,12 +256,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
268256
pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI ||
269257
pdev->device == PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI ||
270258
pdev->device == PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI ||
271-
pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI ||
272-
pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI ||
273-
pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI ||
274-
pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI ||
275-
pdev->device == PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI ||
276-
pdev->device == PCI_DEVICE_ID_INTEL_METEOR_LAKE_XHCI))
259+
pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI))
277260
xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW;
278261

279262
if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
@@ -336,15 +319,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
336319
pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4))
337320
xhci->quirks |= XHCI_NO_SOFT_RETRY;
338321

339-
if (pdev->vendor == PCI_VENDOR_ID_AMD &&
340-
(pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1 ||
341-
pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2 ||
342-
pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 ||
343-
pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 ||
344-
pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 ||
345-
pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 ||
346-
pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_7 ||
347-
pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_8))
322+
/* xHC spec requires PCI devices to support D3hot and D3cold */
323+
if (xhci->hci_version >= 0x120)
348324
xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW;
349325

350326
if (xhci->quirks & XHCI_RESET_ON_RESUME)

0 commit comments

Comments
 (0)