From: Paul Durrant <paul@xen.org>
To: xen-devel@lists.xenproject.org
Cc: Paul Durrant <pdurrant@amazon.com>,
Ian Jackson <iwj@xenproject.org>, Wei Liu <wl@xen.org>,
Anthony PERARD <anthony.perard@citrix.com>
Subject: [PATCH v5 4/4] xl: introduce a 'xen-abi-features' option...
Date: Thu, 3 Dec 2020 12:41:59 +0000 [thread overview]
Message-ID: <20201203124159.3688-5-paul@xen.org> (raw)
In-Reply-To: <20201203124159.3688-1-paul@xen.org>
From: Paul Durrant <pdurrant@amazon.com>
... to control which features of the Xen ABI are enabled in
'libxl_domain_build_info', and hence exposed to the guest.
Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Ian Jackson <iwj@xenproject.org>
Cc: Wei Liu <wl@xen.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>
v5:
- New in v5
---
docs/man/xl.cfg.5.pod.in | 50 ++++++++++++++++++++++++++++++++++++++++
tools/xl/xl_parse.c | 50 ++++++++++++++++++++++++++++++++++++++--
2 files changed, 98 insertions(+), 2 deletions(-)
diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 3f0f8de1e988..b42ab8ba9f60 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -1649,6 +1649,56 @@ This feature is a B<technology preview>.
=back
+=item B<xen_abi_features=[ "STRING", "STRING", ...]>
+
+The features of the Xen ABI exposed to the guest. The following features
+may be specified:
+
+=over 4
+
+=item B<evtchn_fifo>
+
+A new event channel ABI was introduced in Xen 4.4. Moving a guest from an
+earlier Xen to Xen 4.4 onwards may expose bugs in the guest support for
+this ABI. Disabling this feature hides the ABI from the guest and hence
+may be used as a workaround for such bugs.
+
+The festure is enabled by default.
+
+=item B<evcthn_upcall>
+
+B<x86 HVM only>. A new hypercall to specify per-VCPU interrupt vectors to use
+for event channel upcalls in HVM guests was added in Xen 4.6. Moving a guest
+from an earlier Xen to Xen 4.6 onwards may expose bugs in the guest support
+for this hypercall. Disabling this feature hides the hypercall from the
+guest and hence may be used as a workaround for such bugs.
+
+The festure is enabled by default for B<x86 HVM> guests. Note that it is
+considered an error to enable this feature for B<Arm> or B<x86 PV> guests.
+
+=item B<all>
+
+This is a special value that enables all available features.
+
+=back
+
+Features can be disabled by prefixing the name with '!'. So, for example,
+to enable all features except B<evtchn_upcall>, specify:
+
+=over 4
+
+B<xen-abi-features=[ "all", "!evtchn_upcall" ]>
+
+=back
+
+Or, to simply enable default features except B<evtchn_fifo>, specify:
+
+=over 4
+
+B<xen-abi-features=[ "!evtchn_fifo" ]>
+
+=back
+
=back
=head2 Paravirtualised (PV) Guest Specific Options
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index cae8eb679c5a..566e09f938f4 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1216,8 +1216,9 @@ void parse_config_data(const char *config_source,
XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms,
*usbctrls, *usbdevs, *p9devs, *vdispls, *pvcallsifs_devs;
XLU_ConfigList *channels, *ioports, *irqs, *iomem, *viridian, *dtdevs,
- *mca_caps;
- int num_ioports, num_irqs, num_iomem, num_cpus, num_viridian, num_mca_caps;
+ *mca_caps, *features;
+ int num_ioports, num_irqs, num_iomem, num_cpus, num_viridian, num_mca_caps,
+ num_features;
int pci_power_mgmt = 0;
int pci_msitranslate = 0;
int pci_permissive = 0;
@@ -2737,6 +2738,51 @@ skip_usbdev:
xlu_cfg_get_defbool(config, "xend_suspend_evtchn_compat",
&c_info->xend_suspend_evtchn_compat, 0);
+ switch (xlu_cfg_get_list(config, "xen_abi_features",
+ &features, &num_features, 1))
+ {
+ case 0: /* Success */
+ if (num_features) {
+ libxl_bitmap_alloc(ctx, &b_info->feature_enable,
+ LIBXL_BUILDINFO_FEATURE_ENABLE_DISABLE_WIDTH);
+ libxl_bitmap_alloc(ctx, &b_info->feature_disable,
+ LIBXL_BUILDINFO_FEATURE_ENABLE_DISABLE_WIDTH);
+ }
+ for (i = 0; i < num_features; i++) {
+ if (strcmp(buf, "all") == 0)
+ libxl_bitmap_set_any(&b_info->feature_enable);
+ else {
+ libxl_bitmap *s = &b_info->feature_enable;
+ libxl_bitmap *r = &b_info->feature_disable;
+ libxl_xen_abi_feature f;
+
+ buf = xlu_cfg_get_listitem(features, i);
+
+ if (*buf == '!') {
+ s = &b_info->feature_disable;
+ r = &b_info->feature_enable;
+ buf++;
+ }
+
+ e = libxl_xen_abi_feature_from_string(buf, &f);
+ if (e) {
+ fprintf(stderr,
+ "xl: Unknown Xen ABI feature '%s'\n",
+ buf);
+ exit(-ERROR_FAIL);
+ }
+
+ libxl_bitmap_set(s, f);
+ libxl_bitmap_reset(r, f);
+ }
+ }
+ break;
+ case ESRCH: break; /* Option not present */
+ default:
+ fprintf(stderr,"xl: Unable to parse Xen ABI features.\n");
+ exit(-ERROR_FAIL);
+ }
+
xlu_cfg_destroy(config);
}
--
2.20.1
next prev parent reply other threads:[~2020-12-03 12:42 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-03 12:41 [PATCH v5 0/4] Xen ABI feature control Paul Durrant
2020-12-03 12:41 ` [PATCH v5 1/4] domctl: introduce a new domain create flag, XEN_DOMCTL_CDF_evtchn_fifo, Paul Durrant
2020-12-03 15:22 ` Jan Beulich
2020-12-03 15:45 ` Paul Durrant
2020-12-03 15:56 ` Jan Beulich
2020-12-03 17:07 ` Paul Durrant
2020-12-03 17:19 ` Jürgen Groß
2020-12-03 18:44 ` Paul Durrant
2020-12-04 7:53 ` Jan Beulich
2020-12-04 8:22 ` Paul Durrant
2020-12-04 9:43 ` Jan Beulich
2020-12-04 11:45 ` Julien Grall
2020-12-04 11:52 ` Andrew Cooper
2020-12-04 17:41 ` Stefano Stabellini
2020-12-04 17:45 ` Andrew Cooper
2020-12-04 18:33 ` Durrant, Paul
2020-12-05 1:34 ` Stefano Stabellini
2020-12-07 9:17 ` Jan Beulich
2020-12-07 10:04 ` Julien Grall
2020-12-07 10:07 ` Julien Grall
2020-12-07 10:15 ` Jan Beulich
2020-12-07 10:23 ` Durrant, Paul
2020-12-03 12:41 ` [PATCH v5 2/4] domctl: introduce a new domain create flag, XEN_DOMCTL_CDF_evtchn_upcall, Paul Durrant
2020-12-03 12:41 ` [PATCH v5 3/4] libxl: introduce a 'libxl_xen_abi_features' enumeration Paul Durrant
2020-12-03 12:41 ` Paul Durrant [this message]
2020-12-03 13:15 ` [PATCH v5 0/4] Xen ABI feature control Jürgen Groß
2020-12-03 13:51 ` Paul Durrant
2020-12-03 13:58 ` Jürgen Groß
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=20201203124159.3688-5-paul@xen.org \
--to=paul@xen.org \
--cc=anthony.perard@citrix.com \
--cc=iwj@xenproject.org \
--cc=pdurrant@amazon.com \
--cc=wl@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).