Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions drivers/thunderbolt/apple-dpin-state.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ const struct apple_dpin_policy apple_dpin_m3 = {
* writes only DPTX_INACTIVE (+0x0c bit 0) and polls its ACK (+0x10 bit 0),
* gated on HPD. The DP IN interrupts are not set up (nothing handles them),
* and a tunnel that DCP never activated is torn down without touching the
* block at all. Both DP IN streams of an ATC PHY need one link rate, so
* every tunnel gets HBR2 at most.
* block at all. Both DP IN streams of an ATC PHY need one link rate: a
* tunnel alone gets up to HBR3, two get HBR2 (TB_HOST_DP_SHARED_RATE).
*/
const struct apple_dpin_policy apple_dpin_m4 = {
.flow = APPLE_DPIN_CHANGED,
.capacity_retry = true,
.defer_new_bringup = true,
.host_policy = TB_HOST_DP_NOTIFY | TB_HOST_DP_HBR2_MAX,
.host_policy = TB_HOST_DP_NOTIFY | TB_HOST_DP_SHARED_RATE,
.lazy_idle = true,
};

Expand Down
12 changes: 6 additions & 6 deletions drivers/thunderbolt/apple-dpin-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ static void apple_dpin_qualification_profiles(struct kunit *test)

/*
* M4 (T8132): the M3 flow without DP IN interrupts, a lazy teardown, and
* DP tunnels capped at HBR2.
* DP tunnels sharing one link rate.
*/
static void apple_dpin_m4_policy(struct kunit *test)
{
Expand All @@ -393,15 +393,15 @@ static void apple_dpin_m4_policy(struct kunit *test)
KUNIT_EXPECT_FALSE(test, p->t602x_handshake);
KUNIT_EXPECT_TRUE(test, p->defer_new_bringup);
KUNIT_EXPECT_TRUE(test, p->lazy_idle);
KUNIT_EXPECT_EQ(test, p->host_policy, TB_HOST_DP_NOTIFY | TB_HOST_DP_HBR2_MAX);
KUNIT_EXPECT_EQ(test, p->host_policy, TB_HOST_DP_NOTIFY | TB_HOST_DP_SHARED_RATE);
/* The hooks of the M3 flow: a queue and a display pipeline both. */
KUNIT_EXPECT_EQ(test, apple_dpin_hooks(p, true, true), APPLE_DPIN_CHANGED);
KUNIT_EXPECT_EQ(test, apple_dpin_hooks(p, true, false), APPLE_DPIN_DISABLED);
KUNIT_EXPECT_EQ(test, apple_dpin_hooks(p, false, true), APPLE_DPIN_DISABLED);
/* No other Apple host is capped. */
KUNIT_EXPECT_FALSE(test, apple_dpin_m3.host_policy & TB_HOST_DP_HBR2_MAX);
KUNIT_EXPECT_FALSE(test, apple_dpin_m2.host_policy & TB_HOST_DP_HBR2_MAX);
KUNIT_EXPECT_FALSE(test, apple_dpin_m1.host_policy & TB_HOST_DP_HBR2_MAX);
/* No other Apple host shares one rate. */
KUNIT_EXPECT_FALSE(test, apple_dpin_m3.host_policy & TB_HOST_DP_SHARED_RATE);
KUNIT_EXPECT_FALSE(test, apple_dpin_m2.host_policy & TB_HOST_DP_SHARED_RATE);
KUNIT_EXPECT_FALSE(test, apple_dpin_m1.host_policy & TB_HOST_DP_SHARED_RATE);
}

static void apple_dpin_all_policy_fields(struct kunit *test)
Expand Down
11 changes: 9 additions & 2 deletions drivers/thunderbolt/ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/pci.h>
#include <linux/dmapool.h>
#include <linux/workqueue.h>
#include <kunit/static_stub.h>

#include "ctl.h"

Expand Down Expand Up @@ -1111,8 +1112,14 @@ static int tb_cfg_get_error(struct tb_ctl *ctl, enum tb_cfg_space space,
int tb_cfg_read(struct tb_ctl *ctl, void *buffer, u64 route, u32 port,
enum tb_cfg_space space, u32 offset, u32 length)
{
struct tb_cfg_result res = tb_cfg_read_raw(ctl, buffer, route, port,
space, offset, length, ctl->timeout_msec);
struct tb_cfg_result res;

/* The KUnit tests read adapter registers without hardware */
KUNIT_STATIC_STUB_REDIRECT(tb_cfg_read, ctl, buffer, route, port, space, offset,
length);

res = tb_cfg_read_raw(ctl, buffer, route, port, space, offset, length,
ctl->timeout_msec);
switch (res.err) {
case 0:
/* Success */
Expand Down
2 changes: 2 additions & 0 deletions drivers/thunderbolt/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,7 @@ int tb_domain_init(void)
ret = bus_register(&tb_bus_type);
if (ret)
goto err_xdomain;
tb_dp_pm_gate_init();

return 0;

Expand All @@ -941,6 +942,7 @@ int tb_domain_init(void)

void tb_domain_exit(void)
{
tb_dp_pm_gate_exit();
bus_unregister(&tb_bus_type);
ida_destroy(&tb_domain_ida);
tb_nvm_exit();
Expand Down
9 changes: 5 additions & 4 deletions drivers/thunderbolt/nhi.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,12 @@ struct tb_nhi_ops {
#define TB_HOST_DP_ADAPTER_QUIRKS BIT(4)
#define TB_HOST_DP_INITIAL_BW_GRANT BIT(5)
/*
* Both DP IN streams of a host PHY must run at one link rate: DP tunnels
* from the host's DP IN adapters offer at most HBR2, at which two 4K60
* streams still fit.
* Both DP IN streams of a host PHY must run at one link rate. A DP tunnel
* alone on the host router offers up to HBR3; when more are needed, all of
* them offer HBR2 at most (two 4K60 streams fit), a tunnel up above that
* being set up again at HBR2 first.
*/
#define TB_HOST_DP_HBR2_MAX BIT(6)
#define TB_HOST_DP_SHARED_RATE BIT(6)

/*
* Minimal number of vectors when we use MSI-X. Two for control channel
Expand Down
Loading