Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1008753pxb; Tue, 3 Nov 2020 19:54:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJyj1cXM7DLq28Ys27JAWLiifI0Z+7iPno5jXs3iVCqizMry8JYK9Q0iO2lKvJviJpNSIshh X-Received: by 2002:a05:6402:1bdb:: with SMTP id ch27mr22615228edb.63.1604462073760; Tue, 03 Nov 2020 19:54:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604462073; cv=none; d=google.com; s=arc-20160816; b=wHV5MWAxiCxRg3blNwpa0eGXriL+zQ1FuvlFzd7tyzo/QQha7jXqk7bg5+80scJK8h NutWWv5XnhKeli7aJ2z573QxUhZKDZe5QiZm6WrFFE4LD/1Pqpm5nYEAf8SkEYEcTrEd a5g6djsJLK3wo80NGHc4VQw6LBFwcvGR0l0JttAsFYjAT/PlzJbLjaj3wxHWg1iHdg2M ZAJoz6ozPSHGCtOv9LXfEznrYE95biur8yxd+JuLogLbcqn8GdJTSvRoK0NqwXaDaMIL X+U6D960kCMVpi/7ekP9hRMGddzfy0GN6+Rgdronma5EtjuL9zLeyV+2l0WTB/tF416F KsFg== 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=JB9lv9X4T83KrDdF28lOMCyp9IkyKDj2wshbp9jsP3M=; b=AMOQ47UUn8fQgDQxYPa6oELtq/edplr7d/AxU7ohYSOVqK3ZsRKIqeRi6Ox/Ydx/DS x/rEW2JFbhrpnfS54WOSryX2NQrBv/3yDpn/elYR17qe3z5I3mJvRZQUEn2hVWYdYGzM r6kMHcG6SXnoj/ijuOxFrnPVO7lhu/0A2FClPGHglEDDG6k1569kC68AYLb2voSlhzPL TpUDWmyEDLooOSl70sPklvgI5hLrI+cYJQUKkvTL+iRUBbFHpZ+zPoL56WAGSRvxKGv4 gEG4J5bTCl5sHS0mF1hQc6OE1NGxe+89aa0DsuR1T/8FMUQHNAcQHztNrB3WLBUnC900 yYRw== 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 t9si415706edw.355.2020.11.03.19.54.11; Tue, 03 Nov 2020 19:54:33 -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 S1728162AbgKDDud (ORCPT + 99 others); Tue, 3 Nov 2020 22:50:33 -0500 Received: from mga02.intel.com ([134.134.136.20]:34726 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726008AbgKDDud (ORCPT ); Tue, 3 Nov 2020 22:50:33 -0500 IronPort-SDR: VJA2ECPWJDqCFgi5fB4xh2J725WZPHI+9TtJogWQw9NpZ6jSfbo4Ik5QJqgom6Wwmb++VJlA0H QYAw5lHrZyMQ== X-IronPort-AV: E=McAfee;i="6000,8403,9794"; a="156150906" X-IronPort-AV: E=Sophos;i="5.77,449,1596524400"; d="scan'208";a="156150906" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2020 19:50:32 -0800 IronPort-SDR: 7yLk8WgFV8IulWqBll0qQ6AUNBY5g7xGXO9konAWwj4X58tWoOMfV0V8tuiQEym4OjOKV17AWd aLJRalIs5AIg== X-IronPort-AV: E=Sophos;i="5.77,449,1596524400"; d="scan'208";a="538742905" Received: from shuo-intel.sh.intel.com (HELO localhost) ([10.239.154.30]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2020 19:50:29 -0800 Date: Wed, 4 Nov 2020 11:50:27 +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: <20201104035027.GA17702@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20201103102538.GB6310@zn.tnic> User-Agent: Mutt/1.8.3 (2017-05-23) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > >Now where is yours explaining what your hypervisor is doing? Currently, it is in arch/x86/include/asm/acrn.h. > >> I can change to use >> cpuid_eax(acrn_cpuid_base() + 1)... >> If you prefer to. > >Yes please. Sure. 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). 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. > >> hypervisor_cpuid_base() implies the base is variable, no? We use >> this function to detect the base. > >Yes, but you need to document all that and make it clear and >understandable. If Linux is supposed to run as an acrn guest, that >interface better be documented just like KVM does. OK. I can add a similar cpuid.rst for acrn. > >Also, if there's a bug in the KVM guest/host interface, we might be able >to fix it modulo ABI. Is that possible with acrn? > >I'm guessing the answer to that is yes if I'm looking at > >https://github.com/projectacrn/acrn-hypervisor > >? Yes. Fix patches are always welcome. > >> OK. Then i will define acrn_cpuid_base() as a static inline function >> in asm/acrn.h for callers. > >Yah, that function is simple enough. Thanks shuo