]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.135/iommu-amd-return-devid-as-alias-for-acpi-hid-devices.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.9.135 / iommu-amd-return-devid-as-alias-for-acpi-hid-devices.patch
CommitLineData
be7e94f8
GKH
1From foo@baz Thu Oct 18 11:11:32 CEST 2018
2From: Arindam Nath <arindam.nath@amd.com>
3Date: Tue, 18 Sep 2018 15:40:58 +0530
4Subject: iommu/amd: Return devid as alias for ACPI HID devices
5
6From: Arindam Nath <arindam.nath@amd.com>
7
8[ Upstream commit 5ebb1bc2d63d90dd204169e21fd7a0b4bb8c776e ]
9
10ACPI HID devices do not actually have an alias for
11them in the IVRS. But dev_data->alias is still used
12for indexing into the IOMMU device table for devices
13being handled by the IOMMU. So for ACPI HID devices,
14we simply return the corresponding devid as an alias,
15as parsed from IVRS table.
16
17Signed-off-by: Arindam Nath <arindam.nath@amd.com>
18Fixes: 2bf9a0a12749 ('iommu/amd: Add iommu support for ACPI HID devices')
19Signed-off-by: Joerg Roedel <jroedel@suse.de>
20Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
21Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22---
23 drivers/iommu/amd_iommu.c | 6 ++++++
24 1 file changed, 6 insertions(+)
25
26--- a/drivers/iommu/amd_iommu.c
27+++ b/drivers/iommu/amd_iommu.c
28@@ -288,7 +288,13 @@ static u16 get_alias(struct device *dev)
29
30 /* The callers make sure that get_device_id() does not fail here */
31 devid = get_device_id(dev);
32+
33+ /* For ACPI HID devices, we simply return the devid as such */
34+ if (!dev_is_pci(dev))
35+ return devid;
36+
37 ivrs_alias = amd_iommu_alias_table[devid];
38+
39 pci_for_each_dma_alias(pdev, __last_alias, &pci_alias);
40
41 if (ivrs_alias == pci_alias)