Skip to content

Commit 99bf0ee

Browse files
YanfeiXudavejiang
authored andcommitted
cxl/pci: Check Mem_info_valid bit for each applicable DVSEC
In theory a device might set the mem_info_valid bit for a first range after it is ready but before as second range has reached that state. Therefore, the correct approach is to check the Mem_info_valid bit for each applicable DVSEC range against HDM_COUNT, rather than only for the DVSEC range 1. Consequently, let's move the check into the "for loop" that handles each DVSEC range. Reviewed-by: Jonathan Cameron <[email protected]> Signed-off-by: Yanfei Xu <[email protected]> Reviewed-by: Alison Schofield <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Dave Jiang <[email protected]>
1 parent 5c6e3d5 commit 99bf0ee

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/cxl/core/pci.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,6 @@ int cxl_dvsec_rr_decode(struct device *dev, struct cxl_port *port,
324324
if (!hdm_count || hdm_count > 2)
325325
return -EINVAL;
326326

327-
rc = cxl_dvsec_mem_range_valid(cxlds, 0);
328-
if (rc)
329-
return rc;
330-
331327
/*
332328
* The current DVSEC values are moot if the memory capability is
333329
* disabled, and they will remain moot after the HDM Decoder
@@ -345,6 +341,10 @@ int cxl_dvsec_rr_decode(struct device *dev, struct cxl_port *port,
345341
u64 base, size;
346342
u32 temp;
347343

344+
rc = cxl_dvsec_mem_range_valid(cxlds, i);
345+
if (rc)
346+
return rc;
347+
348348
rc = pci_read_config_dword(
349349
pdev, d + CXL_DVSEC_RANGE_SIZE_HIGH(i), &temp);
350350
if (rc)

0 commit comments

Comments
 (0)