Re: [PATCH] intel-iommu: Quiesce devices before disabling IOMMU

2013-09-23 Thread Baoquan He
Hi, Patch is great and works on my HP-z420. There are several small concerns, please see inline comments. On 08/21/13 at 04:15pm, Takao Indoh wrote: This patch quiesces devices before disabling IOMMU on boot to stop ongoing DMA. In intel_iommu_init(), check context entries and if there is

Re: [PATCHv2 0/6] Crashdump Accepting Active IOMMU

2013-12-19 Thread Baoquan He
I have reviewed and tested this patchset. Without it the DMAR error always occured as below. With this patchset, no error is reported and kdump can work successfully. This patchset is awesome, it get to the root of the problem when enable intel-iommu in kdump and fix it. And from code no harm

Re: [PATCHv2 4/6] Crashdump-Accepting-Active-IOMMU-Copy-Translations

2013-12-19 Thread Baoquan He
On 12/19/13 at 07:49pm, Bill Sumner wrote: +static int copy_page_addr(u64 page_addr, u32 shift, u32 bus, u32 devfn, + u64 pte, struct dmar_domain *domain, + void *parms) +{ + struct copy_page_addr_parms *ppap = parms; + + u64

Re: [PATCHv2 4/6] Crashdump-Accepting-Active-IOMMU-Copy-Translations

2013-12-19 Thread Baoquan He
On 12/20/13 at 02:04pm, Baoquan He wrote: On 12/19/13 at 07:49pm, Bill Sumner wrote: +static int copy_page_addr(u64 page_addr, u32 shift, u32 bus, u32 devfn, + u64 pte, struct dmar_domain *domain, + void *parms) +{ + struct

Re: [PATCHv3 0/6] Crashdump Accepting Active IOMMU

2014-01-24 Thread Baoquan He
added to Copy-Translations patch to initialize the iovad struct as recommended by Baoquan He [b...@redhat.com] init_iova_domain(domain-iovad, DMA_32BIT_PFN); v1-v2: The following series implements a fix for: A kdump problem about DMA that has been discussed for a long time

Re: hpsa driver bug crack kernel down!

2014-04-10 Thread Baoquan He
, 2014-04-09 at 15:49 -0700, Davidlohr Bueso wrote: On Wed, 2014-04-09 at 10:39 +0800, Baoquan He wrote: Hi, The kernel is 3.14.0+ which is pulled just now. Cc'ing more people. While the hpsa driver appears to be involved in some way, I'm sure if this is a related issue

Re: [PATCH] hpsa: fix uninitialized trans_support in hpsa_put_ctlr_into_performant_mode()

2014-04-10 Thread Baoquan He
This patch works for me. Tested-by: Baoquan He b...@redhat.com Thanks Baoquan On 04/10/14 at 05:17pm, scame...@beardog.cce.hp.com wrote: Without this, you'll see a null pointer dereference in hpsa_enter_performant_mode(). Signed-off-by: Stephen M. Cameron scame...@beardog.cce.hp.com

Re: hpsa driver bug crack kernel down!

2014-04-10 Thread Baoquan He
-04-09 at 10:39 +0800, Baoquan He wrote: Hi, The kernel is 3.14.0+ which is pulled just now. Cc'ing more people. While the hpsa driver appears to be involved in some way, I'm sure if this is a related issue, but as of today's pull I'm getting another problem that causes my DL980

Re: [PATCH 2/8] Consolidate all .h lines at front of intel-iommu.c file

2014-04-19 Thread Baoquan He
Hi Bill, Could you rebase on latest linus's kernel tree, since there are several changes in intel-iommu.c. This patch can't be applied because of below commits. I think patch need be reabsed on latest linus's tree before post, people will apply your patch without conflict. commit

Re: [PATCH 0/5] iommu/vt-d: Fix crash dump failure caused by legacy DMA/IO

2014-10-22 Thread Baoquan He
On 10/22/14 at 10:22am, Li, Zhen-Hua wrote: Hi Baoquan, I tested it on 3.17, it does not have these faults. There are little differences between this version and Bill's last version. I will test it on 3.18.0-rc1+ on my system and let you know the result. And could you send me the

Re: [PATCH 0/5] iommu/vt-d: Fix crash dump failure caused by legacy DMA/IO

2014-10-27 Thread Baoquan He
On 10/27/14 at 03:29pm, Li, ZhenHua wrote: Hi Baoquan, I failed in testing this patchset for 3.18.0-rc1, this upstream 3.18.0-rc1 kernel cannot boot on my system, have not found out the reason. Could you please test this patchset on 3.17.0 to see whether it has these faults? Thanks

Re: [PATCH 1/1] x86/iommu: fix incorrect bit operations in setting values

2014-11-13 Thread Baoquan He
On 11/13/14 at 05:06pm, Li, ZhenHua wrote: Minfei, Thanks for your testing. On my system, I got error messages: [8.019096] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [8.019617] dmar: DRHD: handling fault status reg 102 [8.019621] dmar: DMAR:[DMA Read]

Re: [PATCH 0/5] iommu/vt-d: Fix crash dump failure caused by legacy DMA/IO

2014-12-10 Thread Baoquan He
Hi Joerg, ZhenHua, This issue happens on AMD iommu too, do you have any plans or thoughts on that? Thanks Baoquan On 11/17/14 at 02:38pm, Joerg Roedel wrote: On Fri, Nov 14, 2014 at 02:27:44PM +0800, Li, ZhenHua wrote: I am working following your directions: 1. If the VT-d driver

Re: [PATCH 0/5] iommu/vt-d: Fix crash dump failure caused by legacy DMA/IO

2014-12-15 Thread Baoquan He
On 12/12/14 at 05:11pm, Joerg Roedel wrote: On Fri, Dec 12, 2014 at 10:25:31AM +0800, Li, ZhenHua wrote: Sorry I have no plan yet. Could you send me your logs on your AMD system? On 12/10/2014 04:46 PM, Baoquan He wrote: This issue happens on AMD iommu too, do you have any plans

Re: [PATCH 0/5] iommu/vt-d: Fix crash dump failure caused by legacy DMA/IO

2014-12-15 Thread Baoquan He
On 12/12/14 at 10:25am, Li, ZhenHua wrote: Sorry I have no plan yet. Could you send me your logs on your AMD system? Sure, please check the attachment. AMD iommu seems a little different on action. On the machine I reserved for testing, it always hang the system bootup. As Joerg said, we can

Re: [PATCH v8 06/10] iommu/vt-d: datatypes and functions used for kdump

2015-01-14 Thread Baoquan He
, yes. So please ignore this comment. See my comments. On 01/15/2015 11:28 AM, Baoquan He wrote: On 01/12/15 at 03:06pm, Li, Zhen-Hua wrote: +/* + * Interface to the copy translation tables set of functions + * from mainline code. + */ +static int intel_iommu_load_translation_tables(struct

Re: [PATCH 0/10] iommu/vt-d: Fix intel vt-d faults in kdump kernel

2015-01-05 Thread Baoquan He
Hi Zhenhua, I just tested your patchset based on 3.19.0-rc2+, and found several dmar fault and intr-remap fault, it seems not the same as Takao's, please check the attachment. Thanks Baoquan [root@dhcp-16-105 ~]# kdumpctl restart kexec: failed to unloaded kdump kernel Stopping kdump: [FAILED]

Re: [PATCH v8 0/10] iommu/vt-d: Fix intel vt-d faults in kdump kernel

2015-01-12 Thread Baoquan He
. 2. Updated the comments about changes in each version. 3. Fixed: one-line added to Copy-Translations patch to initialize the iovad struct as recommended by Baoquan He [b...@redhat.com] init_iova_domain(domain-iovad, DMA_32BIT_PFN); Changelog[v2

Re: [PATCH v7 0/10] iommu/vt-d: Fix intel vt-d faults in kdump kernel

2015-01-06 Thread Baoquan He
On 01/07/15 at 12:11pm, Li, ZhenHua wrote: Many thanks to Takao Indoh and Baoquan He, for your testing on more different systems. The calling of flush functions are added to this version. The usage of __iommu_flush_cache function : 1. Fixes a dump on Takao's system. 2. Reduces the count

Re: [PATCH v7 0/10] iommu/vt-d: Fix intel vt-d faults in kdump kernel

2015-01-07 Thread Baoquan He
! Thanks Baoquan Regards Zhenhua On 01/07/2015 01:02 PM, Baoquan He wrote: On 01/07/15 at 12:11pm, Li, ZhenHua wrote: Many thanks to Takao Indoh and Baoquan He, for your testing on more different systems. The calling of flush functions are added to this version. The usage

Re: [PATCH v8 02/10] iommu/vt-d: Items required for kdump

2015-01-13 Thread Baoquan He
On 01/12/15 at 10:29am, Vivek Goyal wrote: On Mon, Jan 12, 2015 at 04:22:08PM +0100, Joerg Roedel wrote: It looks like you are still copying the io-page-tables from the old kernel into the kdump kernel, is that right? With the approach that was proposed you only need to copy over the

Re: [PATCH v10 0/10] iommu/vt-d: Fix intel vt-d faults in kdump kernel

2015-04-24 Thread Baoquan He
On 04/15/15 at 02:48pm, Dave Young wrote: On 04/15/15 at 01:47pm, Li, ZhenHua wrote: On 04/15/2015 08:57 AM, Dave Young wrote: Again, I think it is bad to use old page table, below issues need consider: 1) make sure old page table are reliable across crash 2) do not allow writing oldmem

Re: [PATCH v10 0/10] iommu/vt-d: Fix intel vt-d faults in kdump kernel

2015-04-24 Thread Baoquan He
On 04/24/15 at 04:25pm, Dave Young wrote: Hi, Baoquan I support this patchset. We should not fear oldmem since reserved crashkernel region is similar. No one can guarantee that any crazy code won't step into crashkernel region just because 1st kernel says it's reversed for kdump

Re: [PATCH v10 0/10] iommu/vt-d: Fix intel vt-d faults in kdump kernel

2015-04-29 Thread Baoquan He
Bad news, I rebuilt a kernel with your patchset on 4.0.0+ (this commit f614c81). Now dmar fault is seen again. The lspci log and kdump log are attached, please check: [ ~]$ cat /proc/cmdline BOOT_IMAGE=/vmlinuz-4.0.0+ root=/dev/mapper/fedora_dhcp--128--28-root ro

Re: [PATCH v10 0/10] iommu/vt-d: Fix intel vt-d faults in kdump kernel

2015-04-28 Thread Baoquan He
On 04/24/15 at 04:49pm, Dave Young wrote: On 04/24/15 at 04:35pm, Baoquan He wrote: On 04/24/15 at 04:25pm, Dave Young wrote: Hi, Baoquan I support this patchset. We should not fear oldmem since reserved crashkernel region is similar. No one can guarantee that any crazy

Re: [PATCH v10 0/10] iommu/vt-d: Fix intel vt-d faults in kdump kernel

2015-05-03 Thread Baoquan He
On 04/29/15 at 07:20pm, Baoquan He wrote: Bad news, I rebuilt a kernel with your patchset on 4.0.0+ (this commit f614c81). Now dmar fault is seen again. The lspci log and kdump log are attached, please check: I found the lspci log previously attached is emtyp, resend it again. 00:00.0

Re: [PATCH v10 0/10] iommu/vt-d: Fix intel vt-d faults in kdump kernel

2015-05-03 Thread Baoquan He
On 05/04/15 at 11:06am, Li, ZhenHua wrote: Hi baoquan, Could you paste the kernel log of the first kernel ? Please check the attachment. [0.00] microcode: CPU0 microcode updated early to revision 0x710, date = 2013-06-17 [0.00] Initializing cgroup subsys cpuset [0.00]

Re: [PATCH v10 04/10] iommu/vt-d: functions to copy data from old mem

2015-05-07 Thread Baoquan He
On 04/10/15 at 04:42pm, Li, Zhen-Hua wrote: Add some functions to copy the data from old kernel. These functions are used to copy context tables and page tables. To avoid calling iounmap between spin_lock_irqsave and spin_unlock_irqrestore, use a link here, store the pointers , and then use

Re: [PATCH v11 0/10] iommu/vt-d: Fix intel vt-d faults in kdump kernel

2015-05-12 Thread Baoquan He
On 05/11/15 at 05:52pm, Li, Zhen-Hua wrote: This patchset is an update of Bill Sumner's patchset, implements a fix for: If a kernel boots with intel_iommu=on on a system that supports intel vt-d, when a panic happens, the kdump kernel will boot with these faults: Test passed on my local

Re: [PATCH v11 04/10] iommu/vt-d: functions to copy data from old mem

2015-05-13 Thread Baoquan He
On 05/13/15 at 05:13pm, Li, ZhenHua wrote: Hi Baoquan, I am using a list here to store all the mapped addresses, and unmap them out of iounmap. About the reason, please check the old mails. I cannot remember the detailed reasons. Yeah, I understand that the list is used to collect all

Re: [PATCH v11 06/10] iommu/vt-d: datatypes and functions used for kdump

2015-05-13 Thread Baoquan He
On 05/11/15 at 05:52pm, Li, Zhen-Hua wrote: Populate it with support functions to copy iommu translation tables from from the panicked kernel into the kdump kernel in the event of a crash. Functions: Use old root entry table, and load the old data to root_entry as cache. Malloc new

Re: [PATCH v11 04/10] iommu/vt-d: functions to copy data from old mem

2015-05-13 Thread Baoquan He
On 05/11/15 at 05:52pm, Li, Zhen-Hua wrote: Add some functions to copy the data from old kernel. These functions are used to copy context tables and page tables. To avoid calling iounmap between spin_lock_irqsave and spin_unlock_irqrestore, use a link here, store the pointers , and then use

Re: [PATCH v11 06/10] iommu/vt-d: datatypes and functions used for kdump

2015-05-13 Thread Baoquan He
on this. Thanks for telling. Zhenhua On 05/13/2015 04:56 PM, Baoquan He wrote: + + iommu-root_entry_old_phys = q VTD_PAGE_MASK; + if (!iommu-root_entry_old_phys) { + pr_err(Could not read old root entry address.); + return -1; + } + I didn't find where you call iounmap

Re: [PATCH v11 07/10] iommu/vt-d: enable kdump support in iommu module

2015-05-12 Thread Baoquan He
On 05/11/15 at 05:52pm, Li, Zhen-Hua wrote: Modify the operation of the following functions when called during crash dump: iommu_context_addr free_context_table get_domain_for_dev init_dmars intel_iommu_init Bill Sumner: Original version. Zhenhua: The name

Re: [PATCH v11 07/10] iommu/vt-d: enable kdump support in iommu module

2015-05-12 Thread Baoquan He
On 05/13/15 at 10:28am, Li, ZhenHua wrote: +static u8 g_translation_pre_enabled; Hi Zhenhua, I haven't checked patch one by one, am going through the code flow. About g_translation_pre_enabled, I don't think it's necessary to define it as a global variable. Both its assignment and

Re: [PATCH v11 08/10] iommu/vt-d: assign new page table for dma_map

2015-05-20 Thread Baoquan He
On 05/11/15 at 05:52pm, Li, Zhen-Hua wrote: When a device driver issues the first dma_map command for a device, we assign a new and empty page-table, thus removing all mappings from the old kernel for the device. Hi Zhenhua, From your patch I got it will remove all mappings, assign a new

Re: [PATCH v11 08/10] iommu/vt-d: assign new page table for dma_map

2015-05-21 Thread Baoquan He
, and this is what this patch does. OK, just a new page table allocated in init_domain(), right? I thought a specific empty page-table is allocated for these new domains in kdump kernel. Thanks Zhenhua On 05/21/2015 07:52 AM, Baoquan He wrote: On 05/11/15 at 05:52pm, Li, Zhen-Hua wrote: When

Re: [PATCH v11 08/10] iommu/vt-d: assign new page table for dma_map

2015-05-21 Thread Baoquan He
. Thanks Zhenhua On 05/21/2015 02:54 PM, Baoquan He wrote: On 05/21/15 at 09:27am, Li, ZhenHua wrote: Hi Baoquan, In the early version of this patchset, old page tables are used by new kernel. But as discussed, we need to make kernel use new pages when there is a new dma request , so we

[Patch v2] iommu/vt-d: Adjsut the return value of the parse_ioapics_under_ir

2015-10-22 Thread Baoquan He
Adjust the return value of parse_ioapics_under_ir as negative value representing failure and "0" representing succcess. Just make it consistent with other function implementation, and we can judge if calling is successfull by if (!parse_ioapics_under_ir()) style. Signed-off-by: Bao

[Patch v2 6/9] iommu/amd: Add functions copy_command_buffer/copy_event_buffer

2015-11-06 Thread Baoquan He
Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu_init.c | 39 +++ drivers/iommu/amd_iommu_types.h | 1 + 2 files changed, 40 insertions(+) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 1

[Patch v2 2/9] iommu/amd: Detect pre enabled translation

2015-11-06 Thread Baoquan He
Add functions to check whether translation is already enabled in IOMMU. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu_init.c | 26 ++ drivers/iommu/amd_iommu_proto.h | 4 2 files changed, 30 insertions(+) diff --git a/drivers

Re: [Patch v2 0/9] Fix AMD IOMMU faults in kdump kernel

2015-11-06 Thread Baoquan He
The kdump kernel boog log is attached here. On 11/06/15 at 08:10pm, Baoquan He wrote: > This is v2 draft patch set. It mainly functions as the following steps: > > 1. Checking if it's in kdump kernel and previously enabled > 2. If yes do below operatons: > a. Do not disable a

[Patch v2 5/9] iommu/amd: Add function copy_dev_tables

2015-11-06 Thread Baoquan He
Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu_init.c | 36 drivers/iommu/amd_iommu_types.h | 2 ++ 2 files changed, 38 insertions(+) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index e

[Patch v2 0/9] Fix AMD IOMMU faults in kdump kernel

2015-11-06 Thread Baoquan He
ttached kdump kernel boot log with this patchset applied. Baoquan He (9): iommu/amd: Use standard bitmap operation to set bitmap iommu/amd: Detect pre enabled translation iommu/amd: make several functions global iommu/amd: add copy_irq_table function iommu/amd: Add function copy_dev_t

[Patch v2 7/9] iommu/amd: copy old tables and do not update dev tables before driver init

2015-11-06 Thread Baoquan He
Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 19 +-- drivers/iommu/amd_iommu_init.c | 71 -- 2 files changed, 49 insertions(+), 41 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_i

[Patch v2 1/9] iommu/amd: Use standard bitmap operation to set bitmap

2015-11-06 Thread Baoquan He
It will be more readable then the old setting. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 2 +- drivers/iommu/amd_iommu_init.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_i

[Patch v2 4/9] iommu/amd: add copy_irq_table function

2015-11-06 Thread Baoquan He
Here old irq tables are ioremapped and not iounmapped for now. Maybe it can be adjusted later to use a better way. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu_init.c | 30 ++ drivers/iommu/amd_iommu_types.h | 1 + 2 files chang

[Patch v2 8/9] iommu/amd: Do not update the information of domain to devtables before device driver init

2015-11-06 Thread Baoquan He
Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 90c6205..0ac6799 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_i

[Patch v2 3/9] iommu/amd: make several functions globally seen

2015-11-06 Thread Baoquan He
They will be called later when copy old dev/irq tables. It's better to use them then call iommu_flush_all_caches() since iommu_flush_all_caches() will iterate many empty table entries. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 4 ++-- drivers

[Patch v2 9/9] iommu/amd: Clear the iommu pre enabled setting

2015-11-06 Thread Baoquan He
Now any change of domain can be updated to dev tables and io page table Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu_init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index d978f80..7

Re: [PATCH 07/10] iommu/amd: copy old dev tables and do not touch dev tables

2015-10-10 Thread Baoquan He
On 09/29/15 at 06:08pm, Joerg Roedel wrote: > On Thu, Sep 24, 2015 at 02:37:33PM +0800, Baoquan He wrote: > > +if ( !translation_pre_enabled() ) { > > + iommu_disable(iommu); > > + i

Re: [PATCH 06/10] iommu/amd: Add functions copy_command_buffer/copy_event_buffer

2015-10-10 Thread Baoquan He
Hi Joerg, On 09/29/15 at 06:04pm, Joerg Roedel wrote: > On Thu, Sep 24, 2015 at 02:37:32PM +0800, Baoquan He wrote: > > Copy command buffer and event buffer from the old to kdump kernel. > > > > Still there are 2 problems: > > 1) Not very sure if this is necess

Re: [PATCH 09/10] iommu/amd: Clear the iommu pre enabled setting

2015-10-10 Thread Baoquan He
On 09/29/15 at 06:09pm, Joerg Roedel wrote: > On Thu, Sep 24, 2015 at 02:37:35PM +0800, Baoquan He wrote: > > @@ -2469,6 +2469,8 @@ static dma_addr_t __map_single(struct device *dev, > > unsigned long align_mask = 0; > > int i; > > > >

Re: [PATCH 10/10] iommu/amd: Copy the old ir table

2015-10-10 Thread Baoquan He
On 09/29/15 at 06:11pm, Joerg Roedel wrote: > On Thu, Sep 24, 2015 at 02:37:36PM +0800, Baoquan He wrote: > Is it necessary to copy the old ir tables? On AMD these tables are > per-device, so it is probably the best to handle them like the io > page-tables and just update

Re: About amd-iommu support for kdump kernel

2015-09-16 Thread Baoquan He
On 09/15/15 at 08:06pm, Baoquan He wrote: > Hi Joerg, > > Recently I am free and can try to work out the amd-iommu support for > kdump kernel. Now I have some plans and draft them into codes and debugging. > And also there are prlblems. I brief them here, could you please have a

About amd-iommu support for kdump kernel

2015-09-15 Thread Baoquan He
0x80 [ 12.541238] [] kernel_init+0xe/0xe0 [ 12.546361] [] ret_from_fork+0x3f/0x70 [ 12.551745] [] ? rest_init+0x80/0x80 [ 12.556957] Rebooting in 10 seconds.. >From 09943d6354ee1626426f6ff060d92173bb164279 Mon Sep 17 00:00:00 2001 From: Baoquan He <b...@redhat.com> Date: Thu, 25 Jun

[PATCH 2/2] iommu/vt-d: Adjsut the return value of the parse_ioapics_under_ir

2015-09-29 Thread Baoquan He
Adjust the return value of parse_ioapics_under_ir as "-1" representing failure and "0" representing succcess. Just make it consistent with other function implementation, and we can judge if calling is successfull by if (!parse_ioapics_under_ir()) style. Signed-off-by: Baoquan

Re: [PATCH 1/2] iommu/vt-d: break the for loop if an empty ir_ioapic entry found

2015-09-29 Thread Baoquan He
On 09/29/15 at 03:50pm, Joerg Roedel wrote: > On Tue, Sep 29, 2015 at 03:26:08PM +0800, Baoquan He wrote: > > No need to continue the loop after it has been found. > > > > Signed-off-by: Baoquan He <b...@redhat.com> > > --- > > drivers/iommu/intel_irq_rema

[PATCH 04/10] iommu/amd: Detect pre enabled translation

2015-09-24 Thread Baoquan He
Add functions to check whether translation is already enabled in IOMMU. Maybe it need be checked per IOMMU. Currently for debugging I didn't do like that. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu_init.c | 26 ++ drivers

[PATCH 02/10] iommu/amd: Adjust functons which get first/last devid by reading pci config

2015-09-24 Thread Baoquan He
The old functon find_last_devid_on_pci not only gets the last devid, but calls update_last_devid(). Now adjust the function definition to make it be consistent with its name. Meanwhile add a new function find_first_devid_on_pci for later use. Signed-off-by: Baoquan He <b...@redhat.

[PATCH 08/10] iommu/amd: Do not update the information of domain to devtables before device driver init

2015-09-24 Thread Baoquan He
update_domain() is the only place where domain->pt_root will be got and set into dev entry. So before the device driver initialization we do nothing if it's in previously enabled translation status. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 2 +- 1 fil

[PATCH 09/10] iommu/amd: Clear the iommu pre enabled setting

2015-09-24 Thread Baoquan He
In the first Now any change of domain can be updated to dev tables and io page table Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index aee1ae4..1

[PATCH 07/10] iommu/amd: copy old dev tables and do not touch dev tables

2015-09-24 Thread Baoquan He
Before old dev tables coping do not touch dev tables if translation is previously enabled. And copy the dev tables/command buffer/event buffer from the old kernel to newly allocated data structure. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu_init.

[PATCH 10/10] iommu/amd: Copy the old ir table

2015-09-24 Thread Baoquan He
Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 25 +++-- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 1e86f4c..f4f3e63 100644 --- a/drivers/iommu/amd_iommu.c

[PATCH 05/10] iommu/amd: Add function copy_dev_tables

2015-09-24 Thread Baoquan He
Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu_init.c | 26 ++ drivers/iommu/amd_iommu_types.h | 2 ++ 2 files changed, 28 insertions(+) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 1fc369e..913a718

[PATCH 03/10] iommu/amd: Get the first/last device of iommu earlier

2015-09-24 Thread Baoquan He
iommu->first_device/last_device are needed by function init_iommu_from_acpi() and init_iommu_devices(). So putting the assignment of them in iommu_init_pci() could be late. In this patch put them earlier. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu_in

[PATCH 06/10] iommu/amd: Add functions copy_command_buffer/copy_event_buffer

2015-09-24 Thread Baoquan He
and tail register store an offset from the base address, which point to the next command to be read/written separately. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu_init.c | 37 + drivers/iommu/amd_iommu_types.h | 1 + 2 f

[PATCH 01/10] iommu/amd: Use standard bitmap operation to set bitmap

2015-09-24 Thread Baoquan He
Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 2 +- drivers/iommu/amd_iommu_init.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index f82060e7..0d59f79 100644 --- a/drivers

Re: About amd-iommu support for kdump kernel

2015-09-21 Thread Baoquan He
On 09/21/15 at 03:54pm, Joerg Roedel wrote: > Hi Baoquan, > > On Tue, Sep 15, 2015 at 08:06:06PM +0800, Baoquan He wrote: > > Recently I am free and can try to work out the amd-iommu support for > > kdump kernel. Now I have some plans and draft them into codes and de

Re: About amd-iommu support for kdump kernel

2015-09-22 Thread Baoquan He
On 09/21/15 at 03:54pm, Joerg Roedel wrote: > Hi Baoquan, > > On Tue, Sep 15, 2015 at 08:06:06PM +0800, Baoquan He wrote: > > Recently I am free and can try to work out the amd-iommu support for > > kdump kernel. Now I have some plans and draft them into codes and de

Re: [Patch v2 7/9] iommu/amd: copy old tables and do not update dev tables before driver init

2015-12-12 Thread Baoquan He
Hi Joerg, On 11/27/15 at 12:35pm, Joerg Roedel wrote: > > +++ b/drivers/iommu/amd_iommu.c > > @@ -1992,14 +1992,15 @@ static void do_attach(struct iommu_dev_data > > *dev_data, > > /* Update data structures */ > > dev_data->domain = domain; > > list_add(_data->list, >dev_list); > > -

Re: [Patch v2 2/9] iommu/amd: Detect pre enabled translation

2015-11-30 Thread Baoquan He
On 11/27/15 at 12:03pm, Joerg Roedel wrote: > On Fri, Nov 06, 2015 at 08:10:44PM +0800, Baoquan He wrote: > > Add functions to check whether translation is already enabled in IOMMU. > > > > Signed-off-by: Baoquan He <b...@redhat.com> > > --- > >

Re: [Patch v2 4/9] iommu/amd: add copy_irq_table function

2015-11-30 Thread Baoquan He
On 11/27/15 at 12:13pm, Joerg Roedel wrote: > On Fri, Nov 06, 2015 at 08:10:46PM +0800, Baoquan He wrote: > > +static void copy_irq_table(u16 devid) > > +{ > > + struct irq_remap_table *table = NULL; > > + u16 alias; > > + u64 dte; > > +

Re: [Patch v2 5/9] iommu/amd: Add function copy_dev_tables

2015-11-30 Thread Baoquan He
On 11/27/15 at 12:21pm, Joerg Roedel wrote: > On Fri, Nov 06, 2015 at 08:10:47PM +0800, Baoquan He wrote: > > +static void copy_dev_tables(void) > > +{ > > +u64 entry; > > +u32 lo, hi; > > +phys_addr_t old_devtb_phys; > > +

Re: [Patch v2 6/9] iommu/amd: Add functions copy_command_buffer/copy_event_buffer

2015-11-30 Thread Baoquan He
On 11/27/15 at 12:24pm, Joerg Roedel wrote: > On Fri, Nov 06, 2015 at 08:10:48PM +0800, Baoquan He wrote: > > > > +static void copy_command_buffer(void) > > + > > +static void copy_event_buffer(void) > > +{ > > There is no need to copy any of these buf

Re: [Patch v2 7/9] iommu/amd: copy old tables and do not update dev tables before driver init

2015-11-30 Thread Baoquan He
On 11/27/15 at 12:35pm, Joerg Roedel wrote: > On Fri, Nov 06, 2015 at 08:10:49PM +0800, Baoquan He wrote: > > Signed-off-by: Baoquan He <b...@redhat.com> > > Missing patch description. > > > --- > > drivers/iommu/amd_iommu.c | 19 +-- >

Re: [Patch v2 0/9] Fix AMD IOMMU faults in kdump kernel

2015-11-30 Thread Baoquan He
Hi Joerg, Thanks a lot for reviewing this patchset. On 11/27/15 at 12:38pm, Joerg Roedel wrote: > On Fri, Nov 06, 2015 at 08:10:42PM +0800, Baoquan He wrote: > > This is v2 draft patch set. It mainly functions as the following steps: > > > > 1. Checking if it's in kdump

Re: [Patch v2 3/9] iommu/amd: make several functions globally seen

2015-11-30 Thread Baoquan He
On 11/27/15 at 12:06pm, Joerg Roedel wrote: > On Fri, Nov 06, 2015 at 08:10:45PM +0800, Baoquan He wrote: > > They will be called later when copy old dev/irq tables. It's better to use > > them > > then call iommu_flush_all_caches() since iommu_flush_all_caches() will > &g

Re: [Patch v2 0/9] Fix AMD IOMMU faults in kdump kernel

2015-11-17 Thread Baoquan He
Hi Joerg, Could you please help have a look and give some suggestions on this issue? Or any one else who is familiar with AMD IOMMU have any idea about this? Thanks Baoquan On 11/06/15 at 08:10pm, Baoquan He wrote: > This is v2 draft patch set. It mainly functions as the following steps: >

[Patch v4 0/9] *** Fix kdump failure in system with amd iommu***

2016-05-25 Thread Baoquan He
ned the implementation of vt-d fix done by Joerg and did the AMD IOMMU change similiarly. Baoquan HE (4): iommu/amd: add early_enable_iommu() helper function iommu/amd: copy old trans table from old kernel iommu/amd: Do not initialize dev tables again in kdump iommu/amd: Check the validation of

[Patch v4 1/9] iommu/amd: clean up the cmpxchg64 invocation

2016-05-25 Thread Baoquan He
Change it as it's designed for and keep it consistent with other places. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 5efadad..9

[Patch v4 3/9] iommu/amd: Detect pre enabled translation

2016-05-25 Thread Baoquan He
Add functions to check whether translation is already enabled in IOMMU. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu_init.c | 25 + drivers/iommu/amd_iommu_types.h | 4 2 files changed, 29 insertions(+) diff --git a/drivers

[Patch v4 2/9] iommu/amd: Use standard bitmap operation to set bitmap

2016-05-25 Thread Baoquan He
It will be more readable then the old setting. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 2 +- drivers/iommu/amd_iommu_init.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_i

[Patch v4 9/9] iommu/amd: Check the validation of irq table and domain id

2016-05-25 Thread Baoquan He
From: Baoquan HE <b...@dhcp-129-10.nay.redhat.com> If not valid just skip reserving the old domain id. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 4 drivers/iommu/amd_iommu_init.c | 5 +++-- drivers/iommu/amd_iommu_types.h | 5 + 3 f

[Patch v4 4/9] iommu/amd: add early_enable_iommu() helper function

2016-05-25 Thread Baoquan He
From: Baoquan HE <b...@dhcp-129-10.nay.redhat.com> This can make later kdump change easier. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu_init.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/d

[Patch v4 7/9] iommu/amd: copy old trans table from old kernel

2016-05-25 Thread Baoquan He
From: Baoquan HE <b...@dhcp-129-10.nay.redhat.com> Here several things need be done: 1) Initialize amd_iommu_dev_table because it was set several times since kdump kernel reboot. We don't need the set because we will copy the content from old kernel. 2) Re-enable event/cmd buffer 3) I

[Patch v4 6/9] iommu/amd: Add function copy_dev_tables

2016-05-25 Thread Baoquan He
be reserved in order to avoid touch the old translation tables. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 2 +- drivers/iommu/amd_iommu_init.c | 38 ++ drivers/iommu/amd_iommu_types.h | 1 + 3 files changed, 40 insertions

[Patch v4 8/9] iommu/amd: Do not initialize dev tables again in kdump

2016-05-25 Thread Baoquan He
From: Baoquan HE <b...@dhcp-129-10.nay.redhat.com> The init should have been done in normal kernel, skip it in kdump kernel. And clean up the function comments. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu_init.c | 9 ++--- 1 file changed, 6 inse

[Patch v4 5/9] iommu/amd: Define bit fields for DTE particularly

2016-05-25 Thread Baoquan He
In amd-vi spec several bits of IO PTE fields and DTE fields are similar so that both of them can share the same MACRO definition. However defining their respecitve bit fields can make code more read-able. So do it in this patch. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers

Re: [Patch v4 0/9] *** Fix kdump failure in system with amd iommu***

2016-05-25 Thread Baoquan He
Hi Joerg, Attachments are console log of normal kernel and kdump kernel on a test machine at my hand, and the related information of lspci -vt and lspci -vvv. Before I tried to defer the calling of set_dte_entry() until the device driver try to call __map_single() to really allocate coherent

Re: [Patch v4 3/9] iommu/amd: Detect pre enabled translation

2016-05-29 Thread Baoquan He
On 05/28/16 at 08:49pm, Wan Zongshun wrote: > > > Original Message > >@@ -1101,6 +1121,11 @@ static int __init init_iommu_one(struct amd_iommu > >*iommu, struct ivhd_header *h) > > > > iommu->int_enabled = false; > > > >+init_translation_status(iommu); > >+ > >+if

Re: [Patch v4 3/9] iommu/amd: Detect pre enabled translation

2016-05-29 Thread Baoquan He
On 05/30/16 at 11:24am, Baoquan He wrote: > On 05/28/16 at 08:49pm, Wan Zongshun wrote: > In fact I am still debugging and trying to figure out what need be done > further to stop the IO_PAGE_FAULT happened on ethernet network card. I > kept changing code and adjust the patches. Up to

Re: [Patch v4 6/9] iommu/amd: Add function copy_dev_tables

2016-05-29 Thread Baoquan He
On 05/28/16 at 09:08pm, Wan Zongshun wrote: > >+static int copy_dev_tables(void) > >+{ > >+u64 entry; > >+u32 lo, hi, devid; > >+phys_addr_t old_devtb_phys; > >+struct dev_table_entry *old_devtb; > >+u16 dom_id, dte_v; > >+struct amd_iommu *iommu; > >+static int copied;

Re: [Patch v4 9/9] iommu/amd: Check the validation of irq table and domain id

2016-05-29 Thread Baoquan He
On 05/28/16 at 09:30pm, Wan Zongshun wrote: > > > Original Message > >From: Baoquan HE <b...@dhcp-129-10.nay.redhat.com> > >diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c > >index f3bd7fd..40c4a05 100644 > >--- a/dri

Re: Can't boot new 4.4 kernel with IOMMU enabled

2016-01-13 Thread Baoquan He
On 01/13/16 at 09:42am, Mark Hounschell wrote: > First, attached are the 2 lspci outputs you asked for. > > After the patch I was still unable to bring the system up but it was > much better. 2 of the 8 Sata disks do not come up. If I remove those > from my fstab the box comes up with the patch.

Re: [Patch v3 00/12] Fix AMD IOMMU faults in kdump kernel

2016-01-26 Thread Baoquan He
CC more people who is interested On 01/26/16 at 06:29pm, Baoquan He wrote: > This is v3 post. Now the situation is patchset test on amd-vi v2 machine > is OK, however still some IO_PAGE_FAULT warning is printed out on v1 > machine. The log will be attached later. > > I didn't

[Patch v3 06/12] iommu/amd: Clean up the useless IOMMU_PTE_U/IOMMU_PTE_FC

2016-01-26 Thread Baoquan He
In amd-vi spec bit[60:58] are only used to store the bit[14:12] of GCR3. No any other useage is found in several versions of amd-vi spec. So remove them in this patch. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 6 +++--- drivers/iommu/amd_iommu_types

[Patch v3 09/12] iommu/amd: Don't update the domain information to iommu dev before dev init

2016-01-26 Thread Baoquan He
Don't update the domain information to the related DTE entry before iommu dev initialization. For this a new member 'domain_updated' is added to iommu_dev_data. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 14 +- 1 file changed, 9 insertions

[Patch v3 05/12] iommu/amd: change IOMMU_PTE_P to IOMMU_PTE_V

2016-01-26 Thread Baoquan He
In amd-vi spec the name of bit0 in DTE is V. But in code it's defined as IOMMU_PTE_P. Here change it to IOMMU_PTE_V to make it be consistent with spec. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 10 +- drivers/iommu/amd_iommu_types.h | 6 +++

[Patch v3 03/12] iommu/amd: move dte irq macro defitions to amd_iommu_types.h

2016-01-26 Thread Baoquan He
These macro definitions are also needed by irq table copy function later, so move them to amd_iommu_types.h. Signed-off-by: Baoquan He <b...@redhat.com> --- drivers/iommu/amd_iommu.c | 4 drivers/iommu/amd_iommu_types.h | 5 + 2 files changed, 5 insertions(+), 4 deletions(-)

  1   2   3   >