]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
iommu/amd: Introduces ivrs_acpihid kernel parameter
authorSuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Fri, 1 Apr 2016 13:06:01 +0000 (09:06 -0400)
committerJoerg Roedel <jroedel@suse.de>
Thu, 7 Apr 2016 11:29:41 +0000 (13:29 +0200)
This patch introduces a new kernel parameter, ivrs_acpihid.
This is used to override existing ACPI-HID IVHD device entry,
or add an entry in case it is missing in the IVHD.

Signed-off-by: Wan Zongshun <Vincent.Wan@amd.com>
Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Documentation/kernel-parameters.txt
drivers/iommu/amd_iommu_init.c

index ecc74fa4bfde8a55d9fee00d96ae5ae4123560e9..8c881a5f7af03f4f5215847f57220b6d753ba4a1 100644 (file)
@@ -1767,6 +1767,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
                        PCI device 00:14.0 write the parameter as:
                                ivrs_hpet[0]=00:14.0
 
+       ivrs_acpihid    [HW,X86_64]
+                       Provide an override to the ACPI-HID:UID<->DEVICE-ID
+                       mapping provided in the IVRS ACPI table. For
+                       example, to map UART-HID:UID AMD0020:0 to
+                       PCI device 00:14.5 write the parameter as:
+                               ivrs_acpihid[00:14.5]=AMD0020:0
+
        js=             [HW,JOY] Analog joystick
                        See Documentation/input/joystick.txt.
 
index e7ebfa2a6c2c26d1178b45d6912bfc326f8bbd29..9e0034196e10468ea6e624b64737a1487dade7fa 100644 (file)
@@ -2477,10 +2477,43 @@ static int __init parse_ivrs_hpet(char *str)
        return 1;
 }
 
+static int __init parse_ivrs_acpihid(char *str)
+{
+       u32 bus, dev, fn;
+       char *hid, *uid, *p;
+       char acpiid[ACPIHID_UID_LEN + ACPIHID_HID_LEN] = {0};
+       int ret, i;
+
+       ret = sscanf(str, "[%x:%x.%x]=%s", &bus, &dev, &fn, acpiid);
+       if (ret != 4) {
+               pr_err("AMD-Vi: Invalid command line: ivrs_acpihid(%s)\n", str);
+               return 1;
+       }
+
+       p = acpiid;
+       hid = strsep(&p, ":");
+       uid = p;
+
+       if (!hid || !(*hid) || !uid) {
+               pr_err("AMD-Vi: Invalid command line: hid or uid\n");
+               return 1;
+       }
+
+       i = early_acpihid_map_size++;
+       memcpy(early_acpihid_map[i].hid, hid, strlen(hid));
+       memcpy(early_acpihid_map[i].uid, uid, strlen(uid));
+       early_acpihid_map[i].devid =
+               ((bus & 0xff) << 8) | ((dev & 0x1f) << 3) | (fn & 0x7);
+       early_acpihid_map[i].cmd_line   = true;
+
+       return 1;
+}
+
 __setup("amd_iommu_dump",      parse_amd_iommu_dump);
 __setup("amd_iommu=",          parse_amd_iommu_options);
 __setup("ivrs_ioapic",         parse_ivrs_ioapic);
 __setup("ivrs_hpet",           parse_ivrs_hpet);
+__setup("ivrs_acpihid",                parse_ivrs_acpihid);
 
 IOMMU_INIT_FINISH(amd_iommu_detect,
                  gart_iommu_hole_init,