cxl: Add helper function to verify port is in memdev hierarchy
Dave Jiang
maintainerPATCH 1/1 cxl: Add helper function to verify port is in memdev hierarchy
'cxl enable-port -m' uses cxl_port_get_dport_by_memdev() to find the memdevs that are associated with a port in order to enable those associated memdevs. When the kernel switch to delayed dport initialization by enumerating the dports during memdev probe, the dports are no longer valid until the memdev is probed. This means that cxl_port_get_dport_by_memdev() will not find any memdevs under the port.
Add a new helper function cxl_port_is_memdev_hierarchy() that checks if a port is in the memdev hierarchy via the memdev->host_path where the sysfs path contains all the devices in the hierarchy. This call is also backward compatible with the old behavior.
--- cxl/lib/libcxl.c | 31 +++++++++++++++++++++++++++++++ cxl/lib/libcxl.sym | 5 +++++ cxl/libcxl.h | 3 +++ cxl/port.c | 2 +- 4 files changed, 40 insertions(+), 1 deletion(-)
cxl/lib/libcxl.c +31 -0
@@ -2024,6 +2024,37 @@ CXL_EXPORT int cxl_memdev_nvdimm_bridge_active(struct cxl_memdev *memdev)return is_enabled (path); } +CXL_EXPORT bool cxl_memdev_is_port_ancestor(struct cxl_memdev *memdev, +struct cxl_port *port) +{ +const char *uport =cxl_port_get_host (port); +const char *start ="devices" ; +const char *pstr ="platform" ; +char *host, *pos; + + host =strdup (memdev->host_path); +if (!host) +return false; + + pos =strstr (host, start); + pos +=strlen (start) +1 ; +if (strncmp (pos, pstr,strlen (pstr)) ==0 ) + pos +=strlen (pstr) +1 ; + pos =strtok (pos,"/" ); + +while (pos) { +if (strcmp (pos, uport) ==0 ) { +free (host); +return true; + } + pos =strtok (NULL ,"/" ); + } + +free (host); + +return false; +} +static int cxl_port_init (struct cxl_port *port,struct cxl_port *parent_port,enum cxl_port_type type,struct cxl_ctx *ctx,int id,const char *cxlport_base)
cxl/lib/libcxl.sym +5 -0
@@ -295,3 +295,8 @@ global: cxl_fwctl_get_major; cxl_fwctl_get_minor; } LIBECXL_8; + +LIBCXL_10 { +global: + cxl_memdev_is_port_ancestor; +} LIBCXL_9;
cxl/libcxl.h +3 -0
@@ -179,6 +179,9 @@ bool cxl_dport_maps_memdev(struct cxl_dport *dport, struct cxl_memdev *memdev);struct cxl_dport *cxl_port_get_dport_by_memdev (struct cxl_port *port,struct cxl_memdev *memdev); +bool cxl_memdev_is_port_ancestor (struct cxl_memdev *memdev, +struct cxl_port *port); +#define cxl_dport_foreach (port, dport) \ for (dport = cxl_dport_get_first(port); dport != NULL; \ dport = cxl_dport_get_next(dport))
cxl/port.c +1 -1
@@ -102,7 +102,7 @@ static int action_enable(struct cxl_port *port)return rc; cxl_memdev_foreach(ctx, memdev) -if (cxl_port_get_dport_by_memdev (port, memdev)) +if (cxl_memdev_is_port_ancestor (memdev, port))cxl_memdev_enable (memdev);return 0 ; }
base-commit: 74b9e411bf13e87df39a517d10143fafa7e2ea92
Signature · 1 line
2.49.0
Alison Schofield
maintainerQuoted 8 lines · Dave Jiang
'cxl enable-port -m' uses
cxl_port_get_dport_by_memdev()to find the memdevs that are associated with a port in order to enable those associated memdevs. When the kernel switch to delayed dport initialization by enumerating the dports during memdev probe, the dports are no longer valid until the memdev is probed. This means thatcxl_port_get_dport_by_memdev()will not find any memdevs under the port.
Quoted 4 lines
Add a new helper function
cxl_port_is_memdev_hierarchy()that checks if a port is in the memdev hierarchy via thememdev->host_pathwhere the sysfs path contains all the devices in the hierarchy. This call is also backward compatible with the old behavior.
I get how this new function works w the delayed dport init that is coming soon to the CXL driver. I'm not so clear on why we leave the existing function in place when we know it will fail in some use cases. (It is a libcxl fcn afterall)
Why not change the behavior of the existing function?
How come this usage of cxl_port_get_dport_by_memdev() needs to change to the new helper and not the other usage in action_disable()?
If the 'sometimes fails to find' function stays, how about libcxl docs explaining the limitations.
Just stirring the pot to better understand ;)
--Alison
Quoted 97 lines
Signed-off-by Dave Jiang <[email protected]>--- cxl/lib/libcxl.c | 31 +++++++++++++++++++++++++++++++ cxl/lib/libcxl.sym | 5 +++++ cxl/libcxl.h | 3 +++ cxl/port.c | 2 +- 4 files changed, 40 insertions(+), 1 deletion(-)cxl/lib/libcxl.c +31
-0@@ -2024,6 +2024,37 @@ CXL_EXPORT int cxl_memdev_nvdimm_bridge_active(struct cxl_memdev *memdev)return is_enabled (path); } +CXL_EXPORT bool cxl_memdev_is_port_ancestor(struct cxl_memdev *memdev, +struct cxl_port *port) +{ +const char *uport =cxl_port_get_host (port); +const char *start ="devices" ; +const char *pstr ="platform" ; +char *host, *pos; + + host =strdup (memdev->host_path); +if (!host) +return false; + + pos =strstr (host, start); + pos +=strlen (start) +1 ; +if (strncmp (pos, pstr,strlen (pstr)) ==0 ) + pos +=strlen (pstr) +1 ; + pos =strtok (pos,"/" ); + +while (pos) { +if (strcmp (pos, uport) ==0 ) { +free (host); +return true; + } + pos =strtok (NULL ,"/" ); + } + +free (host); + +return false; +} +static int cxl_port_init (struct cxl_port *port,struct cxl_port *parent_port,enum cxl_port_type type,struct cxl_ctx *ctx,int id,const char *cxlport_base)cxl/lib/libcxl.sym +5
-0@@ -295,3 +295,8 @@ global: cxl_fwctl_get_major; cxl_fwctl_get_minor; } LIBECXL_8; + +LIBCXL_10 { +global: + cxl_memdev_is_port_ancestor; +} LIBCXL_9;cxl/libcxl.h +3
-0@@ -179,6 +179,9 @@ bool cxl_dport_maps_memdev(struct cxl_dport *dport, struct cxl_memdev *memdev);struct cxl_dport *cxl_port_get_dport_by_memdev (struct cxl_port *port,struct cxl_memdev *memdev); +bool cxl_memdev_is_port_ancestor (struct cxl_memdev *memdev, +struct cxl_port *port); +#define cxl_dport_foreach (port, dport) \ for (dport = cxl_dport_get_first(port); dport != NULL; \ dport = cxl_dport_get_next(dport))cxl/port.c +1
-1@@ -102,7 +102,7 @@ static int action_enable(struct cxl_port *port)return rc; cxl_memdev_foreach(ctx, memdev) -if (cxl_port_get_dport_by_memdev (port, memdev)) +if (cxl_memdev_is_port_ancestor (memdev, port))cxl_memdev_enable (memdev);return 0 ; }base-commit:
74b9e411bf13e87df39a517d10143fafa7e2ea92Signature · 1 line
2.49.0
Dave Jiang
maintainerQuoted 19 lines · Alison Schofield
Quoted 8 lines · Dave Jiang
'cxl enable-port -m' uses
cxl_port_get_dport_by_memdev()to find the memdevs that are associated with a port in order to enable those associated memdevs. When the kernel switch to delayed dport initialization by enumerating the dports during memdev probe, the dports are no longer valid until the memdev is probed. This means thatcxl_port_get_dport_by_memdev()will not find any memdevs under the port.Quoted 4 lines
Add a new helper function
cxl_port_is_memdev_hierarchy()that checks if a port is in the memdev hierarchy via thememdev->host_pathwhere the sysfs path contains all the devices in the hierarchy. This call is also backward compatible with the old behavior.I get how this new function works w the delayed dport init that is coming soon to the CXL driver. I'm not so clear on why we leave the existing function in place when we know it will fail in some use cases. (It is a libcxl fcn afterall)
Quoted 8 lines
Why not change the behavior of the existing function?
How come this usage ofcxl_port_get_dport_by_memdev()needs to change to the new helper and not the other usage inaction_disable()?If the 'sometimes fails to find' function stays, how about libcxl docs explaining the limitations.
Just stirring the pot to better understand ;)
What's the process of retiring API calls? Add deprecated in the doc? Add warnings when called?
Quoted 101 lines
--Alison
Quoted 97 lines
Signed-off-by Dave Jiang <[email protected]>--- cxl/lib/libcxl.c | 31 +++++++++++++++++++++++++++++++ cxl/lib/libcxl.sym | 5 +++++ cxl/libcxl.h | 3 +++ cxl/port.c | 2 +- 4 files changed, 40 insertions(+), 1 deletion(-)cxl/lib/libcxl.c +31
-0@@ -2024,6 +2024,37 @@ CXL_EXPORT int cxl_memdev_nvdimm_bridge_active(struct cxl_memdev *memdev)return is_enabled (path); } +CXL_EXPORT bool cxl_memdev_is_port_ancestor(struct cxl_memdev *memdev, +struct cxl_port *port) +{ +const char *uport =cxl_port_get_host (port); +const char *start ="devices" ; +const char *pstr ="platform" ; +char *host, *pos; + + host =strdup (memdev->host_path); +if (!host) +return false; + + pos =strstr (host, start); + pos +=strlen (start) +1 ; +if (strncmp (pos, pstr,strlen (pstr)) ==0 ) + pos +=strlen (pstr) +1 ; + pos =strtok (pos,"/" ); + +while (pos) { +if (strcmp (pos, uport) ==0 ) { +free (host); +return true; + } + pos =strtok (NULL ,"/" ); + } + +free (host); + +return false; +} +static int cxl_port_init (struct cxl_port *port,struct cxl_port *parent_port,enum cxl_port_type type,struct cxl_ctx *ctx,int id,const char *cxlport_base)cxl/lib/libcxl.sym +5
-0@@ -295,3 +295,8 @@ global: cxl_fwctl_get_major; cxl_fwctl_get_minor; } LIBECXL_8; + +LIBCXL_10 { +global: + cxl_memdev_is_port_ancestor; +} LIBCXL_9;cxl/libcxl.h +3
-0@@ -179,6 +179,9 @@ bool cxl_dport_maps_memdev(struct cxl_dport *dport, struct cxl_memdev *memdev);struct cxl_dport *cxl_port_get_dport_by_memdev (struct cxl_port *port,struct cxl_memdev *memdev); +bool cxl_memdev_is_port_ancestor (struct cxl_memdev *memdev, +struct cxl_port *port); +#define cxl_dport_foreach (port, dport) \ for (dport = cxl_dport_get_first(port); dport != NULL; \ dport = cxl_dport_get_next(dport))cxl/port.c +1
-1@@ -102,7 +102,7 @@ static int action_enable(struct cxl_port *port)return rc; cxl_memdev_foreach(ctx, memdev) -if (cxl_port_get_dport_by_memdev (port, memdev)) +if (cxl_memdev_is_port_ancestor (memdev, port))cxl_memdev_enable (memdev);return 0 ; }base-commit:
74b9e411bf13e87df39a517d10143fafa7e2ea92Signature · 1 line
2.49.0
Alison Schofield
maintainerQuoted 26 lines · Dave Jiang
Quoted 23 lines · Alison Schofield
Quoted 8 lines · Dave Jiang
'cxl enable-port -m' uses
cxl_port_get_dport_by_memdev()to find the memdevs that are associated with a port in order to enable those associated memdevs. When the kernel switch to delayed dport initialization by enumerating the dports during memdev probe, the dports are no longer valid until the memdev is probed. This means thatcxl_port_get_dport_by_memdev()will not find any memdevs under the port.Quoted 4 lines
Add a new helper function
cxl_port_is_memdev_hierarchy()that checks if a port is in the memdev hierarchy via thememdev->host_pathwhere the sysfs path contains all the devices in the hierarchy. This call is also backward compatible with the old behavior.I get how this new function works w the delayed dport init that is coming soon to the CXL driver. I'm not so clear on why we leave the existing function in place when we know it will fail in some use cases. (It is a libcxl fcn afterall)
Why not change the behavior of the existing function?
How come this usage ofcxl_port_get_dport_by_memdev()needs to change to the new helper and not the other usage inaction_disable()?
Quoted 6 lines
Quoted 4 lines
If the 'sometimes fails to find' function stays, how about libcxl docs explaining the limitations.
Just stirring the pot to better understand ;)
What's the process of retiring API calls? Add deprecated in the doc? Add warnings when called?
What is wanted here? Should a v2 of the existing cxl_port_get_dport... be replaced with a v2 that can differentiate btw memdev not probed vs NULL for dport not found.
I see example of v2 APIs in ndctl/ndctl lib, so doable, but first need to define what is wanted.
Quoted 103 lines
Quoted 102 lines
--Alison
Quoted 97 lines
Signed-off-by Dave Jiang <[email protected]>--- cxl/lib/libcxl.c | 31 +++++++++++++++++++++++++++++++ cxl/lib/libcxl.sym | 5 +++++ cxl/libcxl.h | 3 +++ cxl/port.c | 2 +- 4 files changed, 40 insertions(+), 1 deletion(-)cxl/lib/libcxl.c +31
-0@@ -2024,6 +2024,37 @@ CXL_EXPORT int cxl_memdev_nvdimm_bridge_active(struct cxl_memdev *memdev)return is_enabled (path); } +CXL_EXPORT bool cxl_memdev_is_port_ancestor(struct cxl_memdev *memdev, +struct cxl_port *port) +{ +const char *uport =cxl_port_get_host (port); +const char *start ="devices" ; +const char *pstr ="platform" ; +char *host, *pos; + + host =strdup (memdev->host_path); +if (!host) +return false; + + pos =strstr (host, start); + pos +=strlen (start) +1 ; +if (strncmp (pos, pstr,strlen (pstr)) ==0 ) + pos +=strlen (pstr) +1 ; + pos =strtok (pos,"/" ); + +while (pos) { +if (strcmp (pos, uport) ==0 ) { +free (host); +return true; + } + pos =strtok (NULL ,"/" ); + } + +free (host); + +return false; +} +static int cxl_port_init (struct cxl_port *port,struct cxl_port *parent_port,enum cxl_port_type type,struct cxl_ctx *ctx,int id,const char *cxlport_base)cxl/lib/libcxl.sym +5
-0@@ -295,3 +295,8 @@ global: cxl_fwctl_get_major; cxl_fwctl_get_minor; } LIBECXL_8; + +LIBCXL_10 { +global: + cxl_memdev_is_port_ancestor; +} LIBCXL_9;cxl/libcxl.h +3
-0@@ -179,6 +179,9 @@ bool cxl_dport_maps_memdev(struct cxl_dport *dport, struct cxl_memdev *memdev);struct cxl_dport *cxl_port_get_dport_by_memdev (struct cxl_port *port,struct cxl_memdev *memdev); +bool cxl_memdev_is_port_ancestor (struct cxl_memdev *memdev, +struct cxl_port *port); +#define cxl_dport_foreach (port, dport) \ for (dport = cxl_dport_get_first(port); dport != NULL; \ dport = cxl_dport_get_next(dport))cxl/port.c +1
-1@@ -102,7 +102,7 @@ static int action_enable(struct cxl_port *port)return rc; cxl_memdev_foreach(ctx, memdev) -if (cxl_port_get_dport_by_memdev (port, memdev)) +if (cxl_memdev_is_port_ancestor (memdev, port))cxl_memdev_enable (memdev);return 0 ; }base-commit:
74b9e411bf13e87df39a517d10143fafa7e2ea92Signature · 1 line
2.49.0
Dave Jiang
maintainerQuoted 32 lines · Alison Schofield
Quoted 31 lines · Dave Jiang
Quoted 27 lines · Alison Schofield
Quoted 8 lines · Dave Jiang
'cxl enable-port -m' uses
cxl_port_get_dport_by_memdev()to find the memdevs that are associated with a port in order to enable those associated memdevs. When the kernel switch to delayed dport initialization by enumerating the dports during memdev probe, the dports are no longer valid until the memdev is probed. This means thatcxl_port_get_dport_by_memdev()will not find any memdevs under the port.Quoted 4 lines
Add a new helper function
cxl_port_is_memdev_hierarchy()that checks if a port is in the memdev hierarchy via thememdev->host_pathwhere the sysfs path contains all the devices in the hierarchy. This call is also backward compatible with the old behavior.I get how this new function works w the delayed dport init that is coming soon to the CXL driver. I'm not so clear on why we leave the existing function in place when we know it will fail in some use cases. (It is a libcxl fcn afterall)
Why not change the behavior of the existing function?
How come this usage ofcxl_port_get_dport_by_memdev()needs to change to the new helper and not the other usage inaction_disable()?If the 'sometimes fails to find' function stays, how about libcxl docs explaining the limitations.
Just stirring the pot to better understand ;)
Quoted 8 lines
Quoted 1 line
What's the process of retiring API calls? Add deprecated in the doc? Add warnings when called?
What is wanted here? Should a v2 of the existing
cxl_port_get_dport... be replaced with a v2 that can differentiate btw memdev not probed vs NULL for dport not found.I see example of v2 APIs in ndctl/ndctl lib, so doable, but first need to define what is wanted.
So there are 2 locations using cxl_port_get_dport_by_memdev(). If the usage in cxl/filter.c can be replaced by the new function, then we can drop the call entirely for CXL CLI. Of course if someone else is using this function in their app, then we would be breaking their app. I wonder if we need to add documentation to explain where it would fail and emit warning of deprecation in the next release?
Quoted 104 lines
Quoted 104 lines
Quoted 103 lines
--Alison
Quoted 97 lines
Signed-off-by Dave Jiang <[email protected]>--- cxl/lib/libcxl.c | 31 +++++++++++++++++++++++++++++++ cxl/lib/libcxl.sym | 5 +++++ cxl/libcxl.h | 3 +++ cxl/port.c | 2 +- 4 files changed, 40 insertions(+), 1 deletion(-)cxl/lib/libcxl.c +31
-0@@ -2024,6 +2024,37 @@ CXL_EXPORT int cxl_memdev_nvdimm_bridge_active(struct cxl_memdev *memdev)return is_enabled (path); } +CXL_EXPORT bool cxl_memdev_is_port_ancestor(struct cxl_memdev *memdev, +struct cxl_port *port) +{ +const char *uport =cxl_port_get_host (port); +const char *start ="devices" ; +const char *pstr ="platform" ; +char *host, *pos; + + host =strdup (memdev->host_path); +if (!host) +return false; + + pos =strstr (host, start); + pos +=strlen (start) +1 ; +if (strncmp (pos, pstr,strlen (pstr)) ==0 ) + pos +=strlen (pstr) +1 ; + pos =strtok (pos,"/" ); + +while (pos) { +if (strcmp (pos, uport) ==0 ) { +free (host); +return true; + } + pos =strtok (NULL ,"/" ); + } + +free (host); + +return false; +} +static int cxl_port_init (struct cxl_port *port,struct cxl_port *parent_port,enum cxl_port_type type,struct cxl_ctx *ctx,int id,const char *cxlport_base)cxl/lib/libcxl.sym +5
-0@@ -295,3 +295,8 @@ global: cxl_fwctl_get_major; cxl_fwctl_get_minor; } LIBECXL_8; + +LIBCXL_10 { +global: + cxl_memdev_is_port_ancestor; +} LIBCXL_9;cxl/libcxl.h +3
-0@@ -179,6 +179,9 @@ bool cxl_dport_maps_memdev(struct cxl_dport *dport, struct cxl_memdev *memdev);struct cxl_dport *cxl_port_get_dport_by_memdev (struct cxl_port *port,struct cxl_memdev *memdev); +bool cxl_memdev_is_port_ancestor (struct cxl_memdev *memdev, +struct cxl_port *port); +#define cxl_dport_foreach (port, dport) \ for (dport = cxl_dport_get_first(port); dport != NULL; \ dport = cxl_dport_get_next(dport))cxl/port.c +1
-1@@ -102,7 +102,7 @@ static int action_enable(struct cxl_port *port)return rc; cxl_memdev_foreach(ctx, memdev) -if (cxl_port_get_dport_by_memdev (port, memdev)) +if (cxl_memdev_is_port_ancestor (memdev, port))cxl_memdev_enable (memdev);return 0 ; }base-commit:
74b9e411bf13e87df39a517d10143fafa7e2ea92Signature · 1 line
2.49.0
Alison Schofield
maintainerQuoted 37 lines · Dave Jiang
Quoted 34 lines · Alison Schofield
Quoted 32 lines · Dave Jiang
Quoted 19 lines · Alison Schofield
Quoted 8 lines · Dave Jiang
'cxl enable-port -m' uses
cxl_port_get_dport_by_memdev()to find the memdevs that are associated with a port in order to enable those associated memdevs. When the kernel switch to delayed dport initialization by enumerating the dports during memdev probe, the dports are no longer valid until the memdev is probed. This means thatcxl_port_get_dport_by_memdev()will not find any memdevs under the port.Quoted 4 lines
Add a new helper function
cxl_port_is_memdev_hierarchy()that checks if a port is in the memdev hierarchy via thememdev->host_pathwhere the sysfs path contains all the devices in the hierarchy. This call is also backward compatible with the old behavior.I get how this new function works w the delayed dport init that is coming soon to the CXL driver. I'm not so clear on why we leave the existing function in place when we know it will fail in some use cases. (It is a libcxl fcn afterall)
Quoted 8 lines
Why not change the behavior of the existing function?
How come this usage ofcxl_port_get_dport_by_memdev()needs to change to the new helper and not the other usage inaction_disable()?If the 'sometimes fails to find' function stays, how about libcxl docs explaining the limitations.
Just stirring the pot to better understand ;)
What's the process of retiring API calls? Add deprecated in the doc? Add warnings when called?
Quoted 8 lines
Quoted 6 lines
What is wanted here? Should a v2 of the existing
cxl_port_get_dport... be replaced with a v2 that can differentiate btw memdev not probed vs NULL for dport not found.I see example of v2 APIs in ndctl/ndctl lib, so doable, but first need to define what is wanted.
So there are 2 locations using
cxl_port_get_dport_by_memdev(). If the usage incxl/filter.ccan be replaced by the new function, then we can drop the call entirely for CXL CLI. Of course if someone else is using this function in their app, then we would be breaking their app. I wonder if we need to add documentation to explain where it would fail and emit warning of deprecation in the next release?
OK, back to this:
There was no issue or question about adding the new function that only checks for existence. In fact, neither of the call sites of the old cxl_port_get_dport_by_memdev() use the returned dport - so both can switch to use the new function.
What to do about the old? Can we do something like this. I'm thinking we don't need to obsolete the function.
We can document this alongside the description of the new function.
Not so sure of the is_enabled() in this context. It is just checking for the sysfs symbolic link.
cxl_port_get_dport_by_memdev(struct cxl_port *port, struct cxl_memdev *memdev)
{
struct cxl_dport *dport;
if (cxl_memdev_is_enabled(memdev)) {
error message
return NULL;
}
cxl_dport_foreach(port, dport)
if (cxl_dport_maps_memdev(dport, memdev))
return dport;
return NULL;
}Quoted 105 lines
Quoted 104 lines
Quoted 104 lines
Quoted 103 lines
--Alison
Quoted 97 lines
Signed-off-by Dave Jiang <[email protected]>--- cxl/lib/libcxl.c | 31 +++++++++++++++++++++++++++++++ cxl/lib/libcxl.sym | 5 +++++ cxl/libcxl.h | 3 +++ cxl/port.c | 2 +- 4 files changed, 40 insertions(+), 1 deletion(-)cxl/lib/libcxl.c +31
-0@@ -2024,6 +2024,37 @@ CXL_EXPORT int cxl_memdev_nvdimm_bridge_active(struct cxl_memdev *memdev)return is_enabled (path); } +CXL_EXPORT bool cxl_memdev_is_port_ancestor(struct cxl_memdev *memdev, +struct cxl_port *port) +{ +const char *uport =cxl_port_get_host (port); +const char *start ="devices" ; +const char *pstr ="platform" ; +char *host, *pos; + + host =strdup (memdev->host_path); +if (!host) +return false; + + pos =strstr (host, start); + pos +=strlen (start) +1 ; +if (strncmp (pos, pstr,strlen (pstr)) ==0 ) + pos +=strlen (pstr) +1 ; + pos =strtok (pos,"/" ); + +while (pos) { +if (strcmp (pos, uport) ==0 ) { +free (host); +return true; + } + pos =strtok (NULL ,"/" ); + } + +free (host); + +return false; +} +static int cxl_port_init (struct cxl_port *port,struct cxl_port *parent_port,enum cxl_port_type type,struct cxl_ctx *ctx,int id,const char *cxlport_base)cxl/lib/libcxl.sym +5
-0@@ -295,3 +295,8 @@ global: cxl_fwctl_get_major; cxl_fwctl_get_minor; } LIBECXL_8; + +LIBCXL_10 { +global: + cxl_memdev_is_port_ancestor; +} LIBCXL_9;cxl/libcxl.h +3
-0@@ -179,6 +179,9 @@ bool cxl_dport_maps_memdev(struct cxl_dport *dport, struct cxl_memdev *memdev);struct cxl_dport *cxl_port_get_dport_by_memdev (struct cxl_port *port,struct cxl_memdev *memdev); +bool cxl_memdev_is_port_ancestor (struct cxl_memdev *memdev, +struct cxl_port *port); +#define cxl_dport_foreach (port, dport) \ for (dport = cxl_dport_get_first(port); dport != NULL; \ dport = cxl_dport_get_next(dport))cxl/port.c +1
-1@@ -102,7 +102,7 @@ static int action_enable(struct cxl_port *port)return rc; cxl_memdev_foreach(ctx, memdev) -if (cxl_port_get_dport_by_memdev (port, memdev)) +if (cxl_memdev_is_port_ancestor (memdev, port))cxl_memdev_enable (memdev);return 0 ; }base-commit:
74b9e411bf13e87df39a517d10143fafa7e2ea92Signature · 1 line
2.49.0