All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] iommu/amd: Fix ivrs_acpihid cmdline parsing code
@ 2022-09-19 15:56 Kim Phillips
  2022-09-19 15:56 ` [PATCH v2 2/2] iommu/amd: Fix ill-formed ivrs_ioapic, ivrs_hpet and ivrs_acpihid options Kim Phillips
  2022-11-10 16:38 ` [PATCH v2 1/2] iommu/amd: Fix ivrs_acpihid cmdline parsing code Kim Phillips
  0 siblings, 2 replies; 4+ messages in thread
From: Kim Phillips @ 2022-09-19 15:56 UTC (permalink / raw)
  To: iommu, joro
  Cc: robin.murphy, suravee.suthikulpanit, vasant.hegde, Mike Day,
	linux-acpi, Kim Phillips, stable, Suravee Suthikulpanit,
	Joerg Roedel

The second (UID) strcmp in acpi_dev_hid_uid_match considers
"0" and "00" different, which can prevent device registration.

Have the AMD IOMMU driver's ivrs_acpihid parsing code remove
any leading zeroes to make the UID strcmp succeed.  Now users
can safely specify "AMDxxxxx:00" or "AMDxxxxx:0" and expect
the same behaviour.

Fixes: ca3bf5d47cec ("iommu/amd: Introduces ivrs_acpihid kernel parameter")
Signed-off-by: Kim Phillips <kim.phillips@amd.com>
Cc: stable@vger.kernel.org
Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Cc: Joerg Roedel <jroedel@suse.de>
---
v2: no changes

 drivers/iommu/amd/init.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index fdc642362c14..ef0e1a4b5a11 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -3471,6 +3471,13 @@ static int __init parse_ivrs_acpihid(char *str)
 		return 1;
 	}
 
+	/*
+	 * Ignore leading zeroes after ':', so e.g., AMDI0095:00
+	 * will match AMDI0095:0 in the second strcmp in acpi_dev_hid_uid_match
+	 */
+	while (*uid == '0' && *(uid + 1))
+		uid++;
+
 	i = early_acpihid_map_size++;
 	memcpy(early_acpihid_map[i].hid, hid, strlen(hid));
 	memcpy(early_acpihid_map[i].uid, uid, strlen(uid));
-- 
2.34.1


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

end of thread, other threads:[~2022-11-19  9:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-19 15:56 [PATCH v2 1/2] iommu/amd: Fix ivrs_acpihid cmdline parsing code Kim Phillips
2022-09-19 15:56 ` [PATCH v2 2/2] iommu/amd: Fix ill-formed ivrs_ioapic, ivrs_hpet and ivrs_acpihid options Kim Phillips
2022-11-19  9:06   ` Joerg Roedel
2022-11-10 16:38 ` [PATCH v2 1/2] iommu/amd: Fix ivrs_acpihid cmdline parsing code Kim Phillips

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.