Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754295Ab3DVHMP (ORCPT ); Mon, 22 Apr 2013 03:12:15 -0400 Received: from mail-oa0-f42.google.com ([209.85.219.42]:41001 "EHLO mail-oa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752799Ab3DVHMO (ORCPT ); Mon, 22 Apr 2013 03:12:14 -0400 MIME-Version: 1.0 In-Reply-To: <5174E185.1040806@jp.fujitsu.com> References: <1366441080-5937-1-git-send-email-wei@aristanetworks.com> <5174CB26.9060908@jp.fujitsu.com> <5174E185.1040806@jp.fujitsu.com> From: Wei Hu Date: Mon, 22 Apr 2013 00:11:33 -0700 Message-ID: Subject: Re: [PATCH 1/1] intel-iommu: Disable DMA Remapping when intel_iommu=off To: Takao Indoh Cc: dwmw2 , iommu , linux-kernel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2008 Lines: 50 On Mon, Apr 22, 2013 at 12:06 AM, Takao Indoh wrote: > (2013/04/22 15:50), Wei Hu wrote: >> On Sun, Apr 21, 2013 at 10:31 PM, Takao Indoh >> wrote: >>> (2013/04/20 15:58), Wei Hu wrote: >>>> On a VT-d capable machine Linux will enable IOMMU by default. If it >>>> then kexec's a second kernel with intel_iommu=off, this second kernel >>>> will leave the DMA remapping engine on with no code handling it. The >>>> symptom is at least USB and SATA drives stop working. This patch fixes >>>> the problem by always disabling DMA remapping when intel_iommu=off. >>> >>> Even when second kernel boots up with intel_iommu=on, dma-remapping need >>> to be disabled as well before it is initialized and enabled again in >>> init_dmars(). So, how about something like this? >>> >>> for_each_drhd_unit(drhd) { >>> struct dmar_drhd_unit *drhd; >>> if (drhd->ignored) >>> continue; >>> >>> iommu = drhd->iommu; >>> if (iommu->gcmd & DMA_GCMD_TE) >>> iommu_disable_translation(iommu); >>> } >>> >>> Note, if you agree above code and fix your patch like this, you need >>> additinal fix to set iommu->gcmd flag sinse gcmd is always zero here. >>> See first hunk of this patch. >>> https://lkml.org/lkml/2013/3/20/707 >> >> Thanks for your reply. I reviewed your patch. Are you suggesting >> keeping your change to dmar.c, and moving your change to intel-iommu.c >> (i.e. the code you just showed) up after the call to >> dmar_table_init()? >> > > Yes, exactly. > > Thanks, > Takao Indoh > Sounds great. If you want to make the change and get your patch accepted that's fine with me. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/