]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cxl/test: Setup target_map for cxl_test decoder initialization
authorDave Jiang <dave.jiang@intel.com>
Fri, 29 Aug 2025 18:09:27 +0000 (11:09 -0700)
committerDave Jiang <dave.jiang@intel.com>
Thu, 18 Sep 2025 16:55:23 +0000 (09:55 -0700)
cxl_test uses mock functions for decoder enumaration. Add initialization
of the cxld->target_map[] for cxl_test based decoders in the mock
functions.

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>
tools/testing/cxl/test/cxl.c

index e3b4dc265a3be048f0d61423f86bbd8b65745be5..5d0040b7d7dbd69fe1c49dec93398c2a03f9745b 100644 (file)
@@ -811,15 +811,21 @@ static void mock_init_hdm_decoder(struct cxl_decoder *cxld)
                 */
                if (WARN_ON(!dev))
                        continue;
+
                cxlsd = to_cxl_switch_decoder(dev);
                if (i == 0) {
                        /* put cxl_mem.4 second in the decode order */
-                       if (pdev->id == 4)
+                       if (pdev->id == 4) {
                                cxlsd->target[1] = dport;
-                       else
+                               cxld->target_map[1] = dport->port_id;
+                       } else {
                                cxlsd->target[0] = dport;
-               } else
+                               cxld->target_map[0] = dport->port_id;
+                       }
+               } else {
                        cxlsd->target[0] = dport;
+                       cxld->target_map[0] = dport->port_id;
+               }
                cxld = &cxlsd->cxld;
                cxld->target_type = CXL_DECODER_HOSTONLYMEM;
                cxld->flags = CXL_DECODER_F_ENABLE;