Message ID | 562c5e2097f32567bf7aa505d7952d9c068d830b.1715192606.git.alison.schofield@intel.com |
---|---|
State | Superseded |
Headers | show |
Series | XOR Math Fixups: translation & position | expand |
On Wed, 8 May 2024 11:47:52 -0700 alison.schofield@intel.com wrote: > From: Alison Schofield <alison.schofield@intel.com> > > 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: f9db85bfec0d ("cxl/acpi: Support CXL XOR Interleave Math (CXIMS)") > Signed-off-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
alison.schofield@ wrote: > From: Alison Schofield <alison.schofield@intel.com> > > 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: f9db85bfec0d ("cxl/acpi: Support CXL XOR Interleave Math (CXIMS)") > Signed-off-by: Alison Schofield <alison.schofield@intel.com> LGTM Reviewed-by: Dan Williams <dan.j.williams@intel.com>
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 2fe93c5a8072..6aa2c981f1c4 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1559,10 +1559,13 @@ static int cxl_region_attach_position(struct cxl_region *cxlr, const struct cxl_dport *dport, int pos) { struct cxl_memdev *cxlmd = cxled_to_memdev(cxled); + struct cxl_switch_decoder *cxlsd = &cxlrd->cxlsd; + struct cxl_decoder *cxld = &cxlsd->cxld; + int iw = cxld->interleave_ways; struct cxl_port *iter; int rc; - if (cxlrd->calc_hb(cxlrd, pos) != dport) { + if (dport != cxlrd->cxlsd.target[pos % iw]) { dev_dbg(&cxlr->dev, "%s:%s invalid target position for %s\n", dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev), dev_name(&cxlrd->cxlsd.cxld.dev));