From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A068C2D0A3 for ; Wed, 4 Nov 2020 18:52:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 83FE120782 for ; Wed, 4 Nov 2020 18:52:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="CCBUBlun" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730634AbgKDSwL (ORCPT ); Wed, 4 Nov 2020 13:52:11 -0500 Received: from mail.skyhub.de ([5.9.137.197]:43174 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729755AbgKDSwL (ORCPT ); Wed, 4 Nov 2020 13:52:11 -0500 Received: from zn.tnic (p200300ec2f0ef400317dde2deb3fed11.dip0.t-ipconnect.de [IPv6:2003:ec:2f0e:f400:317d:de2d:eb3f:ed11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id E5CBD1EC0179; Wed, 4 Nov 2020 19:52:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1604515930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=j35nNUv7vFKPZCAWGuXz8ekUUIF51j9Annk7NSuaxBA=; b=CCBUBlunPd2Wfa6m5DSTGXAr7/w4HCLTmNA4aAn0gHiWqbEYtl9VXfWeULS/z5fKyvjTep BxSMyAg0xzOwlIfhwitqAmqPONucjkw0Ev9sFuEO9NjkuGhVbmCN6meBveQMWQ6SaMfa/g MrzmgVD4XIW4ZpwQcnme1EoLDji8L7A= Date: Wed, 4 Nov 2020 19:51:57 +0100 From: Borislav Petkov To: Shuo A Liu 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: <20201104185157.GE23298@zn.tnic> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201104035027.GA17702@shuo-intel.sh.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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." 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. > > 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... > 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. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette