Skip to content

Commit 1b9b7a6

Browse files
committed
cxl/region: Validate region mode vs decoder mode
In preparation for a new region mode, do not, for example, allow 'ram' decoders to be assigned to 'pmem' regions and vice versa. Reviewed-by: Vishal Verma <[email protected]> Reviewed-by: Gregory Price <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Reviewed-by: Ira Weiny <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Tested-by: Fan Ni <[email protected]> Link: https://lore.kernel.org/r/167601995111.1924368.7459128614177994602.stgit@dwillia2-xfh.jf.intel.com Signed-off-by: Dan Williams <[email protected]>
1 parent a8e7d55 commit 1b9b7a6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/cxl/core/region.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,12 @@ static int cxl_region_attach(struct cxl_region *cxlr,
12211221
struct cxl_dport *dport;
12221222
int i, rc = -ENXIO;
12231223

1224+
if (cxled->mode != cxlr->mode) {
1225+
dev_dbg(&cxlr->dev, "%s region mode: %d mismatch: %d\n",
1226+
dev_name(&cxled->cxld.dev), cxlr->mode, cxled->mode);
1227+
return -EINVAL;
1228+
}
1229+
12241230
if (cxled->mode == CXL_DECODER_DEAD) {
12251231
dev_dbg(&cxlr->dev, "%s dead\n", dev_name(&cxled->cxld.dev));
12261232
return -ENODEV;

0 commit comments

Comments
 (0)