xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Tim Deegan <tim@xen.org>, Jan Beulich <jbeulich@suse.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v4 1/4] xen: make logdirty and iommu mutually exclusive
Date: Wed, 4 Jun 2014 12:06:18 +0200	[thread overview]
Message-ID: <1401876381-42977-2-git-send-email-roger.pau@citrix.com> (raw)
In-Reply-To: <1401876381-42977-1-git-send-email-roger.pau@citrix.com>

Prevent the usage of global logdirty if the domain is using the IOMMU,
and also prevent passthrough of devices if logdirty is enabled.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Cc: Tim Deegan <tim@xen.org>
Cc: Jan Beulich <jbeulich@suse.com>
---
Changes since v2:
 - Check for global logdirty enable in paging_log_dirty_enable instead
   of doing it in shadow/ept code.
 - Use the newly introduced global_logdirty flag to check if the
   domain has global logdirty enabled.
---
 xen/arch/x86/mm/paging.c      |    9 +++++++++
 xen/drivers/passthrough/pci.c |    3 ++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 9e9a11b..32764ba 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -168,6 +168,15 @@ int paging_log_dirty_enable(struct domain *d, bool_t log_global)
 {
     int ret;
 
+    if ( need_iommu(d) && log_global )
+    {
+        /*
+         * Refuse to turn on global log-dirty mode
+         * if the domain is using the IOMMU.
+         */
+        return -EINVAL;
+    }
+
     if ( paging_mode_log_dirty(d) )
         return -EINVAL;
 
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index b7f6e8a..43c1a81 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -1233,7 +1233,8 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn)
      * enabled for this domain */
     if ( unlikely(!need_iommu(d) &&
             (d->arch.hvm_domain.mem_sharing_enabled ||
-             d->mem_event->paging.ring_page)) )
+             d->mem_event->paging.ring_page ||
+             p2m_get_hostp2m(d)->global_logdirty)) )
         return -EXDEV;
 
     if ( !spin_trylock(&pcidevs_lock) )
-- 
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2014-06-04 10:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-04 10:06 [PATCH v4 0/4] Fix grant/foreign mappings with auto-translated guests Roger Pau Monne
2014-06-04 10:06 ` Roger Pau Monne [this message]
2014-06-05 11:33   ` [PATCH v4 1/4] xen: make logdirty and iommu mutually exclusive Tim Deegan
2014-06-04 10:06 ` [PATCH v4 2/4] iommu: set correct IOMMU entries when iommu_hap_pt_share == 0 Roger Pau Monne
2014-06-04 10:06 ` [PATCH v4 3/4] amd-iommu: disable iommu_hap_pt_share with AMD IOMMUs Roger Pau Monne
2014-06-04 12:52   ` Jan Beulich
2014-07-04  9:44   ` Jan Beulich
2014-07-22 17:30   ` Suravee Suthikulpanit
2014-07-22 17:39     ` Roger Pau Monné
2014-08-08 15:36       ` Suravee Suthikulanit
2014-08-18  9:22         ` Roger Pau Monné
2014-08-07  8:12   ` Ping: " Jan Beulich
2014-06-04 10:06 ` [PATCH v4 4/4] xen: expose that grant table mappings update the IOMMU Roger Pau Monne
2014-06-04 13:07   ` Jan Beulich

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=1401876381-42977-2-git-send-email-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.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).