diff options
| -rw-r--r-- | drivers/misc/cxl/pci.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c index 2b2e1b80d759..1ef01647265f 100644 --- a/drivers/misc/cxl/pci.c +++ b/drivers/misc/cxl/pci.c | |||
| @@ -598,6 +598,8 @@ static int cxl_read_afu_descriptor(struct cxl_afu *afu) | |||
| 598 | 598 | ||
| 599 | static int cxl_afu_descriptor_looks_ok(struct cxl_afu *afu) | 599 | static int cxl_afu_descriptor_looks_ok(struct cxl_afu *afu) |
| 600 | { | 600 | { |
| 601 | int i; | ||
| 602 | |||
| 601 | if (afu->psa && afu->adapter->ps_size < | 603 | if (afu->psa && afu->adapter->ps_size < |
| 602 | (afu->pp_offset + afu->pp_size*afu->max_procs_virtualised)) { | 604 | (afu->pp_offset + afu->pp_size*afu->max_procs_virtualised)) { |
| 603 | dev_err(&afu->dev, "per-process PSA can't fit inside the PSA!\n"); | 605 | dev_err(&afu->dev, "per-process PSA can't fit inside the PSA!\n"); |
| @@ -607,6 +609,13 @@ static int cxl_afu_descriptor_looks_ok(struct cxl_afu *afu) | |||
| 607 | if (afu->pp_psa && (afu->pp_size < PAGE_SIZE)) | 609 | if (afu->pp_psa && (afu->pp_size < PAGE_SIZE)) |
| 608 | dev_warn(&afu->dev, "AFU uses < PAGE_SIZE per-process PSA!"); | 610 | dev_warn(&afu->dev, "AFU uses < PAGE_SIZE per-process PSA!"); |
| 609 | 611 | ||
| 612 | for (i = 0; i < afu->crs_num; i++) { | ||
| 613 | if ((cxl_afu_cr_read32(afu, i, 0) == 0)) { | ||
| 614 | dev_err(&afu->dev, "ABORTING: AFU configuration record %i is invalid\n", i); | ||
| 615 | return -EINVAL; | ||
| 616 | } | ||
| 617 | } | ||
| 618 | |||
| 610 | return 0; | 619 | return 0; |
| 611 | } | 620 | } |
| 612 | 621 | ||
