Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp377209ybn; Tue, 1 Oct 2019 22:56:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyL4x3ZBElgmUXQ4mE6PFNyla4NzPjzC8ULwpG1hk3Wa4lpawqND7utUBgbzLrppwmsdohu X-Received: by 2002:a17:906:6d4:: with SMTP id v20mr1517692ejb.223.1569995799160; Tue, 01 Oct 2019 22:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569995799; cv=none; d=google.com; s=arc-20160816; b=RmbXWalltaGpyY8sd2E0atrIq8oiUiGTReiTwJG9WZn7jPRJQ0GYmSCoXQVcyIwa5h S2YUZYwL5u+LWqyJwjjNbmL4ArW3226fwWt+6uAOqvINIogY6TbtYuPsZ/iJWlaNUAqQ omwDcvNSAHX2m111Qbl2V7neVkeBMZs7/sjsDHI3esjTDzIo95G9R94xPVSRhIMxyKfY Gl3pCdBaj6YNkNvCsscgeKYETDhizN643sDrRcqJhJpnxYOGW/cWJ84iTrq5+JWs/PtS fG7bx1Lj9XIZ2SCngze6KBxaRjgZarDuzXI67GjAelEB2hKdbOi+RgnldpHYwaru3qHD CJYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=SW+QeXhnSpbVW9LQkBj+n8dk32Kxuff5dvKj69bO72Y=; b=xTNT9TMxXLlxudy7GujNZJ/94rFV7CXrm4VJlkJUsfvqyCMjqqXK5pqfbviiyE+91Z bZ5O+ux2ijqagMfV5ZcvQknZAtN3nM76v8+b9RYJMXP8gLB14Hw08YsHg8RyWnRExBh2 x54YJpAEj43Rq8Iq6H0JDOnpOegVCwpSG3z/PSC0HzpDI6eipbKA+Gts69ZbvKlx57XF GlBmH0Hv/93lcongwj8HoeLAugQK0CcH1pvlnrFGyMleJ0i1r2mHPXCnmDumJz8WRgjn VVxQlAmbiEgkSsV0h9Wt48KKMki/KnQvJcieOr3daX7nZehrJzTj+xAfSmrxd3kP846K ry3A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qk5si10287442ejb.188.2019.10.01.22.56.14; Tue, 01 Oct 2019 22:56:39 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728351AbfJAWQt (ORCPT + 99 others); Tue, 1 Oct 2019 18:16:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59484 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728254AbfJAWQs (ORCPT ); Tue, 1 Oct 2019 18:16:48 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B879B2DC4; Tue, 1 Oct 2019 22:16:48 +0000 (UTC) Received: from localhost (ovpn-116-88.gru2.redhat.com [10.97.116.88]) by smtp.corp.redhat.com (Postfix) with ESMTP id 161E660619; Tue, 1 Oct 2019 22:16:47 +0000 (UTC) Date: Tue, 1 Oct 2019 19:16:46 -0300 From: Eduardo Habkost To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Jim Mattson , konrad.wilk@oracle.com Subject: Re: [PATCH 2/3] KVM: x86: always expose VIRT_SSBD to guests Message-ID: <20191001221646.GN4084@habkost.net> References: <1566376002-17121-1-git-send-email-pbonzini@redhat.com> <1566376002-17121-3-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1566376002-17121-3-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 01 Oct 2019 22:16:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 21, 2019 at 10:26:41AM +0200, Paolo Bonzini wrote: > Even though it is preferrable to use SPEC_CTRL (represented by > X86_FEATURE_AMD_SSBD) instead of VIRT_SPEC, VIRT_SPEC is always > supported anyway because otherwise it would be impossible to > migrate from old to new CPUs. Make this apparent in the > result of KVM_GET_SUPPORTED_CPUID as well. > > While at it, reuse X86_FEATURE_* constants for the SVM leaf too. > > However, we need to hide the bit on Intel processors, so move > the setting to svm_set_supported_cpuid. > > Cc: Konrad Rzeszutek Wilk > Reported-by: Eduardo Habkost > Signed-off-by: Paolo Bonzini > --- [...] > @@ -5944,6 +5944,11 @@ static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) > if (nested) > entry->ecx |= (1 << 2); /* Set SVM bit */ > break; > + case 0x80000008: > + if (boot_cpu_has(X86_FEATURE_LS_CFG_SSBD) || > + boot_cpu_has(X86_FEATURE_AMD_SSBD)) > + entry->ebx |= F(VIRT_SSBD); > + break; Wasn't the old code at arch/x86/kvm/cpuid.c:__do_cpuid_func() supposed to be deleted? /* * The preference is to use SPEC CTRL MSR instead of the * VIRT_SPEC MSR. */ if (boot_cpu_has(X86_FEATURE_LS_CFG_SSBD) && !boot_cpu_has(X86_FEATURE_AMD_SSBD)) entry->ebx |= F(VIRT_SSBD); -- Eduardo