Skip to content

Commit 3939dba

Browse files
committed
Merge branch 'for-7.1/cxl-misc' into cxl-for-next
cxl/hdm: Add support for 32 switch decoders
2 parents bfbb6cb + 3624a22 commit 3939dba

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

drivers/cxl/core/hdm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static struct cxl_hdm *devm_cxl_setup_hdm(struct cxl_port *port,
177177
}
178178

179179
parse_hdm_decoder_caps(cxlhdm);
180-
if (cxlhdm->decoder_count == 0) {
180+
if (cxlhdm->decoder_count < 0) {
181181
dev_err(dev, "Spec violation. Caps invalid\n");
182182
return ERR_PTR(-ENXIO);
183183
}

drivers/cxl/cxl.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,16 @@ static inline int cxl_hdm_decoder_count(u32 cap_hdr)
7878
{
7979
int val = FIELD_GET(CXL_HDM_DECODER_COUNT_MASK, cap_hdr);
8080

81-
return val ? val * 2 : 1;
81+
switch (val) {
82+
case 0:
83+
return 1;
84+
case 1 ... 8:
85+
return val * 2;
86+
case 9 ... 12:
87+
return (val - 4) * 4;
88+
default:
89+
return -ENXIO;
90+
}
8291
}
8392

8493
/* Encode defined in CXL 2.0 8.2.5.12.7 HDM Decoder Control Register */

drivers/cxl/cxlmem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ int cxl_mem_sanitize(struct cxl_memdev *cxlmd, u16 cmd);
841841
*/
842842
struct cxl_hdm {
843843
struct cxl_component_regs regs;
844-
unsigned int decoder_count;
844+
int decoder_count;
845845
unsigned int target_count;
846846
unsigned int interleave_mask;
847847
unsigned long iw_cap_mask;

0 commit comments

Comments
 (0)