From nobody Mon Feb 9 12:25:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+98263+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+98263+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1673400290; cv=none; d=zohomail.com; s=zohoarc; b=ERIdHujHVHBrJqkxr2eKun7dojio1KIpkVBVR+Qfmdk61NNztf2m71CKECrmnl5NEyS2QSf7MaNu/r58OHiKUx/u1hbihhszTubeJRN/yNIfESPZtVIGkRylPKrHoHBus0OU0t8IQZiI+0jsiWSC/s/6sAoD0jVUIL8MQPC1gbk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673400290; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=IK/wgN6w2kQTApFsFXreV389v+T8cWHhWfNxwlFbgrI=; b=H3TZfUEUrO3nqd7o7waec+OaHcfQM4gmj5C3aL4TLjEC3xz1pH4HOlNMb1fVIumCZC8XtTsc47fjXuIQaClHky8yeyMDk6nLDehxmdp1CK8JZSIrVy9xGj08TmvHdWOYFcTG65SYkveY2PI3lKxu6VbjH/ZQq1Xehk07MulxU60= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+98263+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1673400290159684.1351860120187; Tue, 10 Jan 2023 17:24:50 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 9roxYY1788612xmnlqBXoIHy; Tue, 10 Jan 2023 17:24:49 -0800 X-Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web10.12263.1673400289090483968 for ; Tue, 10 Jan 2023 17:24:49 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="387764489" X-IronPort-AV: E=Sophos;i="5.96,315,1665471600"; d="scan'208";a="387764489" X-Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2023 17:24:28 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="659192851" X-IronPort-AV: E=Sophos;i="5.96,315,1665471600"; d="scan'208";a="659192851" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.213.42.137]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2023 17:24:20 -0800 From: "Min Xu" To: devel@edk2.groups.io Cc: Min M Xu , Laszlo Ersek , Erdem Aktas , James Bottomley , Jiewen Yao , Gerd Hoffmann , Tom Lendacky Subject: [edk2-devel] [PATCH V3 5/6] OvmfPkg/AcpiPlatformDxe: Refactor QemuAcpiTableNotifyProtocol Date: Wed, 11 Jan 2023 09:22:34 +0800 Message-Id: <20230111012235.189-6-min.m.xu@intel.com> In-Reply-To: <20230111012235.189-1-min.m.xu@intel.com> References: <20230111012235.189-1-min.m.xu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,min.m.xu@intel.com X-Gm-Message-State: D9Wg6vBLyEToeUlFh7jooaeex1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1673400289; bh=/+NR/Xee6aWvcF1eKtemMZSAlIgM6Lt9wmSS0mB/bJY=; h=Cc:Date:From:Reply-To:Subject:To; b=Esp1JA2Il9mNu2BcM9pFBRJ4i/SjY5p1mW4FAdFsc6AU54VKwIm+QgJI6abcsb8SGfH RTgr+xb+nUsHo5nVIbu3SEGgX37Vud5q+5E+2JbywaITFtJ8cANsLhNFjZNR4DCUHHnJ/ 5OWSYp+Pmhk8eeU9hUspWayvRPCKrw+6/jg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1673400291557100001 Content-Type: text/plain; charset="utf-8" From: Min M Xu BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4237 Commit 9fdc70af6ba8 install the QemuAcpiTableNotifyProtocol at a wrong positioin. It should be called before TransferS3ContextToBootScript because TransferS3ContextToBootScript is the last operation in InstallQemuFwCfgTables(). Another error is that we should check the returned value after installing the QemuAcpiTableNotifyProtocol. This patch refactors the installation and error handling of QemuAcpiTableNotifyProtocol in InstallQemuFwCfgTables (). Cc: Laszlo Ersek Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Tom Lendacky Reported-by: Laszlo Ersek Signed-off-by: Min Xu Reviewed-by: Laszlo Ersek --- OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c | 38 ++++++++++++++++--------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatform= Dxe/QemuFwCfgAcpi.c index 462921466604..f0d81d6fd73d 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c +++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c @@ -1247,6 +1247,21 @@ InstallQemuFwCfgTables ( } } =20 + // + // Install a protocol to notify that the ACPI table provided by Qemu is + // ready. + // + QemuAcpiHandle =3D NULL; + Status =3D gBS->InstallProtocolInterface ( + &QemuAcpiHandle, + &gQemuAcpiTableNotifyProtocolGuid, + EFI_NATIVE_INTERFACE, + NULL + ); + if (EFI_ERROR (Status)) { + goto UninstallAcpiTables; + } + // // Translating the condensed QEMU_LOADER_WRITE_POINTER commands to ACPI = S3 // Boot Script opcodes has to be the last operation in this function, be= cause @@ -1255,7 +1270,7 @@ InstallQemuFwCfgTables ( if (S3Context !=3D NULL) { Status =3D TransferS3ContextToBootScript (S3Context); if (EFI_ERROR (Status)) { - goto UninstallAcpiTables; + goto UninstallQemuAcpiTableNotifyProtocol; } =20 // @@ -1266,6 +1281,15 @@ InstallQemuFwCfgTables ( =20 DEBUG ((DEBUG_INFO, "%a: installed %d tables\n", __FUNCTION__, Installed= )); =20 +UninstallQemuAcpiTableNotifyProtocol: + if (EFI_ERROR (Status)) { + gBS->UninstallProtocolInterface ( + QemuAcpiHandle, + &gQemuAcpiTableNotifyProtocolGuid, + NULL + ); + } + UninstallAcpiTables: if (EFI_ERROR (Status)) { // @@ -1275,18 +1299,6 @@ UninstallAcpiTables: --Installed; AcpiProtocol->UninstallAcpiTable (AcpiProtocol, InstalledKey[Install= ed]); } - } else { - // - // Install a protocol to notify that the ACPI table provided by Qemu is - // ready. - // - QemuAcpiHandle =3D NULL; - gBS->InstallProtocolInterface ( - &QemuAcpiHandle, - &gQemuAcpiTableNotifyProtocolGuid, - EFI_NATIVE_INTERFACE, - NULL - ); } =20 for (SeenPointerEntry =3D OrderedCollectionMin (SeenPointers); --=20 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#98263): https://edk2.groups.io/g/devel/message/98263 Mute This Topic: https://groups.io/mt/96191601/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-