From patchwork Thu Dec 5 10:51:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11274651 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 84886138D for ; Thu, 5 Dec 2019 10:53:00 +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 5F3F824648 for ; Thu, 5 Dec 2019 10:53:00 +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="RHwzHcip" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F3F824648 Authentication-Results: mail.kernel.org; dmarc=fail (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 1icojU-0007sF-An; Thu, 05 Dec 2019 10:51:40 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1icojS-0007s9-Fx for xen-devel@lists.xenproject.org; Thu, 05 Dec 2019 10:51:38 +0000 X-Inumbo-ID: 35e5f396-174d-11ea-a0d2-bc764e2007e4 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 35e5f396-174d-11ea-a0d2-bc764e2007e4; Thu, 05 Dec 2019 10:51:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1575543097; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Pw1JewxFnchssyqWPRk//HZa44jJe7aWETaAmZFFzF8=; b=RHwzHcip14mZRU82YwXN055uKifZLolXmCkFtlQm7OOiS17TiIH6FUMq ujpSMLeIhHKHpY3ZUsinqP0lysnn0GiArQCQSonIkKxE8W8FH9rZZoJbh +FZ2fP/xKmlcX0q/WecQvVReE2lOWrGVNRlT7RrJ4rUv00pT2KlRqQ7ex U=; 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 ip4:168.245.78.127 ~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: PeIZiqJ6xCj8XxnuOCcrrRhLjjn5iilVUKaNIkpXv75rLULiPlA/DAyFXGtwOpfLSWZSD0x74m 9wVgnTbvHB56g3FlmfHwUO74iT13uXrRNpbaoablNAXYgcFV8glSH1avpE5EeZi6r9ESNCl8Qs UI2nM0NyUCyB8kkt7vpLLzeGj5RPaA5VGUaVK0o39P7WLIrM6ehZk1njcKcqWh2s0NR27SFora MTFp6UzBVBdC9h/XdkFG/uymJqJ5gADKJ4pnO2H3lONlyBgMXRHoB7sbWDqsJ/C2rI4ItZyTc+ 2lM= X-SBRS: 2.7 X-MesageID: 9241747 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.69,281,1571716800"; d="scan'208";a="9241747" From: Andrew Cooper To: Xen-devel Date: Thu, 5 Dec 2019 10:51:34 +0000 Message-ID: <20191205105134.7801-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191204094335.24603-1-andrew.cooper3@citrix.com> References: <20191204094335.24603-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 5/4] x86/svm: Minor cleanup to start_svm() 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 function is init, so can use boot_cpu_data directly. There is no need to write 0 to svm_feature_flags in the case of a CPUID mismatch (not least because this is dead code on real hardware), and no need to use locked atomic operations. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monné --- xen/arch/x86/hvm/svm/svm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index af3d45fe56..806bf91171 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1632,14 +1632,14 @@ const struct hvm_function_table * __init start_svm(void) setup_vmcb_dump(); - svm_feature_flags = (current_cpu_data.extended_cpuid_level >= 0x8000000A ? - cpuid_edx(0x8000000A) : 0); + if ( boot_cpu_data.extended_cpuid_level >= 0x8000000a ) + svm_feature_flags = cpuid_edx(0x8000000a); printk("SVM: Supported advanced features:\n"); /* DecodeAssists fast paths assume nextrip is valid for fast rIP update. */ if ( !cpu_has_svm_nrips ) - clear_bit(SVM_FEATURE_DECODEASSISTS, &svm_feature_flags); + __clear_bit(SVM_FEATURE_DECODEASSISTS, &svm_feature_flags); if ( cpu_has_tsc_ratio ) svm_function_table.tsc_scaling.ratio_frac_bits = 32;