From: Paolo Bonzini Subject: Re: [PATCH v3 7/8] KVM:X86: Add XSS bit 11 and 12 support for CET xsaves/xrstors. Date: Fri, 8 Mar 2019 12:32:04 +0100 Message-ID: References: <20190225132716.6982-1-weijiang.yang@intel.com> <20190225132716.6982-8-weijiang.yang@intel.com> <20190228162512.GG6166@linux.intel.com> <20190228084404.GD12006@local-michael-cet-test.sh.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: rkrcmar@redhat.com, jmattson@google.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, mst@redhat.com, yu-cheng.yu@intel.com, Zhang Yi Z To: Yang Weijiang , Sean Christopherson Return-path: In-Reply-To: <20190228084404.GD12006@local-michael-cet-test.sh.intel.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 28/02/19 09:44, Yang Weijiang wrote: >>> if (!vmx_xsaves_supported()) >>> return 1; >>> + >>> /* >>> - * The only supported bit as of Skylake is bit 8, but >>> - * it is not supported on KVM. >>> + * Check bits being set are supported in KVM. >> I'd drop the comment altogether, it's pretty obvious from the code that >> were checking which bits are supported. > you won't see these redundancies in next version ;) >>> */ >>> - if (data != 0) >>> + if (data & ~kvm_supported_xss()) >>> return 1; You should instead check this against CPUID[0xD, 1].EDX:ECX. If CET is disabled in CPUID, the guest should not be able to set it in MSR_IA32_CSS. Paolo