[RFC PATCH 03/20] PCI/MSI: Remove useless bus-msi assignment

2014-08-12 Thread Yijing Wang
Currently, PCI drivers will initialize bus-msi in pcibios_add_bus(). pcibios_add_bus() will be called in every pci bus initialization. So the bus-msi assignment in pci_alloc_child_bus() is useless. Signed-off-by: Yijing Wang wangyij...@huawei.com CC: Thierry Reding

[RFC PATCH 05/20] MSI: Refactor struct msi_chip to become more common

2014-08-12 Thread Yijing Wang
Now there are a lot of __weak arch functions in MSI code. These functions make MSI driver complex, It's time to refactor it. Add .restore_irq(), .setup_irqs(), .teardown_irqs() to make msi_chip common across all platforms. Also replace the argument struct pci_dev with struct device to support

[RFC PATCH 02/20] MSI: Clean up struct msi_chip argument

2014-08-12 Thread Yijing Wang
Msi_chip functions setup_irq/teardown_irq/check_device rarely use msi_chip argument. We can get msi_chip pointer from the device pointer or irq number, so clean up msi_chip arguments. This patch is also preparation for using msi_chip in all platforms to setup/teardown MSI irqs. Signed-off-by:

[RFC PATCH 04/20] MSI: Remove the redundant irq_set_chip_data()

2014-08-12 Thread Yijing Wang
Currently, pcie-designware, pcie-rcar, pci-tegra drivers use irq chip_data to the msi_chip pointer. They already call irq_set_chip_data() in their own MSI irq map functions. So irq_set_chip_data() in arch_setup_msi_irq() is useless. Signed-off-by: Yijing Wang wangyij...@huawei.com ---

[RFC PATCH 16/20] arm/iop13xx/MSI: Use msi_chip instead of arch func to configure MSI/MSI-X

2014-08-12 Thread Yijing Wang
Introduce a new struct msi_chip iop13xx_msi_chip instead of weak arch functions to configure MSI/MSI-X. And associate the pci bus with msi_chip in pcibios_add_bus(). Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/arm/mach-iop13xx/include/mach/pci.h |2 ++

[RFC PATCH 00/20] Use msi_chip to configure MSI/MSI-X in all platforms

2014-08-12 Thread Yijing Wang
This series is mainly to use msi_chip instead of currently weak arch functions across all platforms. Also clean up current MSI code and make drivers support MSI easier. Yijing Wang (20): x86/xen/MSI: Eliminate arch_msix_mask_irq() and arch_msi_mask_irq() MSI: Clean up struct msi_chip

[RFC PATCH 18/20] Sparc/MSI: Use msi_chip instead of arch func to configure MSI/MSI-X

2014-08-12 Thread Yijing Wang
Introduce a new struct msi_chip sparc_msi_chip instead of weak arch functions to configure MSI/MSI-X. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/sparc/kernel/pci.c | 18 ++ 1 files changed, 14 insertions(+), 4 deletions(-) diff --git a/arch/sparc/kernel/pci.c

[RFC PATCH 01/20] x86/xen/MSI: Eliminate arch_msix_mask_irq() and arch_msi_mask_irq()

2014-08-12 Thread Yijing Wang
Commit 0e4ccb150 added two __weak arch functions arch_msix_mask_irq() and arch_msi_mask_irq() to fix a bug found when running xen in x86. Introduced these two funcntions make MSI code complex. This patch reverted commit 0e4ccb150 and add #ifdef for x86 msi_chip to fix this bug for simplicity. Also

[RFC PATCH 07/20] x86/MSI: Use msi_chip instead of arch func to configure MSI/MSI-X

2014-08-12 Thread Yijing Wang
Introduce a new struct msi_chip apic_msi_chip instead of weak arch functions to configure MSI/MSI-X in x86. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/x86/include/asm/pci.h |1 + arch/x86/kernel/apic/io_apic.c | 20 2 files changed, 17 insertions(+),

[RFC PATCH 06/20] PCI/MSI: Introduce arch_get_match_msi_chip() to find the match msi_chip

2014-08-12 Thread Yijing Wang
Introduce __weak arch_get_match_msi_chip() to find the match msi_chip. We prepare to use struct msi_chip to eliminate arch_xxx functions in all platforms. The MSI device and the msi_chip binding is platform specific. For instance, in x86, LAPICs receive all MSI irq, but in arm, PCI device usually

[RFC PATCH 17/20] IA64/MSI: Use msi_chip instead of arch func to configure MSI/MSI-X

2014-08-12 Thread Yijing Wang
Introduce a new struct msi_chip ia64_msi_chip instead of weak arch functions to configure MSI/MSI-X. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/ia64/kernel/msi_ia64.c | 18 ++ 1 files changed, 14 insertions(+), 4 deletions(-) diff --git

[RFC PATCH 10/20] x86/MSI: Remove unused MSI weak arch functions

2014-08-12 Thread Yijing Wang
Now we can clean up MSI weak arch functions in x86. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/x86/include/asm/pci.h |3 --- arch/x86/kernel/apic/io_apic.c |2 +- arch/x86/kernel/x86_init.c | 24 3 files changed, 1 insertions(+), 28

[RFC PATCH 15/20] s390/MSI: Use msi_chip instead of arch func to configure MSI/MSI-X

2014-08-12 Thread Yijing Wang
Introduce a new struct msi_chip zpci_msi_chip instead of weak arch functions to configure MSI/MSI-X. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/s390/pci/pci.c | 16 ++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/s390/pci/pci.c

[RFC PATCH 12/20] MIPS/Xlp/MSI: Use msi_chip instead of arch func to configure MSI/MSI-X

2014-08-12 Thread Yijing Wang
Introduce a new struct msi_chip xlp_chip instead of weak arch functions to configure MSI/MSI-X. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/mips/pci/msi-xlp.c | 15 +-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/mips/pci/msi-xlp.c

[RFC PATCH 09/20] irq_remapping/MSI: Use msi_chip instead of arch func to configure MSI/MSI-X

2014-08-12 Thread Yijing Wang
Introduce a new struct msi_chip remap_msi_chip instead of weak arch functions to configure irq remapping MSI/MSI-X in x86. Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/irq_remapping.c | 13 + 1 files changed, 9 insertions(+), 4 deletions(-) diff --git

[RFC PATCH 13/20] MIPS/xlr/MSI: Use msi_chip instead of arch func to configure MSI/MSI-X

2014-08-12 Thread Yijing Wang
Introduce a new struct msi_chip xlr_msi_chip instead of weak arch functions to configure MSI/MSI-X. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/mips/pci/pci-xlr.c | 19 +++ 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/arch/mips/pci/pci-xlr.c

[RFC PATCH 14/20] Powerpc/MSI: Use msi_chip instead of arch func to configure MSI/MSI-X

2014-08-12 Thread Yijing Wang
Introduce a new struct msi_chip ppc_msi_chip instead of weak arch functions to configure MSI/MSI-X. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/powerpc/kernel/msi.c | 23 +-- 1 files changed, 17 insertions(+), 6 deletions(-) diff --git

[RFC PATCH 20/20] PCI/MSI: Clean up unused MSI arch functions

2014-08-12 Thread Yijing Wang
Now we use struct msi_chip in all platforms to configure MSI/MSI-X. We can clean up the unused arch functions. Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/pci/msi.c | 82 1 files changed, 32 insertions(+), 50 deletions(-)

[RFC PATCH 08/20] x86/xen/MSI: Use msi_chip instead of arch func to configure MSI/MSI-X

2014-08-12 Thread Yijing Wang
Introduce a new struct msi_chip xen_msi_chip instead of weak arch functions to configure MSI/MSI-X. Signed-off-by: Yijing Wang wangyij...@huawei.com CC: Konrad Rzeszutek Wilk konrad.w...@oracle.com --- arch/x86/pci/xen.c | 128 +-- 1 files

[RFC PATCH 11/20] MIPS/Octeon/MSI: Use msi_chip instead of arch func to configure MSI/MSI-X

2014-08-12 Thread Yijing Wang
Introduce a new struct msi_chip octeon_msi_chip instead of weak arch functions to configure MSI/MSI-X. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/mips/pci/msi-octeon.c | 45 ++- 1 files changed, 19 insertions(+), 26 deletions(-) diff

LPC IOMMU and VFIO MicroConference - Call for Participation

2014-08-12 Thread Joerg Roedel
LPC IOMMU and VFIO MicroConference - Call for Participation === We are pleased to announce that this year there will be the first IOMMU and VFIO MicroConference held at Linux Plumbers Conference in Düsseldorf. An initial request for support

Re: [PATCH v5 1/1] iommu-api: Add map_sg/unmap_sg functions

2014-08-12 Thread Rob Clark
On Mon, Aug 11, 2014 at 9:51 PM, Hiroshi Doyu hd...@nvidia.com wrote: Hi Olav, Olav Haugan ohau...@codeaurora.org writes: @@ -93,6 +94,10 @@ enum iommu_attr { * @detach_dev: detach device from an iommu domain * @map: map a physically contiguous memory region to an iommu domain *

Re: [Xen-devel] [RFC PATCH 01/20] x86/xen/MSI: Eliminate arch_msix_mask_irq() and arch_msi_mask_irq()

2014-08-12 Thread Yijing Wang
On 2014/8/12 17:09, David Vrabel wrote: On 12/08/14 08:25, Yijing Wang wrote: Commit 0e4ccb150 added two __weak arch functions arch_msix_mask_irq() and arch_msi_mask_irq() to fix a bug found when running xen in x86. Introduced these two funcntions make MSI code complex. This patch reverted

Re: [PATCH v5 1/1] iommu-api: Add map_sg/unmap_sg functions

2014-08-12 Thread Olav Haugan
On 8/11/2014 6:35 PM, Konrad Rzeszutek Wilk wrote: On Mon, Aug 11, 2014 at 03:45:50PM -0700, Olav Haugan wrote: .. snip.. +for_each_sg(sg, s, nents, i) { +phys_addr_t phys = page_to_phys(sg_page(s)); +size_t page_len = s-offset + s-length; + +ret =

Re: [PATCH v5 1/1] iommu-api: Add map_sg/unmap_sg functions

2014-08-12 Thread Laurent Pinchart
Hi Olav, Thank you for the patch. On Monday 11 August 2014 15:45:50 Olav Haugan wrote: Mapping and unmapping are more often than not in the critical path. map_sg and unmap_sg allows IOMMU driver implementations to optimize the process of mapping and unmapping buffers into the IOMMU page

Re: [PATCH v5 1/1] iommu-api: Add map_sg/unmap_sg functions

2014-08-12 Thread Olav Haugan
On 8/12/2014 3:48 AM, Rob Clark wrote: On Mon, Aug 11, 2014 at 9:51 PM, Hiroshi Doyu hd...@nvidia.com wrote: Hi Olav, Olav Haugan ohau...@codeaurora.org writes: @@ -93,6 +94,10 @@ enum iommu_attr { * @detach_dev: detach device from an iommu domain * @map: map a physically contiguous

Re: [PATCH v5 1/1] iommu-api: Add map_sg/unmap_sg functions

2014-08-12 Thread Olav Haugan
Hi Laurent, On 8/12/2014 9:55 AM, Laurent Pinchart wrote: Hi Olav, Thank you for the patch. On Monday 11 August 2014 15:45:50 Olav Haugan wrote: Mapping and unmapping are more often than not in the critical path. map_sg and unmap_sg allows IOMMU driver implementations to optimize the

Re: [Xen-devel] [RFC PATCH 01/20] x86/xen/MSI: Eliminate arch_msix_mask_irq() and arch_msi_mask_irq()

2014-08-12 Thread David Vrabel
On 12/08/14 08:25, Yijing Wang wrote: Commit 0e4ccb150 added two __weak arch functions arch_msix_mask_irq() and arch_msi_mask_irq() to fix a bug found when running xen in x86. Introduced these two funcntions make MSI code complex. This patch reverted commit 0e4ccb150 and add #ifdef for x86

Re: [RFC PATCH 07/20] x86/MSI: Use msi_chip instead of arch func to configure MSI/MSI-X

2014-08-12 Thread Konrad Rzeszutek Wilk
On Tue, Aug 12, 2014 at 03:26:00PM +0800, Yijing Wang wrote: Introduce a new struct msi_chip apic_msi_chip instead of weak arch functions to configure MSI/MSI-X in x86. Why not 'x86_msi_ops' (see arch/x86/kernel/x86_init.c) Signed-off-by: Yijing Wang wangyij...@huawei.com ---

[PATCH 0/6] iommu/arm-smmu: misc features, new DT bindings

2014-08-12 Thread Mitchel Humpherys
This series contains a some enhancements to the ARM SMMU driver. These are mostly distinct but I'm sending them out in a single series since they depend on each other for clean application. The first two patches are related to power-saving features (clocks and regulators). The third adds support

[PATCH 5/6] iommu/arm-smmu: support buggy implementations with invalidate-on-map

2014-08-12 Thread Mitchel Humpherys
Add a workaround for some buggy hardware that requires a TLB invalidate operation to occur at map time. Activate the feature with the qcom,smmu-invalidate-on-map boolean DT property. Signed-off-by: Mitchel Humpherys mitch...@codeaurora.org --- Documentation/devicetree/bindings/iommu/arm,smmu.txt

[PATCH 4/6] iommu/arm-smmu: implement generic DT bindings

2014-08-12 Thread Mitchel Humpherys
Generic IOMMU device tree bindings were recently added in [devicetree: Add generic IOMMU device tree bindings]. Implement the bindings in the ARM SMMU driver. See Documentation/devicetree/bindings/iommu/iommu.txt for the bindings themselves. Signed-off-by: Mitchel Humpherys

[PATCH 1/6] iommu/arm-smmu: add support for specifying clocks

2014-08-12 Thread Mitchel Humpherys
On some platforms with tight power constraints it is polite to only leave your clocks on for as long as you absolutely need them. Currently we assume that all clocks necessary for SMMU register access are always on. Add some optional device tree properties to specify any clocks that are necessary

[PATCH 2/6] iommu/arm-smmu: add support for specifying regulators

2014-08-12 Thread Mitchel Humpherys
On some power-constrained platforms it's useful to disable power when a device is not in use. Add support for specifying regulators for SMMUs and only leave power on as long as the SMMU is in use (attached). Signed-off-by: Mitchel Humpherys mitch...@codeaurora.org ---

[PATCH 3/6] iommu/arm-smmu: add support for iova_to_phys through ATS1PR

2014-08-12 Thread Mitchel Humpherys
Currently, we provide the iommu_ops.iova_to_phys service by doing a table walk in software to translate IO virtual addresses to physical addresses. On SMMUs that support it, it can be useful to ask the SMMU itself to do the translation. This can be used to warm the TLBs for an SMMU. It can also be

[PATCH 6/6] iommu/arm-smmu: add .domain_{set, get}_attr for coherent walk control

2014-08-12 Thread Mitchel Humpherys
Under certain conditions coherent hardware translation table walks can result in degraded performance. Add a new domain attribute to disable/enable this feature in generic code along with the domain attribute setter and getter to handle it in the ARM SMMU driver. Signed-off-by: Mitchel Humpherys