Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp57314imu; Wed, 2 Jan 2019 14:03:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xwpsj1PN7C30W3OcJ5ThCDg+zbGsZTotik2dZyo42hJD70AtKiPvDhbZihIXVfCwC5VQZp X-Received: by 2002:a62:4714:: with SMTP id u20mr45523020pfa.144.1546466583992; Wed, 02 Jan 2019 14:03:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546466583; cv=none; d=google.com; s=arc-20160816; b=ORubNHfoSxScEjY92pJmZ2lBjWtIsbummdZ4VyZBwvoefYBFJBc0LqQgp3JnTOeX2d jTT2GTNAwl3dm6gtK38v2CWisUI//qAdVzQyisFKL22050u84PDi5dOAvRsNJ/jGO9II ++AdmoTGHjjxmUMHw4ReHTQgDUgzAlFJvcmyDmbvZmJLO/5JrETNl6mQR3I24tdtZlvZ DtRx3PyyEUyxFm4iAucJ4O6gDLQSS8j7UIWoSmVtODUlcg6MNrna3vT0Szk2eNXr/IE3 8b7TjNj/YsDMJtmZnqPc5Y5IZMxVGJhYgQRQPLLhZ5ncc4yG4Tm8DOH3C0q2ybJIfUcG O0ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=oWnPKF16oOcS7VJ9naJp0a5/SJGD58NVsZXbQban15w=; b=hU7aNYiZfkqF0jwwjcFuMzlZPBLl7u4IxZZMKEjrFw52LPs7Mcc1bQOiDyvpDERPYa OrDcVIxIR0A91nwxfvn6Du8THtCUeQbPvNL0iK7C5OfXSUZJ17Jx+mE3d6pXXZiWec9b /KHIqWMJ03/WA9EQ7yXOWWctXTC/6PeO2ltP+L/zWCJmVZxr1yYvprECYxbGtEOxsURX qnricGE37XnEm9Juv5YxrFvfoCDapbdJV2GxwUxcg6NDGVBEvLOkLjOtSIg2qKVBJc3s 7M6ogQpYUseqpc8phsb5CwuXc6Rl6QRzeMmEPTcWEWwAljVhoSlIkdBm+RoLQFt3f9cL 5DGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tlV96abm; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j70si3859835pgd.138.2019.01.02.14.02.48; Wed, 02 Jan 2019 14:03:03 -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=@google.com header.s=20161025 header.b=tlV96abm; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728579AbfABTTq (ORCPT + 99 others); Wed, 2 Jan 2019 14:19:46 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:33183 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727107AbfABTTq (ORCPT ); Wed, 2 Jan 2019 14:19:46 -0500 Received: by mail-it1-f196.google.com with SMTP id m8so39472006itk.0 for ; Wed, 02 Jan 2019 11:19:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oWnPKF16oOcS7VJ9naJp0a5/SJGD58NVsZXbQban15w=; b=tlV96abmWRzrI18a3IiPR51fBa5C4eirFSxnuApnYa6IIVkxmI/DZstKF0eoEmfgy9 49fcVa0SuC6zeGNAShwqyYlO+5H9+wmR1i0Kg16wzeOl1GVOXcmHzIs1SnwkaajVymdJ BZb3aL8Kv53VjBDp56U/PP1Yv2VCE3FiPiY5K5j4kgvgRwdo94cKs7qF5R7O2ll9iJFw eME2hvXyWQvme1zzihMBK0p0tr9N+TBLJ4waVjJhpki0FXxdEvoMiGrFssvZsoRTubHX 8hRKyLLwHWODmelPtEjFcOH8KtN1o0PAeEZPQC6rWbWaTRHDkscWHiBIrDnqGOlWSTsz oZ7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oWnPKF16oOcS7VJ9naJp0a5/SJGD58NVsZXbQban15w=; b=H3cey4S3FnXamXKTc/F+5zN1U7W8VhaVwbzSJyU68FYDDXfK4NzYES9IrAK6Z8lNXc RUk2pY5Dv6+A/y6isr2sHFnXyYZTfFPe4C/ZgIY3JBQZC15GdB701LrQ/FtGHdstHUEE M7qUYTPt4DCJfNMHAPOP1/lSsCYOdOgTrVk8fyf8a3kt/PFny1nEu4nngIZciNNWiqey LiiMU4cIG98DHdnhq43POkHrJzPVzUmMJUVng80Aog5HvEvNqu4WwgEmUxXB2O6twx2g PrE6pwlcK2MuS3+4FlAx6HOJfm45mNHzaORSsyDyCb/w2BEYKDsCG1UpQk3Cmmj2UJZq OWiw== X-Gm-Message-State: AA+aEWarn6LBLyX8lGIfClT3OudA6VtLG3LSdZKvmQSJSwfJ0KMdqsUC Ox4rGWLs5A1xUQXoacQ+9k0uDqADw7MgBvUpN8qiVA== X-Received: by 2002:a02:ac8c:: with SMTP id x12mr27486427jan.72.1546456785167; Wed, 02 Jan 2019 11:19:45 -0800 (PST) MIME-Version: 1.0 References: <20181226081532.30698-1-weijiang.yang@intel.com> <20181226081532.30698-6-weijiang.yang@intel.com> <20190102182446.GC7460@linux.intel.com> In-Reply-To: <20190102182446.GC7460@linux.intel.com> From: Jim Mattson Date: Wed, 2 Jan 2019 11:19:34 -0800 Message-ID: Subject: Re: [PATCH v1 5/8] kvm:x86 Enable MSR_IA32_XSS bit 11 and 12 for CET xsaves/xrstors. To: Sean Christopherson Cc: Yang Weijiang , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , LKML , kvm list , "Michael S. Tsirkin" , yu-cheng.yu@intel.com, yi.z.zhang@intel.com, hjl.tools@gmail.com, Zhang Yi Z Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 2, 2019 at 10:24 AM Sean Christopherson wrote: > > On Wed, Dec 26, 2018 at 04:15:29PM +0800, Yang Weijiang wrote: > > For kvm Guest OS, right now, only bit 11(user mode CET) and bit 12 > > (supervisor CET) are supported in XSS MSR, if other bits are being set, > > the write to XSS will be skipped. > > > > Signed-off-by: Zhang Yi Z > > Signed-off-by: Yang Weijiang > > --- > > arch/x86/kvm/vmx.c | 11 ++++++++--- > > 1 file changed, 8 insertions(+), 3 deletions(-) > > > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > > index fa2db6248404..5739ab393b90 100644 > > --- a/arch/x86/kvm/vmx.c > > +++ b/arch/x86/kvm/vmx.c > > @@ -47,6 +47,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -4323,12 +4324,16 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) > > case MSR_IA32_XSS: > > if (!vmx_xsaves_supported()) > > return 1; > > + > > /* > > - * The only supported bit as of Skylake is bit 8, but > > - * it is not supported on KVM. > > + * Right now, only support XSS_CET_U[bit 11] and > > + * XSS_CET_S[bit 12] in MSR_IA32_XSS. > > */ > > - if (data != 0) > > + > > + if (data & ~(XFEATURE_MASK_SHSTK_USER > > + | XFEATURE_MASK_SHSTK_KERNEL)) > > New lines are usually after the operator, e.g.: > > if (data & ~(XFEATURE_MASK_SHSTK_USER | > XFEATURE_MASK_SHSTK_KERNEL)) > > And doesn't this flow need to check that the bits are actually supported? Supported on the host and in the guest.