Linux ACPI
 help / color / mirror / Atom feed
* [PATCH] ACPI: utils: Ignore leading root scope prefix in string _UID match
@ 2026-08-31 18:01 Mario Limonciello
  2026-09-04 13:26 ` Rafael J. Wysocki (Intel)
  0 siblings, 1 reply; 7+ messages in thread
From: Mario Limonciello @ 2026-08-31 18:01 UTC (permalink / raw)
  To: rafael, maciej.wieczor-retman, pawel.chmielewski, lenb
  Cc: Mario Limonciello, linux-acpi, acpica-devel

Firmware may express an ACPI namespace path used as a _UID with or
without the leading root scope character ('\'). For example, an AMD
IVRS IVHD ACPI HID device entry may carry a character UID of
"\_SB.MHSP" while the corresponding device's _UID evaluates to
"_SB.MHSP" (or vice versa).  This semantic difference is due to how
Windows PnP enumerates and uses devices.

acpi_str_uid_match() compared the two strings verbatim, so such
entries failed to match on the UID even though they refer to the same
object. In the AMD IOMMU case (get_acpihid_device_id()) this caused
the exact HID+UID match to be missed and the code to fall through to
the HID-only path, spuriously raising a FW_BUG.

Skip a single leading '\' on either string before comparing so that
paths that differ only by the root scope prefix are treated as a
match. The integer _UID path is unaffected.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 include/acpi/acpi_bus.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 1a45e0d521d8e..e0bec35953ef1 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -835,7 +835,15 @@ static inline bool acpi_str_uid_match(struct acpi_device *adev, const char *uid2
 {
 	const char *uid1 = acpi_device_uid(adev);
 
-	return uid1 && uid2 && !strcmp(uid1, uid2);
+	if (!uid1 || !uid2)
+		return false;
+
+	if (*uid1 == '\\')
+		uid1++;
+	if (*uid2 == '\\')
+		uid2++;
+
+	return !strcmp(uid1, uid2);
 }
 
 static inline bool acpi_int_uid_match(struct acpi_device *adev, u64 uid2)
-- 
2.43.0


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

end of thread, other threads:[~2026-09-10 17:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 18:01 [PATCH] ACPI: utils: Ignore leading root scope prefix in string _UID match Mario Limonciello
2026-09-04 13:26 ` Rafael J. Wysocki (Intel)
2026-09-04 17:32   ` Mario Limonciello
2026-09-04 17:58     ` Rafael J. Wysocki (Intel)
2026-09-10  9:22       ` Andy Shevchenko
2026-09-10 10:56         ` Rafael J. Wysocki (Intel)
2026-09-10 17:13           ` Mario Limonciello

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