From patchwork Thu Sep 5 13:27:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 11133153 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4952B14B4 for ; Thu, 5 Sep 2019 13:28:41 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0A2D8206CD for ; Thu, 5 Sep 2019 13:28:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="gSAKvdUB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A2D8206CD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i5rnB-0005Bl-NC; Thu, 05 Sep 2019 13:27:17 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i5rnA-0005Bg-IS for xen-devel@lists.xenproject.org; Thu, 05 Sep 2019 13:27:16 +0000 X-Inumbo-ID: e01f1cfc-cfe0-11e9-978d-bc764e2007e4 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id e01f1cfc-cfe0-11e9-978d-bc764e2007e4; Thu, 05 Sep 2019 13:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1567690035; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ghzckbyBbcwqcly0CIDxbFxFK8UVz3syqzkrHF679Tc=; b=gSAKvdUB034CssgUmkHQ4lpIqH/yOH2UZ5wtGpeUqnMmSvt39Kzvifxz a9XbRNWhwouGJ+WyjzdqhbuBWd9QHVSQJ9rCzSim7mekx527miAAyEWKg aRh7kLd1sRMyRpuwkpdqdcgwCQtEnc0KvdKAaXHnK7MHflMIUVHMOeHEU Y=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=Pass smtp.mailfrom=roger.pau@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of roger.pau@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of roger.pau@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: BkhGeCUgk3eTdUqSm1hmzELIPKvvWl3qT6mRsjGd4ooKsHLXBagY/E1lkLODhh/X5g4yZMK41Q Ka2Y/xKdWzU8Ed+NDkQFNmax9KAZ4+k88yuD/YlacJYxS1L2LKKgZJ7HdsXcH3/hQymCGCgBaM FHK6tXRFr0pVfRfwwAn5BIeYuHxTBTQ+V4EGD0Sd+KmcHSJ10sfrfhPA8zAn13OMDVpmmghHCy z6PtRVLdZu+qc6Eo+lWUlHYeSEpzGwn3/34dYgJ78LioC2S3OTYyPYeCgGB8Yazd5mwAkFgDAE Mt4= X-SBRS: 2.7 X-MesageID: 5408139 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,470,1559534400"; d="scan'208";a="5408139" From: Roger Pau Monne To: Date: Thu, 5 Sep 2019 15:27:02 +0200 Message-ID: <20190905132703.5554-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190905132703.5554-1-roger.pau@citrix.com> References: <20190905132703.5554-1-roger.pau@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 1/2] sysctl: report existing physcaps on ARM 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: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Volodymyr Babchuk , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Current physcaps in XEN_SYSCTL_physinfo are only used by x86, albeit the capabilities themselves are not x86 specific. This patch adds support for also reporting the current capabilities on ARM hardware. Note that on ARM PHYSCAP_hvm is always reported, and setting PHYSCAP_directio has been moved to common code since the same logic to set it is used by x86 and ARM. Signed-off-by: Roger Pau Monné Reviewed-by: Paul Durrant Acked-by: Jan Beulich --- Changes since v1: - New in this version. --- xen/arch/arm/sysctl.c | 5 ++++- xen/arch/x86/sysctl.c | 2 -- xen/common/sysctl.c | 2 ++ xen/include/public/sysctl.h | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/sysctl.c b/xen/arch/arm/sysctl.c index fbfdb44eff..92ac99c928 100644 --- a/xen/arch/arm/sysctl.c +++ b/xen/arch/arm/sysctl.c @@ -12,7 +12,10 @@ #include #include -void arch_do_physinfo(struct xen_sysctl_physinfo *pi) { } +void arch_do_physinfo(struct xen_sysctl_physinfo *pi) +{ + pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm; +} long arch_do_sysctl(struct xen_sysctl *sysctl, XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c index c50d910a1c..7ec6174e6b 100644 --- a/xen/arch/x86/sysctl.c +++ b/xen/arch/x86/sysctl.c @@ -163,8 +163,6 @@ void arch_do_physinfo(struct xen_sysctl_physinfo *pi) pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm; if ( IS_ENABLED(CONFIG_PV) ) pi->capabilities |= XEN_SYSCTL_PHYSCAP_pv; - if ( iommu_enabled ) - pi->capabilities |= XEN_SYSCTL_PHYSCAP_directio; } long arch_do_sysctl( diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index fcf2d2fd7c..92b4ea0d21 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -267,6 +267,8 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) pi->cpu_khz = cpu_khz; pi->max_mfn = get_upper_mfn_bound(); arch_do_physinfo(pi); + if ( iommu_enabled ) + pi->capabilities |= XEN_SYSCTL_PHYSCAP_directio; if ( copy_to_guest(u_sysctl, op, 1) ) ret = -EFAULT; diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h index 91c48dcae0..36b3f8c429 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -81,13 +81,13 @@ struct xen_sysctl_tbuf_op { * Get physical information about the host machine */ /* XEN_SYSCTL_physinfo */ - /* (x86) The platform supports HVM guests. */ + /* The platform supports HVM guests. */ #define _XEN_SYSCTL_PHYSCAP_hvm 0 #define XEN_SYSCTL_PHYSCAP_hvm (1u<<_XEN_SYSCTL_PHYSCAP_hvm) - /* (x86) The platform supports PV guests. */ + /* The platform supports PV guests. */ #define _XEN_SYSCTL_PHYSCAP_pv 1 #define XEN_SYSCTL_PHYSCAP_pv (1u<<_XEN_SYSCTL_PHYSCAP_pv) - /* (x86) The platform supports direct access to I/O devices with IOMMU. */ + /* The platform supports direct access to I/O devices with IOMMU. */ #define _XEN_SYSCTL_PHYSCAP_directio 2 #define XEN_SYSCTL_PHYSCAP_directio (1u<<_XEN_SYSCTL_PHYSCAP_directio) struct xen_sysctl_physinfo {