cxl/mem: Skip range enumeration if mem_enable clear

When a device does not have mem_enable set then the current range
settings are moot. Skip the enumeration and cause cxl_hdm_decode_init()
to proceed directly to enable the HDM Decoder Capability.

Fixes: 560f78559006 ("cxl/pci: Retrieve CXL DVSEC memory info")
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/165291689442.1426646.18012291761753694336.stgit@dwillia2-xfh
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Williams 2022-05-18 16:34:54 -07:00
parent 14d7887407
commit dd2d42ad6f
2 changed files with 3 additions and 1 deletions

View File

@ -224,6 +224,8 @@ int cxl_dvsec_ranges(struct cxl_dev_state *cxlds,
} }
info->mem_enabled = FIELD_GET(CXL_DVSEC_MEM_ENABLE, ctrl); info->mem_enabled = FIELD_GET(CXL_DVSEC_MEM_ENABLE, ctrl);
if (!info->mem_enabled)
return 0;
for (i = 0; i < hdm_count; i++) { for (i = 0; i < hdm_count; i++) {
u64 base, size; u64 base, size;

View File

@ -92,7 +92,7 @@ __mock bool cxl_hdm_decode_init(struct cxl_dev_state *cxlds,
* are expected even though Linux does not require or maintain that * are expected even though Linux does not require or maintain that
* match. * match.
*/ */
if (!global_enable && info->ranges) if (!global_enable && info->mem_enabled && info->ranges)
goto out; goto out;
retval = true; retval = true;