From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Cc: Yang Z Zhang <yang.z.zhang@intel.com>,
Kevin Tian <kevin.tian@intel.com>,
Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>,
suravee.suthikulpanit@amd.com
Subject: Re: [PATCH] don't allow Dom0 access to IOMMUs' MMIO pages
Date: Thu, 2 Oct 2014 18:53:13 +0100 [thread overview]
Message-ID: <542D9109.3020304@citrix.com> (raw)
In-Reply-To: <542D70A0020000780003BFE3@mail.emea.novell.com>
[-- Attachment #1.1: Type: text/plain, Size: 2155 bytes --]
On 02/10/14 14:34, Jan Beulich wrote:
> Just like for LAPIC, IO-APIC, MSI, and HT we shouldn't be granting Dom0
> access to these. This implicitly results in these pages also getting
> marked reserved in the machine memory map Dom0 uses to determine the
> ranges where PCI devices can have their MMIO ranges placed.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
> +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
> @@ -19,6 +19,7 @@
> */
>
> #include <xen/sched.h>
> +#include <xen/iocap.h>
> #include <xen/pci.h>
> #include <xen/pci_regs.h>
> #include <xen/paging.h>
> @@ -283,6 +284,7 @@ static int amd_iommu_domain_init(struct
> static void __hwdom_init amd_iommu_hwdom_init(struct domain *d)
> {
> unsigned long i;
> + const struct amd_iommu *iommu;
>
> if ( !iommu_passthrough && !need_iommu(d) )
> {
> @@ -304,6 +306,12 @@ static void __hwdom_init amd_iommu_hwdom
> }
> }
>
> + for_each_amd_iommu ( iommu )
> + if ( iomem_deny_access(d, PFN_DOWN(iommu->mmio_base_phys),
> + PFN_DOWN(iommu->mmio_base_phys +
> + IOMMU_MMIO_REGION_LENGTH - 1)) )
> + BUG();
> +
> setup_hwdom_pci_devices(d, amd_iommu_setup_hwdom_device);
> }
>
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -23,6 +23,7 @@
> #include <xen/sched.h>
> #include <xen/xmalloc.h>
> #include <xen/domain_page.h>
> +#include <xen/iocap.h>
> #include <xen/iommu.h>
> #include <asm/hvm/iommu.h>
> #include <xen/numa.h>
> @@ -1258,6 +1259,9 @@ static void __hwdom_init intel_iommu_hwd
>
> for_each_drhd_unit ( drhd )
> {
> + if ( iomem_deny_access(d, PFN_DOWN(drhd->address),
> + PFN_DOWN(drhd->address)) )
> + BUG();
> iommu_enable_translation(drhd);
> }
> }
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 3055 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2014-10-02 17:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-02 13:34 [PATCH] don't allow Dom0 access to IOMMUs' MMIO pages Jan Beulich
2014-10-02 17:53 ` Andrew Cooper [this message]
2014-10-03 21:09 ` Tian, Kevin
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=542D9109.3020304@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=aravind.gopalakrishnan@amd.com \
--cc=kevin.tian@intel.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=xen-devel@lists.xenproject.org \
--cc=yang.z.zhang@intel.com \
/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).