public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Chiu, Chasel" <chasel.chiu@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Desimone, Nathaniel L" <nathaniel.l.desimone@intel.com>,
	"Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH v2] IntelFsp2Pkg: LoadMicrocodeDefault() causing unnecessary delay.
Date: Thu, 30 Mar 2023 05:30:38 +0000	[thread overview]
Message-ID: <MN6PR11MB82441069219D03817E7EC0378C8E9@MN6PR11MB8244.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230329154352.1092-1-chasel.chiu@intel.com>

> 
> +   mov   eax, 1
> 
> +   cpuid
> 
> +   mov   ecx, MSR_IA32_BIOS_SIGN_ID
> 
> +   rdmsr                         ; Get current microcode signature
> 
> +   xor   eax, eax
> 
> +   test  edx, edx
> 
> +   jnz   Exit2
> 
1. SDM uses following assembly to read current microcode signature.

Example 10-9. Assembly Code to Retrieve the Update Revision
MOV ECX, 08BH ;IA32_BIOS_SIGN_ID
XOR EAX, EAX ;clear EAX
XOR EDX, EDX ;clear EDX
WRMSR ;Load 0 to MSR at 8BH
MOV EAX, 1
Cupid
MOV ECX, 08BH ;IA32_BIOS_SIGN_ID
rdmsr ;Read Model Specific Register


Comparing against yours, I think there are two diffs:
1). you missed the write-zero to msr 8b
2). you cleared RAX (I don't know why)

And the existing code "LoadCheck:" actually contains exactly the SDM
recommended logic to get current microcode revision.
Why not use that directly?

> -   je    Continue
> 
> +   je    Done ; if already one version microcode loaded, go to done

2. You changed another behavior: from load all microcodes to load one only.
Can you separate it in a standalone patch and explain in commit?
I guess since the 1st check you added will skip loading when cpu microcode revision
is not 0, so the change here is to align with that behavior.

  parent reply	other threads:[~2023-03-30  5:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 15:43 [PATCH v2] IntelFsp2Pkg: LoadMicrocodeDefault() causing unnecessary delay Chiu, Chasel
2023-03-30  3:21 ` [edk2-devel] " Kuo, Ted
2023-03-30  5:30 ` Ni, Ray [this message]
2023-03-30 15:29   ` Chiu, Chasel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN6PR11MB82441069219D03817E7EC0378C8E9@MN6PR11MB8244.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox