From: Takao Indoh <indou.takao-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
To: wei-BGArkANP9klv6pq1l3V1OdBPR1lH4CV8@public.gmane.org
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/1] intel-iommu: Disable DMA Remapping when intel_iommu=off
Date: Mon, 22 Apr 2013 16:06:45 +0900 [thread overview]
Message-ID: <5174E185.1040806@jp.fujitsu.com> (raw)
In-Reply-To: <CANwcMEZF+ehPeFuucRqcKSiNNoXL6bDy+GTHBHYjr3DfoZY7vg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
(2013/04/22 15:50), Wei Hu wrote:
> On Sun, Apr 21, 2013 at 10:31 PM, Takao Indoh
> <indou.takao-+CUm20s59erQFUHtdCDX3A@public.gmane.org> 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
WARNING: multiple messages have this Message-ID (diff)
From: Takao Indoh <indou.takao@jp.fujitsu.com>
To: wei@aristanetworks.com
Cc: dwmw2@infradead.org, iommu@lists.linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] intel-iommu: Disable DMA Remapping when intel_iommu=off
Date: Mon, 22 Apr 2013 16:06:45 +0900 [thread overview]
Message-ID: <5174E185.1040806@jp.fujitsu.com> (raw)
In-Reply-To: <CANwcMEZF+ehPeFuucRqcKSiNNoXL6bDy+GTHBHYjr3DfoZY7vg@mail.gmail.com>
(2013/04/22 15:50), Wei Hu wrote:
> On Sun, Apr 21, 2013 at 10:31 PM, Takao Indoh
> <indou.takao@jp.fujitsu.com> 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
next prev parent reply other threads:[~2013-04-22 7:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-20 6:58 [PATCH 1/1] intel-iommu: Disable DMA Remapping when intel_iommu=off Wei Hu
[not found] ` <1366441080-5937-1-git-send-email-wei-BGArkANP9klv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2013-04-22 5:31 ` Takao Indoh
2013-04-22 5:31 ` Takao Indoh
2013-04-22 6:50 ` Wei Hu
[not found] ` <CANwcMEZF+ehPeFuucRqcKSiNNoXL6bDy+GTHBHYjr3DfoZY7vg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-22 7:06 ` Takao Indoh [this message]
2013-04-22 7:06 ` Takao Indoh
2013-04-22 7:11 ` Wei Hu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5174E185.1040806@jp.fujitsu.com \
--to=indou.takao-+cum20s59erqfuhtdcdx3a@public.gmane.org \
--cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=wei-BGArkANP9klv6pq1l3V1OdBPR1lH4CV8@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.