Re: [PATCH] kernel: resourse: Add conditional handling for ACPI device

Gregory Price
2025-10-17T14:11:18Z

On Fri, Oct 17, 2025 at 10:35:31AM +0800, Szuying Chen wrote:
> To avoid address conflicts and related errors, specific checks for
> the ACPI device "AMDIF031" should be bypassed.
>
> Signed-off-by: Szuying Chen <Chloe_Chen@asmedia.com.tw>
> ---
> kernel/resource.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/kernel/resource.c b/kernel/resource.c
> index b9fa2a4ce089..9ffcd5bdb62e 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -177,6 +177,27 @@ static struct resource *alloc_resource(gfp_t flags)
> return kzalloc(sizeof(struct resource), flags);
> }
>
> +static int IgnoreResource(struct resource *tmp)
> +{
> + char *pt, *name_sep;
> + char *name;
> +
> + pt = kstrdup(tmp->name, GFP_KERNEL);
> + name_sep = pt;
> + if (!name_sep)
> + goto out;
> +
> + name = strsep(&name_sep, ":");
> + if (strcmp(name, "AMDIF031") == 0) {
> + kfree(pt);
> + return 1;
> + }

Assuming we actually want this, i think we probably need to put this in
an arch/ extension, not hard-coded into kernel/. There's no need for
non-x86 platforms to ever touch this.

> +
> +out:
> + kfree(pt);
> + return 0;
> +}
> +
> /* Return the conflict entry if you can't request it */
> static struct resource * __request_resource(struct resource *root, struct resource *new)
> {
> @@ -202,6 +223,8 @@ static struct resource * __request_resource(struct resource *root, struct resour
> p = &tmp->sibling;
> if (tmp->end < start)
> continue;
> + if (IgnoreResource(tmp))
> + continue;
> return tmp;
> }
> }
> --
> 2.39.2
>