Skip to content

Commit 03ff65c

Browse files
MingLi-4davejiang
authored andcommitted
cxl/edac: Fix wrong dpa checking for PPR operation
Per Table 8-143. "Get Partition Info Output Payload" in CXL r3.2 section 8.2.10.9.2.1 "Get Partition Info(Opcode 4100h)", DPA 0 is a valid address of a CXL device. However, cxl_do_ppr() considers it as an invalid address, so that user will get an -EINVAL when user calls the sysfs interface of the edac driver to trigger a Post Package Repair(PPR) operation for DPA 0 on a CXL device. The correct implementation should be checking if the input DPA is in the DPA range of the CXL device. Fixes: be9b359 ("cxl/edac: Add CXL memory device soft PPR control feature") Signed-off-by: Li Ming <[email protected]> Tested-by: Shiju Jose <[email protected]> Reviewed-by: Shiju Jose <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Reviewed-by: Alison Schofield <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Dave Jiang <[email protected]>
1 parent 5b6031c commit 03ff65c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/cxl/core/edac.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1923,8 +1923,11 @@ static int cxl_ppr_set_nibble_mask(struct device *dev, void *drv_data,
19231923
static int cxl_do_ppr(struct device *dev, void *drv_data, u32 val)
19241924
{
19251925
struct cxl_ppr_context *cxl_ppr_ctx = drv_data;
1926+
struct cxl_memdev *cxlmd = cxl_ppr_ctx->cxlmd;
1927+
struct cxl_dev_state *cxlds = cxlmd->cxlds;
19261928

1927-
if (!cxl_ppr_ctx->dpa || val != EDAC_DO_MEM_REPAIR)
1929+
if (val != EDAC_DO_MEM_REPAIR ||
1930+
!cxl_resource_contains_addr(&cxlds->dpa_res, cxl_ppr_ctx->dpa))
19281931
return -EINVAL;
19291932

19301933
return cxl_mem_perform_ppr(cxl_ppr_ctx);

0 commit comments

Comments
 (0)