Linux ACPI
 help / color / mirror / Atom feed
From: Ting-Han Hou <ue081723@gmail.com>
To: stable@vger.kernel.org
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Frederic MARIE-JOSEPH <fredericmariejoseph@protonmail.com>,
	Wolfgang Walter <linux@stwm.de>,
	Bob Anderson <kernel@ametros.net>,
	Domenico Suppa <domenicosuppa@gmail.com>,
	Thorsten Leemhuis <regressions@leemhuis.info>,
	Sasha Levin <sashal@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-acpi@vger.kernel.org, regressions@lists.linux.dev,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Jarkko Sakkinen <jarkko@kernel.org>
Subject: [PATCH 6.18.y 3/3] ACPI: scan: Do not combine resources that overlap completely
Date: Sat, 24 Oct 2026 18:57:10 +0800	[thread overview]
Message-ID: <20261024105710.593-4-ue081723@gmail.com> (raw)
In-Reply-To: <20261024105710.593-1-ue081723@gmail.com>

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

[ Upstream commit 7617cc05df28dcae967cca109de74084321eaa62 ]

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 checks 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>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://patch.msgid.link/12955564.O9o76ZdvQC@rafael.j.wysocki
[ Ting-Han: __resource_contains_unbound() was added by edfaa81d5da5
  ("resource: Add __resource_contains_unbound() for internal contains
  checks"), which is not in 6.18.y, so use resource_contains() instead.
  The two only differ in the IORESOURCE_UNSET check, and the resources
  returned by acpi_dev_get_resources() never have IORESOURCE_UNSET set:
  it is only set together with IORESOURCE_DISABLED, and disabled
  resources are not added to the list. ]
Signed-off-by: Ting-Han Hou <ue081723@gmail.com>
---
 drivers/acpi/acpi_platform.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
index abdd8893e..29b197440 100644
--- a/drivers/acpi/acpi_platform.c
+++ b/drivers/acpi/acpi_platform.c
@@ -85,7 +85,13 @@ static unsigned int acpi_platform_adjust_resources(struct acpi_device *adev,
 	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(res, new_res) ||
+		    resource_contains(new_res, res) ||
+		    resource_type(new_res) != resource_type(res) ||
 		    !resource_union(new_res, res, new_res)) {
 			i++;
 			continue;
-- 
2.53.0


      parent reply	other threads:[~2026-10-24 10:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2026102308-twisting-bazooka-12b5@gregkh>
2026-10-24 10:57 ` [PATCH 6.18.y 0/3] ACPI: scan: fix the fixed event power button since 6.18.57 Ting-Han Hou
2026-10-24 10:57   ` [PATCH 6.18.y 1/3] ACPI: scan: Register platform devices for fixed event buttons Ting-Han Hou
2026-10-24 10:57   ` [PATCH 6.18.y 2/3] ACPI: scan: Avoid registering platform devices with resource overlaps Ting-Han Hou
2026-10-24 20:11     ` Sasha Levin
2026-10-24 10:57   ` Ting-Han Hou [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261024105710.593-4-ue081723@gmail.com \
    --to=ue081723@gmail.com \
    --cc=domenicosuppa@gmail.com \
    --cc=fredericmariejoseph@protonmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jarkko@kernel.org \
    --cc=kernel@ametros.net \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux@stwm.de \
    --cc=nathan@kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rafael@kernel.org \
    --cc=regressions@leemhuis.info \
    --cc=regressions@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox