Re: [PATCH 2/2] cxl/core: Add a helper function to check dpa availability

From: Alison Schofield
Date: Sun Jun 29 2025 - 21:42:05 EST


On Sun, Jun 29, 2025 at 04:20:42PM +0800, Li Ming wrote:
> In CXL subsystem, many pieces of code that need to check dpa
> availability in case using wrong dpa. Add a helper function called
> is_valid_dpa() for dpa availability checking.

Does this have anything DPA special about it. Could it be done in
in a new helper like resource_contains_addr() for all to employ.
In CXL, we'd use it in at least one more place, checking for HPA
in a region resource.

-- Alison


>
snip

> +bool is_valid_dpa(struct resource *res, u64 dpa)
> +{
> + return (dpa >= res->start && dpa <= res->end);
> +}
> +

snip

>