Received: by 10.223.176.5 with SMTP id f5csp1029802wra; Fri, 2 Feb 2018 10:00:08 -0800 (PST) X-Google-Smtp-Source: AH8x227hXLaIzyAKSJ5HLWTsFPi1QEy3xOjls81EMPD78h6t/IZFyMjYEgRVDmEoEECOvlQxAJi+ X-Received: by 10.99.152.10 with SMTP id q10mr17907066pgd.212.1517594408379; Fri, 02 Feb 2018 10:00:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517594408; cv=none; d=google.com; s=arc-20160816; b=EiK2SLuoa/f3Bnv7KcdojqpDhWXd7TLdhcRHeBq6h1bRS1mYgmWGS/jr5+4Maf9pyK AHFqwVH1+GoYdoZg9nXlQTMI8ysmCgqxy5X9QhVtQtU36aE+NxABqwpCXS8hXa+zNdrt KDmO1PR1PjLkJwDhQPGNx5VMV3cwCCXzUT4U+S6TBDqmW2Qks4FSKiaod4oJvSjlLj+C QmY/CHGqCcOCx1EXsd0VHchstaO3jv/rFYdoUtcbW/ExIChBHiWsqdQjsWDa5ZmDSPa9 QJJow2u/7ZacQCa82498ooBKPjREVe4bqFkLb+R+iJVJE3B/zjhSU6N68dVPabTQ5Fjt qGJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=7bBjPXaJ98x437gPIEZuMAvUvqqMm0taaVF7XxevA1Y=; b=sXKR/zBFtMiT/njpaVoCx+97aBKB7al0HRvQlGuwCXEtQSaSzgMgslAuzola384F4U dnTjf3MSMK1oKIkB0Es2pxlKH2OshOfAFtbU4LssesCqk4mP+7CTXH8A+BSV8nk8r2qG 66r6HdYRcxcwPnnIugKV/RaTYWLtU4T7OHFRhZgAsfQUTRs9aVgx6HG/c1fYFPva/peH 4lotX4wVxie2BDxtgaZ6IK8kp8pSnHD4c5o3Asxx0GmpBaGuglv/Y1j+Oi4wSqFhA0cx 7nmepsQYHZTqi6zExpa9E2CmJszaK+ueMRhD+4ghqdfhftK4JFufCyU+MDMCVX8BrseV 1ePA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=J7atDId9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id az5-v6si2119861plb.71.2018.02.02.09.59.52; Fri, 02 Feb 2018 10:00:08 -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; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=J7atDId9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753690AbeBBR66 (ORCPT + 99 others); Fri, 2 Feb 2018 12:58:58 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:41746 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752637AbeBBR6s (ORCPT ); Fri, 2 Feb 2018 12:58:48 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w12HwMoo156450; Fri, 2 Feb 2018 17:58:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=7bBjPXaJ98x437gPIEZuMAvUvqqMm0taaVF7XxevA1Y=; b=J7atDId9gU1SeV8Ol5VeIL2bDjMYPaSk2BzcolMdTeC/8sb9p9BmY3Phc5VPsVFnlNJy jqTelDfzevJKh7V9eixMPepgFU2EMIC7ChRrkkADtmaPRel3/oJzIUjGA3nBAbuk+UIQ 00Hm2IDxIZhF0KbO2fTV8ZOLw9sosWebDKwMBe4lJXtCunjb7osMB+r5jNweHtwxK3ox ORVJn38wxcZkHnmVSbEI7oH2ykKARqjG9/5RqpymZLbMewAlCkWSsI+5THQH8Lu+DV0S 9b5p1GjTHY+tNRfrLFmPvmQ7nPSmgE8fRPauEnm8xzm/y7iSVZZ1JbYCaQxaWiYpuNHL xw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2fvv5805bw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 02 Feb 2018 17:58:31 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w12HruwE025544 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Feb 2018 17:53:56 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w12HrtHT011440; Fri, 2 Feb 2018 17:53:55 GMT Received: from char.us.oracle.com (/10.137.176.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 02 Feb 2018 09:53:55 -0800 Received: by char.us.oracle.com (Postfix, from userid 1000) id 563636A0A42; Fri, 2 Feb 2018 12:53:52 -0500 (EST) Date: Fri, 2 Feb 2018 12:53:52 -0500 From: Konrad Rzeszutek Wilk To: KarimAllah Ahmed Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, Asit Mallick , Arjan Van De Ven , Dave Hansen , Andi Kleen , Andrea Arcangeli , Linus Torvalds , Tim Chen , Thomas Gleixner , Dan Williams , Jun Nakajima , Paolo Bonzini , David Woodhouse , Greg KH , Andy Lutomirski , Ashok Raj Subject: Re: [PATCH v6 4/5] KVM: VMX: Allow direct access to MSR_IA32_SPEC_CTRL Message-ID: <20180202175352.GT28192@char.us.oracle.com> References: <1517522386-18410-1-git-send-email-karahmed@amazon.de> <1517522386-18410-5-git-send-email-karahmed@amazon.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1517522386-18410-5-git-send-email-karahmed@amazon.de> User-Agent: Mutt/1.8.3 (2017-05-23) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8793 signatures=668661 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=768 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802020218 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org .snip.. > @@ -1913,6 +1914,29 @@ static void update_exception_bitmap(struct kvm_vcpu *vcpu) > } > > /* > + * Check if MSR is intercepted for currently loaded MSR bitmap. > + */ > +static bool msr_write_intercepted(struct kvm_vcpu *vcpu, u32 msr) > +{ > + unsigned long *msr_bitmap; > + int f = sizeof(unsigned long); unsigned int > + > + if (!cpu_has_vmx_msr_bitmap()) > + return true; > + > + msr_bitmap = to_vmx(vcpu)->loaded_vmcs->msr_bitmap; > + > + if (msr <= 0x1fff) { > + return !!test_bit(msr, msr_bitmap + 0x800 / f); > + } else if ((msr >= 0xc0000000) && (msr <= 0xc0001fff)) { > + msr &= 0x1fff; > + return !!test_bit(msr, msr_bitmap + 0xc00 / f); > + } > + > + return true; > +} with that: Reviewed-by: Konrad Rzeszutek Wilk