From patchwork Sun Apr 28 19:08:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 10921031 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A0B51398 for ; Sun, 28 Apr 2019 19:10:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67AD0284FC for ; Sun, 28 Apr 2019 19:10:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 558EF2871E; Sun, 28 Apr 2019 19:10:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EDA9C284FC for ; Sun, 28 Apr 2019 19:10:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hKpAB-0004Uy-EK; Sun, 28 Apr 2019 19:08:35 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hKpAA-0004Ut-6J for xen-devel@lists.xenproject.org; Sun, 28 Apr 2019 19:08:34 +0000 X-Inumbo-ID: 03eb3c0a-69e9-11e9-843c-bc764e045a96 Received: from out5-smtp.messagingengine.com (unknown [66.111.4.29]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 03eb3c0a-69e9-11e9-843c-bc764e045a96; Sun, 28 Apr 2019 19:08:32 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 6C17425E4D; Sun, 28 Apr 2019 15:08:32 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sun, 28 Apr 2019 15:08:32 -0400 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=RYxRba 9s11plp0fcUcis5yxCZ/bSR4PUIEWli20pcFM=; b=0MNj5qbxAMd7FCvnpU0lUA ySGP4xvpI9PJbL1UXNySn+DHX41U2eRSW9gyW66m57G8q6/5k4mImovMKfTup4FC S7MEtSGxkCoodkHTMYmKCs3ditDtW6IXF3BhiMXB21LG+i2ajDc/3DMKTCDwU0DS xk06+eqki87niELgOagJl36nKDenLdwBKAlhqJF1m67r8F1/TciTOCwc14J6iDUF 9oLbVourV3ixxAxLfWbi1NFgLKbukx9vcQmxOSjF6JOIQ0qiSr5JRCqNkS2fWo2u JF/+PZ9mAGdod6sA5rTmZTeWxC5H5m4fK9CwjeYu6xx+n8FKkzNdyH4QRWO7dvPQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddriedtgddufeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffogggtohfgsehtkeertdertdejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucfkphepledurdeihedrfeegrdef feenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghrvghksehinhhvihhsihgslh gvthhhihhnghhslhgrsgdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost.localdomain (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id D2196E40E3; Sun, 28 Apr 2019 15:08:30 -0400 (EDT) From: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Date: Sun, 28 Apr 2019 21:08:23 +0200 Message-Id: <20190428190824.28029-1-marmarek@invisiblethingslab.com> X-Mailer: git-send-email 2.17.2 MIME-Version: 1.0 Organization: Invisible Things Lab Subject: [Xen-devel] [PATCH] 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_Marczykowski-G=C3=B3recki?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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, and add reporting of both "pv_directio" and "hvm_directio". Signed-off-by: Marek Marczykowski-Górecki Acked-by: Wei Liu --- This should be backported to 4.12 Cc: Ian Jackson --- tools/python/xen/lowlevel/xc/xc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index cc8175a11e..0a8d8f407e 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -973,7 +973,8 @@ 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", + "hvm_directio", "pv_directio" }; if ( xc_physinfo(self->xc_handle, &pinfo) != 0 ) return pyxc_error_to_exception(self->xc_handle); @@ -989,6 +990,10 @@ static PyObject *pyxc_physinfo(XcObject *self) for ( i = 0; i < 2; i++ ) if ( (pinfo.capabilities >> i) & 1 ) p += sprintf(p, "%s ", virtcap_names[i]); + if (pinfo.capabilities & XEN_SYSCTL_PHYSCAP_directio) + for ( i = 0; i < 2; i++ ) + if ( (pinfo.capabilities >> i) & 1 ) + p += sprintf(p, "%s ", virtcap_names[i+2]); if ( p != virt_caps ) *(p-1) = '\0';