Skip to content

Commit 82a3e3a

Browse files
AlisonSchofielddavejiang
authored andcommitted
cxl/region: Verify target positions using the ordered target list
When a root decoder is configured the interleave target list is read from the BIOS populated CFMWS structure. Per the CXL spec 3.1 Table 9-22 the target list is in interleave order. The CXL driver populates its decoder target list in the same order and stores it in 'struct cxl_switch_decoder' field "@target: active ordered target list in current decoder configuration" Given the promise of an ordered list, the driver can stop duplicating the work of BIOS and simply check target positions against the ordered list during region configuration. The simplified check against the ordered list is presented here. A follow-on patch will remove the unused code. For Modulo arithmetic this is not a fix, only a simplification. For XOR arithmetic this is a fix for HB IW of 3,6,12. Fixes: f9db85b ("cxl/acpi: Support CXL XOR Interleave Math (CXIMS)") Signed-off-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://patch.msgid.link/35d08d3aba08fee0f9b86ab1cef0c25116ca8a55.1719980933.git.alison.schofield@intel.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent 3b2fedc commit 82a3e3a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/cxl/core/region.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1559,10 +1559,13 @@ static int cxl_region_attach_position(struct cxl_region *cxlr,
15591559
const struct cxl_dport *dport, int pos)
15601560
{
15611561
struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
1562+
struct cxl_switch_decoder *cxlsd = &cxlrd->cxlsd;
1563+
struct cxl_decoder *cxld = &cxlsd->cxld;
1564+
int iw = cxld->interleave_ways;
15621565
struct cxl_port *iter;
15631566
int rc;
15641567

1565-
if (cxlrd->calc_hb(cxlrd, pos) != dport) {
1568+
if (dport != cxlrd->cxlsd.target[pos % iw]) {
15661569
dev_dbg(&cxlr->dev, "%s:%s invalid target position for %s\n",
15671570
dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev),
15681571
dev_name(&cxlrd->cxlsd.cxld.dev));

0 commit comments

Comments
 (0)