Linux Integrity Measurement development
 help / color / mirror / Atom feed
* [PATCH v1] ACPI: scan: Do not combine resources that overlap completely
@ 2026-08-20 10:50 Rafael J. Wysocki
  2026-08-21  1:23 ` Jarkko Sakkinen
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2026-08-20 10:50 UTC (permalink / raw)
  To: Linux ACPI
  Cc: LKML, Andy Shevchenko, Mika Westerberg, Julien, jarkko,
	linux-integrity, Nathan Chancellor

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

Commit f234fdaae1ca ("ACPI: scan: Avoid registering platform devices
with resource overlaps") attempted to avoid platform device registration
errors due to overlaps of resources of the same type returned by the
same _CRS object in the ACPI tables.  It did that by combining two or
more overlapping resources into one, but it went too far and also
caused resources that overlap completely to be combined which broke
the arm-cmn driver that expects two MMIO resources to be present for
each device it binds to and it expects those two resources to overlap
completely.

Address this issue by adding a check for completely overlapping
resources to acpi_platform_adjust_resources() and add a comment
explaining what is done there.

Fixes: f234fdaae1ca ("ACPI: scan: Avoid registering platform devices with resource overlaps")
Reported-by: Nathan Chancellor <nathan@kernel.org> 
Tested-by: Nathan Chancellor <nathan@kernel.org> 
Closes: https://lore.kernel.org/linux-acpi/20260819003752.GA3063251@ax162/
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

@Julien: I would appreciate testing this on the machine that needed
commit f234fdaae1ca.

---
 drivers/acpi/acpi_platform.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/drivers/acpi/acpi_platform.c
+++ b/drivers/acpi/acpi_platform.c
@@ -85,7 +85,12 @@ static unsigned int acpi_platform_adjust
 	for (i = 0; i < count; ) {
 		struct resource *res = &resources[i];
 
-		if (resource_type(new_res) != resource_type(res) ||
+		/*
+		 * Look for overlaps of resources of the same type that would
+		 * cause resource insertion to fail down the road.
+		 */
+		if (__resource_contains_unbound(res, new_res) ||
+		    resource_type(new_res) != resource_type(res) ||
 		    !resource_union(new_res, res, new_res)) {
 			i++;
 			continue;




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] ACPI: scan: Do not combine resources that overlap completely
  2026-08-20 10:50 [PATCH v1] ACPI: scan: Do not combine resources that overlap completely Rafael J. Wysocki
@ 2026-08-21  1:23 ` Jarkko Sakkinen
  2026-08-21 11:31   ` Rafael J. Wysocki (Intel)
  0 siblings, 1 reply; 3+ messages in thread
From: Jarkko Sakkinen @ 2026-08-21  1:23 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux ACPI, LKML, Andy Shevchenko, Mika Westerberg, Julien,
	linux-integrity, Nathan Chancellor

On Thu, Aug 20, 2026 at 12:50:46PM +0200, Rafael J. Wysocki wrote:
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
> 
> Commit f234fdaae1ca ("ACPI: scan: Avoid registering platform devices
> with resource overlaps") attempted to avoid platform device registration
> errors due to overlaps of resources of the same type returned by the
> same _CRS object in the ACPI tables.  It did that by combining two or
> more overlapping resources into one, but it went too far and also
> caused resources that overlap completely to be combined which broke
> the arm-cmn driver that expects two MMIO resources to be present for
> each device it binds to and it expects those two resources to overlap
> completely.
> 
> Address this issue by adding a check for completely overlapping
> resources to acpi_platform_adjust_resources() and add a comment
> explaining what is done there.
> 
> Fixes: f234fdaae1ca ("ACPI: scan: Avoid registering platform devices with resource overlaps")
> Reported-by: Nathan Chancellor <nathan@kernel.org> 
> Tested-by: Nathan Chancellor <nathan@kernel.org> 
> Closes: https://lore.kernel.org/linux-acpi/20260819003752.GA3063251@ax162/
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> @Julien: I would appreciate testing this on the machine that needed
> commit f234fdaae1ca.
> 
> ---
>  drivers/acpi/acpi_platform.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> --- a/drivers/acpi/acpi_platform.c
> +++ b/drivers/acpi/acpi_platform.c
> @@ -85,7 +85,12 @@ static unsigned int acpi_platform_adjust
>  	for (i = 0; i < count; ) {
>  		struct resource *res = &resources[i];
>  
> -		if (resource_type(new_res) != resource_type(res) ||
> +		/*
> +		 * Look for overlaps of resources of the same type that would
> +		 * cause resource insertion to fail down the road.
> +		 */
> +		if (__resource_contains_unbound(res, new_res) ||
> +		    resource_type(new_res) != resource_type(res) ||
>  		    !resource_union(new_res, res, new_res)) {
>  			i++;
>  			continue;
> 
> 
> 

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] ACPI: scan: Do not combine resources that overlap completely
  2026-08-21  1:23 ` Jarkko Sakkinen
@ 2026-08-21 11:31   ` Rafael J. Wysocki (Intel)
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-08-21 11:31 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: Rafael J. Wysocki, Linux ACPI, LKML, Andy Shevchenko,
	Mika Westerberg, Julien, linux-integrity, Nathan Chancellor

On Fri, Aug 21, 2026 at 3:23 AM Jarkko Sakkinen <jarkko@kernel.org> wrote:
>
> On Thu, Aug 20, 2026 at 12:50:46PM +0200, Rafael J. Wysocki wrote:
> > From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
> >
> > Commit f234fdaae1ca ("ACPI: scan: Avoid registering platform devices
> > with resource overlaps") attempted to avoid platform device registration
> > errors due to overlaps of resources of the same type returned by the
> > same _CRS object in the ACPI tables.  It did that by combining two or
> > more overlapping resources into one, but it went too far and also
> > caused resources that overlap completely to be combined which broke
> > the arm-cmn driver that expects two MMIO resources to be present for
> > each device it binds to and it expects those two resources to overlap
> > completely.
> >
> > Address this issue by adding a check for completely overlapping
> > resources to acpi_platform_adjust_resources() and add a comment
> > explaining what is done there.
> >
> > Fixes: f234fdaae1ca ("ACPI: scan: Avoid registering platform devices with resource overlaps")
> > Reported-by: Nathan Chancellor <nathan@kernel.org>
> > Tested-by: Nathan Chancellor <nathan@kernel.org>
> > Closes: https://lore.kernel.org/linux-acpi/20260819003752.GA3063251@ax162/
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> >
> > @Julien: I would appreciate testing this on the machine that needed
> > commit f234fdaae1ca.
> >
> > ---
> >  drivers/acpi/acpi_platform.c |    7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > --- a/drivers/acpi/acpi_platform.c
> > +++ b/drivers/acpi/acpi_platform.c
> > @@ -85,7 +85,12 @@ static unsigned int acpi_platform_adjust
> >       for (i = 0; i < count; ) {
> >               struct resource *res = &resources[i];
> >
> > -             if (resource_type(new_res) != resource_type(res) ||
> > +             /*
> > +              * Look for overlaps of resources of the same type that would
> > +              * cause resource insertion to fail down the road.
> > +              */
> > +             if (__resource_contains_unbound(res, new_res) ||
> > +                 resource_type(new_res) != resource_type(res) ||
> >                   !resource_union(new_res, res, new_res)) {
> >                       i++;
> >                       continue;
> >
> >
> >
>
> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

Thanks!

I'm assuming that the tag also applies to the v2 of the patch

https://lore.kernel.org/linux-acpi/12955564.O9o76ZdvQC@rafael.j.wysocki/

so please let me know if that's not the case.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-21 11:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20 10:50 [PATCH v1] ACPI: scan: Do not combine resources that overlap completely Rafael J. Wysocki
2026-08-21  1:23 ` Jarkko Sakkinen
2026-08-21 11:31   ` Rafael J. Wysocki (Intel)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox