Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1840320ybn; Thu, 26 Sep 2019 03:03:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqzyYcqT+coSLkwkzqFhJZOyUR7H2BoDPwnBZNHhIQYwYsZD/SJWPWCrE0KStZ0pneN+bHuj X-Received: by 2002:a17:906:f82:: with SMTP id q2mr2285275ejj.143.1569492191311; Thu, 26 Sep 2019 03:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569492191; cv=none; d=google.com; s=arc-20160816; b=K39ipTCaN90H6nJIIz2Q9yXuWSO17tLGxLvYxs7odt/UkUMC2/KFgp7lofzfNaJgOb mZcm4wENSDa3+zaSqMKlNbAUHxPPABsw1U7PIW3evYqYVBq+xOq1lwb4lRVVLDZNPjk2 kOTTG/lymJndx5nSh5U+v02pzbWWbAuThZA/cIYC6s6/PlTr9CrUPnoPUQZ3tL1DfCJj zycw5sCo7tkcXbvbFZDGQ49xfMJuihQPnew0pE1LL7Rm52B9HzjUpDYx2+9TOsOHRpcf lLPf6QkdLvi3AmHkxrjdQlH0FwC/G/WIbMR4BAd1ygXus0GH6tvHxmZQ3UOqR7UZT/X8 nvQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=gWrtMO/1hZ/o86Hyus1zQo+xeKnPuBEenuj+vizXnyo=; b=QhW77BvxLI+or68VVZ7PYTkgZ1KyGBxjs3rcu+5dh9tmgn6w3HCrn6OxJukfSNb76i 76db/2MgUYYSYLfehQRrrDXoknpB6CsSUoRvjOg7sE/qqXEe6vi9UrXjzwvjCCjAzvCX D93k9YacYuifu+X+iWHOg3RX6No4vKLVuk3fdgplRePkRNgddC4dq91ZqGTY9z1bvXt6 Pmo/GA3UUsdyxBVqCLLxMbAwTgnYooEx/bHWim56vP3kCm1sKpJlNHcSi2quJ7H1d970 nyKHzGaEf4S2VhgCo1m5UW8gamQmJW6mReIgDJcVKkXM1Hm2iL5yJNBVqJhvLYEsPcVY b8sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=koGSocao; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u14si968782edq.167.2019.09.26.03.02.45; Thu, 26 Sep 2019 03:03:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=koGSocao; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728832AbfIYWKv (ORCPT + 99 others); Wed, 25 Sep 2019 18:10:51 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:44232 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728756AbfIYWKu (ORCPT ); Wed, 25 Sep 2019 18:10:50 -0400 Received: by mail-io1-f65.google.com with SMTP id j4so957658iog.11 for ; Wed, 25 Sep 2019 15:10:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gWrtMO/1hZ/o86Hyus1zQo+xeKnPuBEenuj+vizXnyo=; b=koGSocaoGdmmz2EAifg+USVuephOpKxacLGEobTQDZHxSK8IPRGIsHXPLo6+ji3M02 he/qi3ePlQUkYeQETTqk6AZqfafzx33eWntchMyfmH1i41z911ZRRnr2h55zLnAH5DhU Lk0XXvyS1BLAy2Cwap8ZXQ8O3zH7LAUKwTky6dCiToae2EpAvzExqPX+0L911zwFJktD bk8OgO6YJl2QwKvw9+mZEEWeACNFH03tolWaXQUwHtYrbqL+bvuZT7CgPAZvmRZJ3pic +96DCQ7muxwH9sOoNIVQ7UCzL5I3RRD7yVBokZLVs97ENcqyAmMFESn8KH5hGlFskgu4 gs6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gWrtMO/1hZ/o86Hyus1zQo+xeKnPuBEenuj+vizXnyo=; b=Fd8f2xqwe8CffgpEPZExxmaHKeF5nfS4WUsnkdQaI22HVX5CZOKQWY54gCJPJ55VNm Zifr8zHOe5h/4lqXGc7irYk9W78Y+FnCvsfHs5tvkFJ/+M+H4+V4o02NIXY4yGA794KM 945PbY31gRV6hBvZ8MF7p2Bu0ve4fKwQYs51BlZbhXf4NhDIr/dyq7GeS0jLHqLoI9Cg w0gfjISXV0sI0da9VWcEApekbUABZtyGbM7kVPw7BtsnoYkQUJ4lkxGwqJtuZdM/47f1 FnHS4waC7djBK6Rxt+YAtjQOdJ3aCUcljAEbc89R9lniB9f8S64QIL2+T10v38bUBARF pFmw== X-Gm-Message-State: APjAAAV5tteaKlQVcUx+C4AYzhLS9/vXi5hAYAHwnZrTkVRAs8aRIZ9q 2HOXCIPSaFLrrdkYpR96vG+B7Uf8uyapP0jk9FWtOQ== X-Received: by 2002:a92:5ad1:: with SMTP id b78mr7934ilg.118.1569449449584; Wed, 25 Sep 2019 15:10:49 -0700 (PDT) MIME-Version: 1.0 References: <20190925213721.21245-1-bigeasy@linutronix.de> <20190925213721.21245-3-bigeasy@linutronix.de> In-Reply-To: <20190925213721.21245-3-bigeasy@linutronix.de> From: Jim Mattson Date: Wed, 25 Sep 2019 15:10:38 -0700 Message-ID: Subject: Re: [PATCH 2/2] KVM: x86: Expose CLZERO and XSAVEERPTR to the guest To: Sebastian Andrzej Siewior Cc: kvm list , LKML , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "the arch/x86 maintainers" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 25, 2019 at 2:37 PM Sebastian Andrzej Siewior wrote: > > I was surprised to see that the guest reported `fxsave_leak' while the > host did not. After digging deeper I noticed that the bits are simply > masked out during enumeration. > The XSAVEERPTR feature is actually a bug fix on AMD which means the > kernel can disable a workaround. > While here, I've seen that CLZERO is also masked out. This opcode is > unprivilged so exposing it to the guest should not make any difference. > > Pass CLZERO and XSAVEERPTR to the guest if available on the host. > > Signed-off-by: Sebastian Andrzej Siewior > --- > arch/x86/kvm/cpuid.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c > index 22c2720cd948e..0ae9194d0f4d2 100644 > --- a/arch/x86/kvm/cpuid.c > +++ b/arch/x86/kvm/cpuid.c > @@ -473,6 +473,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function, > > /* cpuid 0x80000008.ebx */ > const u32 kvm_cpuid_8000_0008_ebx_x86_features = > + F(CLZERO) | F(XSAVEERPTR) | > F(WBNOINVD) | F(AMD_IBPB) | F(AMD_IBRS) | F(AMD_SSBD) | F(VIRT_SSBD) | > F(AMD_SSB_NO) | F(AMD_STIBP) | F(AMD_STIBP_ALWAYS_ON); > > -- > 2.23.0 Didn't someone just post "[PATCH] kvm: x86: Enumerate support for CLZERO instruction" yesterday? :-)