Re: [PATCH v7 00/12] Fix kdump faults on system with amd iommu

2016-12-23 Thread Baoquan He
Hi Joerg, Ping! Could you help review this version? Not sure this could catch up to v4.10 merging. Thanks Baoqaun On 11/25/16 at 01:13pm, Baoquan He wrote: > This is v7 post. > > The principle of the fix is similar to intel iommu. Just defer the assignment > of device to doma

[PATCH v7 RESEND 02/12] iommu/amd: add several helper function

2017-01-01 Thread Baoquan He
Move per iommu enabling code into a wrapper function early_enable_iommu(). This can make later kdump change easier. And also add iommu_disable_command_buffer and iommu_disable_event_buffer for later usage. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 42

[PATCH v7 RESEND 01/12] iommu/amd: Detect pre enabled translation

2017-01-01 Thread Baoquan He
Add functions to check whether translation is already enabled in IOMMU. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 25 + drivers/iommu/amd_iommu_proto.h | 1 + drivers/iommu/amd_iommu_types.h | 4 3 files changed, 30 insertions(+) diff --git

[PATCH v7 RESEND 05/12] iommu/amd: copy old trans table from old kernel

2017-01-01 Thread Baoquan He
, and detect and enable guest vapic. - Flush all caches Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 51 -- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index

[PATCH v7 RESEND 04/12] iommu/amd: Add function copy_dev_tables

2017-01-01 Thread Baoquan He
. And define MACRO DEV_DOMID_MASK to replace magic number 0xULL because it need be reused in copy_dev_tables. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 2 +- drivers/iommu/amd_iommu_init.c | 55 + drivers/iommu/amd_iommu_types.h

[PATCH v7 RESEND 00/12] Fix kdump faults on system with amd iommu

2017-01-01 Thread Baoquan He
. device-table pointer update is split up into two 32bit writes in the IOMMU hardware. So updating it while the IOMMU is enabled could have some nasty side effects. Baoquan He (12): iommu/amd: Detect pre enabled translation iommu/amd: add several helper function iommu/amd: Define bi

[PATCH v7 RESEND 03/12] iommu/amd: Define bit fields for DTE particularly

2017-01-01 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 --- drivers/iommu/amd_iommu.c | 8

[PATCH v7 RESEND 06/12] iommu: Add is_attach_deferred call-back to iommu-ops

2017-01-01 Thread Baoquan He
This new call-back will be used to check if the domain attach need be deferred for now. If yes, the domain attach/detach will return directly. Suggested-by: Joerg Roedel Signed-off-by: Baoquan He --- drivers/iommu/iommu.c | 8 include/linux/iommu.h | 1 + 2 files changed, 9 insertions

[PATCH v7 RESEND 07/12] iommu/amd: Use is_attach_deferred call-back

2017-01-01 Thread Baoquan He
Implement call-back is_attach_deferred and use it to defer the domain attach from iommu driver init to device driver init when iommu is pre-enabled in kdump kernel. Suggested-by: Joerg Roedel Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 23 ++- 1 file changed

[PATCH v7 RESEND 10/12] iommu/amd: Allocate memory below 4G for dev table if translation pre-enabled

2017-01-01 Thread Baoquan He
is is to allocate the device-table below 4GB if translation is pre-enabled in kdump kernel. If allocation failed, still use the old one. Suggested-by: Joerg Roedel Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 12 1 file changed, 12 insertions(+) diff --git a/dr

[PATCH v7 RESEND 12/12] iommu/amd: Clear out the GV flag when handle deferred domain attach

2017-01-01 Thread Baoquan He
When handle deferred domain attach, we need check if the domain is v2. If not, should try to clear out the GV flag which could be copied from the old device table entry. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 18 +- 1 file changed, 17 insertions(+), 1 deletion

[PATCH v7 RESEND 09/12] iommu: Assign the direct mapped domain to group->domain

2017-01-01 Thread Baoquan He
In iommu_request_dm_for_dev(), devices of group have all been attached to newly created direct mapped domain. We should store the domain into group->domain so that it works for iommu_get_domain_for_dev() and get_domain(). Signed-off-by: Baoquan He --- drivers/iommu/iommu.c | 1 + 1 file chan

[PATCH v7 RESEND 11/12] iommu/amd: Don't copy GCR3 table root pointer

2017-01-01 Thread Baoquan He
s are recoverable for the device and we should not allow the device to change old-kernels data when we don't have to. Suggested-by: Joerg Roedel Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 26 +++--- drivers/iommu/amd_iommu_init.c | 11 +++ dri

[PATCH v7 RESEND 08/12] iommu/amd: Add sanity check of irq remap information of old dev table entry

2017-01-01 Thread Baoquan He
Firstly split the dev table entry copy into address translation part and irq remapping part. Because these two parts could be configured to be available indepentently. Secondly check if IntCtl and IntTabLen are 10b and 1000b if they are set. Signed-off-by: Baoquan He --- drivers/iommu

Re: [PATCH] iommu/vt-d: Make sure IOMMUs are off when intel_iommu=off

2017-04-11 Thread Baoquan He
Hi Joerg, Do you plan to merge this one as urgent? There's bug created about this issue on rhel, it would be great if it can be put in next or merged so that we can back port it. Thanks Baoquan On 03/29/17 at 05:00pm, Joerg Roedel wrote: > From: Joerg Roedel > > When booting into a kexec kern

Re: [PATCH] iommu/vt-d: Make sure IOMMUs are off when intel_iommu=off

2017-04-12 Thread Baoquan He
On 04/12/17 at 11:54pm, Joerg Roedel wrote: > Hi Baoquan, > > On Wed, Apr 12, 2017 at 09:40:56AM +0800, Baoquan He wrote: > > Do you plan to merge this one as urgent? > > > > There's bug created about this issue on rhel, it would be great if it > > can b

Re: [PATCH] iommu/amd: Suppress IO_PAGE_FAULTs in kdump kernel

2017-06-23 Thread Baoquan He
Hi dear Joerg, On 06/16/17 at 10:15am, Joerg Roedel wrote: > From: Joerg Roedel > > When booting into a kdump kernel, suppress IO_PAGE_FAULTs by > default for all devices. But allow the faults again when a > domain is assigned to a device. I have two bugs at hand reported by customer, saying th

Re: [PATCH] iommu/amd: Suppress IO_PAGE_FAULTs in kdump kernel

2017-06-23 Thread Baoquan He
Hi Joerg, On 06/23/17 at 04:57pm, Baoquan He wrote: > Hi dear Joerg, > > On 06/16/17 at 10:15am, Joerg Roedel wrote: > > From: Joerg Roedel > > > > When booting into a kdump kernel, suppress IO_PAGE_FAULTs by > > default for all devices. But allow the faults ag

Re: [PATCH] iommu/amd: Suppress IO_PAGE_FAULTs in kdump kernel

2017-06-26 Thread Baoquan He
On 06/26/17 at 12:07pm, Joerg Roedel wrote: > Hi Baoquan, > > On Fri, Jun 23, 2017 at 07:43:10PM +0800, Baoquan He wrote: > > Do you think whether it's necessary to continue my kdump fix of amd iommu > > patchset? Seems my last post was in Jan this year. I know you a

Re: [PATCH] iommu/amd: Suppress IO_PAGE_FAULTs in kdump kernel

2017-07-20 Thread Baoquan He
Hi Joerg, On 06/26/17 at 12:07pm, Joerg Roedel wrote: > Hi Baoquan, > > On Fri, Jun 23, 2017 at 07:43:10PM +0800, Baoquan He wrote: > > Do you think whether it's necessary to continue my kdump fix of amd iommu > > patchset? Seems my last post was in Jan this year. I kno

[PATCH v8 01/13] iommu/amd: Detect pre enabled translation

2017-07-21 Thread Baoquan He
Add functions to check whether translation is already enabled in IOMMU. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 24 drivers/iommu/amd_iommu_proto.h | 1 + drivers/iommu/amd_iommu_types.h | 4 3 files changed, 29 insertions(+) diff --git a

[PATCH v8 00/13] Fix the on-flight DMA issue on system with amd iommu

2017-07-21 Thread Baoquan He
AGE_FAULT can't be seen anymore. Below is link of v5 post. https://lists.linuxfoundation.org/pipermail/iommu/2016-September/018527.html Baoquan He (12): iommu/amd: Detect pre enabled translation iommu/amd: add several helper functions Revert "iommu/amd: Suppress IO_PAGE_FA

[PATCH v8 03/13] Revert "iommu/amd: Suppress IO_PAGE_FAULTs in kdump kernel"

2017-07-21 Thread Baoquan He
This reverts commit 54bd63570484167cb13edf81e31fff107b879981. We still need the IO_PAGE_FAULT message to warn error after the issue of on-flight dma in kdump kernel is fixed. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 3 +-- drivers/iommu/amd_iommu_init.c | 9

[PATCH v8 02/13] iommu/amd: add several helper functions

2017-07-21 Thread Baoquan He
Move single iommu enabling codes into a wrapper function early_enable_iommu(). This can make later kdump change easier. And also add iommu_disable_command_buffer and iommu_disable_event_buffer for later usage. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 42

[PATCH v8 04/13] iommu/amd: Define bit fields for DTE particularly

2017-07-21 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 them respectively can make code more read-able. Do it now. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 8 drivers

[PATCH v8 05/13] iommu/amd: Add function copy_dev_tables()

2017-07-21 Thread Baoquan He
, it can be reused in copy_dev_tables(). Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 2 +- drivers/iommu/amd_iommu_init.c | 55 + drivers/iommu/amd_iommu_types.h | 1 + 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a

[PATCH v8 06/13] iommu/amd: copy old trans table from old kernel

2017-07-21 Thread Baoquan He
, and detect and enable guest vapic. - Flush all caches Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 51 -- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index

[PATCH v8 11/13] iommu/amd: Don't copy GCR3 table root pointer

2017-07-21 Thread Baoquan He
s are recoverable for the device and we should not allow the device to change old-kernels data when we don't have to. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 28 +++- drivers/iommu/amd_iommu_init.c | 11 +++ drivers/iommu/amd_iommu_pr

[PATCH v8 12/13] iommu/amd: Clear out the GV flag when handle deferred domain attach

2017-07-21 Thread Baoquan He
When handle deferred domain attach, we need check if the domain is v2. If not, should try to clear out the GV flag which could be copied from the old device table entry. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 18 +- 1 file changed, 17 insertions(+), 1 deletion

[PATCH v8 13/13] iommu/amd: Disable iommu only if amd_iommu=off is specified

2017-07-21 Thread Baoquan He
From: root It's ok to disable iommu in normal kernel. While there's no need to disable it in kdump kernel after the on-flight dma issue has heen fixed. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH v8 09/13] iommu/amd: Use is_attach_deferred call-back

2017-07-21 Thread Baoquan He
Implement call-back is_attach_deferred and use it to defer the domain attach from iommu driver init to device driver init when iommu is pre-enabled in kdump kernel. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion

[PATCH v8 07/13] iommu/amd: Do sanity check for irq remap of old dev table entry

2017-07-21 Thread Baoquan He
Firstly split the dev table entry copy into address translation part and irq remapping part. Because these two parts could be enabled independently. Secondly check if IntCtl and IntTabLen are 10b and 1000b if they are set. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 5

[PATCH v8 08/13] iommu: Add is_attach_deferred call-back to iommu-ops

2017-07-21 Thread Baoquan He
This new call-back will be used to check if the domain attach need be deferred for now. If yes, the domain attach/detach will return directly. Signed-off-by: Baoquan He --- drivers/iommu/iommu.c | 8 include/linux/iommu.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers

[PATCH v8 10/13] iommu/amd: Allocate memory below 4G for dev table if translation pre-enabled

2017-07-21 Thread Baoquan He
is is to allocate the device-table below 4GB if translation is pre-enabled in kdump kernel. If allocation failed, still use the old one. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/iommu/amd_iommu_init.c b/dr

Re: [PATCH v8 11/13] iommu/amd: Don't copy GCR3 table root pointer

2017-07-23 Thread Baoquan He
the system] > > url: > https://github.com/0day-ci/linux/commits/Baoquan-He/Fix-the-on-flight-DMA-issue-on-system-with-amd-iommu/20170724-060048 > base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next > config: x86_64-randconfig-x005-201730 (attached as .confi

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

2013-09-23 Thread Baoquan He
mu_init(void) > { > int ret = 0; > @@ -3687,8 +3738,11 @@ int __init intel_iommu_init(void) > continue; > > iommu = drhd->iommu; > - if (iommu->gcmd & DMA_GCMD_TE) > + if (iommu->gcmd & DMA_GCMD_TE) { > + if

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 en

Re: [RFC PATCH] Crashdump Accepting Active IOMMU

2013-11-20 Thread Baoquan He
Hi Bill, I have tested this prototype patch on hp z420, it works very well. Looking forward to your formal patch set. I can help test and review. Baoquan Thanks On 11/18/13 at 11:30pm, Sumner, William wrote: > Thank you for testing this RFC patch. It is great to have confirmation that > the co

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 wou

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; > + > +

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, > > +

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

2014-01-24 Thread Baoquan He
all patches in the > set. > 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); > > v1->v2: > The following se

Re: hpsa driver bug crack kernel down!

2014-04-10 Thread Baoquan He
014-04-09 at 16:10 -0700, James Bottomley wrote: > >>>>> On Wed, 2014-04-09 at 16:08 -0700, James Bottomley wrote: > >>>>>> [+linux-scsi] > >>>>>> On Wed, 2014-04-09 at 15:49 -0700, Davidlohr Bueso wrote: > >>>>>>> On Wed, 20

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

Re: hpsa driver bug crack kernel down!

2014-04-10 Thread Baoquan He
Wed, 2014-04-09 at 16:08 -0700, James Bottomley wrote: > >>>>>> [+linux-scsi] > >>>>>> On Wed, 2014-04-09 at 15:49 -0700, Davidlohr Bueso wrote: > >>>>>>> On Wed, 2014-04-09 at 10:39 +0800, Baoquan He wrote: > >>>>>&g

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 b94e4117f8c4ffb5

Re: [PATCH] swiotlb: Allow swiotlb to live at pre-defined address

2020-03-30 Thread Baoquan He
On 03/30/20 at 10:42pm, Alexander Graf wrote: > > > On 30.03.20 15:40, Konrad Rzeszutek Wilk wrote: > > > > > > > > On Mon, Mar 30, 2020 at 02:06:01PM +0800, Kairui Song wrote: > > > On Sat, Mar 28, 2020 at 7:57 PM Dave Young wrote: > > > > > > > > On 03/26/20 at 05:29pm, Alexander Graf wrot

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

2014-10-22 Thread Baoquan He
Hi Zhenhua, I tested your latest patch on 3.18.0-rc1+, there are still some dmar errors. I remember it worked well with Bill's original patchset. 0console [earlya[0.00] allocate tes of page_cg 'a ong[ 0.00] tsc: Fast TSC calibration using PIT 0031] Calibrating delay loop (skipped),

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 th

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? > > Tha

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

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 drive

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

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 j

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 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&#

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

2015-01-07 Thread Baoquan He
ntr-remap fault seen any more, good job! 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 > >>differen

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

2015-01-12 Thread Baoquan He
t; mem. > > 5. New functions to save updated root entry table and irte table. > > 6. Use intel_unmap to unmap the old dma; > > 7. Allocate new pages while driver is being loaded. > > > >Changelog[v4]: > > 1. Cut off the patches that move some define

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 v8 06/10] iommu/vt-d: datatypes and functions used for kdump

2015-01-14 Thread Baoquan He
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 dmar_drhd_unit *drhd, > + int g_num_of_iommus) The argument g_num_of_iommus is t

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

2015-01-14 Thread Baoquan He
in next version; Oh, 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 f

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

2015-04-04 Thread Baoquan He
On 04/03/15 at 05:21pm, Dave Young wrote: > On 04/03/15 at 05:01pm, Li, ZhenHua wrote: > > Hi Dave, > > > > There may be some possibilities that the old iommu data is corrupted by > > some other modules. Currently we do not have a better solution for the > > dmar faults. > > > > But I think when

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 writi

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

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 s

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

2016-05-24 Thread Baoquan He
Change it as it's designed for and keep it consistent with other places. Signed-off-by: Baoquan He --- 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..9ec7cad 100644

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

2016-05-24 Thread Baoquan He
2)Learned 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 vali

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

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

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

2016-05-24 Thread Baoquan He
It will be more readable then the old setting. Signed-off-by: Baoquan He --- 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 9ec7cad

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

2016-05-24 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 --- drivers/iommu/amd_iommu.c | 10

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

2016-05-24 Thread Baoquan He
reserved in order to avoid touch the old translation tables. Signed-off-by: Baoquan He --- 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(+), 1 deletion

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

2016-05-24 Thread Baoquan He
From: Baoquan HE 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 --- drivers/iommu/amd_iommu_init.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/iommu

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

2016-05-24 Thread Baoquan He
From: Baoquan HE This can make later kdump change easier. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 9e1dfcb

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

2016-05-24 Thread Baoquan He
From: Baoquan HE 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) Install the DTE table to reg 4)

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

2016-05-24 Thread Baoquan He
From: Baoquan HE If not valid just skip reserving the old domain id. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 4 drivers/iommu/amd_iommu_init.c | 5 +++-- drivers/iommu/amd_iommu_types.h | 5 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a

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 memor

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

2016-05-25 Thread Baoquan He
Sorry, log of 'lspci -vvv' is not attatched correclty. Re-attach it here. 00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 30h-3fh) Processor Root Complex Subsystem: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 30h-3fh) Processor Root Complex Co

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 > >diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c > >index f3bd7fd..40c4a05 100644 > >--- a/drivers/iommu/amd_iommu.c > >+++ b/d

[PATCH 2/4] iommu/amd: Use standard bitmap operation to set bitmap

2016-09-15 Thread Baoquan He
It will be more readable and safer than the old setting. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 59741ea..3e810c6 100644 --- a/drivers

[PATCH 1/4] iommu/amd: clean up the cmpxchg64 invocation

2016-09-15 Thread Baoquan He
Change it as it's designed for and keep it consistent with other places. Signed-off-by: Baoquan He --- 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 96de97a..160fc6a 100644

[PATCH 3/4] iommu/amd: Free domain id when free a domain of struct dma_ops_domain

2016-09-15 Thread Baoquan He
The current code missed freeing domain id when free a domain of struct dma_ops_domain. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 160fc6a..a9f78c2 100644 --- a/drivers

[PATCH 0/4] iommu/amd: Clean up patches

2016-09-15 Thread Baoquan He
These were found out when I tried to fix the kdump failure on system with AMD iommu. Pack them into this patchset since they are not related to the kdump issue and each other. Baoquan He (4): iommu/amd: clean up the cmpxchg64 invocation iommu/amd: Use standard bitmap operation to set bitmap

[PATCH 4/4] iommu/amd: No need to wait iommu completion if no dte irq entry change

2016-09-15 Thread Baoquan He
This is a clean up. In get_irq_table() only if DTE entry is changed iommu_completion_wait() need be called. Otherwise no need to do it. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b

[PATCH v5 1/8] iommu/amd: Detect pre enabled translation

2016-09-15 Thread Baoquan He
Add functions to check whether translation is already enabled in IOMMU. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 25 + drivers/iommu/amd_iommu_proto.h | 1 + drivers/iommu/amd_iommu_types.h | 4 3 files changed, 30 insertions(+) diff --git

[PATCH v5 2/8] iommu/amd: add early_enable_iommu() wrapper function

2016-09-15 Thread Baoquan He
Move per iommu enabling code into a wrapper function early_enable_iommu(). This can make later kdump change easier. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/iommu

[PATCH v5 5/8] iommu/amd: copy old trans table from old kernel

2016-09-15 Thread Baoquan He
caches Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 44 +++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index ce49641..47a8fc9 100644 --- a/drivers/iommu

[PATCH v5 3/8] iommu/amd: Define bit fields for DTE particularly

2016-09-15 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 --- drivers/iommu/amd_iommu.c | 8

[PATCH v5 6/8] iommu/amd: Do not re-enable dev table entries in kdump

2016-09-15 Thread Baoquan He
This enabling should have been done in normal kernel. It's unnecessary to enable it again in kdump kernel. And clean up the function comments of init_device_table_dma. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 10 +++--- 1 file changed, 7 insertions(+), 3 dele

[PATCH v5 4/8] iommu/amd: Add function copy_dev_tables

2016-09-15 Thread Baoquan He
occupied in 1st kernel need be reserved to avoid touching the old io-page tables so that on-flight DMA can continue looking up. And define MACRO DEV_DOMID_MASK to replace magic number 0xULL because it need be reused in copy_dev_tables. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c

[PATCH v5 7/8] iommu/amd: Don't update domain info to dte entry at iommu init stage

2016-09-15 Thread Baoquan He
;t be updated to dte entry. We should wait until device driver init stage. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index fcb69ff..6c37300 100644 --- a/drivers/

[PATCH v5 8/8] iommu/amd: Update domain into to dte entry during device driver init

2016-09-15 Thread Baoquan He
es to. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 21 + 1 file changed, 21 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 6c37300..00b64ee 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -2310,6 +23

[PATCH v5 0/8] Fix kdump faults on system with amd iommu

2016-09-15 Thread Baoquan He
the pte_root to dev table entry to device driver init stage. Baoquan He (8): iommu/amd: Detect pre enabled translation iommu/amd: add early_enable_iommu() wrapper function iommu/amd: Define bit fields for DTE particularly iommu/amd: Add function copy_dev_tables iommu/amd: copy old trans

[PATCH RESEND 4/4] iommu/amd: No need to wait iommu completion if no dte irq entry change

2016-09-19 Thread Baoquan He
This is a clean up. In get_irq_table() only if DTE entry is changed iommu_completion_wait() need be called. Otherwise no need to do it. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b

Re: [PATCH 0/4] iommu/amd: Clean up patches

2016-09-19 Thread Baoquan He
On 09/19/16 at 04:20pm, Joerg Roedel wrote: > Hi Baoquan, > > On Thu, Sep 15, 2016 at 04:50:49PM +0800, Baoquan He wrote: > > These were found out when I tried to fix the kdump failure on system > > with AMD iommu. Pack them into this patchset since they are not related >

Re: [PATCH RESEND 4/4] iommu/amd: No need to wait iommu completion if no dte irq entry change

2016-09-20 Thread Baoquan He
On 09/20/16 at 11:56am, Joerg Roedel wrote: > On Tue, Sep 20, 2016 at 09:05:34AM +0800, Baoquan He wrote: > > This is a clean up. In get_irq_table() only if DTE entry is changed > > iommu_completion_wait() need be called. Otherwise no need to do it. > > > >

Re: [PATCH v5 4/8] iommu/amd: Add function copy_dev_tables

2016-09-21 Thread Baoquan He
Hi Joerg, Thanks for your reviewing and great suggestion! On 09/20/16 at 01:58pm, Joerg Roedel wrote: > Hi Baoquan, > > On Thu, Sep 15, 2016 at 11:03:22PM +0800, Baoquan He wrote: > > +static int copy_dev_tables(void) > > +{ > > + u64 entry; > > + u32 l

Re: [PATCH v5 5/8] iommu/amd: copy old trans table from old kernel

2016-09-21 Thread Baoquan He
On 09/20/16 at 02:40pm, Joerg Roedel wrote: > On Thu, Sep 15, 2016 at 11:03:23PM +0800, Baoquan He wrote: > > Here several things need be done: > > 1) If iommu is pre-enabled in a normal kernel, just disable it and print > >warning. > > 2) If failed to copy dev table

  1   2   3   4   >