aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-10-26 13:50:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-10-26 13:50:10 -0400
commitd1f2b1710d92a80d60351503bbf41cdac95ed7a8 (patch)
treecc8247f2917c38b476b8777c29e3c9a154445d9e /include/linux
parent18d0eae30e6a4f8644d589243d7ac1d70d29203d (diff)
parent2f2fbfb71ecc221352d84ae6430b42031ae5b654 (diff)
Merge tag 'iommu-updates-v4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull IOMMU updates from Joerg Roedel: - Debugfs support for the Intel VT-d driver. When enabled, it now also exposes some of its internal data structures to user-space for debugging purposes. - ARM-SMMU driver now uses the generic deferred flushing and fast-path iova allocation code. This is expected to be a major performance improvement, as this allocation path scales a lot better. - Support for r8a7744 in the Renesas iommu driver - Couple of minor fixes and improvements all over the place * tag 'iommu-updates-v4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (39 commits) iommu/arm-smmu-v3: Remove unnecessary wrapper function iommu/arm-smmu-v3: Add SPDX header iommu/amd: Add default branch in amd_iommu_capable() dt-bindings: iommu: ipmmu-vmsa: Add r8a7744 support iommu/amd: Move iommu_init_pci() to .init section iommu/arm-smmu: Support non-strict mode iommu/io-pgtable-arm-v7s: Add support for non-strict mode iommu/arm-smmu-v3: Add support for non-strict mode iommu/io-pgtable-arm: Add support for non-strict mode iommu: Add "iommu.strict" command line option iommu/dma: Add support for non-strict mode iommu/arm-smmu: Ensure that page-table updates are visible before TLBI iommu/arm-smmu-v3: Implement flush_iotlb_all hook iommu/arm-smmu-v3: Avoid back-to-back CMD_SYNC operations iommu/arm-smmu-v3: Fix unexpected CMD_SYNC timeout iommu/io-pgtable-arm: Fix race handling in split_blk_unmap() iommu/arm-smmu-v3: Fix a couple of minor comment typos iommu: Fix a typo iommu: Remove .domain_{get,set}_windows iommu: Tidy up window attributes ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/fsl/mc.h8
-rw-r--r--include/linux/intel-iommu.h72
-rw-r--r--include/linux/iommu.h10
-rw-r--r--include/linux/iova.h1
-rw-r--r--include/linux/of.h11
-rw-r--r--include/linux/of_pci.h10
6 files changed, 96 insertions, 16 deletions
diff --git a/include/linux/fsl/mc.h b/include/linux/fsl/mc.h
index 5160f06ffbac..9d3f668df7df 100644
--- a/include/linux/fsl/mc.h
+++ b/include/linux/fsl/mc.h
@@ -351,6 +351,14 @@ int mc_send_command(struct fsl_mc_io *mc_io, struct fsl_mc_command *cmd);
351#define dev_is_fsl_mc(_dev) (0) 351#define dev_is_fsl_mc(_dev) (0)
352#endif 352#endif
353 353
354/* Macro to check if a device is a container device */
355#define fsl_mc_is_cont_dev(_dev) (to_fsl_mc_device(_dev)->flags & \
356 FSL_MC_IS_DPRC)
357
358/* Macro to get the container device of a MC device */
359#define fsl_mc_cont_dev(_dev) (fsl_mc_is_cont_dev(_dev) ? \
360 (_dev) : (_dev)->parent)
361
354/* 362/*
355 * module_fsl_mc_driver() - Helper macro for drivers that don't do 363 * module_fsl_mc_driver() - Helper macro for drivers that don't do
356 * anything special in module init/exit. This eliminates a lot of 364 * anything special in module init/exit. This eliminates a lot of
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 28004d74ae04..b0ae25837361 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -72,6 +72,42 @@
72#define DMAR_PEDATA_REG 0xe4 /* Page request event interrupt data register */ 72#define DMAR_PEDATA_REG 0xe4 /* Page request event interrupt data register */
73#define DMAR_PEADDR_REG 0xe8 /* Page request event interrupt addr register */ 73#define DMAR_PEADDR_REG 0xe8 /* Page request event interrupt addr register */
74#define DMAR_PEUADDR_REG 0xec /* Page request event Upper address register */ 74#define DMAR_PEUADDR_REG 0xec /* Page request event Upper address register */
75#define DMAR_MTRRCAP_REG 0x100 /* MTRR capability register */
76#define DMAR_MTRRDEF_REG 0x108 /* MTRR default type register */
77#define DMAR_MTRR_FIX64K_00000_REG 0x120 /* MTRR Fixed range registers */
78#define DMAR_MTRR_FIX16K_80000_REG 0x128
79#define DMAR_MTRR_FIX16K_A0000_REG 0x130
80#define DMAR_MTRR_FIX4K_C0000_REG 0x138
81#define DMAR_MTRR_FIX4K_C8000_REG 0x140
82#define DMAR_MTRR_FIX4K_D0000_REG 0x148
83#define DMAR_MTRR_FIX4K_D8000_REG 0x150
84#define DMAR_MTRR_FIX4K_E0000_REG 0x158
85#define DMAR_MTRR_FIX4K_E8000_REG 0x160
86#define DMAR_MTRR_FIX4K_F0000_REG 0x168
87#define DMAR_MTRR_FIX4K_F8000_REG 0x170
88#define DMAR_MTRR_PHYSBASE0_REG 0x180 /* MTRR Variable range registers */
89#define DMAR_MTRR_PHYSMASK0_REG 0x188
90#define DMAR_MTRR_PHYSBASE1_REG 0x190
91#define DMAR_MTRR_PHYSMASK1_REG 0x198
92#define DMAR_MTRR_PHYSBASE2_REG 0x1a0
93#define DMAR_MTRR_PHYSMASK2_REG 0x1a8
94#define DMAR_MTRR_PHYSBASE3_REG 0x1b0
95#define DMAR_MTRR_PHYSMASK3_REG 0x1b8
96#define DMAR_MTRR_PHYSBASE4_REG 0x1c0
97#define DMAR_MTRR_PHYSMASK4_REG 0x1c8
98#define DMAR_MTRR_PHYSBASE5_REG 0x1d0
99#define DMAR_MTRR_PHYSMASK5_REG 0x1d8
100#define DMAR_MTRR_PHYSBASE6_REG 0x1e0
101#define DMAR_MTRR_PHYSMASK6_REG 0x1e8
102#define DMAR_MTRR_PHYSBASE7_REG 0x1f0
103#define DMAR_MTRR_PHYSMASK7_REG 0x1f8
104#define DMAR_MTRR_PHYSBASE8_REG 0x200
105#define DMAR_MTRR_PHYSMASK8_REG 0x208
106#define DMAR_MTRR_PHYSBASE9_REG 0x210
107#define DMAR_MTRR_PHYSMASK9_REG 0x218
108#define DMAR_VCCAP_REG 0xe00 /* Virtual command capability register */
109#define DMAR_VCMD_REG 0xe10 /* Virtual command register */
110#define DMAR_VCRSP_REG 0xe20 /* Virtual command response register */
75 111
76#define OFFSET_STRIDE (9) 112#define OFFSET_STRIDE (9)
77 113
@@ -389,6 +425,33 @@ struct pasid_entry;
389struct pasid_state_entry; 425struct pasid_state_entry;
390struct page_req_dsc; 426struct page_req_dsc;
391 427
428/*
429 * 0: Present
430 * 1-11: Reserved
431 * 12-63: Context Ptr (12 - (haw-1))
432 * 64-127: Reserved
433 */
434struct root_entry {
435 u64 lo;
436 u64 hi;
437};
438
439/*
440 * low 64 bits:
441 * 0: present
442 * 1: fault processing disable
443 * 2-3: translation type
444 * 12-63: address space root
445 * high 64 bits:
446 * 0-2: address width
447 * 3-6: aval
448 * 8-23: domain id
449 */
450struct context_entry {
451 u64 lo;
452 u64 hi;
453};
454
392struct dmar_domain { 455struct dmar_domain {
393 int nid; /* node id */ 456 int nid; /* node id */
394 457
@@ -558,6 +621,15 @@ extern int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct intel_svm_
558extern struct intel_iommu *intel_svm_device_to_iommu(struct device *dev); 621extern struct intel_iommu *intel_svm_device_to_iommu(struct device *dev);
559#endif 622#endif
560 623
624#ifdef CONFIG_INTEL_IOMMU_DEBUGFS
625void intel_iommu_debugfs_init(void);
626#else
627static inline void intel_iommu_debugfs_init(void) {}
628#endif /* CONFIG_INTEL_IOMMU_DEBUGFS */
629
561extern const struct attribute_group *intel_iommu_groups[]; 630extern const struct attribute_group *intel_iommu_groups[];
631bool context_present(struct context_entry *context);
632struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus,
633 u8 devfn, int alloc);
562 634
563#endif 635#endif
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 87994c265bf5..a1d28f42cb77 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -124,6 +124,7 @@ enum iommu_attr {
124 DOMAIN_ATTR_FSL_PAMU_ENABLE, 124 DOMAIN_ATTR_FSL_PAMU_ENABLE,
125 DOMAIN_ATTR_FSL_PAMUV1, 125 DOMAIN_ATTR_FSL_PAMUV1,
126 DOMAIN_ATTR_NESTING, /* two stages of translation */ 126 DOMAIN_ATTR_NESTING, /* two stages of translation */
127 DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE,
127 DOMAIN_ATTR_MAX, 128 DOMAIN_ATTR_MAX,
128}; 129};
129 130
@@ -181,8 +182,6 @@ struct iommu_resv_region {
181 * @apply_resv_region: Temporary helper call-back for iova reserved ranges 182 * @apply_resv_region: Temporary helper call-back for iova reserved ranges
182 * @domain_window_enable: Configure and enable a particular window for a domain 183 * @domain_window_enable: Configure and enable a particular window for a domain
183 * @domain_window_disable: Disable a particular window for a domain 184 * @domain_window_disable: Disable a particular window for a domain
184 * @domain_set_windows: Set the number of windows for a domain
185 * @domain_get_windows: Return the number of windows for a domain
186 * @of_xlate: add OF master IDs to iommu grouping 185 * @of_xlate: add OF master IDs to iommu grouping
187 * @pgsize_bitmap: bitmap of all possible supported page sizes 186 * @pgsize_bitmap: bitmap of all possible supported page sizes
188 */ 187 */
@@ -223,10 +222,6 @@ struct iommu_ops {
223 int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr, 222 int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr,
224 phys_addr_t paddr, u64 size, int prot); 223 phys_addr_t paddr, u64 size, int prot);
225 void (*domain_window_disable)(struct iommu_domain *domain, u32 wnd_nr); 224 void (*domain_window_disable)(struct iommu_domain *domain, u32 wnd_nr);
226 /* Set the number of windows per domain */
227 int (*domain_set_windows)(struct iommu_domain *domain, u32 w_count);
228 /* Get the number of windows per domain */
229 u32 (*domain_get_windows)(struct iommu_domain *domain);
230 225
231 int (*of_xlate)(struct device *dev, struct of_phandle_args *args); 226 int (*of_xlate)(struct device *dev, struct of_phandle_args *args);
232 bool (*is_attach_deferred)(struct iommu_domain *domain, struct device *dev); 227 bool (*is_attach_deferred)(struct iommu_domain *domain, struct device *dev);
@@ -293,6 +288,7 @@ extern int iommu_attach_device(struct iommu_domain *domain,
293extern void iommu_detach_device(struct iommu_domain *domain, 288extern void iommu_detach_device(struct iommu_domain *domain,
294 struct device *dev); 289 struct device *dev);
295extern struct iommu_domain *iommu_get_domain_for_dev(struct device *dev); 290extern struct iommu_domain *iommu_get_domain_for_dev(struct device *dev);
291extern struct iommu_domain *iommu_get_dma_domain(struct device *dev);
296extern int iommu_map(struct iommu_domain *domain, unsigned long iova, 292extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
297 phys_addr_t paddr, size_t size, int prot); 293 phys_addr_t paddr, size_t size, int prot);
298extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, 294extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
@@ -377,6 +373,8 @@ static inline void iommu_tlb_sync(struct iommu_domain *domain)
377extern struct iommu_group *pci_device_group(struct device *dev); 373extern struct iommu_group *pci_device_group(struct device *dev);
378/* Generic device grouping function */ 374/* Generic device grouping function */
379extern struct iommu_group *generic_device_group(struct device *dev); 375extern struct iommu_group *generic_device_group(struct device *dev);
376/* FSL-MC device grouping function */
377struct iommu_group *fsl_mc_device_group(struct device *dev);
380 378
381/** 379/**
382 * struct iommu_fwspec - per-device IOMMU instance data 380 * struct iommu_fwspec - per-device IOMMU instance data
diff --git a/include/linux/iova.h b/include/linux/iova.h
index 928442dda565..0b93bf96693e 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -75,6 +75,7 @@ struct iova_domain {
75 unsigned long granule; /* pfn granularity for this domain */ 75 unsigned long granule; /* pfn granularity for this domain */
76 unsigned long start_pfn; /* Lower limit for this domain */ 76 unsigned long start_pfn; /* Lower limit for this domain */
77 unsigned long dma_32bit_pfn; 77 unsigned long dma_32bit_pfn;
78</