>From 760e18a02c0bb7eb5f5e3ebc192d43931f4c753b Mon Sep 17 00:00:00 2001 From: "Steven L. Kinney" Date: Fri, 16 Nov 2012 15:27:47 -0600 Subject: [PATCH] iommuv2/amd: Add quirk for AMD 15H_M10 IOMMUv2 Performance Counters Add AMD PCI device definition that will identify devices that relate to the IOMMUv2 PC PCI quirk added for potential non-enable by BIOS. On AMD family 15h models 10h-1Fh BIOS may not enable performance counters in IOMMUv2's EFR. Add a quirk to enable the counters when this happens. Signed-off-by: Steven L. Kinney --- arch/x86/kernel/quirks.c | 17 +++++++++++++++++ include/linux/pci_ids.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c index 1b27de5..9ea518b 100644 --- a/arch/x86/kernel/quirks.c +++ b/arch/x86/kernel/quirks.c @@ -567,3 +567,20 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F5, quirk_amd_nb_node); #endif + +#if defined(CONFIG_PCI) && defined(CONFIG_AMD_IOMMU_V2_PC) + +static void amd_force_iommu_v2_pc(struct pci_dev *dev) +{ + u32 val; + + pci_read_config_dword(dev, 0x70, &val); + val |= (1<<9); + pci_write_config_dword(dev, 0x70, val); + dev_printk(KERN_DEBUG, &dev->dev, "Enabled IOMMUv2 PC\n"); +} + +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M10H_IOMMU, + amd_force_iommu_v2_pc); + +#endif diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 9d36b82..70e20a3 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -396,6 +396,8 @@ /* AMD RD890 Chipset */ #define PCI_DEVICE_ID_RD890_IOMMU 0x5a23 +#define PCI_DEVICE_ID_AMD_15H_M10H_IOMMU 0x1419 + #define PCI_VENDOR_ID_ADL 0x1005 #define PCI_DEVICE_ID_ADL_2301 0x2301 -- 1.7.9.5