Linux CXL
 help / color / mirror / Atom feed
* [PATCH] cxl: core/region - ignore interleave granularity when ways=1
@ 2025-04-02 19:34 Gregory Price
  2025-04-02 19:46 ` Dave Jiang
  2025-04-02 21:59 ` Dan Williams
  0 siblings, 2 replies; 5+ messages in thread
From: Gregory Price @ 2025-04-02 19:34 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.

Signed-off-by: Gregory Price <gourry@gourry.net>
---
 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] 5+ messages in thread

* Re: [PATCH] cxl: core/region - ignore interleave granularity when ways=1
  2025-04-02 19:34 [PATCH] cxl: core/region - ignore interleave granularity when ways=1 Gregory Price
@ 2025-04-02 19:46 ` Dave Jiang
  2025-04-02 21:59 ` Dan Williams
  1 sibling, 0 replies; 5+ messages in thread
From: Dave Jiang @ 2025-04-02 19:46 UTC (permalink / raw)
  To: Gregory Price, linux-cxl
  Cc: linux-kernel, kernel-team, dan.j.williams, vishal.l.verma, dave,
	jonathan.cameron, alison.schofield, ira.weiny



On 4/2/25 12:34 PM, Gregory Price wrote:
> 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.
> 
> 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)) {


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

* Re: [PATCH] cxl: core/region - ignore interleave granularity when ways=1
  2025-04-02 19:34 [PATCH] cxl: core/region - ignore interleave granularity when ways=1 Gregory Price
  2025-04-02 19:46 ` Dave Jiang
@ 2025-04-02 21:59 ` Dan Williams
  2025-04-02 22:32   ` Gregory Price
  1 sibling, 1 reply; 5+ messages in thread
From: Dan Williams @ 2025-04-02 21:59 UTC (permalink / raw)
  To: Gregory Price, linux-cxl
  Cc: linux-kernel, kernel-team, dan.j.williams, vishal.l.verma,
	dave.jiang, dave, jonathan.cameron, alison.schofield, ira.weiny

Gregory Price wrote:
> 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.

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

* Re: [PATCH] cxl: core/region - ignore interleave granularity when ways=1
  2025-04-02 21:59 ` Dan Williams
@ 2025-04-02 22:32   ` Gregory Price
  2025-04-02 22:35     ` Dan Williams
  0 siblings, 1 reply; 5+ messages in thread
From: Gregory Price @ 2025-04-02 22:32 UTC (permalink / raw)
  To: Dan Williams
  Cc: linux-cxl, linux-kernel, kernel-team, vishal.l.verma, dave.jiang,
	dave, jonathan.cameron, alison.schofield, ira.weiny

On Wed, Apr 02, 2025 at 02:59:17PM -0700, Dan Williams wrote:
> Gregory Price wrote:
> > 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.

Would like this inline or just in the changelog?

~Gregory

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

* Re: [PATCH] cxl: core/region - ignore interleave granularity when ways=1
  2025-04-02 22:32   ` Gregory Price
@ 2025-04-02 22:35     ` Dan Williams
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Williams @ 2025-04-02 22:35 UTC (permalink / raw)
  To: Gregory Price, Dan Williams
  Cc: linux-cxl, linux-kernel, kernel-team, vishal.l.verma, dave.jiang,
	dave, jonathan.cameron, alison.schofield, ira.weiny

Gregory Price wrote:
> On Wed, Apr 02, 2025 at 02:59:17PM -0700, Dan Williams wrote:
> > Gregory Price wrote:
> > > 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.
> 
> Would like this inline or just in the changelog?

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

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

end of thread, other threads:[~2025-04-02 22:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02 19:34 [PATCH] cxl: core/region - ignore interleave granularity when ways=1 Gregory Price
2025-04-02 19:46 ` Dave Jiang
2025-04-02 21:59 ` Dan Williams
2025-04-02 22:32   ` Gregory Price
2025-04-02 22:35     ` Dan Williams

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