Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp273702pxb; Wed, 4 Nov 2020 22:36:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJz11Mu5IaTBh0fHV6CagaGQNixeu7BbsbWmoaAj1UGGUJwxcU9CJUfphAvWscinSzJOR0VP X-Received: by 2002:a17:906:e254:: with SMTP id gq20mr901264ejb.520.1604558208607; Wed, 04 Nov 2020 22:36:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604558208; cv=none; d=google.com; s=arc-20160816; b=XrIM0sVuCZueYEIzaqkLfQoucj2bYupnMwu+JU/1fBcbw1znNoeLmWb20FUx2xxFeb 0OftP1IbiTPnQkLk3V4jUTKqEWhj22NKlzOO+ed0+P00JKd+KUan0XEhAyPvNotQzLvE JDShkC3Thw2vxz9H1uQNcexHJQcW2JfmJqNpCUGInN7Z6QtP8gI9eLwXlTBnHAX7dGuv jyEVvMGVJBoRKOYn8C5AaJSxzXpRR9E+sOBR9LYxX+ZsyaNOL0m7Iw1VqASrkqthHh0P a8+iVBcEW7IC8QJvEKqFR+9I9s7MIzl/4MxpiIhhhthH3u3K5qK2KP1CtHeiiVa9IQng xItQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=hKqI1cwINg8e9aCLT2iMoCi366ZDfVoTbjOn0P01ng0=; b=o5bQJrG3yTs674F9X3NNaggx1qFdTgJ3q9KuLB9T2WO+AZZ8J/FCNjNVlR5y/nPi7p RT/swZfoxvElgtWIAS/VQ3XQ1QEyXspJr1TrZ6fY2DOGHQzFurKLMBF1amMqyTGDnxBn pPMh2ywc0Eg/dnRpuu9iN2UWNJVWEuRj9mmPQ+/41ouAUmRKLa3kiLKKXjlsuW5678pi MHo/voKvyTm2/ywOnhRgLVtfzkUvS6u6pkWjxriybuMLRbGbAUQI9NMRWkrt1uaPIs3B JzVyeI1BV0P7a53X7C0MgQQ2u+aquf0xhxiISDbehXSN+muSVL3mZh3Y5/WsThS2q47r WZdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n9si503940ejo.640.2020.11.04.22.36.26; Wed, 04 Nov 2020 22:36:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388577AbgKEDZa (ORCPT + 99 others); Wed, 4 Nov 2020 22:25:30 -0500 Received: from mga07.intel.com ([134.134.136.100]:33200 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728511AbgKEDZa (ORCPT ); Wed, 4 Nov 2020 22:25:30 -0500 IronPort-SDR: sN/RHjDqsqwzMR6fit0MjqcVnU3BHeHERWWjyebTcglCbPDrKcY+1TW7dE4oUCi5JFgMR1sh7m fjafLuvvxG6w== X-IronPort-AV: E=McAfee;i="6000,8403,9795"; a="233482034" X-IronPort-AV: E=Sophos;i="5.77,452,1596524400"; d="scan'208";a="233482034" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2020 19:25:29 -0800 IronPort-SDR: ZrKPoAYYgtTJyDiXIauVM/1+ylNUbJXxAgclTUOzApmsa9zIkdUb2zFQTCWBPnnbKtl2PmLmQo E4jqBJvvBHmQ== X-IronPort-AV: E=Sophos;i="5.77,452,1596524400"; d="scan'208";a="471474907" Received: from shuo-intel.sh.intel.com (HELO localhost) ([10.239.154.30]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2020 19:25:24 -0800 Date: Thu, 5 Nov 2020 11:25:22 +0800 From: Shuo A Liu To: Borislav Petkov Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Greg Kroah-Hartman , "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , Sean Christopherson , Yu Wang , Reinette Chatre , Yin Fengwei , Dave Hansen , Dan Williams , Zhi Wang , Zhenyu Wang Subject: Re: [PATCH v5 03/17] x86/acrn: Introduce an API to check if a VM is privileged Message-ID: <20201105032522.GC17702@shuo-intel.sh.intel.com> References: <20201019061803.13298-1-shuo.a.liu@intel.com> <20201019061803.13298-4-shuo.a.liu@intel.com> <20201102143707.GC15392@zn.tnic> <20201103062718.GD12408@shuo-intel.sh.intel.com> <20201103102538.GB6310@zn.tnic> <20201104035027.GA17702@shuo-intel.sh.intel.com> <20201104185157.GE23298@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20201104185157.GE23298@zn.tnic> User-Agent: Mutt/1.8.3 (2017-05-23) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 4.Nov'20 at 19:51:57 +0100, Borislav Petkov wrote: >On Wed, Nov 04, 2020 at 11:50:27AM +0800, Shuo A Liu wrote: >> On Tue 3.Nov'20 at 11:25:38 +0100, Borislav Petkov wrote: >> > On Tue, Nov 03, 2020 at 02:27:18PM +0800, Shuo A Liu wrote: >> > > The code just followed KVM style (see kvm_arch_para_features()). >> > >> > Do you see Documentation/virt/kvm/cpuid.rst? >> >> OK. It documents the leaf number. > >It also says > >"Note also that old hosts set eax value to 0x0. This should be >interpreted as if the value was 0x40000001." Ok. > >Does this hold true for the acrn HV? The fact that I'm asking about >all those things should give you a hint that documenting the API is >important. No, acrn HV is always return eax with maximum leaf number. Let me add the document. > >> > Now where is yours explaining what your hypervisor is doing? >> >> Currently, it is in arch/x86/include/asm/acrn.h. > >Yeah, you can't expect people to go scrape it from headers though - it >should be concentrated in a doc file. > >> If the leaf numbers be documented explicitly (like kvm), i think i can >> use them as eax of cpuid_eax() directly (back to your first comment). > >Which means, you don't need to do the logical OR-ing which kvm does >because of what I pasted above about eax being 0 on old hosts. Now we're >getting somewhere... Yes. > >> cpuid_eax(ACRN_CPUID_FEATURES)... >> >> If you looking at implementation of acrn-hypervisor, you will found the >> leaf number is hardcoded in the hypervisor. So, they also can be >> documented explicitly. > >Ok. > >> OK. I can add a similar cpuid.rst for acrn. > >Yes please. > >> Yes. Fix patches are always welcome. > >Ok, good, the thing is open. You could put that in the doc too, along >with the link so that people can find it. OK. Thanks shuo