From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [Xen-devel] [PATCH v2 3/3] paravirt: rename paravirt_enabled to paravirt_legacy Date: Mon, 8 Feb 2016 16:05:47 +0000 Message-ID: <56B8BCDB.9040701@citrix.com> References: <1454733014-15237-1-git-send-email-mcgrof@kernel.org> <1454733014-15237-4-git-send-email-mcgrof@kernel.org> <20160206085930.GF25240@wotan.suse.de> <20160206220437.GA4435@pd.tnic> <56B8B6BF.6030007@oracle.com> <20160208155507.GF28980@pd.tnic> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20160208155507.GF28980@pd.tnic> Sender: linux-kernel-owner@vger.kernel.org To: Borislav Petkov , Boris Ostrovsky Cc: X86 ML , david.e.box@intel.com, Andrey Ryabinin , Lv Zheng , Jan Beulich , "H. Peter Anvin" , qiuxishi@huawei.com, cocci@systeme.lip6.fr, Xen Devel , Joerg Roedel , "Rafael J. Wysocki" , Robert Moore , Ingo Molnar , Andrey Ryabinin , Mauro Carvalho Chehab , "Luis R. Rodriguez" , Rusty Russell , Thomas Gleixner , mcb30@ipxe.org, Juergen Gross , "linux-kernel@vger.kernel.org" , Andy Lutomirski , "Luis R. Rodriguez" , long.wanglong@huawei.com, Fenggu List-Id: xen-devel@lists.xenproject.org On 08/02/16 15:55, Borislav Petkov wrote: > On Mon, Feb 08, 2016 at 10:39:43AM -0500, Boris Ostrovsky wrote: >> It does. Very much IIRC, the problem was not caused by an access to MSR but >> rather some sort of address not being available somewhere. > See below. > >>> - microcode application on Xen: we've had this before. The hypervisor >>> should do that (if it doesn't do so already). >> it does. > Good. > >>> So yes, that paravirt_enabled() thing should go away. Even more so if we >>> have CPUID leaf 0x4... reserved for hypervisors. >> I actually think this was the original proposal until we realized we had >> paravirt_enabled(). So we can go back to checking CPUID 0x40000000. >> >> We might also be able to test for (x86_hyper!=NULL) and have guests that do >> microcode management prior to init_hypervisor() rely on hypervisors ignoring >> MSR accesses (as they do today). > Right, so the early loader can't do that as on 32-bit it runs even > before paging has been enabled. So I *think* the thing with CPUID would > be best. What does the xen hypervisor return in regs when I do CPUID(4)? > I.e., how do I reliably detect it in the guest? > > I can whip up a quick patch and get rid of paravirt_enabled() while at > it... > For compatibility with other virtualisation specs, Xen's cpuid leaves shift depending on configuration. Spec at http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/include/public/arch-x86/cpuid.h;h=d709340f18d089560b959835eabb7b6609542c7e;hb=HEAD#l33 Basically, they are either at 0x40000000, or 0x40000100 if viridian or vmware compatibility has been enabled. ~Andrew