Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1529215pxb; Wed, 4 Nov 2020 11:22:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJy2x0ZqHCVicuHnEJz1wRk8aH29N2PuqFNNf+tZDQ45mTJrs4hT64Gaubpp3owTnGJH6az1 X-Received: by 2002:a50:c945:: with SMTP id p5mr27802622edh.55.1604517777113; Wed, 04 Nov 2020 11:22:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604517777; cv=none; d=google.com; s=arc-20160816; b=sjKvMZAkFXe6Nrrl3xHPfg3KZNEmnbA5jxilrOQGiV1/Enpkpddlw48lJMyQthQu/o M4XNbg0vj72nng70XHQxSwU23OIbIyUnDwbGWVorHwRs7WmE7+aod61VWeCEyKRbIUXm q0dmSMkXZyQmevcautjj22SDV0KTL8VLwGhfIVsZM1oYvIqfM87mHoaZTBCi5hiuBRsT ZmPxbVVuhDTmjbRGQ7FrEnEdTKLWnmH3oj/Z1P/Qh+G/+tXsk/FbOSbFjIrE0b+OBDzY fPf3Me4ZCki+QMk3S6aiPQRzipwI+e1ERNYRZs/obRVv7RzC3QUQY87bE4UudL2jQnt4 7bCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=j35nNUv7vFKPZCAWGuXz8ekUUIF51j9Annk7NSuaxBA=; b=K1QF1Y6jSujSZIKoxyZB6B++3tKegHM8DjapPEIsDLYWY/hhNNg6z47ArMHnv9WTmV anQwmBR9EGIuvRD/2HQYviMpQQGauKqPdvAxKyRys4Dxi8YzVQHxrqhFLjm8JYj93FI4 Y7PK2kp+jlkNFpsJWXqhPvcb1cNn9bAlBOpV/LvSBSfa95CZXorRmlOTffzc5OmfSp2e OPhJQ+75gasxNbX249513dSdKbzuOmZcwHzmMndo//8AIYetIZvqBBZ/CoR74+dPEnzD wTvd8j8NWTxMoA1SgOK+1r45IDhuRTPp83KLyEQjHlRnFp6AyVT9XM+AmKj7NzIhErd4 bdkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=CCBUBlun; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a9si1861287edt.50.2020.11.04.11.22.34; Wed, 04 Nov 2020 11:22:57 -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; dkim=pass header.i=@alien8.de header.s=dkim header.b=CCBUBlun; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730347AbgKDSwL (ORCPT + 99 others); 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