[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] python: Adjust xc_physinfo wrapper for updated virt_caps bits
commit 569e848a488563555578fd5d89cb5739ba62e765 Author: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx> AuthorDate: Tue Apr 30 00:42:52 2019 +0200 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Mon May 13 11:28:27 2019 +0100 python: Adjust xc_physinfo wrapper for updated virt_caps bits Commit f089fddd94 "xen: report PV capability in sysctl and use it in toolstack" changed meaning of virt_caps bit 1 - previously it was "directio", but was changed to "pv" and "directio" was moved to bit 2. Adjust python wrapper to use #defines for the bits values, and add reporting of both "pv_directio" and "hvm_directio". Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- tools/python/xen/lowlevel/xc/xc.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 2d97dc5ecd..522cbe3b9c 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -972,11 +972,17 @@ static PyObject *pyxc_physinfo(XcObject *self) xc_physinfo_t pinfo; char cpu_cap[128], virt_caps[128], *p; int i; - const char *virtcap_names[] = { "hvm", "hvm_directio" }; + const char *virtcap_names[] = { "hvm", "pv" }; + const unsigned virtcaps_bits[] = { XEN_SYSCTL_PHYSCAP_hvm, + XEN_SYSCTL_PHYSCAP_pv }; if ( xc_physinfo(self->xc_handle, &pinfo) != 0 ) return pyxc_error_to_exception(self->xc_handle); + /* + * Keep in sync with tools/xl/xl_info.c:output_xeninfo + * and struct xen_sysctl_physinfo (especially bit fields). + */ p = cpu_cap; *p = '\0'; for ( i = 0; i < sizeof(pinfo.hw_cap)/4; i++ ) @@ -985,9 +991,13 @@ static PyObject *pyxc_physinfo(XcObject *self) p = virt_caps; *p = '\0'; - for ( i = 0; i < 2; i++ ) - if ( (pinfo.capabilities >> i) & 1 ) + for ( i = 0; i < ARRAY_SIZE(virtcaps_bits); i++ ) + if ( pinfo.capabilities & virtcaps_bits[i] ) p += sprintf(p, "%s ", virtcap_names[i]); + if ( pinfo.capabilities & XEN_SYSCTL_PHYSCAP_directio ) + for ( i = 0; i < ARRAY_SIZE(virtcaps_bits); i++ ) + if ( pinfo.capabilities & virtcaps_bits[i] ) + p += sprintf(p, "%s_directio ", virtcap_names[i]); if ( p != virt_caps ) *(p-1) = '\0'; -- generated by git-patchbot for /home/xen/git/xen.git#staging _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |