From nobody Sat May 4 15:51:26 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1556577865; cv=none; d=zoho.com; s=zohoarc; b=ZDbtI9er823VosVL5mNft4vYa528tQj9ihGs2Pcf70aqUtAywlP/cVNXFWt6GrC7Y3DtBVIdKbU5dqxOKbryhWW7NXKvnZQABqRAwVtf4L4HZujEastr4uqvWCEDooqViPgF13PJqLYn94s5sgWUGWECYeJ9vTBzlwZ6ypV4qag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556577865; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=cbKCiPx3SBeuSmbBTKC5c2yzbxSjxteeeE5XwdODRiw=; b=D1acTnyTJh9m149jeFN68ph/gklP5NMqORX3JGrqK8rrJqUe73vfJh84VHPlAPUN4LmYvcIwQZhkAao6qq25in9NryS9AmgzQeeEd+esJuqZvRqGeVUmw9S0xonfb7m74ZQtrJEhRauZG6oCer6HKMnlD0sUC/8C4od/iIvyUxk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1556577865571346.41276789863366; Mon, 29 Apr 2019 15:44:25 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hLEzA-0001i0-SS; Mon, 29 Apr 2019 22:42:56 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hLEz9-0001hv-Nh for xen-devel@lists.xenproject.org; Mon, 29 Apr 2019 22:42:55 +0000 Received: from out4-smtp.messagingengine.com (unknown [66.111.4.28]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 206f7818-6ad0-11e9-843c-bc764e045a96; Mon, 29 Apr 2019 22:42:54 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 0803A21FB7; Mon, 29 Apr 2019 18:42:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Mon, 29 Apr 2019 18:42:54 -0400 Received: from localhost.localdomain (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id D5DDDE4122; Mon, 29 Apr 2019 18:42:51 -0400 (EDT) X-Inumbo-ID: 206f7818-6ad0-11e9-843c-bc764e045a96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Yq1ucv A489h2CHkR6Q9+P6k8g7+0IkiMStA0jH+/DLQ=; b=S+Htnf00GMXwHc0Q/tUKx+ XRAoCmqExJo/JPAHyT2EpW4Jgw8HwwUk77EyMpKJy9i3XeRwotq4bjBZyrTvyz+O v58P7u2O4YqIWsalMArLBy26N/K9zwd0QDs/nsKQb7iJGWoSx2IT2YViOU5v0U/h P/Ey91PRbwk3bifB7ViF6Qe9ZIaQNiaPMnO0brlCtKm1SCfYQZeJz2FqtKb6Qmqz Ec/oUfkkjEDeXgqodIdhsCA5yldA1JA94hTOuPCQdXBV+i+3N25pCg8hmeYTmpse P9u5xeEVAd2O1pXmb/NoX9AGGZqos28g7wVftAA+uTlLD/2IQLqp9Gf6D/peJDNQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrieefgddugecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofggtghogfesthekredtredtjeenucfhrhhomhepofgrrhgvkhcu ofgrrhgtiiihkhhofihskhhiqdfikphrvggtkhhiuceomhgrrhhmrghrvghksehinhhvih hsihgslhgvthhhihhnghhslhgrsgdrtghomheqnecukfhppeeluddrieehrdefgedrfeef necurfgrrhgrmhepmhgrihhlfhhrohhmpehmrghrmhgrrhgvkhesihhnvhhishhisghlvg hthhhinhhgshhlrggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Date: Tue, 30 Apr 2019 00:42:52 +0200 Message-Id: <20190429224252.29000-1-marmarek@invisiblethingslab.com> X-Mailer: git-send-email 2.17.2 MIME-Version: 1.0 Organization: Invisible Things Lab Subject: [Xen-devel] [PATCH v2] python: Adjust xc_physinfo wrapper for updated virt_caps bits X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Ian Jackson , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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=C3=B3recki Acked-by: Ian Jackson Acked-by: Wei Liu --- This should be backported to 4.12 Cc: Ian Jackson Changes in v2: - Check XEN_SYSCTL_PHYSCAP_* instead of hardcoding bits values - Do not duplicate virtcap_names entries, instead append _directio in sprintf() --- 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 cc8175a11e..9c03c8272e 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -973,11 +973,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[] =3D { "hvm", "hvm_directio" }; + const char *virtcap_names[] =3D { "hvm", "pv" }; + const unsigned virtcaps_bits[] =3D { XEN_SYSCTL_PHYSCAP_hvm, + XEN_SYSCTL_PHYSCAP_pv }; =20 if ( xc_physinfo(self->xc_handle, &pinfo) !=3D 0 ) return pyxc_error_to_exception(self->xc_handle); =20 + /* + * Keep in sync with tools/xl/xl_info.c:output_xeninfo + * and struct xen_sysctl_physinfo (especially bit fields). + */ p =3D cpu_cap; *p =3D '\0'; for ( i =3D 0; i < sizeof(pinfo.hw_cap)/4; i++ ) @@ -986,9 +992,13 @@ static PyObject *pyxc_physinfo(XcObject *self) =20 p =3D virt_caps; *p =3D '\0'; - for ( i =3D 0; i < 2; i++ ) - if ( (pinfo.capabilities >> i) & 1 ) + for ( i =3D 0; i < ARRAY_SIZE(virtcaps_bits); i++ ) + if ( pinfo.capabilities & virtcaps_bits[i] ) p +=3D sprintf(p, "%s ", virtcap_names[i]); + if ( pinfo.capabilities & XEN_SYSCTL_PHYSCAP_directio ) + for ( i =3D 0; i < ARRAY_SIZE(virtcaps_bits); i++ ) + if ( pinfo.capabilities & virtcaps_bits[i] ) + p +=3D sprintf(p, "%s_directio ", virtcap_names[i]); if ( p !=3D virt_caps ) *(p-1) =3D '\0'; =20 --=20 2.17.2 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel