Commit d2b61ed2 authored by Ben Widawsky's avatar Ben Widawsky Committed by Dan Williams

cxl/core/port: Make passthrough decoder init implicit

Unused CXL decoders, or ports which use a passthrough decoder (no HDM
decoder registers) are expected to be initialized in a specific way.
Since upcoming drivers will want the same initialization, and it was
already a requirement to have consumers of the API configure the decoder
specific to their needs, initialize to this passthrough state by
default.
Signed-off-by: default avatarBen Widawsky <ben.widawsky@intel.com>
Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/164298418778.3018233.13573986275832546547.stgit@dwillia2-desk3.amr.corp.intel.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent d621bc2e
...@@ -264,11 +264,6 @@ static int add_host_bridge_uport(struct device *match, void *arg) ...@@ -264,11 +264,6 @@ static int add_host_bridge_uport(struct device *match, void *arg)
if (IS_ERR(cxld)) if (IS_ERR(cxld))
return PTR_ERR(cxld); return PTR_ERR(cxld);
cxld->interleave_ways = 1;
cxld->interleave_granularity = PAGE_SIZE;
cxld->target_type = CXL_DECODER_EXPANDER;
cxld->platform_res = (struct resource)DEFINE_RES_MEM(0, 0);
device_lock(&port->dev); device_lock(&port->dev);
dport = list_first_entry(&port->dports, typeof(*dport), list); dport = list_first_entry(&port->dports, typeof(*dport), list);
device_unlock(&port->dev); device_unlock(&port->dev);
......
...@@ -505,7 +505,8 @@ static int decoder_populate_targets(struct cxl_decoder *cxld, ...@@ -505,7 +505,8 @@ static int decoder_populate_targets(struct cxl_decoder *cxld,
* some address space for CXL.mem utilization. A decoder is expected to be * some address space for CXL.mem utilization. A decoder is expected to be
* configured by the caller before registering. * configured by the caller before registering.
* *
* Return: A new cxl decoder to be registered by cxl_decoder_add() * Return: A new cxl decoder to be registered by cxl_decoder_add(). The decoder
* is initialized to be a "passthrough" decoder.
*/ */
static struct cxl_decoder *cxl_decoder_alloc(struct cxl_port *port, static struct cxl_decoder *cxl_decoder_alloc(struct cxl_port *port,
unsigned int nr_targets) unsigned int nr_targets)
...@@ -537,6 +538,12 @@ static struct cxl_decoder *cxl_decoder_alloc(struct cxl_port *port, ...@@ -537,6 +538,12 @@ static struct cxl_decoder *cxl_decoder_alloc(struct cxl_port *port,
else else
cxld->dev.type = &cxl_decoder_switch_type; cxld->dev.type = &cxl_decoder_switch_type;
/* Pre initialize an "empty" decoder */
cxld->interleave_ways = 1;
cxld->interleave_granularity = PAGE_SIZE;
cxld->target_type = CXL_DECODER_EXPANDER;
cxld->platform_res = (struct resource)DEFINE_RES_MEM(0, 0);
return cxld; return cxld;
err: err:
kfree(cxld); kfree(cxld);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment