diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-12 14:29:26 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-12 14:29:26 -0400 |
| commit | e5d0c874391a500be7643d3eef9fb07171eee129 (patch) | |
| tree | e584dda865c5628fbb8e59a50096a0f4c21bf2bd | |
| parent | d5adf7e2db897f9d4a00be59262875ae5d9574f4 (diff) | |
| parent | d6a60fc1a8187004792a01643d8af1d06a465026 (diff) | |
Merge tag 'iommu-updates-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull IOMMU Updates from Joerg Roedel:
"This round the updates contain:
- A new driver for the Freescale PAMU IOMMU from Varun Sethi.
This driver has cooked for a while and required changes to the
IOMMU-API and infrastructure that were already merged before.
- Updates for the ARM-SMMU driver from Will Deacon
- Various fixes, the most important one is probably a fix from Alex
Williamson for a memory leak in the VT-d page-table freeing code
In summary not all that much. The biggest part in the diffstat is the
new PAMU driver"
* tag 'iommu-updates-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
intel-iommu: Fix leaks in pagetable freeing
iommu/amd: Fix resource leak in iommu_init_device()
iommu/amd: Clean up unnecessary MSI/MSI-X capability find
iommu/arm-smmu: Simplify VMID and ASID allocation
iommu/arm-smmu: Don't use VMIDs for stage-1 translations
iommu/arm-smmu: Tighten up global fault reporting
iommu/arm-smmu: Remove broken big-endian check
iommu/fsl: Remove unnecessary 'fsl-pamu' prefixes
iommu/fsl: Fix whitespace problems noticed by git-am
iommu/fsl: Freescale PAMU driver and iommu implementation.
iommu/fsl: Add additional iommu attributes required by the PAMU driver.
powerpc: Add iommu domain pointer to device archdata
iommu/exynos: Remove dead code (set_prefbuf)
| -rw-r--r-- | arch/powerpc/include/asm/device.h | 3 | ||||
| -rw-r--r-- | arch/powerpc/include/asm/fsl_pamu_stash.h | 39 | ||||
| -rw-r--r-- | arch/powerpc/sysdev/fsl_pci.h | 5 | ||||
| -rw-r--r-- | drivers/iommu/Kconfig | 10 | ||||
| -rw-r--r-- | drivers/iommu/Makefile | 1 | ||||
| -rw-r--r-- | drivers/iommu/amd_iommu.c | 4 | ||||
| -rw-r--r-- | drivers/iommu/amd_iommu_init.c | 2 | ||||
| -rw-r--r-- | drivers/iommu/arm-smmu.c | 93 | ||||
| -rw-r--r-- | drivers/iommu/exynos-iommu.c | 44 | ||||
| -rw-r--r-- | drivers/iommu/fsl_pamu.c | 1309 | ||||
| -rw-r--r-- | drivers/iommu/fsl_pamu.h | 410 | ||||
| -rw-r--r-- | drivers/iommu/fsl_pamu_domain.c | 1172 | ||||
| -rw-r--r-- | drivers/iommu/fsl_pamu_domain.h | 85 | ||||
| -rw-r--r-- | drivers/iommu/intel-iommu.c | 72 | ||||
| -rw-r--r-- | include/linux/iommu.h | 16 |
15 files changed, 3145 insertions, 120 deletions
diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h index 77e97dd0c15d..38faeded7d59 100644 --- a/arch/powerpc/include/asm/device.h +++ b/arch/powerpc/include/asm/device.h | |||
| @@ -28,6 +28,9 @@ struct dev_archdata { | |||
| 28 | void *iommu_table_base; | 28 | void *iommu_table_base; |
| 29 | } dma_data; | 29 | } dma_data; |
| 30 | 30 | ||
| 31 | #ifdef CONFIG_IOMMU_API | ||
| 32 | void *iommu_domain; | ||
| 33 | #endif | ||
| 31 | #ifdef CONFIG_SWIOTLB | 34 | #ifdef CONFIG_SWIOTLB |
| 32 | dma_addr_t max_direct_dma_addr; | 35 | dma_addr_t max_direct_dma_addr; |
| 33 | #endif | 36 | #endif |
diff --git a/arch/powerpc/include/asm/fsl_pamu_stash.h b/arch/powerpc/include/asm/fsl_pamu_stash.h new file mode 100644 index 000000000000..caa1b21c25cd --- /dev/null +++ b/arch/powerpc/include/asm/fsl_pamu_stash.h | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | /* | ||
| 2 | * This program is free software; you can redistribute it and/or modify | ||
| 3 | * it under the terms of the GNU General Public License, version 2, as | ||
| 4 | * published by the Free Software Foundation. | ||
| 5 | * | ||
| 6 | * This program is distributed in the hope that it will be useful, | ||
| 7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 9 | * GNU General Public License for more details. | ||
| 10 | * | ||
| 11 | * You should have received a copy of the GNU General Public License | ||
| 12 | * along with this program; if not, write to the Free Software | ||
| 13 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| 14 | * | ||
| 15 | * Copyright (C) 2013 Freescale Semiconductor, Inc. | ||
| 16 | * | ||
| 17 | */ | ||
| 18 | |||
| 19 | #ifndef __FSL_PAMU_STASH_H | ||
| 20 | #define __FSL_PAMU_STASH_H | ||
| 21 | |||
| 22 | /* cache stash targets */ | ||
| 23 | enum pamu_stash_target { | ||
| 24 | PAMU_ATTR_CACHE_L1 = 1, | ||
| 25 | PAMU_ATTR_CACHE_L2, | ||
| 26 | PAMU_ATTR_CACHE_L3, | ||
| 27 | }; | ||
| 28 | |||
| 29 | /* | ||
| 30 | * This attribute allows configuring stashig specific parameters | ||
| 31 | * in the PAMU hardware. | ||
| 32 | */ | ||
| 33 | |||
| 34 | struct pamu_stash_attribute { | ||
| 35 | u32 cpu; /* cpu number */ | ||
| 36 | u32 cache; /* cache to stash to: L1,L2,L3 */ | ||
| 37 | }; | ||
| 38 | |||
| 39 | #endif /* __FSL_PAMU_STASH_H */ | ||
diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h index defc422a375f..8d455df58471 100644 --- a/arch/powerpc/sysdev/fsl_pci.h +++ b/arch/powerpc/sysdev/fsl_pci.h | |||
| @@ -16,6 +16,11 @@ | |||
| 16 | 16 | ||
| 17 | struct platform_device; | 17 | struct platform_device; |
| 18 | 18 | ||
| 19 | |||
| 20 | /* FSL PCI controller BRR1 register */ | ||
| 21 | #define PCI_FSL_BRR1 0xbf8 | ||
| 22 | #define PCI_FSL_BRR1_VER 0xffff | ||
| 23 | |||
| 19 | #define PCIE_LTSSM 0x0404 /* PCIE Link Training and Status */ | 24 | #define PCIE_LTSSM 0x0404 /* PCIE Link Training and Status */ |
| 20 | #define PCIE_LTSSM_L0 0x16 /* L0 state */ | 25 | #define PCIE_LTSSM_L0 0x16 /* L0 state */ |
| 21 | #define PCIE_IP_REV_2_2 0x02080202 /* PCIE IP block version Rev2.2 */ | 26 | #define PCIE_IP_REV_2_2 0x02080202 /* PCIE IP block version Rev2.2 */ |
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 820d85c4a4a0..fe302e33f72e 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig | |||
| @@ -17,6 +17,16 @@ config OF_IOMMU | |||
| 17 | def_bool y | 17 | def_bool y |
| 18 | depends on OF | 18 | depends on OF |
| 19 | 19 | ||
| 20 | config FSL_PAMU | ||
| 21 | bool "Freescale IOMMU support" | ||
| 22 | depends on PPC_E500MC | ||
| 23 | select IOMMU_API | ||
| 24 | select GENERIC_ALLOCATOR | ||
| 25 | help | ||
| 26 | Freescale PAMU support. PAMU is the IOMMU present on Freescale QorIQ platforms. | ||
| 27 | PAMU can authorize memory access, remap the memory address, and remap I/O | ||
| 28 | transaction types. | ||
| 29 | |||
| 20 | # MSM IOMMU support | 30 | # MSM IOMMU support |
| 21 | config MSM_IOMMU | 31 | config MSM_IOMMU |
| 22 | bool "MSM IOMMU Support" | 32 | bool "MSM IOMMU Support" |
diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile index bbe7041212dd..14c1f474cf11 100644 --- a/drivers/iommu/Makefile +++ b/drivers/iommu/Makefile | |||
| @@ -16,3 +16,4 @@ obj-$(CONFIG_TEGRA_IOMMU_SMMU) += tegra-smmu.o | |||
| 16 | obj-$(CONFIG_EXYNOS_IOMMU) += exynos-iommu.o | 16 | obj-$(CONFIG_EXYNOS_IOMMU) += exynos-iommu.o |
| 17 | obj-$(CONFIG_SHMOBILE_IOMMU) += shmobile-iommu.o | 17 | obj-$(CONFIG_SHMOBILE_IOMMU) += shmobile-iommu.o |
| 18 | obj-$(CONFIG_SHMOBILE_IPMMU) += shmobile-ipmmu.o | 18 | obj-$(CONFIG_SHMOBILE_IPMMU) += shmobile-ipmmu.o |
| 19 | obj-$(CONFIG_FSL_PAMU) += fsl_pamu.o fsl_pamu_domain.o | ||
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 6dc659426a51..72531f008a5e 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
| @@ -456,8 +456,10 @@ static int iommu_init_device(struct device *dev) | |||
| 456 | } | 456 | } |
| 457 | 457 | ||
| 458 | ret = init_iommu_group(dev); | 458 | ret = init_iommu_group(dev); |
| 459 | if (ret) | 459 | if (ret) { |
| 460 | free_dev_data(dev_data); | ||
| 460 | return ret; | 461 | return ret; |
| 462 | } | ||
| 461 | 463 | ||
| 462 | if (pci_iommuv2_capable(pdev)) { | 464 | if (pci_iommuv2_capable(pdev)) { |
| 463 | struct amd_iommu *iommu; | 465 | struct amd_iommu *iommu; |
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 7acbf351e9af..8f798be6e398 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
| @@ -1384,7 +1384,7 @@ static int iommu_init_msi(struct amd_iommu *iommu) | |||
| 1384 | if (iommu->int_enabled) | 1384 | if (iommu->int_enabled) |
| 1385 | goto enable_faults; | 1385 | goto enable_faults; |
| 1386 | 1386 | ||
| 1387 | if (pci_find_capability(iommu->dev, PCI_CAP_ID_MSI)) | 1387 | if (iommu->dev->msi_cap) |
| 1388 | ret = iommu_setup_msi(iommu); | 1388 | ret = iommu_setup_msi(iommu); |
| 1389 | else | 1389 | else |
| 1390 | ret = -ENODEV; | 1390 | ret = -ENODEV; |
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index ebd0a4cff049..f417e89e1e7e 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
| @@ -56,9 +56,6 @@ | |||
| 56 | /* Maximum number of mapping groups per SMMU */ | 56 | /* Maximum number of mapping groups per SMMU */ |
| 57 | #define ARM_SMMU_MAX_SMRS 128 | 57 | #define ARM_SMMU_MAX_SMRS 128 |
| 58 | 58 | ||
| 59 | /* Number of VMIDs per SMMU */ | ||
| 60 | #define ARM_SMMU_NUM_VMIDS 256 | ||
| 61 | |||
| 62 | /* SMMU global address space */ | 59 | /* SMMU global address space */ |
| 63 | #define ARM_SMMU_GR0(smmu) ((smmu)->base) | 60 | #define ARM_SMMU_GR0(smmu) ((smmu)->base) |
| 64 | #define ARM_SMMU_GR1(smmu) ((smmu)->base + (smmu)->pagesize) | 61 | #define ARM_SMMU_GR1(smmu) ((smmu)->base + (smmu)->pagesize) |
| @@ -87,6 +84,7 @@ | |||
| 87 | #define ARM_SMMU_PTE_AP_UNPRIV (((pteval_t)1) << 6) | 84 | #define ARM_SMMU_PTE_AP_UNPRIV (((pteval_t)1) << 6) |
| 88 | #define ARM_SMMU_PTE_AP_RDONLY (((pteval_t)2) << 6) | 85 | #define ARM_SMMU_PTE_AP_RDONLY (((pteval_t)2) << 6) |
| 89 | #define ARM_SMMU_PTE_ATTRINDX_SHIFT 2 | 86 | #define ARM_SMMU_PTE_ATTRINDX_SHIFT 2 |
| 87 | #define ARM_SMMU_PTE_nG (((pteval_t)1) << 11) | ||
| 90 | 88 | ||
| 91 | /* Stage-2 PTE */ | 89 | /* Stage-2 PTE */ |
| 92 | #define ARM_SMMU_PTE_HAP_FAULT (((pteval_t)0) << 6) | 90 | #define ARM_SMMU_PTE_HAP_FAULT (((pteval_t)0) << 6) |
| @@ -223,6 +221,7 @@ | |||
| 223 | #define ARM_SMMU_CB_FAR_LO 0x60 | 221 | #define ARM_SMMU_CB_FAR_LO 0x60 |
| 224 | #define ARM_SMMU_CB_FAR_HI 0x64 | 222 | #define ARM_SMMU_CB_FAR_HI 0x64 |
| 225 | #define ARM_SMMU_CB_FSYNR0 0x68 | 223 | #define ARM_SMMU_CB_FSYNR0 0x68 |
| 224 | #define ARM_SMMU_CB_S1_TLBIASID 0x610 | ||
| 226 | 225 | ||
| 227 | #define SCTLR_S1_ASIDPNE (1 << 12) | 226 | #define SCTLR_S1_ASIDPNE (1 << 12) |
| 228 | #define SCTLR_CFCFG (1 << 7) | 227 | #define SCTLR_CFCFG (1 << 7) |
| @@ -282,6 +281,8 @@ | |||
| 282 | #define TTBCR2_ADDR_44 4 | 281 | #define TTBCR2_ADDR_44 4 |
| 283 | #define TTBCR2_ADDR_48 5 | 282 | #define TTBCR2_ADDR_48 5 |
| 284 | 283 | ||
| 284 | #define TTBRn_HI_ASID_SHIFT 16 | ||
| 285 | |||
| 285 | #define MAIR_ATTR_SHIFT(n) ((n) << 3) | 286 | #define MAIR_ATTR_SHIFT(n) ((n) << 3) |
| 286 | #define MAIR_ATTR_MASK 0xff | 287 | #define MAIR_ATTR_MASK 0xff |
| 287 | #define MAIR_ATTR_DEVICE 0x04 | 288 | #define MAIR_ATTR_DEVICE 0x04 |
| @@ -305,7 +306,7 @@ | |||
| 305 | #define FSR_IGN (FSR_AFF | FSR_ASF | FSR_TLBMCF | \ | 306 | #define FSR_IGN (FSR_AFF | FSR_ASF | FSR_TLBMCF | \ |
| 306 | FSR_TLBLKF) | ||
