From: "Laszlo Ersek" <lersek@redhat.com>
To: Star Zeng <star.zeng@intel.com>, devel@edk2.groups.io
Cc: Eric Dong <eric.dong@intel.com>, Ruiyu Ni <ruiyu.ni@intel.com>,
Chandana Kumar <chandana.c.kumar@intel.com>
Subject: Re: [PATCH] UefiCpuPkg CpuCommonFeaturesLib: Remove CPU generation check
Date: Thu, 16 May 2019 15:06:26 +0200 [thread overview]
Message-ID: <7eeffb11-79ae-39b6-73a6-8c84434a1855@redhat.com> (raw)
In-Reply-To: <20190516103335.76628-1-star.zeng@intel.com>
Hi Star,
On 05/16/19 12:33, Star Zeng wrote:
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1679
>
> The checking to CpuInfo->CpuIdVersionInfoEcx.Bits.AESNI is enough,
> the checking to CPU generation could be removed, then the code
> could be reused by more platforms.
>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Chandana Kumar <chandana.c.kumar@intel.com>
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
> UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
> index b79446ba3ca9..4a56eec1b267 100644
> --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
> +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
> @@ -57,15 +57,9 @@ AesniSupport (
> MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER *MsrFeatureConfig;
>
> if (CpuInfo->CpuIdVersionInfoEcx.Bits.AESNI == 1) {
> - if (IS_SANDY_BRIDGE_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
> - IS_SILVERMONT_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
> - IS_XEON_5600_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
> - IS_XEON_E7_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
> - IS_XEON_PHI_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel)) {
> - MsrFeatureConfig = (MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER *) ConfigData;
> - ASSERT (MsrFeatureConfig != NULL);
> - MsrFeatureConfig[ProcessorNumber].Uint64 = AsmReadMsr64 (MSR_SANDY_BRIDGE_FEATURE_CONFIG);
> - }
> + MsrFeatureConfig = (MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER *) ConfigData;
> + ASSERT (MsrFeatureConfig != NULL);
> + MsrFeatureConfig[ProcessorNumber].Uint64 = AsmReadMsr64 (MSR_SANDY_BRIDGE_FEATURE_CONFIG);
> return TRUE;
> }
> return FALSE;
>
the patch and the bugzilla ticket claim that the AESNI bit's presence in
CPUID guarantees that MSR 0x13C is available.
I don't see what guarantees this. According to the latest Intel SDM Vol
4, which I just downloaded (335592-069US, January 2019),
MSR_FEATURE_CONFIG is available on the following (DisplayFamily,
DisplayModel) pairs:
- 06_37H, 06_4AH, 06_4DH, 06_5AH, 06_5DH, 06_5CH, 06_7AH
- 06_25H, 06_2CH
- 06_2FH
- 06_2AH, 06_2DH
- 06_57H
Which seems to indicate that at least *the approach* of the original
code -- i.e. the family/model checking -- is correct. (It's possible
that the family/model list has to be extended from time to time, of course.)
Anyway, I don't intend to block this patch; OVMF does not use
CpuCommonFeaturesLib, so this change cannot regress it. I will let other
UefiCpuPkg reviewers decide about this patch.
Thanks!
Laszlo
next prev parent reply other threads:[~2019-05-16 13:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-16 10:33 [PATCH] UefiCpuPkg CpuCommonFeaturesLib: Remove CPU generation check Zeng, Star
2019-05-16 13:06 ` Laszlo Ersek [this message]
2019-05-16 14:51 ` [edk2-devel] " Zeng, Star
2019-05-17 1:01 ` Dong, Eric
2019-05-17 1:04 ` Ni, Ray
2019-05-17 3:05 ` Zeng, Star
2019-05-17 12:13 ` Laszlo Ersek
2019-05-17 13:10 ` Ni, Ray
2019-05-18 5:51 ` Zeng, Star
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=7eeffb11-79ae-39b6-73a6-8c84434a1855@redhat.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