Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752948AbdHIIeg (ORCPT ); Wed, 9 Aug 2017 04:34:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41576 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752919AbdHIIe0 (ORCPT ); Wed, 9 Aug 2017 04:34:26 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 88490883A5 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=bhe@redhat.com From: Baoquan He To: jroedel@suse.de Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH v10 12/12] iommu/amd: Disable iommu only if amd_iommu=off is specified Date: Wed, 9 Aug 2017 16:33:44 +0800 Message-Id: <1502267624-7066-13-git-send-email-bhe@redhat.com> In-Reply-To: <1502267624-7066-1-git-send-email-bhe@redhat.com> References: <1502267624-7066-1-git-send-email-bhe@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 09 Aug 2017 08:34:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1054 Lines: 31 It's ok to disable iommu early in normal kernel or in kdump kernel when amd_iommu=off is specified. While we should not disable it in kdump kernel when on-flight dma is still on-going. Signed-off-by: Baoquan He --- v9->v10: Change to call disable_iommus() in normal kernel and the case that amd_iommu=off is set in kdump kernel. Otherwise if in kdump kernel but amd_iommu=off is not specified, we can just keep it as it is in 1st kernel. 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 88e7a6e950ae..c7d03251c80a 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -2499,7 +2499,8 @@ static int __init early_amd_iommu_init(void) goto out; /* Disable any previously enabled IOMMUs */ - disable_iommus(); + if (!is_kdump_kernel() || amd_iommu_disabled) + disable_iommus(); if (amd_iommu_irq_remap) amd_iommu_irq_remap = check_ioapic_information(); -- 2.5.5