From: Ed White <edmund.h.white@intel.com>
To: xen-devel@lists.xen.org
Cc: Ravi Sahita <ravi.sahita@intel.com>,
Wei Liu <wei.liu2@citrix.com>,
George Dunlap <george.dunlap@eu.citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
Ed White <edmund.h.white@intel.com>,
Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
tlengyel@novetta.com, Daniel De Graaf <dgdegra@tycho.nsa.gov>
Subject: [PATCH v3 12/13] x86/altp2m: Add altp2mhvm HVM domain parameter.
Date: Wed, 1 Jul 2015 11:09:36 -0700 [thread overview]
Message-ID: <1435774177-6345-13-git-send-email-edmund.h.white@intel.com> (raw)
In-Reply-To: <1435774177-6345-1-git-send-email-edmund.h.white@intel.com>
The altp2mhvm and nestedhvm parameters are mutually
exclusive and cannot be set together.
Signed-off-by: Ed White <edmund.h.white@intel.com>
---
docs/man/xl.cfg.pod.5 | 12 ++++++++++++
tools/libxl/libxl_create.c | 1 +
tools/libxl/libxl_dom.c | 2 ++
tools/libxl/libxl_types.idl | 1 +
tools/libxl/xl_cmdimpl.c | 8 ++++++++
xen/arch/x86/hvm/hvm.c | 16 +++++++++++++++-
xen/include/public/hvm/params.h | 5 ++++-
7 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
index a3e0e2e..18afd46 100644
--- a/docs/man/xl.cfg.pod.5
+++ b/docs/man/xl.cfg.pod.5
@@ -1035,6 +1035,18 @@ enabled by default and you should usually omit it. It may be necessary
to disable the HPET in order to improve compatibility with guest
Operating Systems (X86 only)
+=item B<altp2mhvm=BOOLEAN>
+
+Enables or disables hvm guest access to alternate-p2m capability.
+Alternate-p2m allows a guest to manage multiple p2m guest physical
+"memory views" (as opposed to a single p2m). This option is
+disabled by default and is available only to hvm domains.
+You may want this option if you want to access-control/isolate
+access to specific guest physical memory pages accessed by
+the guest, e.g. for HVM domain memory introspection or
+for isolation/access-control of memory between components within
+a single guest hvm domain.
+
=item B<nestedhvm=BOOLEAN>
Enable or disables guest access to hardware virtualisation features,
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 86384d2..35e322e 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -329,6 +329,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
libxl_defbool_setdefault(&b_info->u.hvm.hpet, true);
libxl_defbool_setdefault(&b_info->u.hvm.vpt_align, true);
libxl_defbool_setdefault(&b_info->u.hvm.nested_hvm, false);
+ libxl_defbool_setdefault(&b_info->u.hvm.altp2mhvm, false);
libxl_defbool_setdefault(&b_info->u.hvm.usb, false);
libxl_defbool_setdefault(&b_info->u.hvm.xen_platform_pci, true);
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 600393d..b75f49b 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -300,6 +300,8 @@ static void hvm_set_conf_params(xc_interface *handle, uint32_t domid,
libxl_defbool_val(info->u.hvm.vpt_align));
xc_hvm_param_set(handle, domid, HVM_PARAM_NESTEDHVM,
libxl_defbool_val(info->u.hvm.nested_hvm));
+ xc_hvm_param_set(handle, domid, HVM_PARAM_ALTP2MHVM,
+ libxl_defbool_val(info->u.hvm.altp2mhvm));
}
int libxl__build_pre(libxl__gc *gc, uint32_t domid,
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 23f27d4..66a89cf 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -437,6 +437,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
("mmio_hole_memkb", MemKB),
("timer_mode", libxl_timer_mode),
("nested_hvm", libxl_defbool),
+ ("altp2mhvm", libxl_defbool),
("smbios_firmware", string),
("acpi_firmware", string),
("nographic", libxl_defbool),
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index c858068..ccb0de9 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1500,6 +1500,14 @@ static void parse_config_data(const char *config_source,
xlu_cfg_get_defbool(config, "nestedhvm", &b_info->u.hvm.nested_hvm, 0);
+ xlu_cfg_get_defbool(config, "altp2mhvm", &b_info->u.hvm.altp2mhvm, 0);
+
+ if (strcmp(libxl_defbool_to_string(b_info->u.hvm.nested_hvm), "True") == 0 &&
+ strcmp(libxl_defbool_to_string(b_info->u.hvm.altp2mhvm), "True") == 0) {
+ fprintf(stderr, "ERROR: nestedhvm and altp2mhvm cannot be used together\n");
+ exit (1);
+ }
+
xlu_cfg_replace_string(config, "smbios_firmware",
&b_info->u.hvm.smbios_firmware, 0);
xlu_cfg_replace_string(config, "acpi_firmware",
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 0d81050..92c123c 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -5754,6 +5754,7 @@ static int hvm_allow_set_param(struct domain *d,
case HVM_PARAM_VIRIDIAN:
case HVM_PARAM_IOREQ_SERVER_PFN:
case HVM_PARAM_NR_IOREQ_SERVER_PAGES:
+ case HVM_PARAM_ALTP2MHVM:
if ( value != 0 && a->value != value )
rc = -EEXIST;
break;
@@ -5876,6 +5877,9 @@ static int hvmop_set_param(
*/
if ( cpu_has_svm && !paging_mode_hap(d) && a.value )
rc = -EINVAL;
+ if ( a.value &&
+ d->arch.hvm_domain.params[HVM_PARAM_ALTP2MHVM] )
+ rc = -EINVAL;
/* Set up NHVM state for any vcpus that are already up. */
if ( a.value &&
!d->arch.hvm_domain.params[HVM_PARAM_NESTEDHVM] )
@@ -5886,6 +5890,13 @@ static int hvmop_set_param(
for_each_vcpu(d, v)
nestedhvm_vcpu_destroy(v);
break;
+ case HVM_PARAM_ALTP2MHVM:
+ if ( a.value > 1 )
+ rc = -EINVAL;
+ if ( a.value &&
+ d->arch.hvm_domain.params[HVM_PARAM_NESTEDHVM] )
+ rc = -EINVAL;
+ break;
case HVM_PARAM_BUFIOREQ_EVTCHN:
rc = -EINVAL;
break;
@@ -5946,6 +5957,7 @@ static int hvm_allow_get_param(struct domain *d,
case HVM_PARAM_STORE_EVTCHN:
case HVM_PARAM_CONSOLE_PFN:
case HVM_PARAM_CONSOLE_EVTCHN:
+ case HVM_PARAM_ALTP2MHVM:
break;
/*
* The following parameters must not be read by the guest
@@ -6460,7 +6472,8 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
return -ESRCH;
rc = -EINVAL;
- if ( is_hvm_domain(d) && hvm_altp2m_supported() )
+ if ( is_hvm_domain(d) && hvm_altp2m_supported() &&
+ d->arch.hvm_domain.params[HVM_PARAM_ALTP2MHVM] )
{
a.state = altp2m_active(d);
rc = __copy_to_guest(arg, &a, 1) ? -EFAULT : 0;
@@ -6486,6 +6499,7 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
rc = -EINVAL;
if ( is_hvm_domain(d) && hvm_altp2m_supported() &&
+ d->arch.hvm_domain.params[HVM_PARAM_ALTP2MHVM] &&
!nestedhvm_enabled(d) )
{
ostate = d->arch.altp2m_active;
diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h
index 7c73089..1b5f840 100644
--- a/xen/include/public/hvm/params.h
+++ b/xen/include/public/hvm/params.h
@@ -187,6 +187,9 @@
/* Location of the VM Generation ID in guest physical address space. */
#define HVM_PARAM_VM_GENERATION_ID_ADDR 34
-#define HVM_NR_PARAMS 35
+/* Boolean: Enable altp2m (hvm only) */
+#define HVM_PARAM_ALTP2MHVM 35
+
+#define HVM_NR_PARAMS 36
#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
--
1.9.1
next prev parent reply other threads:[~2015-07-01 18:09 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-01 18:09 [PATCH v3 00/12] Alternate p2m: support multiple copies of host p2m Ed White
2015-07-01 18:09 ` [PATCH v3 01/13] common/domain: Helpers to pause a domain while in context Ed White
2015-07-01 18:09 ` [PATCH v3 02/13] VMX: VMFUNC and #VE definitions and detection Ed White
2015-07-06 17:16 ` George Dunlap
2015-07-07 18:58 ` Nakajima, Jun
2015-07-01 18:09 ` [PATCH v3 03/13] VMX: implement suppress #VE Ed White
2015-07-06 17:26 ` George Dunlap
2015-07-07 18:59 ` Nakajima, Jun
2015-07-09 13:01 ` Jan Beulich
2015-07-10 19:30 ` Sahita, Ravi
2015-07-13 7:40 ` Jan Beulich
2015-07-13 23:39 ` Sahita, Ravi
2015-07-14 11:18 ` George Dunlap
2015-07-01 18:09 ` [PATCH v3 04/13] x86/HVM: Hardware alternate p2m support detection Ed White
2015-07-01 18:09 ` [PATCH v3 05/13] x86/altp2m: basic data structures and support routines Ed White
2015-07-03 16:22 ` Andrew Cooper
2015-07-06 9:56 ` Jan Beulich
2015-07-06 16:52 ` Ed White
2015-07-06 16:40 ` Ed White
2015-07-06 16:50 ` Ian Jackson
2015-07-07 6:48 ` Coding style (was Re: [PATCH v3 05/13] x86/altp2m: basic data structures and support routines.) Jan Beulich
2015-07-07 6:31 ` [PATCH v3 05/13] x86/altp2m: basic data structures and support routines Jan Beulich
2015-07-07 15:04 ` George Dunlap
2015-07-07 15:22 ` Tim Deegan
2015-07-07 16:19 ` Ed White
2015-07-08 13:52 ` George Dunlap
2015-07-09 17:05 ` Sahita, Ravi
2015-07-10 16:35 ` George Dunlap
2015-07-10 22:11 ` Sahita, Ravi
2015-07-09 13:29 ` Jan Beulich
2015-07-10 21:48 ` Sahita, Ravi
2015-07-13 8:01 ` Jan Beulich
2015-07-14 0:01 ` Sahita, Ravi
2015-07-14 8:53 ` Jan Beulich
2015-07-16 8:48 ` Sahita, Ravi
2015-07-16 9:02 ` Jan Beulich
2015-07-17 22:39 ` Sahita, Ravi
2015-07-20 6:18 ` Jan Beulich
2015-07-21 5:04 ` Sahita, Ravi
2015-07-21 6:24 ` Jan Beulich
2015-07-14 11:34 ` George Dunlap
2015-07-09 15:58 ` George Dunlap
2015-07-01 18:09 ` [PATCH v3 06/13] VMX/altp2m: add code to support EPTP switching and #VE Ed White
2015-07-03 16:29 ` Andrew Cooper
2015-07-07 14:28 ` Wei Liu
2015-07-07 19:02 ` Nakajima, Jun
2015-07-01 18:09 ` [PATCH v3 07/13] VMX: add VMFUNC leaf 0 (EPTP switching) to emulator Ed White
2015-07-03 16:40 ` Andrew Cooper
2015-07-06 19:56 ` Sahita, Ravi
2015-07-07 7:31 ` Jan Beulich
2015-07-09 14:05 ` Jan Beulich
2015-07-01 18:09 ` [PATCH v3 08/13] x86/altp2m: add control of suppress_ve Ed White
2015-07-03 16:43 ` Andrew Cooper
2015-07-01 18:09 ` [PATCH v3 09/13] x86/altp2m: alternate p2m memory events Ed White
2015-07-01 18:29 ` Lengyel, Tamas
2015-07-03 16:46 ` Andrew Cooper
2015-07-07 15:18 ` George Dunlap
2015-07-01 18:09 ` [PATCH v3 10/13] x86/altp2m: add remaining support routines Ed White
2015-07-03 16:56 ` Andrew Cooper
2015-07-09 15:07 ` George Dunlap
2015-07-01 18:09 ` [PATCH v3 11/13] x86/altp2m: define and implement alternate p2m HVMOP types Ed White
2015-07-06 10:09 ` Andrew Cooper
2015-07-06 16:49 ` Ed White
2015-07-06 17:08 ` Ian Jackson
2015-07-06 18:27 ` Ed White
2015-07-06 23:40 ` Lengyel, Tamas
2015-07-07 7:46 ` Jan Beulich
2015-07-07 7:41 ` Jan Beulich
2015-07-07 7:39 ` Jan Beulich
2015-07-07 7:33 ` Jan Beulich
2015-07-07 20:10 ` Sahita, Ravi
2015-07-07 20:25 ` Andrew Cooper
2015-07-09 14:34 ` Jan Beulich
2015-07-01 18:09 ` Ed White [this message]
2015-07-06 10:16 ` [PATCH v3 12/13] x86/altp2m: Add altp2mhvm HVM domain parameter Andrew Cooper
2015-07-06 17:49 ` Wei Liu
2015-07-06 18:01 ` Ed White
2015-07-06 18:18 ` Wei Liu
2015-07-06 22:59 ` Ed White
2015-07-01 18:09 ` [PATCH v3 13/13] x86/altp2m: XSM hooks for altp2m HVM ops Ed White
2015-07-02 19:17 ` Daniel De Graaf
2015-07-06 9:50 ` [PATCH v3 00/12] Alternate p2m: support multiple copies of host p2m Jan Beulich
2015-07-06 11:25 ` Tim Deegan
2015-07-06 11:38 ` Jan Beulich
2015-07-08 18:35 ` Sahita, Ravi
2015-07-09 11:49 ` Wei Liu
2015-07-09 14:14 ` Jan Beulich
2015-07-09 16:13 ` Sahita, Ravi
2015-07-09 16:20 ` Ian Campbell
2015-07-09 16:21 ` Wei Liu
2015-07-09 16:42 ` George Dunlap
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=1435774177-6345-13-git-send-email-edmund.h.white@intel.com \
--to=edmund.h.white@intel.com \
--cc=andrew.cooper3@citrix.com \
--cc=dgdegra@tycho.nsa.gov \
--cc=george.dunlap@eu.citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=ravi.sahita@intel.com \
--cc=tim@xen.org \
--cc=tlengyel@novetta.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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).