[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 2/3] amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 29 Apr 2022 12:35:45 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lPrOjayVsy3Kq2sWARRiRreSlaE+Mdnbbq6qDxzjrYU=; b=iMWh/pBqBDvU3hcQZ1i/od9fSEJjFOHcOCMjLeZTq5+Ei4X+2H8m09TDuZWj1yKcmp9lcGQcsFl3sQ6IVYC8QdhI7SB576c+pGRyMZc4GT8sQXkOoph7EFcw+Tn3ZehvusDHJdirtpL3huvSUJhUZgntMA9BccJLkwL3HgGLM07rrnHuPkXdzwUoEZOaIZjFM0VfP0rDQdE7cOkrMN3XRKihW0YcOrrN5bXrnfkZIKye6RjwRFOTmNXZpBDA6olTJTiyXgSBA7prr1IDAiPQn7G3moVAZOUzbL7qbQX+DgiBz8PaqJHiGB0ZzssGD/SIRjIldhbecMMMnHdaOBlSEA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R99VKT0mbqOcr8NfS5Ey+VDQx1uMyFT8TzmCfesdkcmQYv/MZfeY7R8hLnAunZyYix9KuL2liyxo4P9c5uLJd2j/e1lBmbl7mQQX1g5mldqQq7ZGAVFkS7Q4DLS7cwOO0RF4R3+uBtyeCrTM1lkYRiatS/O2XSYPHWD3BAFSnO14H58KL09m4uDrUGp5H/jc/59/A0QR07UFuw0IGfPQPa9ASPtjkDIWbXSxttbSjFT3EoyZ9CVJRZ1UsF3XM16ASfkVK5Wx4nJSEbP9/jwZPKGQZdJA05ogXHZT3N2UtLlynjDoCtntwWDuE0DSk3pJWLJq8hydT9raObzRYR5y1A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 29 Apr 2022 10:35:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27.04.2022 12:47, Roger Pau Monne wrote:
> --- a/xen/arch/x86/cpuid.c
> +++ b/xen/arch/x86/cpuid.c
> @@ -541,6 +541,10 @@ static void __init calculate_hvm_max_policy(void)
>           raw_cpuid_policy.basic.sep )
>          __set_bit(X86_FEATURE_SEP, hvm_featureset);
>  
> +    if ( !boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
> +        /* Clear VIRT_SSBD if VIRT_SPEC_CTRL is not exposed to guests. */
> +        __clear_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
> +
>      /*
>       * If Xen isn't virtualising MSR_SPEC_CTRL for HVM guests (functional
>       * availability, or admin choice), hide the feature.
> @@ -597,6 +601,13 @@ static void __init calculate_hvm_def_policy(void)
>      guest_common_feature_adjustments(hvm_featureset);
>      guest_common_default_feature_adjustments(hvm_featureset);
>  
> +    /*
> +     * Only expose VIRT_SSBD if AMD_SSBD is not available, and thus
> +     * VIRT_SC_MSR_HVM is set.
> +     */
> +    if ( boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
> +        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);

The earlier patch sets the bit in "max" when SC_MSR_HVM && AMD_SSBD.
This patch doesn't set the bit in "max" at all (it only clears it in
one case as per the earlier hunk), thus leading to "def" holding a
set bit which supposedly cannot be set. Irrespective of the feature's
'!' annotation I think we'd better not violate "max" >= "def".

Everything else in this patch looks good to me.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.