Skip to contentSkip to conversation

cxl: core/region - ignore interleave granularity when ways=1

PATCH Superseded Gregory Price 3 participants 5 messages Apr 2, 2025 CXL

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxl: core/region - ignore interleave granularity when ways=1

When validating decoder IW/IG when setting up regions, the granularity is irrelevant when iw=1 - all accesses will always route to the only target anyway - so all ig values are "correct". Loosen the requirement that ig = (parent_iw * parent_ig) when iw=1.

---
 drivers/cxl/core/region.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/core/region.c +1 -1
index 04bc6cad092c..dec262eadf9a 100644
@@ -1553,7 +1553,7 @@ static int cxl_port_setup_targets(struct cxl_port *port,
 
 	if (test_bit(CXL_REGION_F_AUTO, &cxlr->flags)) {
 		if (cxld->interleave_ways != iw ||
-		    cxld->interleave_granularity != ig ||
+		    (iw > 1 && cxld->interleave_granularity != ig) ||
 		    cxled->spa_range.start != p->res->start ||
 		    cxled->spa_range.end != p->res->end ||
 		    ((cxld->flags & CXL_DECODER_F_ENABLE) == 0)) {
Signature · 1 line
2.47.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Gregory Price

When validating decoder IW/IG when setting up regions, the granularity is irrelevant when iw=1 - all accesses will always route to the only target anyway - so all ig values are "correct". Loosen the requirement that ig = (parent_iw * parent_ig) when iw=1.

Quoted 17 lines
---
 drivers/cxl/core/region.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/core/region.c +1 -1
index 04bc6cad092c..dec262eadf9a 100644
@@ -1553,7 +1553,7 @@ static int cxl_port_setup_targets(struct cxl_port *port,
 
 	if (test_bit(CXL_REGION_F_AUTO, &cxlr->flags)) {
 		if (cxld->interleave_ways != iw ||
-		    cxld->interleave_granularity != ig ||
+		    (iw > 1 && cxld->interleave_granularity != ig) ||
 		    cxled->spa_range.start != p->res->start ||
 		    cxled->spa_range.end != p->res->end ||
 		    ((cxld->flags & CXL_DECODER_F_ENABLE) == 0)) {
#2 lore raw
In reply to Gregory Price
Quoted 4 lines · Gregory Price

When validating decoder IW/IG when setting up regions, the granularity is irrelevant when iw=1 - all accesses will always route to the only target anyway - so all ig values are "correct". Loosen the requirement that ig = (parent_iw * parent_ig) when iw=1.

Can you say a bit more here about the real world impact like we chatted about on Discord? Something like:

---
The platform BIOS on "platform-X" specifies a 512-byte interleave-granularity CXL Window when 256-byte is expected. This leads to Linux erroneously rejecting the region configuration of 2 devices attached to an x1 host bridge.
---

That way distros and platform-X folks can flag the importance of this fix.

#3 lore raw
Quoted 9 lines · Dan Williams
Quoted 4 lines · Gregory Price

When validating decoder IW/IG when setting up regions, the granularity is irrelevant when iw=1 - all accesses will always route to the only target anyway - so all ig values are "correct". Loosen the requirement that ig = (parent_iw * parent_ig) when iw=1.

Can you say a bit more here about the real world impact like we chatted about on Discord? Something like:

Quoted 8 lines

---
The platform BIOS on "platform-X" specifies a 512-byte interleave-granularity CXL Window when 256-byte is expected. This leads to Linux erroneously rejecting the region configuration of 2 devices attached to an x1 host bridge.
---

That way distros and platform-X folks can flag the importance of this fix.

Would like this inline or just in the changelog?

~Gregory

#4 lore raw
Quoted 17 lines · Gregory Price
Quoted 16 lines · Dan Williams
Quoted 4 lines · Gregory Price

When validating decoder IW/IG when setting up regions, the granularity is irrelevant when iw=1 - all accesses will always route to the only target anyway - so all ig values are "correct". Loosen the requirement that ig = (parent_iw * parent_ig) when iw=1.

Can you say a bit more here about the real world impact like we chatted about on Discord? Something like:

---
The platform BIOS on "platform-X" specifies a 512-byte interleave-granularity CXL Window when 256-byte is expected. This leads to Linux erroneously rejecting the region configuration of 2 devices attached to an x1 host bridge.
---

Quoted 3 lines
Quoted 1 line

That way distros and platform-X folks can flag the importance of this fix.

Would like this inline or just in the changelog?

Changelog is fine, because this more about routing the fix than explaining the code.