Linux CXL
 help / color / mirror / Atom feed
* [PATCH v2] cxl: core/region - ignore interleave granularity when ways=1
@ 2025-04-02 23:25 Gregory Price
  2025-04-03  0:00 ` Dan Williams
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Gregory Price @ 2025-04-02 23:25 UTC (permalink / raw)
  To: linux-cxl
  Cc: linux-kernel, kernel-team, dan.j.williams, vishal.l.verma,
	dave.jiang, dave, jonathan.cameron, alison.schofield, ira.weiny

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.

On some Zen5 platforms, the platform BIOS specifies a 256-byte
interleave granularity window for host bridges when there is only
one target downstream.  This leads to Linux rejecting the configuration
of a region with a x2 root with two x1 hostbridges.

Decoder Programming:
   root - iw:2 ig:256
   hb1  - iw:1 ig:256  (Linux expects 512)
   hb2  - iw:1 ig:256  (Linux expects 512)
   ep1  - iw:2 ig:256
   ep2  - iw:2 ig:256

This change allows all decoders downstream of a passthrough decoder to
also be configured as passthrough (iw:1 ig:X), but still disallows
downstream decoders from applying subsequent interleaves.

e.g. in the above example if there was another decoder south of hb1
attempting to interleave 2 endpoints - Linux would enforce hb1.ig=512
because the southern decoder would have iw:2 and require ig=pig*piw.

Signed-off-by: Gregory Price <gourry@gourry.net>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/cxl/core/region.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 04bc6cad092c..dec262eadf9a 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -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.47.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-04-10 16:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02 23:25 [PATCH v2] cxl: core/region - ignore interleave granularity when ways=1 Gregory Price
2025-04-03  0:00 ` Dan Williams
2025-04-03  1:12 ` Zhijian Li (Fujitsu)
2025-04-03  4:25   ` Yasunori Gotou (Fujitsu)
2025-04-03  4:57     ` Dan Williams
2025-04-03  4:42   ` Dan Williams
2025-04-03  8:31     ` Zhijian Li (Fujitsu)
2025-04-04 13:40 ` Jonathan Cameron
2025-04-06 18:38 ` Davidlohr Bueso
2025-04-07  8:04 ` Zhijian Li (Fujitsu)
2025-04-10 16:26 ` Dave Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox