diff mbox series

[SRU,OEM-5.6,1/1] iommu/vt-d: Enable PCI ACS for platform opt in hint

Message ID 20200813082622.6850-2-koba.ko@canonical.com
State New
Headers show
Series Enable PCI ACS for platform opt to get the usb flash drive from WD19TB | expand

Commit Message

Koba Ko Aug. 13, 2020, 8:26 a.m. UTC
From: Lu Baolu <baolu.lu@linux.intel.com>

BugLink: https://bugs.launchpad.net/bugs/1891449

PCI ACS is disabled if Intel IOMMU is off by default or intel_iommu=off
is used in command line. Unfortunately, Intel IOMMU will be forced on if
there're devices sitting on an external facing PCI port that is marked
as untrusted (for example, thunderbolt peripherals). That means, PCI ACS
is disabled while Intel IOMMU is forced on to isolate those devices. As
the result, the devices of an MFD will be grouped by a single group even
the ACS is supported on device.

[    0.691263] pci 0000:00:07.1: Adding to iommu group 3
[    0.691277] pci 0000:00:07.2: Adding to iommu group 3
[    0.691292] pci 0000:00:07.3: Adding to iommu group 3

Fix it by requesting PCI ACS when Intel IOMMU is detected with platform
opt in hint.

Fixes: 89a6079df791a ("iommu/vt-d: Force IOMMU on for platform opt in hint")
Co-developed-by: Lalithambika Krishnakumar <lalithambika.krishnakumar@intel.com>
Signed-off-by: Lalithambika Krishnakumar <lalithambika.krishnakumar@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Ashok Raj <ashok.raj@intel.com>
Link: https://lore.kernel.org/r/20200622231345.29722-5-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
(cherry picked from the commit 50310600ebda74b9988467e2e6128711c7ba56fc)
Signed-off-by: Koba Ko <koba.ko@canonical.com>
---
 drivers/iommu/dmar.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Stefan Bader Aug. 14, 2020, 7:36 a.m. UTC | #1
On 13.08.20 10:26, Koba Ko wrote:
> From: Lu Baolu <baolu.lu@linux.intel.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1891449
> 
> PCI ACS is disabled if Intel IOMMU is off by default or intel_iommu=off
> is used in command line. Unfortunately, Intel IOMMU will be forced on if
> there're devices sitting on an external facing PCI port that is marked
> as untrusted (for example, thunderbolt peripherals). That means, PCI ACS
> is disabled while Intel IOMMU is forced on to isolate those devices. As
> the result, the devices of an MFD will be grouped by a single group even
> the ACS is supported on device.
> 
> [    0.691263] pci 0000:00:07.1: Adding to iommu group 3
> [    0.691277] pci 0000:00:07.2: Adding to iommu group 3
> [    0.691292] pci 0000:00:07.3: Adding to iommu group 3
> 
> Fix it by requesting PCI ACS when Intel IOMMU is detected with platform
> opt in hint.
> 
> Fixes: 89a6079df791a ("iommu/vt-d: Force IOMMU on for platform opt in hint")
> Co-developed-by: Lalithambika Krishnakumar <lalithambika.krishnakumar@intel.com>
> Signed-off-by: Lalithambika Krishnakumar <lalithambika.krishnakumar@intel.com>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> Cc: Ashok Raj <ashok.raj@intel.com>
> Link: https://lore.kernel.org/r/20200622231345.29722-5-baolu.lu@linux.intel.com
> Signed-off-by: Joerg Roedel <jroedel@suse.de>
> (cherry picked from the commit 50310600ebda74b9988467e2e6128711c7ba56fc)
> Signed-off-by: Koba Ko <koba.ko@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  drivers/iommu/dmar.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> index 19245819f326..a658e68b81ea 100644
> --- a/drivers/iommu/dmar.c
> +++ b/drivers/iommu/dmar.c
> @@ -898,7 +898,8 @@ int __init detect_intel_iommu(void)
>  	if (!ret)
>  		ret = dmar_walk_dmar_table((struct acpi_table_dmar *)dmar_tbl,
>  					   &validate_drhd_cb);
> -	if (!ret && !no_iommu && !iommu_detected && !dmar_disabled) {
> +	if (!ret && !no_iommu && !iommu_detected &&
> +	    (!dmar_disabled || dmar_platform_optin())) {
>  		iommu_detected = 1;
>  		/* Make sure ACS will be enabled */
>  		pci_request_acs();
>
diff mbox series

Patch

diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 19245819f326..a658e68b81ea 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -898,7 +898,8 @@  int __init detect_intel_iommu(void)
 	if (!ret)
 		ret = dmar_walk_dmar_table((struct acpi_table_dmar *)dmar_tbl,
 					   &validate_drhd_cb);
-	if (!ret && !no_iommu && !iommu_detected && !dmar_disabled) {
+	if (!ret && !no_iommu && !iommu_detected &&
+	    (!dmar_disabled || dmar_platform_optin())) {
 		iommu_detected = 1;
 		/* Make sure ACS will be enabled */
 		pci_request_acs();