From: Petr Beneš <w1benny@gmail.com>
Encapsulate the altp2m options within a struct. This change is preparatory
and sets the groundwork for introducing additional parameter in subsequent
commit.
Signed-off-by: Petr Beneš <w1benny@gmail.com>
---
tools/libs/light/libxl_create.c | 6 +++---
tools/ocaml/libs/xc/xenctrl_stubs.c | 4 +++-
xen/arch/arm/domain.c | 2 +-
xen/arch/x86/domain.c | 4 ++--
xen/arch/x86/hvm/hvm.c | 2 +-
xen/include/public/domctl.h | 4 +++-
6 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index edeadd57ef..569e3d21ed 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -680,17 +680,17 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
LOG(DETAIL, "altp2m: %s", libxl_altp2m_mode_to_string(b_info->altp2m));
switch(b_info->altp2m) {
case LIBXL_ALTP2M_MODE_MIXED:
- create.altp2m_opts |=
+ create.altp2m.opts |=
XEN_DOMCTL_ALTP2M_mode(XEN_DOMCTL_ALTP2M_mixed);
break;
case LIBXL_ALTP2M_MODE_EXTERNAL:
- create.altp2m_opts |=
+ create.altp2m.opts |=
XEN_DOMCTL_ALTP2M_mode(XEN_DOMCTL_ALTP2M_external);
break;
case LIBXL_ALTP2M_MODE_LIMITED:
- create.altp2m_opts |=
+ create.altp2m.opts |=
XEN_DOMCTL_ALTP2M_mode(XEN_DOMCTL_ALTP2M_limited);
break;
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index a529080129..e6c977521f 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -231,7 +231,9 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co
.max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES),
.grant_opts =
XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)),
- .altp2m_opts = Int32_val(VAL_ALTP2M_OPTS),
+ .altp2m = {
+ .opts = Int32_val(VAL_ALTP2M_OPTS),
+ },
.vmtrace_size = vmtrace_size,
.cpupool_id = Int32_val(VAL_CPUPOOL_ID),
};
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 8bde2f730d..5234b627d0 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -688,7 +688,7 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
return -EINVAL;
}
- if ( config->altp2m_opts )
+ if ( config->altp2m.opts )
{
dprintk(XENLOG_INFO, "Altp2m not supported\n");
return -EINVAL;
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 536542841e..bb5ba8fc1e 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -637,7 +637,7 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
bool hap = config->flags & XEN_DOMCTL_CDF_hap;
bool nested_virt = config->flags & XEN_DOMCTL_CDF_nested_virt;
unsigned int max_vcpus;
- unsigned int altp2m_mode = MASK_EXTR(config->altp2m_opts,
+ unsigned int altp2m_mode = MASK_EXTR(config->altp2m.opts,
XEN_DOMCTL_ALTP2M_mode_mask);
if ( hvm ? !hvm_enabled : !IS_ENABLED(CONFIG_PV) )
@@ -717,7 +717,7 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
return -EINVAL;
}
- if ( config->altp2m_opts & ~XEN_DOMCTL_ALTP2M_mode_mask )
+ if ( config->altp2m.opts & ~XEN_DOMCTL_ALTP2M_mode_mask )
{
dprintk(XENLOG_INFO, "Invalid altp2m options selected: %#x\n",
config->flags);
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 8334ab1711..a66ebaaceb 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -659,7 +659,7 @@ int hvm_domain_initialise(struct domain *d,
d->arch.hvm.params[HVM_PARAM_TRIPLE_FAULT_REASON] = SHUTDOWN_reboot;
/* Set altp2m based on domctl flags. */
- switch ( MASK_EXTR(config->altp2m_opts, XEN_DOMCTL_ALTP2M_mode_mask) )
+ switch ( MASK_EXTR(config->altp2m.opts, XEN_DOMCTL_ALTP2M_mode_mask) )
{
case XEN_DOMCTL_ALTP2M_mixed:
d->arch.hvm.params[HVM_PARAM_ALTP2M] = XEN_ALTP2M_mixed;
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 2a49fe46ce..dea399aa8e 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -86,6 +86,7 @@ struct xen_domctl_createdomain {
uint32_t grant_opts;
+ struct {
/*
* Enable altp2m mixed mode.
*
@@ -102,7 +103,8 @@ struct xen_domctl_createdomain {
/* Altp2m mode signaling uses bits [0, 1]. */
#define XEN_DOMCTL_ALTP2M_mode_mask (0x3U)
#define XEN_DOMCTL_ALTP2M_mode(m) ((m) & XEN_DOMCTL_ALTP2M_mode_mask)
- uint32_t altp2m_opts;
+ uint32_t opts;
+ } altp2m;
/* Per-vCPU buffer size in bytes. 0 to disable. */
uint32_t vmtrace_size;
--
2.34.1