xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>
Cc: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
	Roberto Luongo <rluongo@ready.it>,
	Jan Beulich <JBeulich@suse.com>
Subject: Re: [PATCH] AMD/guest_iommu: Disable guest iommu support
Date: Mon, 6 Oct 2014 01:46:27 -0500	[thread overview]
Message-ID: <54323AC3.5050200@amd.com> (raw)
In-Reply-To: <1412258549-18671-1-git-send-email-andrew.cooper3@citrix.com>



On 10/02/2014 09:02 AM, Andrew Cooper wrote:
> AMD Guest IOMMU support was added to allow correct use of PASID and PRI
> hardware support with an ATS-aware guest driver.
>
> However, support cannot possibly function as guest_iommu_set_base() has no
> callers.  This means that its MMIO region's P2M pages are not set to
> p2m_mmio_dm, preventing any invocation of the MMIO read/write handlers.
>
> c/s fd186384 "x86/HVM: extend LAPIC shortcuts around P2M lookups" introduces a
> path (via hvm_mmio_internal()) where iommu_mmio_handler claims its MMIO range,
> and causes __hvm_copy() to fail with HVMCOPY_bad_gfn_to_mfn.
>
> iommu->mmio_base defaults to 0, with a range of 8 pages, and is unilaterally
> enabled in any HVM guests when the host IOMMU(s) supports any extended
> features.
>
> Unfortunately, HVMLoader's AP boot trampoline executes an `lmsw` instruction
> at linear address 0x100c which unconditionally requires emulation.  The
> instruction fetch in turn fails as __hvm_copy() fails with
> HVMCOPY_bad_gfn_to_mfn.
>
> The result is that multi-vcpu HVM guests do not work on newer AMD hardware, if
> IOMMU support is enabled in the BIOS.
>
> Change the default mmio_base address to ~0ULL.  This prevents
> guest_iommu_mmio_range() from actually claiming any physical range
> whatsoever, which allows the emulation of `lmsw` to succeed.
>
> Reported-by: Roberto Luongo <rluongo@ready.it>
> Suggested-by: Jan Beulich <JBeulich@suse.com>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Tested-by: Roberto Luongo <rluongo@ready.it>
> CC: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> CC: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
> ---
>   xen/drivers/passthrough/amd/iommu_guest.c |    1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/xen/drivers/passthrough/amd/iommu_guest.c b/xen/drivers/passthrough/amd/iommu_guest.c
> index 5660020..98e7b38 100644
> --- a/xen/drivers/passthrough/amd/iommu_guest.c
> +++ b/xen/drivers/passthrough/amd/iommu_guest.c
> @@ -885,6 +885,7 @@ int guest_iommu_init(struct domain* d)
>       }
>
>       guest_iommu_reg_init(iommu);
> +    iommu->mmio_base = ~0ULL;
>       iommu->domain = d;
>       hd->arch.g_iommu = iommu;
>
>
Thank you, Andrew.

Acked-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>

Jan,

The function guest_iommu_set_base() was added by Wei before my time. I 
checked the log and didn't see the evidence that this code has ever been 
used. Do you remember why he added this code to begin with, and how this 
was planned to be used?

Suravee

  parent reply	other threads:[~2014-10-06  6:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-02 14:02 [PATCH] AMD/guest_iommu: Disable guest iommu support Andrew Cooper
2014-10-02 14:08 ` Andrew Cooper
2014-10-02 14:50   ` Jan Beulich
2014-10-02 15:16     ` Konrad Rzeszutek Wilk
2014-10-06  6:46 ` Suravee Suthikulpanit [this message]
2014-10-06  7:59   ` Jan Beulich
2014-10-06  9:11     ` Andrew Cooper

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=54323AC3.5050200@amd.com \
    --to=suravee.suthikulpanit@amd.com \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=rluongo@ready.it \
    --cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).