All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tiejun Chen <tiejun.chen@intel.com>
To: xen-devel@lists.xen.org
Cc: Yang Zhang <yang.z.zhang@intel.com>,
	Kevin Tian <kevin.tian@intel.com>, Wei Liu <wei.liu2@citrix.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: [v2][PATCH] xen/vtd/iommu: permit group devices to passthrough in relaxed mode
Date: Wed,  9 Sep 2015 09:59:58 +0800	[thread overview]
Message-ID: <1441763998-4937-1-git-send-email-tiejun.chen@intel.com> (raw)

Currently we don't allow passing through any group devices which are
sharing same RMRR entry since it would break security among VMs. And
indeed, we expect we can figure out a better way to handle this kind
of case completely.

But before the group assignment gets implemented, we might make this
permission dependent on our RMRR policy. So, now it would be allowed
in the relaxed mode.

CC: Yang Zhang <yang.z.zhang@intel.com>
CC: Kevin Tian <kevin.tian@intel.com>
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
v2:

* Sync code comments
* refactor vaiable "relaxed" as bool_t
* s/XENLOG_G_ERR VTDPREFIX/XENLOG_G_WARNING VTDPREFIX
* Try to refine print message

 xen/drivers/passthrough/vtd/iommu.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 836aed5..7b45bff 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2297,7 +2297,9 @@ static int intel_iommu_assign_device(
     /*
      * In rare cases one given rmrr is shared by multiple devices but
      * obviously this would put the security of a system at risk. So
-     * we should prevent from this sort of device assignment.
+     * we would prevent from this sort of device assignment. But this
+     * can be permitted if user set
+     *      "pci = [ 'sbdf, rdm_policy=relaxed' ]"
      *
      * TODO: in the future we can introduce group device assignment
      * interface to make sure devices sharing RMRR are assigned to the
@@ -2310,12 +2312,16 @@ static int intel_iommu_assign_device(
              PCI_DEVFN2(bdf) == devfn &&
              rmrr->scope.devices_cnt > 1 )
         {
-            printk(XENLOG_G_ERR VTDPREFIX
-                   " cannot assign %04x:%02x:%02x.%u"
+            bool_t relaxed = !!(flag & XEN_DOMCTL_DEV_RDM_RELAXED);
+
+            printk(XENLOG_G_WARNING VTDPREFIX
+                   " It's %s to assign %04x:%02x:%02x.%u"
                    " with shared RMRR at %"PRIx64" for Dom%d.\n",
+                   relaxed ? "risky" : "disallowed",
                    seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
                    rmrr->base_address, d->domain_id);
-            return -EPERM;
+            if ( !relaxed )
+                return -EPERM;
         }
     }
 
-- 
1.9.1

             reply	other threads:[~2015-09-09  1:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-09  1:59 Tiejun Chen [this message]
2015-09-09  6:54 ` [v2][PATCH] xen/vtd/iommu: permit group devices to passthrough in relaxed mode Jan Beulich
2015-09-10  1:23   ` Chen, Tiejun
2015-09-10  5:23   ` Tian, Kevin
2015-09-10  5:46     ` Chen, Tiejun
2015-09-10  6:06       ` Tian, Kevin
2015-09-10 11:04         ` Håkon Alstadheim
2015-09-10 11:22           ` Håkon Alstadheim
2015-09-10  8:09     ` Jan Beulich
2015-09-10 10:37       ` Wei Liu
2015-09-10 23:22         ` Tian, Kevin
2015-09-11  0:56           ` Chen, Tiejun
2015-09-11  0:58             ` Tian, Kevin
2015-09-11  2:20               ` Chen, Tiejun
2015-09-11  2:32                 ` Tian, Kevin
2015-09-11  8:56           ` Jan Beulich
2015-09-11 22:44             ` Tian, Kevin
2015-09-14  6:24               ` Chen, Tiejun
2015-09-14  6:59                 ` Tian, Kevin
2015-09-14 10:48                 ` Jan Beulich
2015-09-15  1:17                   ` Chen, Tiejun
2015-09-15  6:49                     ` Jan Beulich
2015-09-15  9:13                     ` Wei Liu
2015-09-14  6:59 ` Tian, Kevin
2015-09-14  9:11   ` Wei Liu

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=1441763998-4937-1-git-send-email-tiejun.chen@intel.com \
    --to=tiejun.chen@intel.com \
    --cc=JBeulich@suse.com \
    --cc=kevin.tian@intel.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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 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.