Re: [PATCH v2] iommu/exynos: Don't unconditionally steal bus ops

2018-01-09 Thread Marek Szyprowski
Hi Robin, On 2018-01-09 16:34, Robin Murphy wrote: Removing the early device registration hook overlooked the fact that it only ran conditionally on a compatible device being present in the DT. With exynos_iommu_init() now running as an unconditional initcall, problems arise on non-Exynos system

[PATCH] iommu/vt-d: use domain instead of cache fetching

2018-01-09 Thread Peter Xu
after commit a1ddcbe93010 ("iommu/vt-d: Pass dmar_domain directly into iommu_flush_iotlb_psi", 2015-08-12), we have domain pointer as parameter to iommu_flush_iotlb_psi(), so no need to fetch it from cache again. More importantly, a NULL reference pointer bug is reported on RHEL7 (and it can be re

[PATCH v6 4/5] iommu/vt-d: Add debugfs support to show Pasid table contents

2018-01-09 Thread Sohil Mehta
From: Gayatri Kammela Debugfs extension to dump the internals such as pasid table entries for each IOMMU to the userspace. Example of such dump in Kabylake: root@OTC-KBLH-01:~# cat /sys/kernel/debug/intel_iommu/dmar_translation_struct IOMMU dmar0: Extended Root Table Addr:402b9e800 Extended Ro

[PATCH v6 5/5] iommu/vt-d: Add debugfs support for Interrupt remapping

2018-01-09 Thread Sohil Mehta
Debugfs extension for Intel IOMMU to dump Interrupt remapping table entries for Interrupt remapping and Interrupt posting. The file /sys/kernel/debug/intel_iommu/ir_translation_struct provides detailed information, such as Index, Source Id, Destination Id, Vector and the raw values for entries wit

[PATCH v6 3/5] iommu/vt-d: Add debugfs support to show register contents

2018-01-09 Thread Sohil Mehta
From: Gayatri Kammela Debugfs extension to dump all the register contents for each IOMMU device to the user space via debugfs. example: root@OTC-KBLH-01:~# cat /sys/kernel/debug/intel_iommu/iommu_regset DMAR: dmar1: reg_base_addr fed9 Name Offset Contents VER 0x00

[PATCH v6 2/5] iommu/vt-d: Add debugfs support to show context internals

2018-01-09 Thread Sohil Mehta
From: Gayatri Kammela IOMMU internals states such as root and context can be exported to the userspace. Example of such dump in Kabylake: root@OTC-KBLH-01:~# cat /sys/kernel/debug/intel_iommu/dmar_translation_struct IOMMU dmar0: Extended Root Table Addr:402b9e800 Extended Root table entries: B

[PATCH v6 1/5] iommu/vt-d: Add debugfs support for Intel IOMMU internals

2018-01-09 Thread Sohil Mehta
From: Gayatri Kammela Enable Intel IOMMU debug to export Intel IOMMU internals in debugfs Cc: Sohil Mehta Cc: Fenghua Yu Cc: Ashok Raj Signed-off-by: Jacob Pan Signed-off-by: Gayatri Kammela --- v6: No change v5: No change v4: No change v3: No change v2: No change drivers/iommu/Kconf

[PATCH v6 0/5] Add Intel IOMMU debugfs support

2018-01-09 Thread Sohil Mehta
Hi All, This series aims to add debugfs support for Intel IOMMU. It exposes IOMMU registers, internal context and dumps individual table entries to help debug Intel IOMMUs. The first patch does the ground work for the following patches by creating a new Kconfig option - INTEL_IOMMU_DEBUG. It also

Re: [PATCH] iommu: Check the result of iommu_group_get() for NULL

2018-01-09 Thread Robin Murphy
Hi Jordan, On 04/12/17 17:22, Jordan Crouse wrote: The result of iommu_group_get() was being blindly used in both attach and detach which results in a dereference when trying to work with an unknown device. I missed this one before it got applied, but FWIW that behaviour was actually somewhat

[PATCH v2 3/3] iommu: Clean up of_iommu_init_fn

2018-01-09 Thread Robin Murphy
Now that no more drivers rely on arbitrary early initialisation via an of_iommu_init_fn hook, let's clean up the redundant remnants. The IOMMU_OF_DECLARE() macro needs to remain for now, as the probe-deferral mechanism has no other nice way to detect built-in drivers before they have registered the

[PATCH v2 2/3] iommu/ipmmu-vmsa: Remove redundant of_iommu_init_fn hook

2018-01-09 Thread Robin Murphy
Having of_iommu_init() call ipmmu_init() via ipmmu_vmsa_iommu_of_setup() does nothing that the subsys_initcall wouldn't do slightly later anyway, since probe-deferral of masters means it is no longer critical to register the driver super-early. Clean it up. Signed-off-by: Robin Murphy --- v2: Ne

[PATCH v2 1/3] iommu/msm: Claim bus ops on probe

2018-01-09 Thread Robin Murphy
Since the MSM IOMMU driver now probes via DT exclusively rather than platform data, dependent masters should be deferred until the IOMMU itself is ready. Thus we can do away with the early initialisation hook to unconditionally claim the bus ops, and instead do that only once an IOMMU is actually p

Re: [PATCH 22/67] dma-mapping: clear harmful GFP_* flags in common code

2018-01-09 Thread Jesper Nilsson
On Fri, Dec 29, 2017 at 09:18:26AM +0100, Christoph Hellwig wrote: > Life the code from x86 so that we behave consistently. In the future we > should probably warn if any of these is set. > > Signed-off-by: Christoph Hellwig Acked-by: Jesper Nilsson > --- > arch/cris/arch-v32/drivers/pci/dma

Re: [PATCH 05/67] dma-mapping: replace PCI_DMA_BUS_IS_PHYS with a flag in struct dma_map_ops

2018-01-09 Thread Jesper Nilsson
On Fri, Dec 29, 2017 at 09:18:09AM +0100, Christoph Hellwig wrote: > The current PCI_DMA_BUS_IS_PHYS decided if a dma implementation is bound > by the dma mask in the device because it directly maps to a physical > address range (modulo an offset in the device), or if it is virtualized > by an iomm

Re: [PATCH 34/67] cris: use dma-direct

2018-01-09 Thread Jesper Nilsson
On Fri, Dec 29, 2017 at 09:18:38AM +0100, Christoph Hellwig wrote: > cris currently has an incomplete direct mapping dma_map_ops implementation > is PCI support is enabled. Replace it with the fully feature generic > dma-direct implementation. > > Signed-off-by: Christoph Hellwig For CRIS: Ack

Re: [PATCH 16/67] powerpc: rename dma_direct_ to dma_nommu_

2018-01-09 Thread Christoph Hellwig
On Thu, Jan 04, 2018 at 09:49:30AM +0100, Christoph Hellwig wrote: > On Tue, Jan 02, 2018 at 08:45:30PM +1100, Michael Ellerman wrote: > > Christoph Hellwig writes: > > > > > We want to use the dma_direct_ namespace for a generic implementation, > > > so rename powerpc to the second best choice:

[PATCH v2] iommu/exynos: Don't unconditionally steal bus ops

2018-01-09 Thread Robin Murphy
Removing the early device registration hook overlooked the fact that it only ran conditionally on a compatible device being present in the DT. With exynos_iommu_init() now running as an unconditional initcall, problems arise on non-Exynos systems when other IOMMU drivers find themselves unable to i

Re: [PATCH] iommu/exynos: Don't unconditionally steal bus ops

2018-01-09 Thread Robin Murphy
On 09/01/18 09:59, Marek Szyprowski wrote: Hi Robin, On 2018-01-08 20:27, Robin Murphy wrote: Removing the early device registration hook overlooked the fact that it only ran conditionally on a compatible device being present in the DT. With exynos_iommu_init() now running as an unconditional i

Re: [PATCH v5 0/6] iommu/arm-smmu: Add runtime pm/sleep support

2018-01-09 Thread Vivek Gautam
On 01/09/2018 04:53 PM, Rafael J. Wysocki wrote: On Tuesday, January 9, 2018 11:01:43 AM CET Vivek Gautam wrote: This series provides the support for turning on the arm-smmu's clocks/power domains using runtime pm. This is done using the recently introduced device links patches, which lets the

Re: [PATCH v5 0/6] iommu/arm-smmu: Add runtime pm/sleep support

2018-01-09 Thread Rafael J. Wysocki
On Tuesday, January 9, 2018 11:01:43 AM CET Vivek Gautam wrote: > This series provides the support for turning on the arm-smmu's > clocks/power domains using runtime pm. This is done using the > recently introduced device links patches, which lets the smmu's > runtime to follow the master's runtime

[PATCH v5 5/6] iommu/arm-smmu: Add support for qcom,smmu-v2 variant

2018-01-09 Thread Vivek Gautam
qcom,smmu-v2 is an arm,smmu-v2 implementation with specific clock and power requirements. This smmu core is used with multiple masters on msm8996, viz. mdss, video, etc. Add bindings for the same. Signed-off-by: Vivek Gautam --- * Major change in this patch - Changed compatible string from '

[PATCH v5 3/6] iommu/arm-smmu: Invoke pm_runtime during probe, add/remove device

2018-01-09 Thread Vivek Gautam
From: Sricharan R The smmu device probe/remove and add/remove master device callbacks gets called when the smmu is not linked to its master, that is without the context of the master device. So calling runtime apis in those places separately. Signed-off-by: Sricharan R [vivek: Cleanup pm runtim

[PATCH v5 1/6] base: power: runtime: Export pm_runtime_get/put_suppliers

2018-01-09 Thread Vivek Gautam
The device link allows the pm framework to tie the supplier and consumer. So, whenever the consumer is powered-on the supplier is powered-on first. There are however cases in which the consumer wants to power-on the supplier, but not itself. E.g., A Graphics or multimedia driver wants to power-on

[PATCH v5 4/6] iommu/arm-smmu: Add the device_link between masters and smmu

2018-01-09 Thread Vivek Gautam
From: Sricharan R Finally add the device link between the master device and smmu, so that the smmu gets runtime enabled/disabled only when the master needs it. This is done from add_device callback which gets called once when the master is added to the smmu. Signed-off-by: Sricharan R --- driv

[PATCH v5 2/6] iommu/arm-smmu: Add pm_runtime/sleep ops

2018-01-09 Thread Vivek Gautam
From: Sricharan R The smmu needs to be functional only when the respective master's using it are active. The device_link feature helps to track such functional dependencies, so that the iommu gets powered when the master device enables itself using pm_runtime. So by adapting the smmu driver for r

[PATCH v5 6/6] drm/msm: iommu: Replace runtime calls with runtime suppliers

2018-01-09 Thread Vivek Gautam
While handling the concerned iommu, there should not be a need to power control the drm devices from iommu interface. If these drm devices need to be powered around this time, the respective drivers should take care of this. Replace the pm_runtime_get/put_sync() with pm_runtime_get/put_suppliers()

[PATCH v5 0/6] iommu/arm-smmu: Add runtime pm/sleep support

2018-01-09 Thread Vivek Gautam
This series provides the support for turning on the arm-smmu's clocks/power domains using runtime pm. This is done using the recently introduced device links patches, which lets the smmu's runtime to follow the master's runtime pm, so the smmu remains powered only when the masters use it. It also

Re: [PATCH] iommu/exynos: Don't unconditionally steal bus ops

2018-01-09 Thread Marek Szyprowski
Hi Robin, On 2018-01-08 20:27, Robin Murphy wrote: Removing the early device registration hook overlooked the fact that it only ran conditionally on a compatible device being present in the DT. With exynos_iommu_init() now running as an unconditional initcall, problems arise on non-Exynos system