[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 4/6] tools/libxl: Combine legacy CPUID handling logic
While we are in the process of overhauling boot time CPUID/MSR handling, the existing logic is going to have to remain in roughly this form for backwards compatibility. Fold libxl__cpuid_apply_policy() and libxl__cpuid_set() together into a single libxl__cpuid_legacy() to reduce the complexity for callers. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Ian Jackson <Ian.Jackson@xxxxxxxxxx> CC: Wei Liu <wl@xxxxxxx> CC: Anthony PERARD <anthony.perard@xxxxxxxxxx> --- tools/libxl/libxl_cpuid.c | 15 ++++++++------- tools/libxl/libxl_dom.c | 4 +--- tools/libxl/libxl_internal.h | 5 ++--- tools/libxl/libxl_nocpuid.c | 8 ++------ 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c index 505ec1b048..49d3ca5b26 100644 --- a/tools/libxl/libxl_cpuid.c +++ b/tools/libxl/libxl_cpuid.c @@ -410,17 +410,18 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid, return 0; } -void libxl__cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) -{ - xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0); -} - -void libxl__cpuid_set(libxl_ctx *ctx, uint32_t domid, - libxl_cpuid_policy_list cpuid) +void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, + libxl_domain_build_info *info) { + libxl_cpuid_policy_list cpuid = info->cpuid; int i; char *cpuid_res[4]; + xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0); + + if (!cpuid) + return; + for (i = 0; cpuid[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++) xc_cpuid_set(ctx->xch, domid, cpuid[i].input, (const char**)(cpuid[i].policy), cpuid_res); diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index bbb1be75ba..71cb578923 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -454,9 +454,7 @@ int libxl__build_post(libxl__gc *gc, uint32_t domid, if (rc) return rc; - libxl__cpuid_apply_policy(ctx, domid); - if (info->cpuid != NULL) - libxl__cpuid_set(ctx, domid, info->cpuid); + libxl__cpuid_legacy(ctx, domid, info); if (info->type == LIBXL_DOMAIN_TYPE_HVM && !libxl_ms_vm_genid_is_zero(&info->u.hvm.ms_vm_genid)) { diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 164d93b89b..4936446069 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -2056,9 +2056,8 @@ struct libxl__cpuid_policy { char *policy[4]; }; -_hidden void libxl__cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid); -_hidden void libxl__cpuid_set(libxl_ctx *ctx, uint32_t domid, - libxl_cpuid_policy_list cpuid); +_hidden void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, + libxl_domain_build_info *info); /* Calls poll() again - useful to check whether a signaled condition * is still true. Cannot fail. Returns currently-true revents. */ diff --git a/tools/libxl/libxl_nocpuid.c b/tools/libxl/libxl_nocpuid.c index a39babe754..7776574a0c 100644 --- a/tools/libxl/libxl_nocpuid.c +++ b/tools/libxl/libxl_nocpuid.c @@ -34,12 +34,8 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid, return 0; } -void libxl__cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) -{ -} - -void libxl__cpuid_set(libxl_ctx *ctx, uint32_t domid, - libxl_cpuid_policy_list cpuid) +void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, + libxl_domain_config *d_config) { } -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |