]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
cxl/port: Move decoder setup before dport creation
authorDan Williams <dan.j.williams@intel.com>
Sat, 31 Jan 2026 00:03:58 +0000 (16:03 -0800)
committerDave Jiang <dave.jiang@intel.com>
Mon, 2 Feb 2026 15:41:29 +0000 (08:41 -0700)
commit86e756715db22cd79a9726c22644415c46b6b149
treea28545c063fdc66a4676226156edd97406d2bd95
parentafa2bdba1ee28e21f30fe5391b0273b58b32e0d3
cxl/port: Move decoder setup before dport creation

There are port setup actions that run on first dport arrival, and there are
setup actions that run per dport.

RAS register setup is a future additional setup action to run per-port
(once the first dport arrives), and each dport also has RAS registers to
map.

Before adding that, flip the order of "first dport" and "per-dport"
actions. This makes allocation symmetric with teardown, "first dport"
actions unwind after last dport removed. It also allows for using a devres
group to collect the unrelated decoder, RAS, and dport setup actions into
one group release action.

The new cxl_port_open_group() collects "first dport" and "per-dport" into
one group that can be released on any failure. This group's lifetime only
needs to span the short duration of cxl_port_add_dport() to cleanup all
potential damage from failing to add a dport. Contrast that to the "dport"
devres group that is called upon to destruct fully formed dport objects.

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Tested-by: Terry Bowman <terry.bowman@amd.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Link: https://patch.msgid.link/20260131000403.2135324-5-dan.j.williams@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/port.c