Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B23CC433F5 for ; Thu, 11 Nov 2021 08:29:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E4F5D61215 for ; Thu, 11 Nov 2021 08:29:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232426AbhKKIb6 (ORCPT ); Thu, 11 Nov 2021 03:31:58 -0500 Received: from mga14.intel.com ([192.55.52.115]:31653 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232257AbhKKIb4 (ORCPT ); Thu, 11 Nov 2021 03:31:56 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10164"; a="233119652" X-IronPort-AV: E=Sophos;i="5.87,225,1631602800"; d="scan'208";a="233119652" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2021 00:29:08 -0800 X-IronPort-AV: E=Sophos;i="5.87,225,1631602800"; d="scan'208";a="504341359" Received: from xiaoyaol-mobl.ccr.corp.intel.com (HELO [10.239.13.123]) ([10.239.13.123]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2021 00:29:03 -0800 Message-ID: <7733a5fe-6284-fe1d-a09d-cc22be8b3887@intel.com> Date: Thu, 11 Nov 2021 16:29:01 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.3.0 Subject: Re: [RFC PATCH v2 22/69] KVM: x86: Add vm_type to differentiate legacy VMs from protected VMs Content-Language: en-US To: Paolo Bonzini , Sean Christopherson Cc: "Yamahata, Isaku" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , "erdemaktas@google.com" , Connor Kuehl , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "isaku.yamahata@gmail.com" References: <8eb87cd52a89d957af03f93a9ece5634426a7757.1625186503.git.isaku.yamahata@intel.com> <5689dc7e-b0e0-1733-f00f-66dc7b62b960@intel.com> <055d924e-2117-247f-8339-7487153e284b@redhat.com> From: Xiaoyao Li In-Reply-To: <055d924e-2117-247f-8339-7487153e284b@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/11/2021 3:28 PM, Paolo Bonzini wrote: > On 11/11/21 04:28, Xiaoyao Li wrote: >>> >>> Heh, because kvm_dev_ioctl_create_vm() takes an "unsigned long" for >>> the type and >>> it felt wrong to store it as something else.  Storing it as a smaller >>> field should >>> be fine, I highly doubt we'll get to 256 types anytime soon :-) >> >> It's the bit position. We can get only 8 types with u8 actually. > > Every architecture defines the meaning, and for x86 we can say it's not > a bit position. Sorry, I find I was wrong. The types are not bit position but value. KVM_CAP_VM_TYPES reports the supported vm types using bitmap that bit n represents type value n. > Paolo >