From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.111.102]) by mx.groups.io with SMTP id smtpd.web12.7705.1625717157067725530 for ; Wed, 07 Jul 2021 21:05:57 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@suse.com header.s=mimecast20200619 header.b=J/JUea3u; spf=pass (domain: suse.com, ip: 194.104.111.102, mailfrom: glin@suse.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1625717155; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zNtND/CsTuOFVPYYHA2C6LS0BbgQhQiEA5IvGFxrFnE=; b=J/JUea3u9Z6uSi9PMPod9b2/MI+swTykIBZKErJ1GET5Jesx6v8AxKuaJYQLO6P85AB9Lp SaTn0dOI/THovMsuivHZwLzXfVxbPa1EJMpUbALTvHCuPPu/cuUFRK/FE2g4oFillFhWfa Vu4jTlhgd13T5SrCDEKcdXnVzVC3uEg= Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2111.outbound.protection.outlook.com [104.47.18.111]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-4-_f3hJMbyNg2uUmL0QN623A-2; Thu, 08 Jul 2021 06:05:54 +0200 X-MC-Unique: _f3hJMbyNg2uUmL0QN623A-2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Eq34pI840BL8Tevljrnr86ugaWH1EX9R4MbgzvId70fZztC9+Ah/Ss5p2GzjrDRmDV2VjurIRBwTQ92J9ltfD72TuCf/AvRCkaXgIoKFPB2G8qZ8zjNEnwKYD9/0kabYXqxzF2cc7tLF37ldd8/8EP5R/FdX42slfXkhyEM6BtTvrkT4T+PXqh/mzys1NF0C4ySOHzH+LGqFTM4mSftk4ioVoDAcQaikaK2qKRpZnoYpGhTyR887xvx9o5u68unHgYu9gljdGUMIVyYTCIok7gWRedcN8/8PodyS4ML44NVRxhvf+jRMEqMJrc2aNteI0SXyE8YudGlN29hqTYxexQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zNtND/CsTuOFVPYYHA2C6LS0BbgQhQiEA5IvGFxrFnE=; b=jQScnMS4WpZMxjE2jVBeFGoBgChn2h6TiFdjHecU6GvziScFcYkyIbBgeVdbWLIJ8xrsoRgGnVtkH8LYXaKKCPRpmIUtSNKkb6yNzee3FuThHgZ+xY3tYJLwttkrG53WoCkHNSAPV9yfCvhMnYUEfWsj+pXVlW2xdcQcjQcqe3kP5edkFp/lFGHIHsZuZYVjFXDnjeMjiHRsVljUVdz+sXIjuuCMYMftlMrEbIsrdQqosyY1VA70hLX1NVXD04XNBFO1NoFcqgdRUFMmaUU27zF+ZdmNhsQyfVNU/HPbhezarZJzEn6ZJo/AJeYQfXYBmbCujLPzpEH5du5UukL3bg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=suse.com; Received: from AM7PR04MB7013.eurprd04.prod.outlook.com (2603:10a6:20b:116::18) by AM6PR04MB5206.eurprd04.prod.outlook.com (2603:10a6:20b:12::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.19; Thu, 8 Jul 2021 04:05:52 +0000 Received: from AM7PR04MB7013.eurprd04.prod.outlook.com ([fe80::a4b6:d6ff:1fc7:1f98]) by AM7PR04MB7013.eurprd04.prod.outlook.com ([fe80::a4b6:d6ff:1fc7:1f98%8]) with mapi id 15.20.4308.022; Thu, 8 Jul 2021 04:05:52 +0000 From: "Gary Lin" To: devel@edk2.groups.io Cc: Laszlo Ersek , Ard Biesheuvel , Jordan Justen , Anthony Perard , Julien Grall , Jim Fehlig Subject: [RFC PATCH] OvmfPkg/OvmfXen: set PcdAcpiS3Enable at initialization Date: Thu, 8 Jul 2021 12:05:49 +0800 Message-Id: <20210708040549.8364-1-glin@suse.com> X-Mailer: git-send-email 2.31.1 X-ClientProxiedBy: AM9P193CA0016.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:21e::21) To AM7PR04MB7013.eurprd04.prod.outlook.com (2603:10a6:20b:116::18) Return-Path: glin@suse.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost (60.251.47.115) by AM9P193CA0016.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:21e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.19 via Frontend Transport; Thu, 8 Jul 2021 04:05:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eb2fc990-e83f-4c51-21e7-08d941c5ad70 X-MS-TrafficTypeDiagnostic: AM6PR04MB5206: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IbLNFbWwSKe1JaKHV9gbADaNU/I/RtwSlVYzDk+vf7v19rMTuGyFWov83TaNMUm9yNjWQFlQdiho2e+L0yRu4Cfj2iaJ+tNVLP5hqH/jgpuGt80w3PPNbY0pLzoM8leXrTLjlsHCMn9hVGg/Px9AdjUW9hlaWMeKCBUx30n0ULFtA2gg4Gigkm4mNKwLUmBYoOh4fFqQhIlxuMd0lWd0ysBGGBNdsBvACRpyzOs1q9rVJlp+fAr6gDgF8p2r7bpSwEidAX/0YW/MVrxCX6GQAvLLVORczV6KXHjO2a+V+OXtxQwylFhjuF0e3IrLgMfRepi3s/ZHt2HRWmkNiMT9lhYo4+PnZjeSV2DE0beiFsw7ctGQy2LWfDrPJXujTwhbOZn1ru77IFtyDy/uD+zIFvXnclXDt7Rk/Er/dnznOBWr8oRWOdfj4i5AwEJXt9/1GxR0N37gMpahET+CCxOg2KN/M/rL2tqMovHlijLC3TeYjn+tPy/2fOe+OUI5K/RNlFc2MwxN3zgnl5dUP/roYokOBeys+OnwSRkpeCBkDrQn+GG83tlk2Jy06IzNWfZV8ous0gObux0qx/nzaXaSKLr6LQGPq2yFY2oIF1c0TVemEoyipWpFuAxJMM+TGMry0/5pcnNZQsYU8UVSxGBXuQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7013.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(396003)(39850400004)(136003)(346002)(5660300002)(38100700002)(66946007)(2906002)(6916009)(6496006)(6486002)(19627235002)(54906003)(66556008)(55236004)(2616005)(956004)(186003)(83380400001)(26005)(66476007)(86362001)(316002)(8936002)(36756003)(1076003)(478600001)(8676002)(107886003)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?+WQRwjY0HVJcSJz1FXPaoK9vBUsPQbToN/PNQoCPYmHq1+DrAb8zaYruFlvH?= =?us-ascii?Q?Y542C5l40chRBHjXhWbw9ACR6iz71kBNUlTNoK8YR+iqgolZIfYB5GK3nWao?= =?us-ascii?Q?g7sQOT+eRCO35VZpE2cSFRQaHHwrxbyCNjkK2WTcKsBTtmuvDQSLWFgXyyBg?= =?us-ascii?Q?wpLUNbihFsoi6k0kQl+w4/MFNRSyu5c2QQ9cDrWMQ03qP+sRkRBR6ZKxWL2b?= =?us-ascii?Q?g1dtbP5jaOamgDo2th/blKJ9WxPT0Py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us-ascii?Q?CwzmRo84ucZITnyubj9wmGLuwiOGhgYg1yx4GLCVk8R8F09s2CXo5jEIWUGi?= =?us-ascii?Q?nZMyAFBFaw5V8p01r2Au7B5sVPU88ynEEmIqhjbpyoCuvupdCc+8631m8MRC?= =?us-ascii?Q?wtzb2nt6QqayOAUXfBG6GMh9BAN9YnIV0TysC1hzJ7/nnlXH7QBNZRtzYdWK?= =?us-ascii?Q?BdYlxgxP31uCtTd7EIOYtvmM?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb2fc990-e83f-4c51-21e7-08d941c5ad70 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7013.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2021 04:05:52.5528 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HXlxLNBiN0kDokAK8wWAy8EhUk3fTtcOdSh4LwBY6tyxJlFaCfGDKejvYSu10Ddb X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5206 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain 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. Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Anthony Perard Cc: Julien Grall Cc: Jim Fehlig Signed-off-by: Gary Lin --- OvmfPkg/XenPlatformPei/Platform.c | 10 ++++++++++ OvmfPkg/XenPlatformPei/XenPlatformPei.inf | 3 +++ 2 files changed, 13 insertions(+) diff --git a/OvmfPkg/XenPlatformPei/Platform.c b/OvmfPkg/XenPlatformPei/Pla= tform.c index a811e72ee301..f7edc979486e 100644 --- a/OvmfPkg/XenPlatformPei/Platform.c +++ b/OvmfPkg/XenPlatformPei/Platform.c @@ -26,6 +26,8 @@ #include =0D #include =0D #include =0D +#include =0D +#include =0D #include =0D #include =0D #include =0D @@ -423,6 +425,8 @@ InitializeXenPlatform ( IN CONST EFI_PEI_SERVICES **PeiServices=0D )=0D {=0D + EFI_STATUS Status;=0D +=0D DEBUG ((DEBUG_INFO, "Platform PEIM Loaded\n"));=0D =0D DebugDumpCmos ();=0D @@ -433,6 +437,12 @@ InitializeXenPlatform ( CpuDeadLoop ();=0D }=0D =0D + if (QemuFwCfgS3Enabled ()) {=0D + DEBUG ((DEBUG_INFO, "S3 support was detected on QEMU\n"));=0D + Status =3D PcdSetBoolS (PcdAcpiS3Enable, TRUE);=0D + ASSERT_EFI_ERROR (Status);=0D + }=0D +=0D XenConnect ();=0D =0D BootModeInitialization ();=0D diff --git a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf b/OvmfPkg/XenPlatfor= mPei/XenPlatformPei.inf index 597cb6fcd7ff..1e22c0b2e2aa 100644 --- a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf +++ b/OvmfPkg/XenPlatformPei/XenPlatformPei.inf @@ -57,6 +57,8 @@ [LibraryClasses] ResourcePublicationLib=0D PeiServicesLib=0D PeimEntryPoint=0D + QemuFwCfgLib=0D + QemuFwCfgS3Lib=0D MtrrLib=0D MemEncryptSevLib=0D PcdLib=0D @@ -79,6 +81,7 @@ [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base=0D gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size=0D gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable=0D gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize=0D gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved=0D gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode=0D --=20 2.31.1