Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:FrontRunner
xen.30330
xsa435-0-16.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xsa435-0-16.patch of Package xen.30330
From ec3474e1dd42e6f410601f50b6e74fb7c442cfb9 Mon Sep 17 00:00:00 2001 From: Andrew Cooper <andrew.cooper3@citrix.com> Date: Fri, 10 Mar 2023 19:04:22 +0000 Subject: tools/xen-cpuid: Rework the handling of dynamic featuresets struct fsinfo is the vestigial remnant of an older internal design which didn't survive very long. Simplify things by inlining get_featureset() and having a single memory allocation that gets reused. This in turn changes featuresets[] to be a simple list of names, so rename it to fs_names[]. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com> --- a/tools/misc/xen-cpuid.c +++ b/tools/misc/xen-cpuid.c @@ -232,16 +232,11 @@ static const struct { #define COL_ALIGN "18" -static struct fsinfo { - const char *name; - uint32_t len; - uint32_t *fs; -} featuresets[] = -{ - [XEN_SYSCTL_cpu_featureset_host] = { "Host", 0, NULL }, - [XEN_SYSCTL_cpu_featureset_raw] = { "Raw", 0, NULL }, - [XEN_SYSCTL_cpu_featureset_pv] = { "PV", 0, NULL }, - [XEN_SYSCTL_cpu_featureset_hvm] = { "HVM", 0, NULL }, +static const char *const fs_names[] = { + [XEN_SYSCTL_cpu_featureset_host] = "Host", + [XEN_SYSCTL_cpu_featureset_raw] = "Raw", + [XEN_SYSCTL_cpu_featureset_pv] = "PV", + [XEN_SYSCTL_cpu_featureset_hvm] = "HVM", }; static void dump_leaf(uint32_t leaf, const char *const *strs) @@ -288,23 +283,10 @@ static void decode_featureset(const uint } } -static void get_featureset(xc_interface *xch, unsigned int idx) -{ - struct fsinfo *f = &featuresets[idx]; - - f->len = nr_features; - f->fs = calloc(nr_features, sizeof(*f->fs)); - - if ( !f->fs ) - err(1, "calloc(, featureset)"); - - if ( xc_get_cpu_featureset(xch, idx, &f->len, f->fs) ) - err(1, "xc_get_featureset()"); -} - static void dump_info(xc_interface *xch, bool detail) { unsigned int i; + uint32_t *fs; printf("nr_features: %u\n", nr_features); @@ -329,16 +311,34 @@ static void dump_info(xc_interface *xch, nr_features, "HVM Hap Mask", detail); printf("\nDynamic sets:\n"); - for ( i = 0; i < ARRAY_SIZE(featuresets); ++i ) + + fs = malloc(sizeof(*fs) * nr_features); + if ( !fs ) + err(1, "malloc(featureset)"); + + for ( i = 0; i < ARRAY_SIZE(fs_names); ++i ) { - get_featureset(xch, i); + uint32_t len = nr_features; + int ret; + + memset(fs, 0, sizeof(*fs) * nr_features); + + ret = xc_get_cpu_featureset(xch, i, &len, fs); + if ( ret ) + { + if ( errno == EOPNOTSUPP ) + { + printf("%s featureset not supported by Xen\n", fs_names[i]); + continue; + } + + err(1, "xc_get_featureset()"); + } - decode_featureset(featuresets[i].fs, featuresets[i].len, - featuresets[i].name, detail); + decode_featureset(fs, len, fs_names[i], detail); } - for ( i = 0; i < ARRAY_SIZE(featuresets); ++i ) - free(featuresets[i].fs); + free(fs); } static void print_policy(const char *name,
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor