Received: by 10.223.164.202 with SMTP id h10csp4875050wrb; Wed, 29 Nov 2017 13:25:07 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ1eiL/RPjIG2LWSo+9SZS9mpce57jXz5/85jqNi964PsLOrkqbh47XcV70A26c6a0SAOnV X-Received: by 10.99.111.2 with SMTP id k2mr259181pgc.344.1511990707233; Wed, 29 Nov 2017 13:25:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511990707; cv=none; d=google.com; s=arc-20160816; b=hoBkX4Ew/086z7ghv5LbY5ACL0g+v8ViBjYMN6t0Bm7tjVRsF4qr34to31URvTtWrb AuP0Wojw8GZw/8ZYhd7/j/2Nn4CclrBJ/NjlcCXv20udcDQmg5RBNuOz9izCw1XxuYR7 qPLJWFz0EIDZg0qcdA6h5CvL/G+67gyQGqHk+5Ykdo+CHsAfpydMyHfJZkV8lptv7aGC woKCXJkGzmUpRMPLWE1KjvyYbqADjbJSrURsr5C4xnMfBX+UVTwfdJaLdxAGkkRykSm+ vZj5EABRTOJxsiHfL4dULNAwDSeg2kdH586TRokUnvEkdnbk3cNhZ5VGd0Cimo9/NPyw hKaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=qVUNRX3LUlPclrTd8d85y39P5Z91sICz55ICEUScnVM=; b=FpQcGYGRNvShwebfkVQqC2jNg3uo/ayUtLq38YMHj9EpCn64EzKnsL/GVpLYTL/Hdq dObQOo268bGxbLL4fF4Zv82raHnoQd0PnBlcBaebVWGJKc66wm8eHq/Vx1tZk1Y1ngMV w1AzOWcfoFKmMAiYJXehHF2CjHU5QYHjTdXH48ZLUM7QjYbermY/vEmNh8w0CJpr004N 70/Gpoy1uJhNlSgxb+gPqzS9Sy0IvUJIsKURtEzj0RAvpFIFfwEZnijYRpqwhRUnPbOl yCbAwUraTtuQOgdLoQe1JV8/zZXAA9sfd86baUbaE8ijd8ZKJcK1OiVudpMBVOVKdeUx 5GPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l11si1860227plt.290.2017.11.29.13.24.54; Wed, 29 Nov 2017 13:25:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753360AbdK2VYr (ORCPT + 99 others); Wed, 29 Nov 2017 16:24:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5286 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752708AbdK2VYo (ORCPT ); Wed, 29 Nov 2017 16:24:44 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 72A2885541; Wed, 29 Nov 2017 21:24:44 +0000 (UTC) Received: from flask (ovpn-204-21.brq.redhat.com [10.40.204.21]) by smtp.corp.redhat.com (Postfix) with SMTP id 3F5654D74B; Wed, 29 Nov 2017 21:24:39 +0000 (UTC) Received: by flask (sSMTP sendmail emulation); Wed, 29 Nov 2017 22:24:38 +0100 From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , Borislav Petkov , Alexander Graf , "Michael S. Tsirkin" , =?UTF-8?q?Jan=20H=2E=20Sch=C3=B6nherr?= , KarimAllah Ahmed , Jim Mattson Subject: [PATCH v2 3/3] KVM: x86: simplify kvm_mwait_in_guest() Date: Wed, 29 Nov 2017 22:23:43 +0100 Message-Id: <20171129212343.23167-4-rkrcmar@redhat.com> In-Reply-To: <20171129212343.23167-1-rkrcmar@redhat.com> References: <20171129212343.23167-1-rkrcmar@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 29 Nov 2017 21:24:44 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If Intel/AMD implements MWAIT, we expect that it works well and only reject known bugs; no reason to do it the other way around for minor vendors. (Not that they are relevant ATM.) This allows further simplification of kvm_mwait_in_guest(). And use boot_cpu_has() instead of "cpu_has(&boot_cpu_data," while at it. Signed-off-by: Radim Krčmář --- arch/x86/kvm/x86.h | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index d15859ec5e92..c69f973111cb 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h @@ -265,18 +265,8 @@ static inline u64 nsec_to_cycles(struct kvm_vcpu *vcpu, u64 nsec) static inline bool kvm_mwait_in_guest(void) { - if (!cpu_has(&boot_cpu_data, X86_FEATURE_MWAIT)) - return false; - - switch (boot_cpu_data.x86_vendor) { - case X86_VENDOR_AMD: - /* All AMD CPUs have a working MWAIT implementation */ - return true; - case X86_VENDOR_INTEL: - return !boot_cpu_has_bug(X86_BUG_MONITOR); - default: - return false; - } + return boot_cpu_has(X86_FEATURE_MWAIT) && + !boot_cpu_has_bug(X86_BUG_MONITOR); } #endif -- 2.14.2 From 1586133943608939392@xxx Thu Dec 07 14:00:04 +0000 2017 X-GM-THRID: 1586133943608939392 X-Gmail-Labels: Inbox,Category Promotions,HistoricalUnread