From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753052AbcGaCck (ORCPT ); Sat, 30 Jul 2016 22:32:40 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35989 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751891AbcGaCcf (ORCPT ); Sat, 30 Jul 2016 22:32:35 -0400 MIME-Version: 1.0 In-Reply-To: <402de949-31fb-1733-9479-4803fce7de93@redhat.com> References: <1468351223-3250-1-git-send-email-pbonzini@redhat.com> <1468351223-3250-5-git-send-email-pbonzini@redhat.com> <20160713203006.GB16130@potion> <402de949-31fb-1733-9479-4803fce7de93@redhat.com> From: Wanpeng Li Date: Sun, 31 Jul 2016 10:32:32 +0800 Message-ID: Subject: Re: [RFC PATCH 4/4] KVM: vmx: add support for emulating UMIP To: Paolo Bonzini Cc: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , "linux-kernel@vger.kernel.org" , kvm Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2016-07-14 16:09 GMT+08:00 Paolo Bonzini : [...] > > This is not necessary because this is how KVM computes > CPUID[EAX=7,EBX=0].ECX: > > unsigned f_umip = kvm_x86_ops->umip_emulated() ? F(UMIP) : 0; > ... > const u32 kvm_cpuid_7_0_ecx_x86_features = F(PKU) | F(UMIP); > ... > // Mask userspace-provided value against supported features > entry->ecx &= kvm_cpuid_7_0_ecx_x86_features; > // Mask userspace-provided value against host features > cpuid_mask(&entry->ecx, CPUID_7_ECX); > // Finally add emulated features > entry->ecx |= f_umip; I think you mean: - entry->ecx -> userspace-provided value - kvm_cpuid_7_0_ecx_x86_features -> supported features - CPUID_7_ECX -> host features However, entry->ecx is returned by cpuid instruction (do_cpuid_1_ent()), so why it is a userspace-provided value? Regards, Wanpeng Li