Skip to content

Commit 5f18e9f

Browse files
kimphillamdjoergroedel
authored andcommitted
iommu/amd: Fix ivrs_acpihid cmdline parsing code
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: ca3bf5d ("iommu/amd: Introduces ivrs_acpihid kernel parameter") Signed-off-by: Kim Phillips <[email protected]> Cc: [email protected] Cc: Suravee Suthikulpanit <[email protected]> Cc: Joerg Roedel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 2a48b15 commit 5f18e9f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/iommu/amd/init.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3488,6 +3488,13 @@ static int __init parse_ivrs_acpihid(char *str)
34883488
return 1;
34893489
}
34903490

3491+
/*
3492+
* Ignore leading zeroes after ':', so e.g., AMDI0095:00
3493+
* will match AMDI0095:0 in the second strcmp in acpi_dev_hid_uid_match
3494+
*/
3495+
while (*uid == '0' && *(uid + 1))
3496+
uid++;
3497+
34913498
i = early_acpihid_map_size++;
34923499
memcpy(early_acpihid_map[i].hid, hid, strlen(hid));
34933500
memcpy(early_acpihid_map[i].uid, uid, strlen(uid));

0 commit comments

Comments
 (0)