Re: [RFC PATCH] OvmfPkg/OvmfXen: set PcdAcpiS3Enable at initialization


Anthony PERARD
 

On Thu, Jul 08, 2021 at 12:05:49PM +0800, Gary Lin wrote:
There are several functions in OvmfPkg/Library using
QemuFwCfgS3Enabled() to detect the S3 support status. However, in
MdeModulePkg, PcdAcpiS3Enable is used to check S3 support. Since
InitializeXenPlatform() didn't set PcdAcpiS3Enable as
InitializePlatform() did, this made the inconsistency between
drivers/functions.

For example, S3SaveStateDxe checked PcdAcpiS3Enable and skipped
S3BootScript because the default value is FALSE. On the other hand,
PlatformBootManagerBeforeConsole() from OvmfPkg/Library called
QemuFwCfgS3Enabled() and found it returned TRUE, so it invoked
SaveS3BootScript(). However, S3SaveStateDxe skipped S3BootScript, so
SaveS3BootScript() asserted due to EFI_NOT_FOUND.

Setting PcdAcpiS3Enable at InitializeXenPlatform() "fixes" the crash
reported by my colleague. The other possible direction is to replace
QemuFwCfgS3Enabled() with PcdAcpiS3Enable. I'm not sure which one is
the right fix.
QemuFwCfgS3Enabled() should always return false as we don't enable
QEMU's fwcfg interface in most case when running a Xen guest. So I don't
expect "PcdAcpiS3Enable" to ever been set via this patch.

Now, maybe we want to set PcdAcpiS3Enable unconditionally but I don't
know if S3 support is going to work as expected with OVMF under Xen, I
never look at that.

What kind of guest are you trying to fix? When does the crash happen?

Thanks,

--
Anthony PERARD

Join devel@edk2.groups.io to automatically receive all group messages.