From patchwork Fri Sep 13 19:27:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11145211 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 1842216B1 for ; Fri, 13 Sep 2019 19:31:08 +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 E8AFB20640 for ; Fri, 13 Sep 2019 19:31:07 +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="EM7nLtYp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E8AFB20640 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 1i8rEm-0006mj-1r; Fri, 13 Sep 2019 19:28:08 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i8rEk-0006kM-9O for xen-devel@lists.xenproject.org; Fri, 13 Sep 2019 19:28:06 +0000 X-Inumbo-ID: 9ad9f737-d65c-11e9-95b9-12813bfff9fa Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 9ad9f737-d65c-11e9-95b9-12813bfff9fa; Fri, 13 Sep 2019 19:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1568402886; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BBEMLZnLm26tjDsc8qn1/8XcgCfCIPk3+lDhvg0ZFL0=; b=EM7nLtYp2GgdRc4DJ/6JvC/efTaftgBOZUhUY+kogS8Hlz4r8Hj5nP1w XJ4r40sIA/l6y8uGYdvB6j1AJwwXoHV6A4wPDWPScmopOUMiwX9A8iQmR y6MRWl+qdZ1J4A6+N45p8TizTsy4BqaqxrYVFYTH6Ric3lDdFsACowp74 s=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: WIJNVgLDnCAc99Gi9yrvYIIDDJsyf74ZNdhpJQJAcucky4RduIMnRMEqGx8gtihtRO0wMe/rcK xsA1hfwpzjIIaP1J0KXJF0xVwwWb5R1HtXgFqUgvxavEiAgrz0dr21B3slg3/PQg8HEZ9HkmSM EoBenp0kUkYdhsCXHmO06CHxn3v08BHq9qyn66MZJ20G4erjMwIz+RT3THx8muwJw0ocG/5GG3 VGEz4xshA1FBuX2TvKJcmbi6oPGUoPODgSFYRL0ilOb9pCIUgIfwwk41/PLF5DZ2AfXOxbCUul XgA= X-SBRS: 2.7 X-MesageID: 5553055 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,501,1559534400"; d="scan'208";a="5553055" From: Andrew Cooper To: Xen-devel Date: Fri, 13 Sep 2019 20:27:50 +0100 Message-ID: <20190913192759.10795-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190913192759.10795-1-andrew.cooper3@citrix.com> References: <20190913192759.10795-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 01/10] x86/msr: Offer CPUID Faulting to PVH control domains 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: Andrew Cooper , Wei Liu , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The control domain exclusion for CPUID Faulting predates dom0 PVH, but the reason for the exclusion (to allow the domain builder to see host CPUID values) isn't applicable. The domain builder *is* broken in PVH control domains, and restricting the use of CPUID Faulting doesn't make it any less broken. Tweak the logic to only exclude PV control domains. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monné v2: * New --- xen/arch/x86/cpu/common.c | 5 +++-- xen/arch/x86/msr.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c index 937d8e82a8..4bf852c948 100644 --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -169,7 +169,7 @@ void ctxt_switch_levelling(const struct vcpu *next) if (nextd && is_idle_domain(nextd)) return; /* - * We *should* be enabling faulting for the control domain. + * We *should* be enabling faulting for PV control domains. * * Unfortunately, the domain builder (having only ever been a * PV guest) expects to be able to see host cpuid state in a @@ -184,7 +184,8 @@ void ctxt_switch_levelling(const struct vcpu *next) * generating the maximum full cpuid policy into Xen, at which * this problem will disappear. */ - set_cpuid_faulting(nextd && !is_control_domain(nextd) && + set_cpuid_faulting(nextd && (!is_control_domain(nextd) || + !is_pv_domain(nextd)) && (is_pv_domain(nextd) || next->arch.msrs-> misc_features_enables.cpuid_faulting)); diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c index e65961fccb..a6c8cc7627 100644 --- a/xen/arch/x86/msr.c +++ b/xen/arch/x86/msr.c @@ -91,8 +91,8 @@ int init_domain_msr_policy(struct domain *d) if ( !mp ) return -ENOMEM; - /* See comment in intel_ctxt_switch_levelling() */ - if ( is_control_domain(d) ) + /* See comment in ctxt_switch_levelling() */ + if ( is_control_domain(d) && is_pv_domain(d) ) mp->platform_info.cpuid_faulting = false; d->arch.msr = mp;