mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
Intel IOMMU: Iommu Gfx workaround
When we fix all the opensource gfx drivers to use the DMA api's, at that time we can yank this config options out. [[email protected]: Kconfig fixes] Signed-off-by: Anil S Keshavamurthy <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Muli Ben-Yehuda <[email protected]> Cc: "Siddha, Suresh B" <[email protected]> Cc: Arjan van de Ven <[email protected]> Cc: Ashok Raj <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Greg KH <[email protected]> Signed-off-by: Jan Engelhardt <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
3460a6d9ce
commit
e820482cd2
5 changed files with 79 additions and 4 deletions
|
|
@ -1602,6 +1602,36 @@ static inline int iommu_prepare_rmrr_dev(struct dmar_rmrr_unit *rmrr,
|
|||
rmrr->end_address + 1);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DMAR_GFX_WA
|
||||
extern int arch_get_ram_range(int slot, u64 *addr, u64 *size);
|
||||
static void __init iommu_prepare_gfx_mapping(void)
|
||||
{
|
||||
struct pci_dev *pdev = NULL;
|
||||
u64 base, size;
|
||||
int slot;
|
||||
int ret;
|
||||
|
||||
for_each_pci_dev(pdev) {
|
||||
if (pdev->sysdata == DUMMY_DEVICE_DOMAIN_INFO ||
|
||||
!IS_GFX_DEVICE(pdev))
|
||||
continue;
|
||||
printk(KERN_INFO "IOMMU: gfx device %s 1-1 mapping\n",
|
||||
pci_name(pdev));
|
||||
slot = arch_get_ram_range(0, &base, &size);
|
||||
while (slot >= 0) {
|
||||
ret = iommu_prepare_identity_map(pdev,
|
||||
base, base + size);
|
||||
if (ret)
|
||||
goto error;
|
||||
slot = arch_get_ram_range(slot, &base, &size);
|
||||
}
|
||||
continue;
|
||||
error:
|
||||
printk(KERN_ERR "IOMMU: mapping reserved region failed\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int __init init_dmars(void)
|
||||
{
|
||||
struct dmar_drhd_unit *drhd;
|
||||
|
|
@ -1665,6 +1695,8 @@ int __init init_dmars(void)
|
|||
}
|
||||
}
|
||||
|
||||
iommu_prepare_gfx_mapping();
|
||||
|
||||
/*
|
||||
* for each drhd
|
||||
* enable fault log
|
||||
|
|
@ -2176,3 +2208,4 @@ int __init intel_iommu_init(void)
|
|||
dma_ops = &intel_dma_ops;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -315,4 +315,11 @@ struct intel_iommu {
|
|||
struct sys_device sysdev;
|
||||
};
|
||||
|
||||
#ifndef CONFIG_DMAR_GFX_WA
|
||||
static inline void iommu_prepare_gfx_mapping(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif /* !CONFIG_DMAR_GFX_WA */
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue