mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 12:35:52 +02:00
dax/hmem: Factor HMEM registration into __hmem_register_device()
Separate the CXL overlap check from the HMEM registration path and keep the platform-device setup in a dedicated __hmem_register_device(). This makes hmem_register_device() the policy entry point for deciding whether a range should be deferred to CXL, while __hmem_register_device() handles the HMEM registration flow. No functional changes. Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Link: https://patch.msgid.link/20260322195343.206900-3-Smita.KoralahalliChannabasappa@amd.com Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
This commit is contained in:
parent
14f2e2ebf3
commit
116be1e112
|
|
@ -58,21 +58,14 @@ static void release_hmem(void *pdev)
|
|||
platform_device_unregister(pdev);
|
||||
}
|
||||
|
||||
static int hmem_register_device(struct device *host, int target_nid,
|
||||
const struct resource *res)
|
||||
static int __hmem_register_device(struct device *host, int target_nid,
|
||||
const struct resource *res)
|
||||
{
|
||||
struct platform_device *pdev;
|
||||
struct memregion_info info;
|
||||
long id;
|
||||
int rc;
|
||||
|
||||
if (IS_ENABLED(CONFIG_CXL_REGION) &&
|
||||
region_intersects(res->start, resource_size(res), IORESOURCE_MEM,
|
||||
IORES_DESC_CXL) != REGION_DISJOINT) {
|
||||
dev_dbg(host, "deferring range to CXL: %pr\n", res);
|
||||
return 0;
|
||||
}
|
||||
|
||||
rc = region_intersects_soft_reserve(res->start, resource_size(res));
|
||||
if (rc != REGION_INTERSECTS)
|
||||
return 0;
|
||||
|
|
@ -123,6 +116,19 @@ static int hmem_register_device(struct device *host, int target_nid,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int hmem_register_device(struct device *host, int target_nid,
|
||||
const struct resource *res)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_CXL_REGION) &&
|
||||
region_intersects(res->start, resource_size(res), IORESOURCE_MEM,
|
||||
IORES_DESC_CXL) != REGION_DISJOINT) {
|
||||
dev_dbg(host, "deferring range to CXL: %pr\n", res);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return __hmem_register_device(host, target_nid, res);
|
||||
}
|
||||
|
||||
static int dax_hmem_platform_probe(struct platform_device *pdev)
|
||||
{
|
||||
return walk_hmem_resources(&pdev->dev, hmem_register_device);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user