Skip to content

Commit 6a5a153

Browse files
jic23davejiang
authored andcommitted
cxl_test: Limit location for fake CFMWS to mappable range
Some architectures (e.g. arm64) only support memory hotplug operations on a restricted set of physical addresses. This applies even when we are faking some CXL fixed memory windows for the purposes of cxl_test. That range can be queried with mhp_get_pluggable_range(true). Use the minimum of that the top of that range and iomem_resource.end to establish the 64GiB region used by cxl_test. From thread #2 which was related to the issue in #1. [ dj: Add CONFIG_MEMORY_HOTPLUG config check, from Alison ] Link: https://lore.kernel.org/linux-cxl/[email protected]/ #2 Reported-by: Itaru Kitayama <[email protected]> Closes: pmem/ndctl#278 #1 Reviewed-by: Dan Williams <[email protected]> Tested-by: Itaru Kitayama <[email protected] <mailto:[email protected]> Tested-by: Marc Herbert <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Dave Jiang <[email protected]>
1 parent a505c74 commit 6a5a153

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

tools/testing/cxl/config_check.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ void check(void)
1414
BUILD_BUG_ON(!IS_ENABLED(CONFIG_CXL_REGION_INVALIDATION_TEST));
1515
BUILD_BUG_ON(!IS_ENABLED(CONFIG_NVDIMM_SECURITY_TEST));
1616
BUILD_BUG_ON(!IS_ENABLED(CONFIG_DEBUG_FS));
17+
BUILD_BUG_ON(!IS_ENABLED(CONFIG_MEMORY_HOTPLUG));
1718
}

tools/testing/cxl/test/cxl.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Copyright(c) 2021 Intel Corporation. All rights reserved.
33

44
#include <linux/platform_device.h>
5+
#include <linux/memory_hotplug.h>
56
#include <linux/genalloc.h>
67
#include <linux/module.h>
78
#include <linux/mutex.h>
@@ -1328,6 +1329,7 @@ static int cxl_mem_init(void)
13281329
static __init int cxl_test_init(void)
13291330
{
13301331
int rc, i;
1332+
struct range mappable;
13311333

13321334
cxl_acpi_test();
13331335
cxl_core_test();
@@ -1342,8 +1344,11 @@ static __init int cxl_test_init(void)
13421344
rc = -ENOMEM;
13431345
goto err_gen_pool_create;
13441346
}
1347+
mappable = mhp_get_pluggable_range(true);
13451348

1346-
rc = gen_pool_add(cxl_mock_pool, iomem_resource.end + 1 - SZ_64G,
1349+
rc = gen_pool_add(cxl_mock_pool,
1350+
min(iomem_resource.end + 1 - SZ_64G,
1351+
mappable.end + 1 - SZ_64G),
13471352
SZ_64G, NUMA_NO_NODE);
13481353
if (rc)
13491354
goto err_gen_pool_add;

0 commit comments

Comments
 (0)