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

Re: [PATCH v3 5/5] x86/microcode: Disable microcode update handler if DIS_MCU_UPDATE is set


  • To: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 20 Jun 2023 11:51:00 +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=XIpf7vE+s7i9E/SCnbKo15QFKuPqmkfc3RMIr7eEF54=; b=jOZG4OJbwNqG58kE9BC2iS2+/1BDY7mEAZhqiQe5ViQwZ9W2QB6V2SnctKATjS+gDb/IwTK+xqJIJeLLIErPzxaJsVLdSPM7uSWVcnMSxLGinmpVz3+5HL1hXqgI85T9ZJMDocyBRf/ei3vYLBVoRvaD9uGo/2XW6q9ZlR5XtXoFBJ8e6O6K85Xln1oAssXTKDUtPedLThdUrgm7AAhp6k46OxO6RlmGlOhyNaLLP+j3A6pOdUdTBoFj2r6l8dVg0ilMcUJxytlio6xXJY1fEKnM/meMY+2f593hBwYK/nbtpzOVKFujFqAHw7SihqjbdULPy3oGahbTI2Ttu7IdGw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A27BZXoeefTfWNc8SUj/gYUvmomL3EycqfDHK94/6WhStlspQtvfaRhTHRVx5IyTreoz6e+ehAGOtDGMbNj+ATWdW9KZHWiO5A9r5NPsTF/FqVKiZCp/l4/HuESAP5o4leM3pOGP2r4m0fhVwMwo7EApQQZf5l1mPfNWao1LVcSDqO+qoOL5jMCP1GbZu+xBKKJOiYVkTmxMfRTAP2f64wtlZc1+7SMiT+NwMxuFy7V7FoUPJpMpBlNkDUblrfggYu5qDCV0uX7VtSyVluufxWrFNYO/x7ZL8F8DudVOXt5TJUhCIYLavKGwT6XlJtw8/tWrZvKik2oucI6RbI+VBw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 20 Jun 2023 09:51:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 15.06.2023 17:48, Alejandro Vallejo wrote:
> --- a/xen/arch/x86/cpu/common.c
> +++ b/xen/arch/x86/cpu/common.c
> @@ -352,6 +352,11 @@ void __init early_cpu_init(void)
>                           &c->x86_capability[FEATURESET_7c0],
>                           &c->x86_capability[FEATURESET_7d0]);
>  
> +             if (test_bit(X86_FEATURE_ARCH_CAPS, c->x86_capability))
> +                     rdmsr(MSR_ARCH_CAPABILITIES,
> +                           c->x86_capability[FEATURESET_m10Al],
> +                           c->x86_capability[FEATURESET_m10Ah]);

Is this still going to be needed if early_microcode_init() uniformly
does this, for things to be correct for tsx_init() (as pointed out
in the other patch)?

> --- a/xen/arch/x86/cpu/microcode/intel.c
> +++ b/xen/arch/x86/cpu/microcode/intel.c
> @@ -387,8 +387,22 @@ static struct microcode_patch *cf_check 
> cpu_request_microcode(
>  
>  void __init intel_get_ucode_ops(struct microcode_ops *ops)
>  {
> +    uint64_t mcu_ctrl;
> +
>      ops->cpu_request_microcode = cpu_request_microcode;
>      ops->collect_cpu_info      = collect_cpu_info;
>      ops->apply_microcode       = apply_microcode;
>      ops->compare_patch         = compare_patch;
> +
> +    if ( cpu_has_mcu_ctrl )
> +    {
> +        rdmsrl(MSR_MCU_CONTROL, mcu_ctrl);
> +        /*
> +         * If DIS_MCU_LOAD is set applying microcode updates won't work. We
> +         * can still query the current version and things like that, so
> +         * we'll leave the other handlers in place.
> +         */
> +        if ( mcu_ctrl & MCU_CONTROL_DIS_MCU_LOAD )
> +            ops->apply_microcode = NULL;
> +    }

While this won't address Andrew's request (afaict), but only the
cf_clobber requirement, I think you want to drop removing of the struct
instances from patch 2, return pointers from the new per-vendor
functions, and simply introduce another static instance of struct
microcode_ops here, with the one hook simply left unset. This lives in
init data, so the size increase is of no major concern.

Jan



 


Rackspace

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