From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Wei Liu <wei.liu2@citrix.com>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
Julien Grall <julien.grall@arm.com>,
Jan Beulich <jbeulich@suse.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v7 2/6] iommu: introduce dom0-iommu option
Date: Wed, 22 Aug 2018 09:51:56 +0200 [thread overview]
Message-ID: <20180822075200.50278-3-roger.pau@citrix.com> (raw)
In-Reply-To: <20180822075200.50278-1-roger.pau@citrix.com>
To select the iommu configuration used by Dom0. This option supersedes
iommu=dom0-strict|dom0-passthrough.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
Changes since v5:
- Fix typo in docs.
- Force iommu_hwdom_passthrough to false for PVH Dom0. Note this in
the documentation.
Changes since v4:
- Move the iommu_dom0_* variable renaming to a previous patch.
- Use dom0-iommu=passthrough|strict booleans, like the iommu option
used.
Changes since v2:
- Change the style and text used in the xen command line document.
- Don't allow none, strict or relaxed to use the no- prefix.
Changes since v1:
- New in this version.
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>
---
docs/misc/xen-command-line.markdown | 21 +++++++++++++++++++
xen/drivers/passthrough/iommu.c | 31 +++++++++++++++++++++++++----
2 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 559c0662fa..cd57960ede 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -681,6 +681,21 @@ Flag that makes a dom0 boot in PVHv2 mode.
Flag that makes a dom0 use shadow paging. Only works when "pvh" is
enabled.
+### dom0-iommu
+> `= List of [ passthrough | strict ]`
+
+This list of booleans controls the iommu usage by Dom0:
+
+* `passthrough`: disables DMA remapping for Dom0. Default is `false`. Note that
+ this option is hard coded to `false` for a PVH Dom0 and any attempt to
+ overwrite it from the command line is ignored.
+
+* `strict`: sets up DMA remapping only for the RAM Dom0 actually got assigned.
+ Default is `false` which means Dom0 will get mappings for all the host
+ RAM except regions in use by Xen. Note that this option is hard coded to
+ `true` for a PVH Dom0 and any attempt to overwrite it from the command line
+ is ignored.
+
### dom0\_ioports\_disable (x86)
> `= List of <hex>-<hex>`
@@ -1152,12 +1167,18 @@ detection of systems known to misbehave upon accesses to that port.
> `dom0-passthrough`
+> **WARNING: This command line option is deprecated, and superseded by
+> _dom0-iommu=passthrough_ - using both options in combination is undefined.**
+
> Default: `false`
>> Control whether to disable DMA remapping for Dom0.
> `dom0-strict`
+> **WARNING: This command line option is deprecated, and superseded by
+> _dom0-iommu=strict_ - using both options in combination is undefined.**
+
> Default: `false`
>> Control whether to set up DMA remapping only for the memory Dom0 actually
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 729ee5c373..8f9975cf4e 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -136,6 +136,32 @@ static int __init parse_iommu_param(const char *s)
return rc;
}
+static int __init parse_dom0_iommu_param(const char *s)
+{
+ const char *ss;
+ int rc = 0;
+
+ do {
+ int val;
+
+ ss = strchr(s, ',');
+ if ( !ss )
+ ss = strchr(s, '\0');
+
+ if ( (val = parse_boolean("passthrough", s, ss)) >= 0 )
+ iommu_hwdom_passthrough = val;
+ else if ( (val = parse_boolean("strict", s, ss)) >= 0 )
+ iommu_hwdom_strict = val;
+ else
+ rc = -EINVAL;
+
+ s = ss + 1;
+ } while ( *ss );
+
+ return rc;
+}
+custom_param("dom0-iommu", parse_dom0_iommu_param);
+
int iommu_domain_init(struct domain *d)
{
struct domain_iommu *hd = dom_iommu(d);
@@ -159,10 +185,7 @@ static void __hwdom_init check_hwdom_reqs(struct domain *d)
arch_iommu_check_autotranslated_hwdom(d);
- if ( iommu_hwdom_passthrough )
- panic("Dom0 uses paging translated mode, dom0-passthrough must not be "
- "enabled\n");
-
+ iommu_hwdom_passthrough = false;
iommu_hwdom_strict = true;
}
--
2.18.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-08-22 7:52 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-22 7:51 [PATCH v7 0/6] x86/iommu: PVH Dom0 workarounds for missing RMRR entries Roger Pau Monne
2018-08-22 7:51 ` [PATCH v7 1/6] iommu: rename iommu_dom0_strict and iommu_passthrough Roger Pau Monne
2018-08-22 9:45 ` Wei Liu
2018-08-22 7:51 ` Roger Pau Monne [this message]
2018-08-22 9:45 ` [PATCH v7 2/6] iommu: introduce dom0-iommu option Wei Liu
2018-08-22 7:51 ` [PATCH v7 3/6] iommu: make iommu_inclusive_mapping a suboption of dom0-iommu Roger Pau Monne
2018-08-22 9:45 ` Wei Liu
2018-08-24 10:30 ` Roger Pau Monné
2018-08-22 15:07 ` Julien Grall
2018-08-22 15:22 ` Roger Pau Monné
2018-08-22 15:24 ` Julien Grall
2018-08-22 7:51 ` [PATCH v7 4/6] mm: introduce a helper to get the memory type of a page Roger Pau Monne
2018-08-22 9:45 ` Wei Liu
2018-08-24 10:49 ` Roger Pau Monné
2018-08-22 7:51 ` [PATCH v7 5/6] x86/iommu: switch the hwdom mapping function to use page_get_type Roger Pau Monne
2018-08-22 9:45 ` Wei Liu
2018-08-22 7:52 ` [PATCH v7 6/6] x86/iommu: add map-reserved dom0-iommu option to map reserved memory ranges Roger Pau Monne
2018-08-22 9:45 ` Wei Liu
2018-08-22 15:08 ` Julien Grall
2018-08-28 15:18 ` Jan Beulich
2018-08-27 9:29 ` [PATCH v7 0/6] x86/iommu: PVH Dom0 workarounds for missing RMRR entries 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=20180822075200.50278-3-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--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).