Skip to content
Closed
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
4 changes: 3 additions & 1 deletion drivers/gpu/drm/apple/afk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1911,12 +1911,14 @@ static void afk_recv_handle_init(struct apple_dcp_afkep *ep, u32 channel,
ep->dcp->hw.firmware_compat == DCP_FIRMWARE_H17P) ||
ep->dcp->v27_j714s ||
(ep->dcp->fw_compat == DCP_FIRMWARE_V_27_0 &&
dcp_has_external_output(ep->dcp)) ||
(dcp_has_external_output(ep->dcp) ||
ep->dcp->hw.afk_name_fallback)) ||
(ep->dcp->v27_sleep_transport && !strcmp(name, "md-manager")))) {
/*
* H17G and firmware-27 T8142 can omit EPIC identity
* for powerlog-service. J716c's sleep transport
* admits only md-manager by name here.
* hw.afk_name_fallback covers firmware-27 T6030 internal DCP.
*/
epic_name = NULL;
epic_class = NULL;
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/apple/dcp-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ struct apple_dcp_hw_data {
* properties after it are not parsed (afk_recv_handle_init()).
*/
bool afk_announced_names;
/* Match firmware-27 AFK services by announced name if identity is missing. */
bool afk_name_fallback;
/*
* How long AFK waits for the firmware to start or stop an endpoint
* and to answer a command or service call (afk_timeout_ms()); zero
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/apple/dcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -12080,6 +12080,7 @@ static const struct apple_dcp_hw_data apple_dcp_hw_dcp = {
static const struct apple_dcp_hw_data apple_dcp_hw_t6030 = {
.iboot_handoff = "apple,t6030-handoff",
.num_dptx_ports = 1,
.afk_name_fallback = true,
};

static const struct apple_dcp_hw_data apple_dcp_hw_t8122 = {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/apple/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -2261,7 +2261,7 @@ int parse_epic_service_init(struct dcp_parse_ctx *handle, const char **name,
break;
}

if (!parsed_unit || !parsed_name || !parsed_class)
if (!ret && (!parsed_unit || !parsed_name || !parsed_class))
ret = -ENOENT;

if (ret) {
Expand Down
21 changes: 20 additions & 1 deletion tools/asahi/dcpext26-startup-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,20 @@ def run(name,code,reject=False):
struct apple_epic_service_ops {const char *name;bool reusable,optional,open_later,singleton;int (*prepare)(struct apple_epic_service *,const char *,const char *,s64);int (*revalidate)(struct apple_epic_service *,const char *,const char *,s64);void (*init)(struct apple_epic_service *,const char *,const char *,s64);void (*teardown)(struct apple_epic_service *);void (*init_props)(struct apple_epic_service *,s64,const void *,size_t);};
struct apple_epic_service {struct apple_dcp_afkep *ep;const struct apple_epic_service_ops *ops;bool enabled,torndown,pending_open,defer_start,started;unsigned users;int lock;u32 channel;void *cookie;const char *pending_name,*pending_class;s64 pending_unit;int cmd_map[1];};
struct dptx_port {struct apple_epic_service *service;s64 unit;bool enabled,connected;int enable_completion;};
struct apple_dcp {const void *push_out_prefill;bool native,ext26_services_open,v27_j714s,v27_sleep_transport,dcpext;int fw_compat,index,dptx_controller_ready;struct {unsigned num_dptx_ports;int iomfb_method_profile,firmware_compat;bool afk_announced_names;} hw;struct dptx_port dptxport[2];void *dev,*fixed_phy;u32 nr_typec_routes;struct apple_dcp_afkep *systemep,*ibootep,*dptx_controller_ep,*dcpavservep,*dptxep,*ext26_aux[3];};
struct apple_dcp {
const void *push_out_prefill;
bool native,ext26_services_open,v27_j714s,v27_sleep_transport,dcpext;
int fw_compat,index,dptx_controller_ready;
struct {
unsigned num_dptx_ports;
int iomfb_method_profile,firmware_compat;
bool afk_announced_names,afk_name_fallback;
} hw;
struct dptx_port dptxport[2];
void *dev,*fixed_phy;
u32 nr_typec_routes;
struct apple_dcp_afkep *systemep,*ibootep,*dptx_controller_ep,*dcpavservep,*dptxep,*ext26_aux[3];
};
''' + fn((A/'dcp-internal.h').read_text(),'dcp_has_external_output') + r'''
struct apple_dcp_afkep {struct apple_dcp *dcp;u32 endpoint,num_channels;bool wire_v2,stopping,match_epic_name,compact;int lock;void *wq,*service_work;const struct apple_epic_service_ops *ops,*unmatched_ops;struct apple_epic_service services[AFK_MAX_CHANNEL];int service_wq;};
#define wake_up_all(q) ((void)(q))
Expand Down Expand Up @@ -190,6 +203,12 @@ def run(name,code,reject=False):
text(&panel,"compartment");text(&panel,"system");text(&panel,"name");text(&panel,"system");text(&panel,"interface-id");number(&panel,1);
assert(!parse(panel.p,panel.n,&ctx));assert(!parse_epic_service_init(&ctx,&n,&c,&u,true,false)&&u==1&&!strcmp(n,"system"));free((void *)n);free((void *)c);
assert(!parse(panel.p,panel.n,&ctx));assert(parse_epic_service_init(&ctx,&n,&c,&u,false,false)==-ENOENT);
// A present but malformed identity must not look like an absent one.
struct blob malformed={0};
put_unaligned_le32(0xd3,malformed.p);malformed.n=4;tag(&malformed,1,1);
text(&malformed,"EPICUnit");text(&malformed,"not an integer");
assert(!parse(malformed.p,malformed.n,&ctx));
assert(parse_epic_service_init(&ctx,&n,&c,&u,false,false)==-EINVAL);
// A failed OPEN cannot publish a prepared port; closed workqueues are never retried.
struct apple_dcp_afkep failed={.dcp=&d,.endpoint=0x2a,.wire_v2=true,.ops=port_ops};failed.wq=&failed;
d.dptxport[0].service=NULL;d.dptxport[0].enabled=false;open_error=-EIO;announce(&failed,1,description("dcpdptx-port-epic","AppleDCPDPTXRemotePort",0,1,false));assert(!d.dptxport[0].service&&!failed.services[0].enabled);
Expand Down
1 change: 1 addition & 0 deletions tools/testing/selftests/drivers/gpu/apple-dcp/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ def v27_panel_handoff(root):
struct device { struct device_node *of_node; };
struct apple_dcp_hw_data {
bool adopt_live_session;
bool afk_name_fallback;
const char *iboot_handoff;
unsigned num_dptx_ports;
u8 firmware_dma_bits;
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/drivers/gpu/apple-dcp/edid.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def function(file,signature):
void *dev;int fw_compat;struct apple_dcp_afkep *dcpavservep;struct apple_connector *connector;
void *desktop;
bool external_physically_absent,hpd_mutex,quiescing,typec_cable_connected;u64 typec_generation;unsigned int nr_modes;
struct { int iomfb_method_profile,firmware_compat; bool fw_14_7_endpoints,afk_announced_names; unsigned int num_dptx_ports; unsigned char dptx_endpoint; } hw; bool ext_dead,external_native;
struct { int iomfb_method_profile,firmware_compat; bool fw_14_7_endpoints,afk_announced_names,afk_name_fallback; unsigned int num_dptx_ports; unsigned char dptx_endpoint; } hw; bool ext_dead,external_native;
struct { bool lock,enabled;u64 epoch;int enable_completion;struct apple_epic_service *service,*opened;
u64 opened_epoch,close_gen,terminated_epoch,close_epoch;bool opening;struct work_struct close_wq; } dcpavserv;
/* A J714s firmware 27 processor's: this one is not. */
Expand Down
Loading