summaryrefslogtreecommitdiff
path: root/include/linux (follow)
Commit message (Collapse)AuthorAge
...
* | | | qpnp: revid: fix the use of TYPE and SUBTYPEAbhijeet Dharmapurikar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The TYPE for a PMIC chip is always 0x51. There is no need to define it for each PMIC chip. Also the SUBTYPE of a PMIC chip doesn't change with versions. Have a single definition of the SUBTYPE per PMIC chip. Also, the driver uses integer indexes to get to the pmic name, instead use the SUBTYPE to index in the pmic names array. Change-Id: Ie1c43f3db0d4a395307253aad347ad93624a1203 Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
* | | | esoc: Snapshot esoc driversAbhimanyu Kapur2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Snapshot esoc components, headers and UAPI headers from msm-3.18@0922caf50f22e751a05e (Merge "usb: dwc3-msm: Fix incorrect roles with multiple instances") Change-Id: I55e7ea4359c1f5b855f082e66d5816316da2fd48 Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
* | | | kernel/lib: add additional debug capabilites for data corruptionSyed Rameez Mustafa2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Data corruptions in the kernel often end up in system crashes that are easier to debug closer to the time of detection. Specifically, if we do not panic immediately after lock or list corruptions have been detected, the problem context is lost in the ensuing system mayhem. Add support for allowing system crash immediately after such corruptions are detected. The CONFIG option controls the enabling/disabling of the feature. Change-Id: I9b2eb62da506a13007acff63e85e9515145909ff Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org> [abhimany: minor merge conflict resolution] Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
* | | | msm: ep_pcie: add the support of PCIe EP mode for mdmcaliforniumYan He2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the support of PCIe Endpoint (EP) mode for mdmcalifornium. Change-Id: I55c85813e674810d865b444b7e19ce4157cea479 Signed-off-by: Yan He <yanhe@codeaurora.org>
* | | | msm: ep_pcie: add PCIe endpoint driverYan He2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MSM PCIe endpoint driver enables the PCIe core in endpoint mode and handles the control signaling with PCIe root complex on host side. Change-Id: Ifc2735e061820762c6040eda44089a2dc26fc065 Signed-off-by: Yan He <yanhe@codeaurora.org>
* | | | devfreq: Add Qualcomm GPU devfreq governorsJordan Crouse2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Snapshot of the Qualcomm GPU devfreq governors and support as of msm-3.18 commit e70ad0cd5efd ("Promotion of kernel.lnx.3.18-151201."). Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
* | | | msm: kgsl: Add Qualcomm GPU driverJordan Crouse2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Snapshot of the Qualcom Adreno GPU driver (KGSL) as of msm-3.18 commit commit e70ad0cd5efd ("Promotion of kernel.lnx.3.18-151201."). Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
* | | | coresight: of_get_coresight_platform_data needs both OF and CORESIGHTJordan Crouse2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The file that defines of_get_coresight_platform_data() is indeed dependent on CONFIG_OF but the entire coresight directory depends on CONFIG_CORESIGHT so both need to be enabled to make the symbol resolve. Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
* | | | iommu: Add snapshot of qcom_iommu.hPatrick Daly2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Taken as of kernel version "e70ad0cd5efdd9dc91a77dcdac31d6132e1315c1" on msm-3.18. Change-Id: I91bdb35429af8159e58bb6fb9e2e52f16d625c4b Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
* | | | coresight: add STM driver support in upstream implementationShashank Mittal2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add STM driver in upstream implementation of Coresight driver. This change copies drivers/coresight/coresight-stm.c (commit : 90095b2ae1d987882f67c6d4a512baa98eecd6cb) to driver/hwtracing/coresight directory. Change-Id: Id023bf85df0345205ca8baa6a97ff340d5808aeb Signed-off-by: Shashank Mittal <mittals@codeaurora.org>
* | | | iommu: Add generic_device_group() functionJoerg Roedel2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This function can be used as a device_group call-back and just allocates one iommu-group per device. Signed-off-by: Joerg Roedel <jroedel@suse.de>
* | | | iommu: Export and rename iommu_group_get_for_pci_dev()Joerg Roedel2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename that function to pci_device_group() and export it, so that IOMMU drivers can use it as their device_group call-back. Change-Id: Ic54268d9854dd2eeba53ca9f9635d0287bfc7f0f Signed-off-by: Joerg Roedel <jroedel@suse.de> [pdaly@codeaurora.org Resolve minor conflicts]
* | | | iommu: Revive device_group iommu-ops call-backJoerg Roedel2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | That call-back is currently unused, change it into a call-back function for finding the right IOMMU group for a device. This is a first step to remove the hard-coded PCI dependency in the iommu-group code. Signed-off-by: Joerg Roedel <jroedel@suse.de>
* | | | iommu: Implement common IOMMU ops for DMA mappingRobin Murphy2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Taking inspiration from the existing arch/arm code, break out some generic functions to interface the DMA-API to the IOMMU-API. This will do the bulk of the heavy lifting for IOMMU-backed dma-mapping. Since associating an IOVA allocator with an IOMMU domain is a fairly common need, rather than introduce yet another private structure just to do this for ourselves, extend the top-level struct iommu_domain with the notion. A simple opaque cookie allows reuse by other IOMMU API users with their various different incompatible allocator types. Change-Id: I4a49976c4e496025b2a2b2b9ef749666a239294b Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Joerg Roedel <jroedel@suse.de> [pdaly@codeaurora.org Add changes only in iommu.h]
* | | | include, lib: add __printf attributes to several function prototypesNicolas Iooss2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using __printf attributes helps to detect several format string issues at compile time (even though -Wformat-security is currently disabled in Makefile). For example it can detect when formatting a pointer as a number, like the issue fixed in commit a3fa71c40f18 ("wl18xx: show rx_frames_per_rates as an array as it really is"), or when the arguments do not match the format string, c.f. for example commit 5ce1aca81435 ("reiserfs: fix __RASSERT format string"). To prevent similar bugs in the future, add a __printf attribute to every function prototype which needs one in include/linux/ and lib/. These functions were mostly found by using gcc's -Wsuggest-attribute=format flag. Change-Id: I17371bb8a1cc40cc0b56fcdded609cc24fe7e261 Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Felipe Balbi <balbi@ti.com> Cc: Joel Becker <jlbec@evilplan.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> [pdaly@codeaurora.org Resolve minor conflicts]
* | | | iommu: Introduce iommu_request_dm_for_dev()Joerg Roedel2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This function can be called by an IOMMU driver to request that a device's default domain is direct mapped. Signed-off-by: Joerg Roedel <jroedel@suse.de>
* | | | iommu: Add function to query the default domain of a groupJoerg Roedel2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This will be used to handle unity mappings in the iommu drivers. Signed-off-by: Joerg Roedel <jroedel@suse.de>
* | | | iommu: Introduce direct mapped region handlingJoerg Roedel2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add two new functions to the IOMMU-API to allow the IOMMU drivers to export the requirements for direct mapped regions per device. This is useful for exporting the information in Intel VT-d's RMRR entries or AMD-Vi's unity mappings. Change-Id: Iab55341a8526084a5110dc5a2d4448fd46e3296a Signed-off-by: Joerg Roedel <jroedel@suse.de> [pdaly@codeaurora.org Resolve minor conflicts]
* | | | iommu: Add iommu_get_domain_for_dev functionJoerg Roedel2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function can be used to request the current domain a device is attached to. Change-Id: I2c88ad3b81d8c9ab5526843ff39e7ff35c74a0fb Signed-off-by: Joerg Roedel <jroedel@suse.de> [pdaly@codeaurora.org Resolve minor conflicts]
* | | | iommu: Remove domain_init and domain_free iommu_opsJoerg Roedel2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All drivers have been converted to the new domain_alloc and domain_free iommu-ops. So remove the old ones and get rid of iommu_domain->priv too, as this is no longer needed when the struct iommu_domain is embedded in the private structures of the iommu drivers. Tested-by: Thierry Reding <treding@nvidia.com> Tested-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Alex Williamson <alex.williamson@redhat.com> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
* | | | iommu: Introduce iommu domain typesJoerg Roedel2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows to handle domains differently based on their type in the future. An IOMMU driver can implement certain optimizations for DMA-API domains for example. The domain types can be extended later and some of the existing domain attributes can be migrated to become domain flags. Tested-by: Thierry Reding <treding@nvidia.com> Tested-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Alex Williamson <alex.williamson@redhat.com> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
* | | | iommu: Introduce domain_alloc and domain_free iommu_opsJoerg Roedel2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These new call-backs defer the allocation and destruction of 'struct iommu_domain' to the iommu driver. This allows drivers to embed this struct into their private domain structures and to get rid of the domain_init and domain_destroy call-backs when all drivers have been converted. Tested-by: Thierry Reding <treding@nvidia.com> Tested-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Alex Williamson <alex.williamson@redhat.com> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
* | | | iommu: add new iommu_ops callback for adding an OF deviceWill Deacon2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new function to the iommu_ops structure to allow an OF device to be added to a specific IOMMU instance using the recently merged generic devicetree binding for IOMMUs. The callback (of_xlate) takes a struct device representing the master and an of_phandle_args representing the IOMMU and the correspondong IDs for the new master. Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Joerg Roedel <jroedel@suse.de> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
* | | | iommu: provide early initialisation hook for IOMMU driversWill Deacon2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IOMMU drivers must be initialised before any of their upstream devices, otherwise the relevant iommu_ops won't be configured for the bus in question. To solve this, a number of IOMMU drivers use initcalls to initialise the driver before anything has a chance to be probed. Whilst this solves the immediate problem, it leaves the job of probing the IOMMU completely separate from the iommu_ops to configure the IOMMU, which are called on a per-bus basis and require the driver to figure out exactly which instance of the IOMMU is being requested. In particular, the add_device callback simply passes a struct device to the driver, which then has to parse firmware tables or probe buses to identify the relevant IOMMU instance. This patch takes the first step in addressing this problem by adding an early initialisation pass for IOMMU drivers, giving them the ability to store some per-instance data in their iommu_ops structure and store that in their of_node. This can later be used when parsing OF masters to identify the IOMMU instance in question. Change-Id: Ie7051c90c0f2e790d016eb465f10ddda48b99cd1 Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Joerg Roedel <jroedel@suse.de> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> [pdaly@codeaurora.org Resolve minor conflicts]
* | | | iommu: add capability IOMMU_CAP_NOEXECAntonios Motakis2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some IOMMUs accept an IOMMU_NOEXEC protection flag in addition to IOMMU_READ and IOMMU_WRITE. Expose this as an IOMMU capability. Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com> Acked-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Will Deacon <will.deacon@arm.com>
* | | | dma-mapping: fix build when !CONFIG_ARM_DMA_USE_IOMMUShiraz Hashim2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow compilation when CONFIG_ARM_DMA_USE_IOMMU is not selected by providing necessary stub functions and fix few mismatch in function declarations. Following this, remove the changes introduced by f3d8d1061fb0b146b3f5 ("msm: ipa: add empty implementation for iommu functions") as they are no longer needed. Change-Id: I04e3aa63407064e8d9c9550a5cb0a82ede899f00 Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
* | | | iommu: Add domain attribute to make faults non-fatalMitchel Humpherys2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During development, any IOMMU faults most likely need to be debugged immediately. Allowing the system to continue to run has a tendency to mask the original problem, which makes debugging more difficult. Some drivers might want to make all faults fatal by default, unless explicitly requested otherwise by a client. Add a domain attribute for this. Change-Id: I454b143ea3cae1f3de36e0888afd15936aa63ce1 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
* | | | iommu: Add iommu_reg_read and iommu_reg_writeMitchel Humpherys2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It might be useful for IOMMU clients to peek and poke at their IOMMU's registers, but knowing how to access those registers is really the job of the IOMMU driver (it might need to enable specific clocks and regulators, for example). Provide an API to read and write IOMMU registers that can be implemented by the driver. Change-Id: I5b2f19225f8bd258278780ff24b4ea96460857aa Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
* | | | iommu: Add flags parameter to .trigger_faultMitchel Humpherys2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IOMMU drivers might want more control over the types of faults being triggered with iommu_trigger_fault. Add a flags parameter that can be used to provide more control over the types of faults that can be triggered. Change-Id: I2f21b383437430e957ab52070d3575e8cb3dee90 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
* | | | iommu: Add client fault handler flag for external faultsMitchel Humpherys2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some IOMMUs (like the ARM SMMU) can raise "external faults" in addition to translation and permission faults. Add an IOMMU fault flag so that this fault type can be propagated to client fault handlers. Change-Id: Ia476ed6c727f5f01011747f30b3a74ebf0fc07f7 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
* | | | iommu: Create iommu debugfs directory from IOMMU codeMitchel Humpherys2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we're creating an "iommu" debugfs directory from the iommu-debug code. Other IOMMU modules might want to make use of this same directory, so create it from the IOMMU framework code itself. Change-Id: I679fdfc34ba5fcbd927dc5981438c6fabcfa3639 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
* | | | iommu: introduce DOMAIN_ATTR_DYNAMICJeremy Gebben2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some devices can support per-process iommu domains, which are used asynchronously by the hardware which directly updates to the TTBR0 and CONTEXTIDR registers. Add DOMAIN_ATTR_DYNAMIC to do indicate a domain may be used dynamically. This attribute must be set before attaching, as it changes what domain and hardware configuration is done by the iommu driver. Before attaching any dynamic domains, the driver must first attach a non-dynamic domain to do initial hardware configuration. A simplified example: void use_domain(struct iommu_domain *domain, struct job *job) { u64 ttbr0; u32 contextidr; iommu_domain_get_attr(domain, DOMAIN_ATTR_TTBR0, &ttbr0); iommu_domain_get_attr(domain, DOMAIN_ATTR_CONTEXTIDR, &contextidr); /* * Schedule work on the hardware, which is time sliced between * clients. Each client has a separate iommu domain and when * a job is run, the hardware first programs TTBR0 and * CONTEXTIDR to use the appropriate domain. */ submit_job(ttbr0, contextidr, job); } void init(void) { struct iommu_domain *master_domain, *dyn_domain1, *dyn_domain2; int dynamic = 1; master_domain = iommu_domain_alloc(bus); dyn_domain1 = iommu_domain_alloc(bus); dyn_domain2 = iommu_domain_alloc(bus); iommu_attach_device(base_domain, dev); iommu_domain_set_attr(dyn_domain1, DOMAIN_ATTR_DYNAMIC, &dynamic); iommu_domain_set_attr(dyn_domain2, DOMAIN_ATTR_DYNAMIC, &dynamic); iommu_attach_device(dyn_domain1, dev); iommu_attach_device(dyn_domain2, dev); while (keep_going) { iommu_map(dyn_domain1, ...); iommu_map(dyn_domain2, ...); use_domain(dyn_domain1, job1); use_domain(dyn_domain2, job2); iommu_unmap(dyn_domain1, ...); iommu_unmap(dyn_domain2, ...); } iommu_detach_device(dyn_domain2, dev); iommu_detach_device(dyn_domain1, dev); iommu_detach_device(master_domain, dev); } Change-Id: Ic4fa0a831751eb4b10fff5d9aec28a411856fbd1 Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
* | | | iommu: introduce TTBR0, CONTEXTIDR, and PROCID domain attributesJeremy Gebben2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the ARM SMMU architecture, pagetable programming is controlled by the TTBR0 and CONTEXTIDR registers. The layout of these registers varies depending on the pagetable format in use. In particular, the ASID (address space ID) field is found in CONTEXTIDR when using V7S format and in the top bits of TTBR0 for V7L and V8L. Some drivers need to program hardware to switch domains on the fly. These attributes allow the correct settings to be determined by querying the domain rather than directly reading registers and making assumptions about the pagetable format. The domain must be attached before TTBR0 and CONTEXTIDR may be queried. The PROCID attribute allows driver set a debug field in the CONTEXTIDR register. This attribute may only be set before attaching, but may be queried at any time. The SMMU hardware doesn't use the contents of this field, but debug can be simpler if each domain stores a unique value in it. Change-Id: I175aa78fee02c3e4e0071496d9cc2b8841ff9e3c Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
* | | | iommu: Add iommu_trigger_faultMitchel Humpherys2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It can be useful to trigger an IOMMU fault during development and debugging. Add support to the IOMMU framework to do so. Change-Id: I908c9f5b52c6abe937f031de546d290027ba64b5 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
* | | | iommu: Add iommu_iova_to_phys_hardMitchel Humpherys2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some IOMMU hardware implementations provide hardware translation operations that can be useful during debugging and development. Add a function for this purpose along with an associated op in the iommu_ops structure so that drivers can implement it. Change-Id: I54ad5df526cdce05f8e04206a4f01253b3976b48 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
* | | | common: DMA-mapping: Add EXEC_MAPPING attributeRohit Vaswani2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DMA_ATTR_EXEC_MAPPING specifies that an executable mapping should be created for the requested buffer. By default, the DMA mappings are non-executable. Change-Id: I135077e14996e92fa9d199bdee043c443db48924 Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
* | | | iommu: msm: Allow passing dma_attrs for lazy mappingRohit Vaswani2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The msm lazy mapping APIs did not allow to pass in dma attributes that could be passed to the dma-mapping driver. This patch allows users to specify dma attributes for the msm lazy mappings. Change-Id: I3e4cd2bb99d205dce78083a256f4d444d865f3cc Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
* | | | common: DMA-mapping: add NO_DELAYED_UNMAP attributeRohit Vaswani2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DMA_ATTR_NO_DELAYED_UNMAP specifies to the msm lazy mapping driver that this buffer should be immediately unmapped once it is freed. Change-Id: I43e6a6058705502cf91bf5f0c530c3099cba06ae Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
* | | | iommu: msm: surround the msm_dma_iommu apis with iommu ifdefAbhimanyu Kapur2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make all msm_dma_iommu apis depend on CONFIG_IOMMU_API as it is only used when we have the linux iommu layer available. Change-Id: I879dc1a9174d498b9b4bc68b2418165f3b2675a3 Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
* | | | iommu: introduce DOMAIN_ATTR_CONTEXT_BANKJeremy Gebben2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After attaching a domain, this attribute may be queried to determine which hardware context bank was assigned. Change-Id: I31e674672041103007fcaff3f83a0cc2c33a4a6d Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
* | | | iommu: Improve client fault handlingSushmita Susheelendra2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some platforms, certain IOMMU hardware state might be cleared before reaching client fault handlers, making it difficult for client fault handlers to do much useful processing. Add some flags so that this information can be passed to client fault handlers directly, rather than expecting clients to read the hardware themselves. Also provide a mechanism for client fault handlers to request that the IOMMU driver not clear the fault or resume/retry the faulting transaction. The client fault handler can return -EBUSY to request this behavior. Change-Id: I9780beb52b4257fff99d708a493173c9fe0a9d8a Signed-off-by: Sushmita Susheelendra <ssusheel@codeaurora.org>
* | | | iommu: add ftrace profiling for map and unmapLiam Mark2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add ftrace start and end logging for map, iommu_map_sg and unmap in order to facilitate performance testing. Change-Id: I9ddf241ffa6cf519f6abece7b0820640f5ce1975 Signed-off-by: Liam Mark <lmark@codeaurora.org>
* | | | iommu: Add support for .dma_supported() opsNeeti Desai2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .dma_supported() checks to see if the device can support DMA to the memory described by the mask. Add support for this operation in the iommu layer Change-Id: Icf37b9540aa68c2be3fd603a48402d6fcccd8208 Signed-off-by: Neeti Desai <neetid@codeaurora.org> Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
* | | | iommu/arm-smmu: Add support for map/unmap to be atomicNeeti Desai2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Certain clients need map and unmap operations to be in the atomic context. This currently doesn't work since we need to prepare clocks and enable regulators (for tlb invalidation), and take a mutex (to protect the smmu_domain->smmu instance), which are all sleeping operations. Fix this by introducing a domain attribute to indicate that map and unmap should be atomic. When this domain attribute is set we assume: (1) clocks are already prepared (2) regulators are already on (3) the domain is attached to an SMMU (1) and (2) allow us to skip preparing clocks and enabling regulators during map and unmap and are taken care of internally in the driver. (3) is a contract with clients that allows us to skip taking the mutex that protects smmu_domain->smmu since we assume that the SMMU instance is valid and will not be going away. If clients break this contract then there are race conditions all over the place that will eventually result in a NULL dereference (specifically, of smmu_domain->smmu). Change-Id: I3e21df02f7b0cd116fb558715eea16f2119f1d03 Signed-off-by: Neeti Desai <neetid@codeaurora.org> Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
* | | | iommu: export iommu_pgsizeMitchel Humpherys2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It can be useful in IOMMU drivers. Export it. Change-Id: I4c423d256312250f1e33ca8d64dfe1626f008b5e Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
* | | | iommu/arm-smmu: change IOMMU_EXEC to IOMMU_NOEXECAntonios Motakis2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Exposing the XN flag of the SMMU driver as IOMMU_NOEXEC instead of IOMMU_EXEC makes it enforceable, since for IOMMUs that don't support the XN flag pages will always be executable. Change-Id: Ic6b1f0ae8873035dcb798e9c996396fb2bc4921e Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com> Acked-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Will Deacon <will.deacon@arm.com> Git-commit: a720b41c41f5a7e4c51558cf087882c57331581f Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git [mitchelh: context fixups] Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
* | | | Revert "iommu/arm-smmu: change IOMMU_EXEC to IOMMU_NOEXEC"Mitchel Humpherys2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 433a4b6a37c8f96295a7e80cb603c2318872c1f2. An equivalent patch is being brought in with the upcoming page table refactoring, so rip this guy out in preparation. This also reverts commit af3e3c36d08077856640b28d68c9f99d2188a000, which introduced users of the IOMMU_NOEXEC flag. Change-Id: Ibb36f60f2148170d8a01632043bf36b5f8c60777 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org> [pdaly@codeaurora.org Resolve minor conflicts] Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
* | | | iommu/arm-smmu: change IOMMU_EXEC to IOMMU_NOEXECNeeti Desai2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Exposing the XN flag of the SMMU driver as IOMMU_NOEXEC instead of IOMMU_EXEC makes it enforceable, since for IOMMUs that don't support the XN flag pages will always be executable. Change-Id: Ib785acd8a188fa95aea9991116139a392862764e Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com> Acked-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Will Deacon <will.deacon@arm.com> Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git Git-commit: a720b41c41f5a7e4c51558cf087882c57331581f [rvaswani@codeaurora.org: resolve trivial merge conflicts] Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
* | | | Introduce the IOMMU_DEVICE flag.Varun Sethi2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is used for indicating device memory type for a DMA transaction. IOMMU driver would set up attributes indicationg access to device memory. CRs-Fixed: 792402 Change-Id: Ifd6f2288353ef737ff4c15d9bd1514c66af8fdd2 Signed-off-by: Varun Sethi <Varun.Sethi@freescale.com> [neetid: changed IOMMU_DEVICE to be on bit 5 instead of bit 4] Patch-mainline: iommu @ 10/06/14, 10:28 Signed-off-by: Neeti Desai <neetid@codeaurora.org>
* | | | iommu/arm-smmu: Add support for page table donationNeeti Desai2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For secure domains, the page tables need to be assigned to the correct VMIDs. Add support for the same. Change-Id: Ic46e61300463d969b35ebc5d4d20cfc30a4ba476 Signed-off-by: Neeti Desai <neetid@codeaurora.org>