[PATCH 1/2] IOMMU/trivial: Use for_each_drhd_unit() instead of list_for_each_entry()

2013-10-31 Thread Yijing Wang
Use for_each_drhd_unit() instead of list_for_each_entry for better readability. Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/dmar.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index 785675a..da2d0d9

[PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-05 Thread Yijing Wang
] Present field in the IRTE entry is clear Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/dmar.c| 93 +- drivers/iommu/intel-iommu.c | 155 --- include/linux/dmar.h| 20 -- 3 files changed

Re: [PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-07 Thread Yijing Wang
HI Bjorn, Thanks for your review and comments very much! +list_for_each_entry(dmar_dev, head, list) +if (dmar_dev-segment == pci_domain_nr(dev-bus) + dmar_dev-bus == dev-bus-number + dmar_dev-devfn == dev-devfn) +

Re: [PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-10 Thread Yijing Wang
Hmmm, this is the thing I am most worried about. If we just only use (pci_dev *) poninter in drhd-devices array as a identification. Change (pci_dev *) pointer instead of pci device id segment:bus:devfn is safe. Or, this is a wrong way to fix this issue. I don't know IOMMU driver much now,

Re: [PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-20 Thread Yijing Wang
On 2013/11/20 23:59, David Woodhouse wrote: On Fri, 2013-11-08 at 08:46 -0700, Bjorn Helgaas wrote: I don't know the IOMMU drivers well either, but it seems like they rely on notifications of device addition and removal (see iommu_bus_notifier()). It doesn't seem right for them to also use

[PATCH v2] Enhance dmar to support device hotplug

2013-11-21 Thread Yijing Wang
to manage target devices for IOMMU, we can easily use list helper. Yijing Wang (1): IOMMU: enhance dmar to support device hotplug drivers/iommu/dmar.c| 82 +++--- drivers/iommu/intel-iommu.c | 161 +- include/linux/dmar.h

Re: [Patch Part1 V2 01/17] iommu/vt-d: use dedicated bitmap to track remapping entry allocation status

2013-12-01 Thread Yijing Wang
Tested-and-reviewed-by: Yijing Wang wangyij...@huawei.com On 2013/11/29 16:50, Jiang Liu wrote: Currently Intel interrupt remapping drivers uses the present flag bit in remapping entry to track whether an entry is allocated or not. It works as follow: 1) allocate a remapping entry and set its

Re: [Patch Part1 V2 02/17] iommu/vt-d: fix PCI device reference leakage on error recovery path

2013-12-01 Thread Yijing Wang
Reviewed-by: Yijing Wang wangyij...@huawei.com On 2013/11/29 16:50, Jiang Liu wrote: Function dmar_parse_dev_scope() should release the PCI device reference count gained in function dmar_parse_one_dev_scope() on error recovery, otherwise will cause PCI device object leakage. This patch also

Re: [Patch Part1 V2 04/17] iommu/vt-d: fix resource leakage on error recovery path in iommu_init_domains()

2013-12-01 Thread Yijing Wang
) { printk(KERN_ERR Allocating domain array failed\n); + kfree(iommu-domain_ids); + iommu-domain_ids = NULL; return -ENOMEM; } Acked-by: Yijing Wang wangyij...@huawei.com -- Thanks! Yijing ___ iommu mailing

Re: [Patch Part1 V2 07/17] iommu/vt-d. trivial: check suitable flag in function detect_intel_iommu()

2013-12-01 Thread Yijing Wang
This patch is the same as the last.:) On 2013/11/29 16:50, Jiang Liu wrote: Flag irq_remapping_enabled is only set by intel_enable_irq_remapping(), which is called after detect_intel_iommu(). So we should check flag disable_irq_remap instead of irq_remapping_enabled in function

Re: [Patch Part1 V2 07/17] iommu/vt-d, trivial: check suitable flag in function detect_intel_iommu()

2013-12-01 Thread Yijing Wang
will be enabled to support x2apic and Intr-remapping.\n); Reviewed-by: Yijing Wang wangyij...@huawei.com -- Thanks! Yijing ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [Patch Part1 V2 12/17] iommu/vt-d: fix invalid memory access when freeing DMAR irq

2013-12-01 Thread Yijing Wang
Reviewed-by: Yijing Wang wangyij...@huawei.com On 2013/11/29 16:50, Jiang Liu wrote: In function free_dmar_iommu(), it sets IRQ handler data to NULL before calling free_irq(), which will cause invalid memory access because free_irq() will access IRQ handler data when calling function

[PATCH 2/3] iommu/fsl_pamu: Use dev_is_pci() to check whether it is pci device

2013-12-05 Thread Yijing Wang
Use PCI standard marco dev_is_pci() instead of directly compare pci_bus_type to check whether it is pci device. Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/fsl_pamu_domain.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu

[PATCH 1/3] iommu/amd: Use dev_is_pci() to check whether it is pci device

2013-12-05 Thread Yijing Wang
Use PCI standard marco dev_is_pci() instead of directly compare pci_bus_type to check whether it is pci device. Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/amd_iommu.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b

[PATCH 3/3] iommu/vt-d: Use dev_is_pci() to check whether it is pci device

2013-12-05 Thread Yijing Wang
Use PCI standard marco dev_is_pci() instead of directly compare pci_bus_type to check whether it is pci device. Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/intel-iommu.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b

Re: [PATCH v2] Enhance dmar to support device hotplug

2013-12-12 Thread Yijing Wang
On 2013/12/11 1:03, Don Dutile wrote: On 11/21/2013 03:21 AM, Yijing Wang wrote: This is the v2 patch, the v1 link: http://marc.info/?l=linux-pcim=138364004628824w=2 v1-v2: keep (pci_dev *) pointer array in dmar_drhd_uni, only use pci device id to update pci_dev * pointer info

Re: [Patch Part2 V1 07/14] iommu/vt-d: fix error in detect ATS capability

2014-01-08 Thread Yijing Wang
This is a issue, our BIOS also supports several ATSR which have the same segment. Good fix :) On 2014/1/7 17:00, Jiang Liu wrote: Current Intel IOMMU driver only matches a PCIe root port with the first DRHD unit with the samge segment number. It will report false result if there are multiple

Re: [PATCH v2] IOMMU: enhance dmar to support device hotplug

2014-03-04 Thread Yijing Wang
On 2014/3/4 22:31, Joerg Roedel wrote: On Thu, Nov 21, 2013 at 04:21:56PM +0800, Yijing Wang wrote: @@ -3641,21 +3681,42 @@ static int device_notifier(struct notifier_block *nb, struct device *dev = data; struct pci_dev *pdev = to_pci_dev(dev); struct dmar_domain *domain

[PATCH 0/6] trivial cleanup for iommu/vt-d

2014-05-20 Thread Yijing Wang
Some cleanup patches for iommu/vt-d. Yijing Wang (6): iommu/vt-d: Use list_for_each_safe() to simplify code iommu/vt-d: move up no_iommu and dmar_disabled check iommu/vt-d: clear the redundant assignment in dmar_enable_qi iommu/vt-d: clear the redundant assignment for domain-nid iommu

[PATCH 3/6] iommu/vt-d: clear the redundant assignment in dmar_enable_qi

2014-05-20 Thread Yijing Wang
__dmar_enable_qi() will initialize free_head,free_tail and free_cnt for q_inval. Remove the redundant initialization in dmar_enable_qi(). Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/dmar.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/drivers

[PATCH 4/6] iommu/vt-d: clear the redundant assignment for domain-nid

2014-05-20 Thread Yijing Wang
Alloc_domain() will initialize domain-nid to -1. So the initialization for domain-nid in md_domain_init() is redundant, clear it. Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/intel-iommu.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers

[PATCH 6/6] iommu/vt-d: fix reference count in iommu_prepare_isa

2014-05-20 Thread Yijing Wang
Decrease the device reference count avoid memory leak. Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/intel-iommu.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 455896c..a78a824

[PATCH 5/6] iommu/vt-d: use inline function dma_pte_superpage instead of macros

2014-05-20 Thread Yijing Wang
Use inline function dma_pte_superpage() instead of macro for better readability. Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/intel-iommu.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c

[PATCH 1/6] iommu/vt-d: Use list_for_each_safe() to simplify code

2014-05-20 Thread Yijing Wang
Use list_for_each_entry_safe() instead of list_entry() to simplify code. Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/intel-iommu.c |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index

[PATCH 1/2] iommu/vt-d: remove the useless dma_pte_addr

2014-05-26 Thread Yijing Wang
Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/intel-iommu.c |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index f256ffc..7b7127a 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers

Re: [PATCH 1/2] iommu/vt-d: remove the useless dma_pte_addr

2014-06-17 Thread Yijing Wang
ping... On 2014/5/26 20:13, Yijing Wang wrote: Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/intel-iommu.c |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index f256ffc..7b7127a

Re: [PATCH 0/6] trivial cleanup for iommu/vt-d

2014-06-17 Thread Yijing Wang
ping... On 2014/5/20 20:37, Yijing Wang wrote: Some cleanup patches for iommu/vt-d. Yijing Wang (6): iommu/vt-d: Use list_for_each_safe() to simplify code iommu/vt-d: move up no_iommu and dmar_disabled check iommu/vt-d: clear the redundant assignment in dmar_enable_qi iommu/vt-d

Re: [PATCH 2/6] iommu/vt-d: move up no_iommu and dmar_disabled check

2014-07-04 Thread Yijing Wang
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index e020dcf..6b71608 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -3948,6 +3948,9 @@ int __init intel_iommu_init(void) /* VT-d is required for a TXT/tboot launch, so enforce that */

Re: [PATCH 0/6] trivial cleanup for iommu/vt-d

2014-07-04 Thread Yijing Wang
On 2014/7/4 17:22, Joerg Roedel wrote: On Tue, May 20, 2014 at 08:37:46PM +0800, Yijing Wang wrote: Yijing Wang (6): iommu/vt-d: Use list_for_each_safe() to simplify code iommu/vt-d: move up no_iommu and dmar_disabled check iommu/vt-d: clear the redundant assignment in dmar_enable_qi

[PATCH] iommu/vt-d: Fix broken device issue when using iommu=pt

2014-08-10 Thread Yijing Wang
[ 1438.703851] DMAR:[fault reason 02] Present bit in context entry is clear Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/x86/include/asm/iommu.h |2 ++ arch/x86/kernel/pci-dma.c|8 drivers/iommu/intel-iommu.c | 41 + 3 files

Re: [PATCH] iommu/vt-d: Fix broken device issue when using iommu=pt

2014-08-11 Thread Yijing Wang
extern struct iommu_table_entry __iommu_table[], __iommu_table_end[]; @@ -146,6 +148,7 @@ void dma_generic_free_coherent(struct device *dev, size_t size, void *vaddr, */ static __init int iommu_setup(char *p) { +char *end; iommu_merge = 1; if (!p) @@ -192,6

Re: [PATCH] iommu/vt-d: Fix broken device issue when using iommu=pt

2014-08-11 Thread Yijing Wang
On 2014/8/12 11:18, Jiang Liu wrote: On 2014/8/12 9:37, Yijing Wang wrote: On 2014/8/11 22:59, Linda Knippers wrote: On 8/11/2014 12:43 AM, Alex Williamson wrote: On Mon, 2014-08-11 at 10:54 +0800, Yijing Wang wrote: We found some strange devices in HP C7000 and Huawei Server. These devices

[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 thierry.red...@avionic

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

2014-08-12 Thread Yijing Wang
future Non-PCI MSI device. Signed-off-by: Yijing Wang wangyij...@huawei.com CC: Thierry Reding thierry.red...@avionic-design.de CC: Thomas Petazzoni thomas.petazz...@free-electrons.com --- drivers/irqchip/irq-armada-370-xp.c |4 ++-- drivers/pci/host/pci-tegra.c|3 ++- drivers/pci/host

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

2014-08-12 Thread Yijing Wang
-by: Yijing Wang wangyij...@huawei.com CC: Thierry Reding thierry.red...@avionic-design.de CC: Thomas Petazzoni thomas.petazz...@free-electrons.com --- drivers/irqchip/irq-armada-370-xp.c | 12 +--- drivers/pci/host/pci-tegra.c|8 +--- drivers/pci/host/pcie-designware.c |4

[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 --- drivers

[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 ++ arch/arm/mach-iop13xx

[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 b

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

2014-08-12 Thread Yijing Wang
this is preparation for using struct msi_chip instead of weak arch MSI functions in all platforms. Signed-off-by: Yijing Wang wangyij...@huawei.com CC: Konrad Rzeszutek Wilk konrad.w...@oracle.com --- arch/x86/include/asm/x86_init.h |3 --- arch/x86/kernel/apic/io_apic.c | 15

[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
deliver their MSI to PCI hostbridge, if more than one msi_chip found in system, DTS file will report the binding between MSI devices and target msi_chip. So we need a platform implemented interface to do that. Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/pci/msi.c | 30

[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 a/arch/ia64/kernel

[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 b/arch/s390

[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 b/arch/mips

[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 b

[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 a/arch/powerpc/kernel

[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 changed

[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

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

[PATCH] iommu/vt-d: Add domain field for dmar fault message

2014-08-25 Thread Yijing Wang
Maybe there are the same bus:dev.fn in different domains, so add the domain field for dmar fault message to identify the exact source device. Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/dmar.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git

[PATCH v2] iommu/vt-d: Fix broken device issue when using iommu=pt

2014-08-25 Thread Yijing Wang
-by: Yijing Wang wangyij...@huawei.com --- v1-v2: Documented to kernel-parameter, tested ok in the real broken platforms. --- Documentation/kernel-parameters.txt |2 + arch/x86/include/asm/iommu.h|2 + arch/x86/kernel/pci-dma.c |8 ++ drivers/iommu/intel-iommu.c

Re: [PATCH v2] iommu/vt-d: Fix broken device issue when using iommu=pt

2014-08-25 Thread Yijing Wang
+/* We found some strange devices in HP c7000 and other platforms, they + * can not be enumerated by OS, and they did DMA read/write without + * driver management. if we open iommu in these platforms, the DMA read/write + * will be blocked by IOMMU hardware. Currently, we only

Re: [PATCH v2] iommu/vt-d: Fix broken device issue when using iommu=pt

2014-08-25 Thread Yijing Wang
On 2014/8/25 20:11, Sathya Perla wrote: -Original Message- From: Yijing Wang [mailto:wangyij...@huawei.com] On 2014/8/25 17:32, Sathya Perla wrote: -Original Message- From: Joerg Roedel [mailto:j...@8bytes.org] [Adding the Emulex driver developers to Cc for some input

Re: [PATCH v2] iommu/vt-d: Fix broken device issue when using iommu=pt

2014-08-25 Thread Yijing Wang
On 2014/8/25 23:04, David Woodhouse wrote: On Mon, 2014-08-25 at 12:11 +, Sathya Perla wrote: Hi Wang, from the kernel log I can see that the faulting address 0xbdf7 falls in the RMRR range the BIOS requested: [0.111343] DMAR: RMRR base: 0x00bdf6f000 end: 0x00bdf7efff

Re: [PATCH v2] iommu/vt-d: Fix broken device issue when using iommu=pt

2014-08-25 Thread Yijing Wang
On 2014/8/25 17:15, Joerg Roedel wrote: [Adding the Emulex driver developers to Cc for some input on the device, and why it might use wrong request ids] Thanks! On Mon, Aug 25, 2014 at 02:44:59PM +0800, Yijing Wang wrote: We found some strange devices in HP C7000 and Huawei Storage Server

Re: [PATCH v2] iommu/vt-d: Fix broken device issue when using iommu=pt

2014-09-04 Thread Yijing Wang
Could you also please send the me the FW version (output of ethtool -i eth0) Hi Sathya, thanks for your help. FW version is 4.6.247.5 driver version is 4.4.161.0s Hi Wang, this issue (a FW bug) was fixed in the 4.9 FW series. The HP qualified FW (ver 4.9.416.0) is available at

[PATCH v1 05/21] PCI/MSI: Introduce weak arch_find_msi_chip() to find MSI chip

2014-09-05 Thread Yijing Wang
() used in ARM platform, find the MSI chip by pci bus. Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/pci/msi.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index a77e7f7..539c11d 100644 --- a/drivers/pci/msi.c

[PATCH v1 03/21] MSI: Remove the redundant irq_set_chip_data()

2014-09-05 Thread Yijing Wang
Currently, pcie-designware, pcie-rcar, pci-tegra drivers use irq chip_data to save 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

[PATCH v1 10/21] x86/MSI: Remove unused MSI weak arch functions

2014-09-05 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/include/asm/x86_init.h |4 arch/x86/kernel/apic/io_apic.c |2 +- arch/x86/kernel/x86_init.c | 24

[PATCH v1 09/21] Irq_remapping/MSI: Use MSI chip framework to configure MSI/MSI-X irq

2014-09-05 Thread Yijing Wang
Use MSI chip framework instead of arch MSI functions to configure MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework. Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/irq_remapping.c |8 +++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git

[PATCH v1 08/21] x86/xen/MSI: Use MSI chip framework to configure MSI/MSI-X irq

2014-09-05 Thread Yijing Wang
Use MSI chip framework instead of arch MSI functions to configure MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework. Signed-off-by: Yijing Wang wangyij...@huawei.com CC: Konrad Rzeszutek Wilk konrad.w...@oracle.com --- arch/x86/pci/xen.c | 46

[PATCH v1 17/21] arm/iop13xx/MSI: Use MSI chip framework to configure MSI/MSI-X irq

2014-09-05 Thread Yijing Wang
Use MSI chip framework instead of arch MSI functions to configure MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/arm/mach-iop13xx/include/mach/pci.h |2 ++ arch/arm/mach-iop13xx/iq81340mc.c|1 + arch

[PATCH v1 16/21] s390/MSI: Use MSI chip framework to configure MSI/MSI-X irq

2014-09-05 Thread Yijing Wang
Use MSI chip framework instead of arch MSI functions to configure MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/s390/pci/pci.c | 18 ++ 1 files changed, 14 insertions(+), 4 deletions(-) diff

[PATCH v1 13/21] MIPS/Xlp/MSI: Use MSI chip framework to configure MSI/MSI-X irq

2014-09-05 Thread Yijing Wang
Use MSI chip framework instead of arch MSI functions to configure MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/mips/pci/msi-xlp.c | 14 -- 1 files changed, 12 insertions(+), 2 deletions(-) diff

[PATCH v1 19/21] Sparc/MSI: Use MSI chip framework to configure MSI/MSI-X irq

2014-09-05 Thread Yijing Wang
Use MSI chip framework instead of arch MSI functions to configure MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/sparc/kernel/pci.c | 14 -- 1 files changed, 12 insertions(+), 2 deletions(-) diff

[PATCH v1 15/21] Powerpc/MSI: Use MSI chip framework to configure MSI/MSI-X irq

2014-09-05 Thread Yijing Wang
Use MSI chip framework instead of arch MSI functions to configure MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/powerpc/kernel/msi.c | 14 -- 1 files changed, 12 insertions(+), 2 deletions(-) diff

[PATCH v1 20/21] tile/MSI: Use MSI chip framework to configure MSI/MSI-X irq

2014-09-05 Thread Yijing Wang
Use MSI chip framework instead of arch MSI functions to configure MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/tile/kernel/pci_gx.c | 14 -- 1 files changed, 12 insertions(+), 2 deletions(-) diff

[PATCH v1 21/21] PCI/MSI: Clean up unused MSI arch functions

2014-09-05 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/iommu/irq_remapping.c |2 +- drivers/pci/msi.c | 99 - include

[PATCH v1 01/21] PCI/MSI: Clean up struct msi_chip argument

2014-09-05 Thread Yijing Wang
Msi_chip functions setup_irq/teardown_irq rarely use msi_chip argument. We can look up msi_chip pointer by the device pointer or irq number, so clean up msi_chip argument. Signed-off-by: Yijing Wang wangyij...@huawei.com CC: Thierry Reding thierry.red...@gmail.com CC: Thomas Petazzoni

[PATCH v1 02/21] PCI/MSI: Remove useless bus-msi assignment

2014-09-05 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 thierry.red...@avionic

Re: [Xen-devel] [PATCH v1 08/21] x86/xen/MSI: Use MSI chip framework to configure MSI/MSI-X irq

2014-09-08 Thread Yijing Wang
On 2014/9/5 22:29, David Vrabel wrote: On 05/09/14 11:09, Yijing Wang wrote: Use MSI chip framework instead of arch MSI functions to configure MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework. [...] --- a/arch/x86/pci/xen.c +++ b/arch/x86/pci/xen.c [...] @@ -418,9

Re: [Xen-devel] [PATCH v1 04/21] x86/xen/MSI: Eliminate arch_msix_mask_irq() and arch_msi_mask_irq()

2014-09-10 Thread Yijing Wang
On 2014/9/10 20:36, David Vrabel wrote: On 05/09/14 11:09, 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. And mask/unmask

Re: [Xen-devel] [PATCH v1 08/21] x86/xen/MSI: Use MSI chip framework to configure MSI/MSI-X irq

2014-09-10 Thread Yijing Wang
On 2014/9/10 20:38, David Vrabel wrote: On 09/09/14 03:06, Yijing Wang wrote: On 2014/9/5 22:29, David Vrabel wrote: On 05/09/14 11:09, Yijing Wang wrote: Use MSI chip framework instead of arch MSI functions to configure MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework

Re: [Xen-devel] [PATCH v1 08/21] x86/xen/MSI: Use MSI chip framework to configure MSI/MSI-X irq

2014-09-10 Thread Yijing Wang
On 2014/9/10 22:59, Konrad Rzeszutek Wilk wrote: On Wed, Sep 10, 2014 at 01:38:25PM +0100, David Vrabel wrote: On 09/09/14 03:06, Yijing Wang wrote: On 2014/9/5 22:29, David Vrabel wrote: On 05/09/14 11:09, Yijing Wang wrote: Use MSI chip framework instead of arch MSI functions to configure

[PATCH] x86: irq_remapping: Make functions static

2014-09-12 Thread Yijing Wang
Change local functions to static. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/x86/include/asm/irq_remapping.h | 27 +-- drivers/iommu/irq_remapping.c| 34 +- 2 files changed, 18 insertions(+), 43 deletions(-) diff

[PATCH] x86: irq_remapping: Fix the regression of hpet irq remapping

2014-09-12 Thread Yijing Wang
() setup_hpet_msi_remapped() intel_setup_hpet_msi() alloc_irte() Currently, we only alloc_irte() for hpet MSI, but have not composed and wrote its msg... Signed-off-by: Yijing Wang wangyij...@huawei.com --- drivers/iommu/irq_remapping.c

Re: [PATCH] x86: irq_remapping: Make functions static

2014-09-12 Thread Yijing Wang
preparing to look at it. Joerg, please drop this trivial patch. Thanks! Yijing. Regards! Gerry On 2014/9/12 17:05, Yijing Wang wrote: Change local functions to static. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/x86/include/asm/irq_remapping.h | 27

Re: [PATCH] x86: irq_remapping: Fix the regression of hpet irq remapping

2014-09-12 Thread Yijing Wang
On 2014/9/12 17:02, Jiang Liu wrote: On 2014/9/12 17:05, Yijing Wang wrote: Commit 71054d8841b4 introduced x86_msi_ops.setup_hpet_msi to setup hpet MSI irq when irq remapping enabled. This caused a regression of hpet MSI irq remapping. Original code flow before commit 71054d8841b4

Re: [Patch Part3 V5 2/8] iommu/vt-d: Dynamically allocate and free seq_id for DMAR units

2014-09-12 Thread Yijing Wang
On 2014/9/12 10:10, Jiang Liu wrote: Introduce functions to support dynamic IOMMU seq_id allocating and releasing, which will be used to support DMAR hotplug. Also rename IOMMU_UNITS_SUPPORTED as DMAR_UNITS_SUPPORTED. Reviewed-by: Yijing Wang wangyij...@huawei.com Signed-off-by: Jiang

Re: [Patch Part3 V5 1/8] iommu/vt-d: Introduce helper function dmar_walk_resources()

2014-09-12 Thread Yijing Wang
On 2014/9/12 10:10, Jiang Liu wrote: Introduce helper function dmar_walk_resources to walk resource entries in DMAR table and ACPI buffer object returned by ACPI _DSM method for IOMMU hot-plug. Signed-off-by: Jiang Liu jiang@linux.intel.com Hi Gerry. some comments below. ---

Re: [Patch Part3 V5 5/8] iommu/vt-d: Enhance intel_irq_remapping driver to support DMAR unit hotplug

2014-09-14 Thread Yijing Wang
+static void ir_remove_ioapic_hpet_scope(struct intel_iommu *iommu) +{ + int i; - ir_parse_one_hpet_scope(scope, iommu); - } - start += scope-length; - } + for (i = 0; i MAX_HPET_TBS; i++) + if (ir_hpet[i].iommu ==

Re: [Patch Part3 V5 6/8] iommu/vt-d: Enhance error recovery in function intel_enable_irq_remapping()

2014-09-14 Thread Yijing Wang
); + intel_teardown_irq_remapping(iommu); + } if (x2apic_present) pr_warn(Failed to enable irq remapping. You are vulnerable to irq-injection attacks.\n); Reviewed-by: Yijing Wang wangyij...@huawei.com -- Thanks! Yijing

Re: [Patch Part3 V5 7/8] iommu/vt-d: Enhance intel-iommu driver to support DMAR unit hotplug

2014-09-14 Thread Yijing Wang
On 2014/9/12 10:10, Jiang Liu wrote: Implement required callback functions for intel-iommu driver to support DMAR unit hotplug. Reviewed-by: Yijing Wang wangyij...@huawei.com Signed-off-by: Jiang Liu jiang@linux.intel.com --- drivers/iommu/intel-iommu.c | 206

Re: [Patch Part3 V5 0/8] Enable support of Intel DMAR device hotplug

2014-09-15 Thread Yijing Wang
I built and boot this series in Huawei RH5885 (Intel(R) Xeon(R) CPU E7- 4807, two IOHs and two IOMMUs), It works fine, IRQ remap and DMA remap are both look good. But because my platform BIOS has no _DSM, so I didn't test the hotplug case yet. Thanks! Yijing. On 2014/9/12 10:10, Jiang Liu

Re: [PATCH v1 03/21] MSI: Remove the redundant irq_set_chip_data()

2014-09-15 Thread Yijing Wang
On 2014/9/15 22:00, Lucas Stach wrote: Am Freitag, den 05.09.2014, 18:09 +0800 schrieb Yijing Wang: Currently, pcie-designware, pcie-rcar, pci-tegra drivers use irq chip_data to save the msi_chip pointer. They already call irq_set_chip_data() in their own MSI irq map functions. So

Re: [PATCH v1 05/21] PCI/MSI: Introduce weak arch_find_msi_chip() to find MSI chip

2014-09-15 Thread Yijing Wang
On 2014/9/15 22:42, Lucas Stach wrote: Am Freitag, den 05.09.2014, 18:09 +0800 schrieb Yijing Wang: Introduce weak arch_find_msi_chip() to find the match msi_chip. Currently, MSI chip associates pci bus to msi_chip. Because in ARM platform, there may be more than one MSI controller in system

Re: [Patch Part3 V5 5/8] iommu/vt-d: Enhance intel_irq_remapping driver to support DMAR unit hotplug

2014-09-16 Thread Yijing Wang
On 2014/9/16 15:00, Jiang Liu wrote: On 2014/9/15 10:20, Yijing Wang wrote: +static void ir_remove_ioapic_hpet_scope(struct intel_iommu *iommu) +{ + int i; - ir_parse_one_hpet_scope(scope, iommu); - } - start += scope-length; - } + for (i = 0

Re: [Patch Part3 V5 1/8] iommu/vt-d: Introduce helper function dmar_walk_resources()

2014-09-16 Thread Yijing Wang
#include irq_remapping.h +typedef int (*dmar_res_handler_t)(struct acpi_dmar_header *, void *); +struct dmar_res_callback { + dmar_res_handler_t cb[ACPI_DMAR_TYPE_RESERVED]; + void*arg[ACPI_DMAR_TYPE_RESERVED]; + boolignore_unhandled; +

Re: [PATCH v1 03/21] MSI: Remove the redundant irq_set_chip_data()

2014-09-16 Thread Yijing Wang
arch_teardown_msi_irq() expects to find the msi_chip in the irq chip_data field. As this means drivers don't have any reasonable other possibility to stuff things into this field, I think it would make sense to do the cleanup the other way around: keep the irq_set_chip_data

[PATCH v2] x86: irq_remapping: Fix the regression of hpet irq remapping

2014-09-17 Thread Yijing Wang
: hpet_setup_msi_irq() x86_msi.setup_hpet_msi() setup_hpet_msi_remapped() intel_setup_hpet_msi() alloc_irte() Currently, we only call alloc_irte() for hpet MSI, but do not composed and wrote its msg... Signed-off-by: Yijing Wang wangyij

Re: [PATCH v1 00/21] Use MSI chip to configure MSI/MSI-X in all platforms

2014-09-23 Thread Yijing Wang
On 2014/9/24 5:09, Bjorn Helgaas wrote: On Fri, Sep 05, 2014 at 06:09:45PM +0800, Yijing Wang wrote: This series is based Bjorn's pci-next branch + Alexander Gordeev's two patches Remove arch_msi_check_device() link: https://lkml.org/lkml/2014/7/12/41 Currently, there are a lot of weak arch

Re: [PATCH] iommu/vt-d: Fix broken device issue when using iommu=pt

2014-09-24 Thread Yijing Wang
On 2014/9/25 5:56, Rob Roschewsk wrote: Hello All wonder if there has been any movement on this issue I'm having a similar issue I'm running an HP dl380 gen 8 with an Emulex OneConnect 10Gb iSCSI (14e4:164c) (rev 11) also known as Hewlett-Packard Company NC373i Integrated

[PATCH v2 07/22] PCI/MSI: Refactor struct msi_chip to make it become more common

2014-09-24 Thread Yijing Wang
. This patch add .restore_irq() and .setup_irqs() to make it become more common. Signed-off-by: Yijing Wang wangyij...@huawei.com Reviewed-by: Lucas Stach l.st...@pengutronix.de --- drivers/pci/msi.c | 15 +++ include/linux/msi.h |3 +++ 2 files changed, 18 insertions(+), 0

[PATCH v2 18/22] arm/iop13xx/MSI: Use MSI chip framework to configure MSI/MSI-X irq

2014-09-24 Thread Yijing Wang
Use MSI chip framework instead of arch MSI functions to configure MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework. Signed-off-by: Yijing Wang wangyij...@huawei.com --- arch/arm/mach-iop13xx/include/mach/pci.h |2 ++ arch/arm/mach-iop13xx/iq81340mc.c|1 + arch

[PATCH v2 02/22] PCI/MSI: Remove useless bus-msi assignment

2014-09-24 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 thierry.red...@gmail.com CC

[PATCH v2 00/22] Use MSI chip framework to configure MSI/MSI-X in all platforms

2014-09-24 Thread Yijing Wang
struct device as the msi_chip argument, we will do that later in another patchset. Yijing Wang (22): PCI/MSI: Clean up struct msi_chip argument PCI/MSI: Remove useless bus-msi assignment MSI: Remove the redundant irq_set_chip_data() x86/xen/MSI: Eliminate arch_msix_mask_irq

  1   2   >