public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Lendacky, Thomas via groups.io" <thomas.lendacky=amd.com@groups.io>
To: Gerd Hoffmann <kraxel@redhat.com>, "Ni, Ray" <ray.ni@intel.com>
Cc: "Wu, Jiaxin" <jiaxin.wu@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Zeng, Star" <star.zeng@intel.com>,
	"Kumar, Rahul R" <rahul.r.kumar@intel.com>,
	"Dong, Guo" <guo.dong@intel.com>,
	"Rhodes, Sean" <sean@starlabs.systems>,
	"Lu, James" <james.lu@intel.com>, "Guo, Gua" <gua.guo@intel.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	"Yao, Jiewen" <jiewen.yao@intel.com>,
	Abdul Lateef Attar <AbdulLateef.Attar@amd.com>,
	Abner Chang <abner.chang@amd.com>
Subject: Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib
Date: Fri, 26 Apr 2024 08:18:34 -0500	[thread overview]
Message-ID: <9d037f5a-3393-acef-ddb1-0736eb4a1669@amd.com> (raw)
In-Reply-To: <4fngcjpmyqnzyp6bh3ycylan2a3k4s4sy2tktankxor4eqnjth@txcoonsfhsmt>

On 4/25/24 01:58, Gerd Hoffmann wrote:
>    Hi,
> 
>> That means the SMMRevId is 0_xx64h for AMD64 processor. But I am not
>> sure what the value is for AMD32 processor. Maybe 0 according to the
>> OVMF logic.
> 
> The smm emulation in the linux kernel uses 0 and 0x64.
> 
>> But, I am very suspicious about the logic in AMD's version as below:
>> --- AMD's version
>>    SmmSaveStateRegisterLma = (UINT8)EFI_MM_SAVE_STATE_REGISTER_LMA_32BIT;
>>
>>    LMAValue = (UINT32)AsmReadMsr64 (EFER_ADDRESS) & LMA;
>>    if (LMAValue) {
>>      SmmSaveStateRegisterLma = (UINT8)EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT;
>>    }
>> ---
>> The above logic detects the current CPU mode and 64bit save state area layout is used if it's running in 64bit.
> 
>> But if a AMD64 CPU runs in 32bit mode, the above logic causes the
>> 32bit save state area layout is used. It's not right!  The save state
>> area layout does not depend on the CPU running mode, but whether it's
>> a legacy CPU or a 64-capable CPU.
> 
> Well, that is not entirely clear to me.  Could it be 64-bit processors
> support both 32-bit and 64-bit format, for backward compatibility
> reasons?
> 
> So OvmfPkgIa32 builds could use the 32-bit format, OvmfPkgX64 builds use
> the 64-bit format, everything works fine?
> 
> The tricky corner case is OvmfPkgIa32X64, where (after applying this
> series) 32-bit PEI should setup things for 64-bit SMM/DXE, and checking
> the current processor mode will not give use the result we need.
> 
>> Jiaxin, I agree that the confusion should be cleaned up by AMD
>> experts. Let's not change any existing behavior.
> 
> Agree.  Tom?

I don't have a lot of experience with SMM. I believe Paolo first ported 
over the support into OVMF and might have more insight?

I'll try to take a look at it when I can, but maybe @Abner or @Abdul might 
have more understanding of SMM with which they can comment.

Thanks,
Tom

> 
> take care,
>    Gerd
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118340): https://edk2.groups.io/g/devel/message/118340
Mute This Topic: https://groups.io/mt/105593568/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2024-04-26 13:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <17C74D78B0B952AD.15491@groups.io>
2024-04-18  8:02 ` [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib Wu, Jiaxin
2024-04-22  7:57   ` Gerd Hoffmann
2024-04-23  7:31     ` Wu, Jiaxin
2024-04-23  8:43       ` Gerd Hoffmann
2024-04-23 12:16         ` Wu, Jiaxin
2024-04-24  3:56         ` Wu, Jiaxin
2024-04-24 11:29           ` Gerd Hoffmann
2024-04-25  0:54             ` Wu, Jiaxin
2024-04-25  5:50               ` Ni, Ray
2024-04-25  6:58                 ` Gerd Hoffmann
2024-04-26  6:07                   ` Ni, Ray
2024-04-26 13:18                   ` Lendacky, Thomas via groups.io [this message]
2024-04-18  8:03 ` Wu, Jiaxin
2024-04-19  3:35   ` Ni, Ray
2024-04-19  3:47     ` Chang, Abner via groups.io
2024-04-19  3:55       ` Wu, Jiaxin
2024-04-18  6:55 Wu, Jiaxin

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=9d037f5a-3393-acef-ddb1-0736eb4a1669@amd.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