From: Jacob Pan <jacob.jun.pan@linux.intel.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org, Joerg Roedel <jroedel@suse.de>,
David Woodhouse <dwmw2@infradead.org>,
linux-kernel@vger.kernel.org, jacob.jun.pan@linux.intel.com
Subject: Re: [PATCH] iommu/vt-d: Make sure IOMMUs are off when intel_iommu=off
Date: Wed, 29 Mar 2017 08:51:53 -0700 [thread overview]
Message-ID: <20170329085153.5d215d44@jacob-builder> (raw)
In-Reply-To: <1490799639-15965-1-git-send-email-joro@8bytes.org>
On Wed, 29 Mar 2017 17:00:39 +0200
Joerg Roedel <joro@8bytes.org> wrote:
> From: Joerg Roedel <jroedel@suse.de>
>
> When booting into a kexec kernel with intel_iommu=off, and
> the previous kernel had intel_iommu=on, the IOMMU hardware
> is still enabled and gets not disabled by the new kernel.
>
> This causes the boot to fail because DMA is blocked by the
> hardware. Disable the IOMMUs when we find it enabled in the
> kexec kernel and boot with intel_iommu=off.
>
> Signed-off-by: Joerg Roedel <jroedel@suse.de>
> ---
> drivers/iommu/intel-iommu.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> index d412a31..1662288 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -4730,6 +4730,15 @@ static int intel_iommu_cpu_dead(unsigned int
> cpu) return 0;
> }
>
> +static void intel_disable_iommus(void)
> +{
> + struct intel_iommu *iommu = NULL;
> + struct dmar_drhd_unit *drhd;
> +
> + for_each_iommu(iommu, drhd)
> + iommu_disable_translation(iommu);
should we also disable IR here? i.e.
iommu_disable_irq_remapping(iommu);
> +}
> +
> static inline struct intel_iommu *dev_to_intel_iommu(struct device
> *dev) {
> return container_of(dev, struct intel_iommu, iommu.dev);
> @@ -4840,8 +4849,15 @@ int __init intel_iommu_init(void)
> goto out_free_dmar;
> }
>
> - if (no_iommu || dmar_disabled)
> + if (no_iommu || dmar_disabled) {
> + /*
> + * Make sure the IOMMUs are switched off, even when
> we
> + * boot into a kexec kernel and the previous kernel
> left
> + * them enabled
> + */
> + intel_disable_iommus();
> goto out_free_dmar;
> + }
>
> if (list_empty(&dmar_rmrr_units))
> pr_info("No RMRR found\n");
[Jacob Pan]
next prev parent reply other threads:[~2017-03-29 15:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-29 15:00 [PATCH] iommu/vt-d: Make sure IOMMUs are off when intel_iommu=off Joerg Roedel
2017-03-29 15:51 ` Jacob Pan [this message]
2017-03-29 21:01 ` Joerg Roedel
2017-04-12 1:40 ` Baoquan He
2017-04-12 21:54 ` Joerg Roedel
2017-04-12 22:57 ` Baoquan He
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=20170329085153.5d215d44@jacob-builder \
--to=jacob.jun.pan@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=jroedel@suse.de \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox