mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
cxl: Add a cached copy of target_map to cxl_decoder
Add a cached copy of the hardware port-id list that is available at init before all @dport objects have been instantiated. Change is in preparation of delayed dport instantiation. Reviewed-by: Robert Richter <rrichter@amd.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Tested-by: Robert Richter <rrichter@amd.com> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
This commit is contained in:
@@ -651,7 +651,7 @@ static int mock_cxl_add_passthrough_decoder(struct cxl_port *port)
|
||||
|
||||
|
||||
struct target_map_ctx {
|
||||
int *target_map;
|
||||
u32 *target_map;
|
||||
int index;
|
||||
int target_count;
|
||||
};
|
||||
@@ -863,9 +863,7 @@ static int mock_cxl_enumerate_decoders(struct cxl_hdm *cxlhdm,
|
||||
target_count = NR_CXL_SWITCH_PORTS;
|
||||
|
||||
for (i = 0; i < NR_CXL_PORT_DECODERS; i++) {
|
||||
int target_map[CXL_DECODER_MAX_INTERLEAVE] = { 0 };
|
||||
struct target_map_ctx ctx = {
|
||||
.target_map = target_map,
|
||||
.target_count = target_count,
|
||||
};
|
||||
struct cxl_decoder *cxld;
|
||||
@@ -894,6 +892,8 @@ static int mock_cxl_enumerate_decoders(struct cxl_hdm *cxlhdm,
|
||||
cxld = &cxled->cxld;
|
||||
}
|
||||
|
||||
ctx.target_map = cxld->target_map;
|
||||
|
||||
mock_init_hdm_decoder(cxld);
|
||||
|
||||
if (target_count) {
|
||||
@@ -905,7 +905,7 @@ static int mock_cxl_enumerate_decoders(struct cxl_hdm *cxlhdm,
|
||||
}
|
||||
}
|
||||
|
||||
rc = cxl_decoder_add_locked(cxld, target_map);
|
||||
rc = cxl_decoder_add_locked(cxld);
|
||||
if (rc) {
|
||||
put_device(&cxld->dev);
|
||||
dev_err(&port->dev, "Failed to add decoder\n");
|
||||
|
||||
Reference in New Issue
Block a user