Hi Gred,

Because:
1) The mode of the CPU check is different between the AMD & OVMF.
OVMF: 
CpuSaveState->x86.SMMRevId & 0Xffff

AMD:
 LMAValue = (UINT32)AsmReadMsr64 (EFER_ADDRESS) & LMA

2) Existing SmBase configuration is different between the AMD & OVMF.
OVMF:
 AmdCpuState->x64.SMBASE = (UINT32)mSmBaseForAllCpus[CpuIndex];

AMD:   
 if ((CpuSaveState->x86.SMMRevId & 0xFFFF) == 0) {
    CpuSaveState->x86.SMBASE = (UINT32)mSmBaseForAllCpus[CpuIndex];
  } else {
    CpuSaveState->x64.SMBASE = (UINT32)mSmBaseForAllCpus[CpuIndex];
  }

This series patch won't change the existing implementation code logic, so, we 
need override one version for OVMF.

+AMD feature owner 

Thanks,
Jiaxin 


> -----Original Message-----
> From: Gerd Hoffmann <kra...@redhat.com>
> Sent: Thursday, April 11, 2024 3:11 PM
> To: Wu, Jiaxin <jiaxin...@intel.com>
> Cc: devel@edk2.groups.io; Ni, Ray <ray...@intel.com>; Zeng, Star
> <star.z...@intel.com>; Ard Biesheuvel <ardb+tianoc...@kernel.org>; Yao,
> Jiewen <jiewen....@intel.com>; Kumar, Rahul R <rahul.r.ku...@intel.com>
> Subject: Re: [PATCH v1 03/13] UefiCpuPkg/SmmRelocationLib: Add library
> instance for OVMF
> 
> On Wed, Apr 10, 2024 at 09:57:14PM +0800, Jiaxin Wu wrote:
> > Due to the definition difference of SMRAM Save State,
> > SmmBase config in SMRAM Save State for OVMF is also different.
> >
> > This patch provides the OvmfSmmRelocationLib library instance
> > to handle the SMRAM Save State difference.
> 
> Why ovmf needs its own version?  Patch #4 adds an AMD version, and given
> that KVM uses the AMD smram layout that library should work for OVMF
> too, no?
> 
> take care,
>   Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117774): https://edk2.groups.io/g/devel/message/117774
Mute This Topic: https://groups.io/mt/105441992/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to