summaryrefslogtreecommitdiff
path: root/include (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>
* | | | lib: spinlock: Trigger a watchdog bite on spin_dump for rwlockPrasad Sodagudi2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently dump_stack is printed once a spin_bug is detected for rwlock. So provide an options to trigger a panic or watchdog bite for debugging rwlock magic corruptions and lockups. Change-Id: I20807e8eceb8b81635e58701d1f9f9bd36ab5877 [abhimany: replace msm with qcom] Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org> Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
* | | | lib: spinlock: Cause a watchdog bite on spin_dumpRohit Vaswani2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we cause a BUG_ON once a spin_bug is detected, but that causes a whole lot of processing and the other CPUs would have proceeded to perform other actions and the state of the system is moved by the time we can analyze it. Provide an option to trigger a watchdog bite instead so that we can get the traces as close to the issue as possible. Change-Id: Ic8d692ebd02c6940a3b4e5798463744db20b0026 Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org> Signed-off-by: Prasad Sodagudi <psodagud@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>
* | | | soc: qcom: Add generic irq handler for secure processorPuja Gupta2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the code to handle watchdog, err_ready and other interrupts from secure processor subsystem to the PIL driver. CRs-Fixed: 972423 Change-Id: I65455229ee14bd4da357358ac3977f2137f3c07e Signed-off-by: Puja Gupta <pujag@codeaurora.org>
* | | | kbuild: export uapi header fileSiddartha Mohanadoss2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | Export uapi header file for EPM driver. Signed-off-by: Siddartha Mohanadoss <smohanad@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>
* | | | msm: kgsl: Update various exernal APIs for the 4.4 kernelJordan Crouse2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make several changes to build the GPU driver for 4.4: - Rename CONFIG_MSM to CONFIG_QCOM where applicable - Add msm_kgsl.h to the Kbuild exports - Remove linux/coresight_of.h (as it has been merged into coresight.h) and remove the .owner member of the coresight_desc struct. - Use the new location for the sync.h file (in staging) - Remove an unused sync function - Move oneshot_sync.h inside of #ifdef wrappers Signed-off-by: Jordan Crouse <jcrouse@codeauorora.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>
* | | | fuse: Add support for passthrough read/writeNikhilesh Reddy2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for filesystem passthrough read/write of files when enabled in userspace through the option FUSE_PASSTHROUGH. There are many FUSE based filesystems that perform checks or enforce policy or perform some kind of decision making in certain functions like the "open" call but simply act as a "passthrough" when performing operations such as read or write. When FUSE_PASSTHROUGH is enabled all the reads and writes to the fuse mount point go directly to the passthrough filesystem i.e a native filesystem that actually hosts the files rather than through the fuse daemon. All requests that aren't read/write still go thought the userspace code. This allows for significantly better performance on read and writes. The difference in performance between fuse and the native lower filesystem is negligible. There is also a significant cpu/power savings that is achieved which is really important on embedded systems that use fuse for I/O. Changelog: v5: Fix the check when setting the passthrough file [Found when testing by Mike Shal] v3 and v4: Use the fs_stack_depth to prevent further stacking and a minor fix [Fix suggested by Jann Horn] v2: Changed the feature name to passthrough from stacked_io [Proposed by Linus Torvalds] Signed-off-by: Nikhilesh Reddy <reddyn@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: Change trace unmap api to report unmapped sizeShuah Khan2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently map and unmap are implemented as events under a common trace class declaration. The common class forces trace_unmap() to require a bogus physical address argument that it doesn't use. Changing unmap to report unmapped size will provide useful information for debugging. Remove common map_unmap trace class and change map and unmap into separate events as opposed to events under the same class to allow for differences in the reporting information. In addition, map and unmap are changed to handle size value as size_t instead of int to match the passed size value and avoid overflow. Change-Id: Ic231e28c2784fbfe41a6749175cc390920165e81 Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Suggested-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Joerg Roedel <jroedel@suse.de> [pdaly@codeaurora.org Keep map_unmap class]
* | | | 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>
* | | | msm: secure_buffer: Add missing includeMitchel Humpherys2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | secure_buffer.h makes use of the scatterlist structure, but doesn't include the header file that defines it. Until now we've been getting lucky that all users of secure_buffer.h have been including the scatterlist header file themselves, but this might not always be the case. Add the missing include. Change-Id: If7598c26a1ef3551132c6eb62ac9bd6d447654d0 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>
* | | | msm: secure_buffer: Update the hyp_assign_phys() apiNeeti Desai2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hyp_assign_phys() api can be called by different usecases where it is not guaranteed that the source vm is always VMID_HLOS. Pass the responsibility of setting the source_vm to caller of the function. Change-Id: I3851a6681f49d4bb6fa5b7a889a16a158497e9e6 Signed-off-by: Neeti Desai <neetid@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>