Merge branch 'for-7.1/cxl-misc' into cxl-for-next

cxl/hdm: Add support for 32 switch decoders
This commit is contained in:
Dave Jiang
2026-04-10 11:11:53 -07:00
3 changed files with 12 additions and 3 deletions

View File

@@ -177,7 +177,7 @@ static struct cxl_hdm *devm_cxl_setup_hdm(struct cxl_port *port,
}
parse_hdm_decoder_caps(cxlhdm);
if (cxlhdm->decoder_count == 0) {
if (cxlhdm->decoder_count < 0) {
dev_err(dev, "Spec violation. Caps invalid\n");
return ERR_PTR(-ENXIO);
}

View File

@@ -78,7 +78,16 @@ static inline int cxl_hdm_decoder_count(u32 cap_hdr)
{
int val = FIELD_GET(CXL_HDM_DECODER_COUNT_MASK, cap_hdr);
return val ? val * 2 : 1;
switch (val) {
case 0:
return 1;
case 1 ... 8:
return val * 2;
case 9 ... 12:
return (val - 4) * 4;
default:
return -ENXIO;
}
}
/* Encode defined in CXL 2.0 8.2.5.12.7 HDM Decoder Control Register */

View File

@@ -841,7 +841,7 @@ int cxl_mem_sanitize(struct cxl_memdev *cxlmd, u16 cmd);
*/
struct cxl_hdm {
struct cxl_component_regs regs;
unsigned int decoder_count;
int decoder_count;
unsigned int target_count;
unsigned int interleave_mask;
unsigned long iw_cap_mask;