mirror of
https://git.yoctoproject.org/meta-ti
synced 2026-07-17 14:57:47 +00:00
189ce92b4c
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
85 lines
2.8 KiB
Diff
85 lines
2.8 KiB
Diff
From 24791636a8052063d0f0ee3df30d8fce92e59398 Mon Sep 17 00:00:00 2001
|
|
From: Joerg Roedel <joerg.roedel@amd.com>
|
|
Date: Thu, 31 May 2012 17:38:11 +0200
|
|
Subject: [PATCH 77/86] iommu/amd: Cache pdev pointer to root-bridge
|
|
|
|
commit c1bf94ec1e12d76838ad485158aecf208ebd8fb9 upstream.
|
|
|
|
At some point pci_get_bus_and_slot started to enable
|
|
interrupts. Since this function is used in the
|
|
amd_iommu_resume path it will enable interrupts on resume
|
|
which causes a warning. The fix will use a cached pointer
|
|
to the root-bridge to re-enable the IOMMU in case the BIOS
|
|
is broken.
|
|
|
|
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
|
|
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
|
---
|
|
drivers/iommu/amd_iommu_init.c | 13 +++++--------
|
|
drivers/iommu/amd_iommu_types.h | 3 +++
|
|
2 files changed, 8 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
|
|
index 20d5852..6269eb0 100644
|
|
--- a/drivers/iommu/amd_iommu_init.c
|
|
+++ b/drivers/iommu/amd_iommu_init.c
|
|
@@ -943,6 +943,9 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h)
|
|
if (!iommu->dev)
|
|
return 1;
|
|
|
|
+ iommu->root_pdev = pci_get_bus_and_slot(iommu->dev->bus->number,
|
|
+ PCI_DEVFN(0, 0));
|
|
+
|
|
iommu->cap_ptr = h->cap_ptr;
|
|
iommu->pci_seg = h->pci_seg;
|
|
iommu->mmio_phys = h->mmio_phys;
|
|
@@ -1225,20 +1228,16 @@ static void iommu_apply_resume_quirks(struct amd_iommu *iommu)
|
|
{
|
|
int i, j;
|
|
u32 ioc_feature_control;
|
|
- struct pci_dev *pdev = NULL;
|
|
+ struct pci_dev *pdev = iommu->root_pdev;
|
|
|
|
/* RD890 BIOSes may not have completely reconfigured the iommu */
|
|
- if (!is_rd890_iommu(iommu->dev))
|
|
+ if (!is_rd890_iommu(iommu->dev) || !pdev)
|
|
return;
|
|
|
|
/*
|
|
* First, we need to ensure that the iommu is enabled. This is
|
|
* controlled by a register in the northbridge
|
|
*/
|
|
- pdev = pci_get_bus_and_slot(iommu->dev->bus->number, PCI_DEVFN(0, 0));
|
|
-
|
|
- if (!pdev)
|
|
- return;
|
|
|
|
/* Select Northbridge indirect register 0x75 and enable writing */
|
|
pci_write_config_dword(pdev, 0x60, 0x75 | (1 << 7));
|
|
@@ -1248,8 +1247,6 @@ static void iommu_apply_resume_quirks(struct amd_iommu *iommu)
|
|
if (!(ioc_feature_control & 0x1))
|
|
pci_write_config_dword(pdev, 0x64, ioc_feature_control | 1);
|
|
|
|
- pci_dev_put(pdev);
|
|
-
|
|
/* Restore the iommu BAR */
|
|
pci_write_config_dword(iommu->dev, iommu->cap_ptr + 4,
|
|
iommu->stored_addr_lo);
|
|
diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h
|
|
index 5b9c507..40ab83b 100644
|
|
--- a/drivers/iommu/amd_iommu_types.h
|
|
+++ b/drivers/iommu/amd_iommu_types.h
|
|
@@ -385,6 +385,9 @@ struct amd_iommu {
|
|
/* Pointer to PCI device of this IOMMU */
|
|
struct pci_dev *dev;
|
|
|
|
+ /* Cache pdev to root device for resume quirks */
|
|
+ struct pci_dev *root_pdev;
|
|
+
|
|
/* physical address of MMIO space */
|
|
u64 mmio_phys;
|
|
/* virtual address of MMIO space */
|
|
--
|
|
1.7.9.5
|
|
|