Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753586AbdGJLEC (ORCPT ); Mon, 10 Jul 2017 07:04:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44790 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752578AbdGJLEB (ORCPT ); Mon, 10 Jul 2017 07:04:01 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7C40680F6D Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=pbonzini@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7C40680F6D Subject: Re: [PATCH 2/3 v2] KVM: nVMX: Enable VMFUNC for the L1 hypervisor To: David Hildenbrand , Bandan Das , kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org References: <20170706230323.29952-1-bsd@redhat.com> <20170706230323.29952-3-bsd@redhat.com> From: Paolo Bonzini Message-ID: Date: Mon, 10 Jul 2017 13:03:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 10 Jul 2017 11:04:00 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 680 Lines: 19 On 10/07/2017 11:17, David Hildenbrand wrote: >> + >> + vmcs12 = get_vmcs12(vcpu); >> + if ((vmcs12->vm_function_control & (1 << function)) == 0) > (learned that in c, shifting beyond the type size is undefined) > > Should we check for function < 64 here? (as SDM mentions) It should be already. The manual says: The VMFUNC instruction causes an invalid-opcode exception (#UD) if the “enable VM functions” VM-execution controls is 0 1 or the value of EAX is greater than 63 (only VM functions 0–63 can be enable). Otherwise, the instruction causes a VM exit if the bit at position EAX is 0 in the VM-function controls (the selected VM function is not enabled). Paolo