Skip to content

Commit aae0594

Browse files
MingLi-4davejiang
authored andcommitted
cxl/region: Fix the first aliased address miscalculation
In extended linear cache(ELC) case, cxl_port_get_spa_cache_alias() helps to get the aliased address of a SPA, it considers the first address in CXL memory range is "region start + region cache size + 1", but it should be "region start + region cache size". So if a SPA is equal to "region start + region cache size", its aliased address should be "SPA - region cache size". Signed-off-by: Li Ming <ming.li@zohomail.com> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Link: https://patch.msgid.link/20250317070124.815028-1-ming.li@zohomail.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent 3b5d432 commit aae0594

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/cxl/core/region.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3460,7 +3460,7 @@ u64 cxl_port_get_spa_cache_alias(struct cxl_port *endpoint, u64 spa)
34603460
if (!p->cache_size)
34613461
return ~0ULL;
34623462

3463-
if (spa > p->res->start + p->cache_size)
3463+
if (spa >= p->res->start + p->cache_size)
34643464
return spa - p->cache_size;
34653465

34663466
return spa + p->cache_size;

0 commit comments

Comments
 (0)