On Fri, Mar 17, 2017 at 02:46:11PM +0800, Haozhong Zhang wrote: > If LMCE is supported by host and ' mca_caps = [ "lmce" ] ' is present > in xl config, the LMCE capability will be exposed in guest MSR_IA32_MCG_CAP. > By default, LMCE is not exposed to guest so as to keep the backwards migration > compatibility. > > Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> [...] > +static int hvm_set_mca_capabilities(libxl__gc *gc, uint32_t domid, > + libxl_domain_build_info *const info) > +{ > + int i, rc = 0; > + const libxl_string_list xl_caps = info->u.hvm.mca_caps; > + unsigned long caps = 0; > + > + if (!xl_caps) > + return 0; > + > + for (i = 0; xl_caps[i] != NULL; i++) { > + if (!strcmp(xl_caps[i], "lmce")) > + caps |= HVMMCA_CAP_LMCE; > + else { > + LOG(ERROR, "Unsupported MCA capability %s", xl_caps[i]); > + rc = ERROR_FAIL; > + break; > + } > + } > +
This is not how we normally do this. Parsing should normally be done in xl. Is there any particular reason you chose to parse here? > + if (!rc) > + rc = xc_hvm_param_set(CTX->xch, domid, HVM_PARAM_MCA_CAP, caps); > + > + return rc; > +} > #endif > > static void hvm_set_conf_params(xc_interface *handle, uint32_t domid, > @@ -438,6 +464,10 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid, > rc = hvm_set_viridian_features(gc, domid, info); > if (rc) > return rc; > + > + rc = hvm_set_mca_capabilities(gc, domid, info); > + if (rc) > + return rc; > #endif > } > > diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl > index a612d1f..71c6c33 100644 > --- a/tools/libxl/libxl_types.idl > +++ b/tools/libxl/libxl_types.idl > @@ -550,6 +550,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ > ("serial_list", > libxl_string_list), > ("rdm", libxl_rdm_reserve), > ("rdm_mem_boundary_memkb", MemKB), > + ("mca_caps", > libxl_string_list), You need to add a LIBXL_HAVE_MCA_CAPS to libxl.h Wei. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel