From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 1B45E740035 for ; Mon, 13 May 2024 02:08:04 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=pf5yHQi0LwyIS0mxo4dPkePdX4ATu4188a64XkNcs3I=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type; s=20240206; t=1715566083; v=1; b=v05G1sU/PJfaHiaSVDl+fEXY3V08q/OJNdUvaXIj99Ke/1AXO6YZIYWyQDHljASZ6UUikOT6 hejgWvR8xFyLgMSTqeqNS/SC8WhkZ8ow0UHhaNrH6CW3HSij2Ke+2YjlOIITmVVfXtfXpa0ZptW ObR1Ne5HG/LM3TXTBVN4ZZKhNumiSsr4wdy31Og7mWL5R/x2xcBQdxZp/Sh84BdwcQuGuc4ckya LqL9m5eDBDWhvnStTSwHGe7Gz3mG+XNqvOEwPuM0znTSzIkJs5BaIueLNifMprtlPvV0twugxG6 ry6U2LDCPnCn80xzcvY8qEiEwj5N2FMMnvg24CCMdEvkw== X-Received: by 127.0.0.2 with SMTP id t2jsYY7687511x35pWB5qAVS; Sun, 12 May 2024 19:08:03 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by mx.groups.io with SMTP id smtpd.web10.50850.1715566078031890372 for ; Sun, 12 May 2024 19:07:58 -0700 X-CSE-ConnectionGUID: kv+woBmTTtGKH0VCtvpT7g== X-CSE-MsgGUID: kQcAIpbsR5GXH1VSx++1nQ== X-IronPort-AV: E=McAfee;i="6600,9927,11071"; a="11618412" X-IronPort-AV: E=Sophos;i="6.08,157,1712646000"; d="scan'208,217";a="11618412" X-Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2024 19:07:58 -0700 X-CSE-ConnectionGUID: 3fx8oxkZT3qzTe+2XppUog== X-CSE-MsgGUID: qZ/Zxp38TK62CyBa5oPhyA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,157,1712646000"; d="scan'208,217";a="34744150" X-Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmviesa004.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 12 May 2024 19:07:57 -0700 X-Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 12 May 2024 19:07:56 -0700 X-Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Sun, 12 May 2024 19:07:56 -0700 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.101) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Sun, 12 May 2024 19:07:56 -0700 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by MN2PR11MB4584.namprd11.prod.outlook.com (2603:10b6:208:264::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 02:07:55 +0000 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::41a4:c775:32e6:76a8]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::41a4:c775:32e6:76a8%4]) with mapi id 15.20.7544.052; Mon, 13 May 2024 02:07:55 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" CC: "Kumar, Rahul R" , Gerd Hoffmann , "Wu, Jiaxin" Subject: Re: [edk2-devel] [PATCH 05/18] UefiCpuPkg: LoadMtrrData for all cpu in S3Resume Thread-Topic: [PATCH 05/18] UefiCpuPkg: LoadMtrrData for all cpu in S3Resume Thread-Index: AQHaosIayM+Ka1fksEuLHkTDbrjGabGUbykr Date: Mon, 13 May 2024 02:07:55 +0000 Message-ID: References: <20240510100827.1903-1-dun.tan@intel.com> <20240510100827.1903-6-dun.tan@intel.com> In-Reply-To: <20240510100827.1903-6-dun.tan@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|MN2PR11MB4584:EE_ x-ms-office365-filtering-correlation-id: a1cbef84-d67b-4d90-7477-08dc72f180b6 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?AQNJM8IIEdUFmIIeu6R1X7KjCTo1OKe/FBm7t1gUaRtgUSzjWmNr43VIl9Ki?= =?us-ascii?Q?40l1ZXfdVFyqBvVG3PJj6nBT573ma2ZllS4lvmgfn8ZSQBlwxDlTFl8Glxty?= =?us-ascii?Q?1GZd3vWKNNmWYV3556j+k1aJBNRE6qY3zb4p3o72sFV8jrbNJfyhhb7UBJWT?= =?us-ascii?Q?5OM39xWp8lGu+CFeJopA/btfDHat5/mA39dL3BUdQxsTyvhUwkFvtzF+FHNb?= =?us-ascii?Q?NGRNW+o2B+Gzm/lJBWWGlge533zRjc39Eh+vjLiOum6bDXhlebl7lFY5HUc/?= =?us-ascii?Q?+vIh/8KyaDMwGayGNy5a7gG9I2gUP1ZNxcxoC1LsPtBYE1NYVXnWzhSa/A+O?=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DpceFJlUYwH6XxIosxOL/D+pi/kSoeX8?= =?us-ascii?Q?1OYcUlvegF5K5oWuQljperNZYqxqheb6xD0yAk4ez8LHgZzvbeqOYQWtmQUX?= =?us-ascii?Q?G/YWVvqLd2QWyG+M6ofqNrGedpMumX6IOFyQumfXa0zSuw=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?FeT7uBBgAEc47x1KppgH0WfHZ5DG3ckW7Dn7iDKc9ttMeW5tTD1XJqwD2eIN?= =?us-ascii?Q?xGMynrANowpcIlTzm8V09iVGoJkKA7pXvFuTVFdrXG0TVrDkzx1/jJNQ++LX?= =?us-ascii?Q?uXb2fMH6b0er5sCMoCWfygXmJk3N4G2Ook5qscsm3TAhKDsVwlxlzyNLjGii?= =?us-ascii?Q?HDT4DKuVK+cV0RamjbHz78aNpWHkKmR4gMPE+PZGbWQITtP28MrctK72M5pi?= =?us-ascii?Q?oHZCivZIrcZ2z4T1wi0hi95QeAMsijeXo4I8/DQsKBjF1E/8eRs52kAlyOiu?= =?us-ascii?Q?XwBS8nW3GfsxTRb+/yanfBPWifWh5UY4S7VmuZsiThb/spvwFFUWc6KFOTHb?= =?us-ascii?Q?SP0iFIW+joaDUZg+Bms6lKr764qreCfFP3llegpVlR/PxCiCv4aVTJVZvQbM?= =?us-ascii?Q?5wtzuO+KtvGWHlMUcTA4qJvMAQduBT4Ad3GnM9AeL6dIP2dy/zUNEw35SMuI?= =?us-ascii?Q?BVHYFr1buBh+tQiAfWKmF3T2Ef4EOuVUaezfS+Aur3zpMslq3+TomB0Ay9Ys?= =?us-ascii?Q?qu8hBHmGb8uio2fqDBDKzdpvyIQmV3FbS3LYK1hLkmwJoh0FIWF8vy9UjOX4?= =?us-ascii?Q?MqkAB6JAYtrR2whMo6wJ7VA2a+uVClKqlhRA9JN7e+nZ4gjhzhsqA6oUlmzZ?= =?us-ascii?Q?8OoxMaWQx8wRHeg2roIlf+6bfdaWrVa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?Q?kBjdgWKV/CA2NvINBLg=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1cbef84-d67b-4d90-7477-08dc72f180b6 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 May 2024 02:07:55.1498 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 62YMA3nbWz0yh7Kj4Yn8VYjhBgEpIPDDuhbssnXwLn9wulE1XKXayxl7VxmByTz2JhKuBqgwE/MAU1E1+b7QFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4584 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Sun, 12 May 2024 19:07:58 -0700 Resent-From: ray.ni@intel.com Reply-To: devel@edk2.groups.io,ray.ni@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: VrYtumpNLvFxe5IRPIFwWGUHx7686176AA= Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MN6PR11MB824436428804D42D95EE29A78CE22MN6PR11MB8244namp_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b="v05G1sU/"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io --_000_MN6PR11MB824436428804D42D95EE29A78CE22MN6PR11MB8244namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni Thanks, Ray ________________________________ From: Tan, Dun Sent: Friday, May 10, 2024 18:08 To: devel@edk2.groups.io Cc: Ni, Ray ; Kumar, Rahul R ; G= erd Hoffmann ; Wu, Jiaxin Subject: [PATCH 05/18] UefiCpuPkg: LoadMtrrData for all cpu in S3Resume In this commit, S3Resume.c wakeup all Aps to run LoadMtrrData for all cpu before transfer to CpuS3.c in smm cpu driver. The MtrrSetting table can be restored by gEdkiiS3MtrrSettingGuid which is saved by lockbox in PEI phase. This can avoid waking up APs in CpuS3.c. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu --- UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c | 49 +++++++++++++= ++++++++++++++++++++++++++++++++++++ UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf | 2 ++ 2 files changed, 51 insertions(+) diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c b/UefiCpuPkg= /Universal/Acpi/S3Resume2Pei/S3Resume.c index 4cf676fb3e..3e85eab28f 100644 --- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c +++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -938,6 +939,20 @@ S3ResumeExecuteBootScript ( CpuDeadLoop (); } +/** + Sync up the MTRR values for all processors. + + @param[in] MtrrTable Address of MTRR setting. +**/ +VOID +EFIAPI +LoadMtrrData ( + IN VOID *MtrrTable + ) +{ + MtrrSetAllMtrrs (MtrrTable); +} + /** Restores the platform to its preboot configuration for an S3 resume and jumps to the OS waking vector. @@ -990,6 +1005,7 @@ S3RestoreConfig2 ( BOOLEAN InterruptStatus; IA32_CR0 Cr0; EDKII_PEI_MP_SERVICES2_PPI *MpService2Ppi; + MTRR_SETTINGS MtrrTable; TempAcpiS3Context =3D 0; TempEfiBootScriptExecutorVariable =3D 0; @@ -1082,6 +1098,39 @@ S3RestoreConfig2 ( Status =3D SmmAccess->Open ((EFI_PEI_SERVICES **)GetPeiServicesTable= Pointer (), SmmAccess, Index); } + // + // Get MP Services2 Ppi to pass it to Smm S3. + // + Status =3D PeiServicesLocatePpi ( + &gEdkiiPeiMpServices2PpiGuid, + 0, + NULL, + (VOID **)&MpService2Ppi + ); + ASSERT_EFI_ERROR (Status); + + // + // Restore MTRR setting + // + VarSize =3D sizeof (MTRR_SETTINGS); + Status =3D RestoreLockBox ( + &gEdkiiS3MtrrSettingGuid, + &MtrrTable, + &VarSize + ); + ASSERT_EFI_ERROR (Status); + + // + // Sync up the MTRR values for all processors. + // + Status =3D MpService2Ppi->StartupAllCPUs ( + MpService2Ppi, + (EFI_AP_PROCEDURE)LoadMtrrData, + 0, + (VOID *)&MtrrTable + ); + ASSERT_EFI_ERROR (Status); + SmramDescriptor =3D (EFI_SMRAM_DESCRIPTOR *)GET_GUID_HOB_DATA (GuidHo= b); SmmS3ResumeState =3D (SMM_S3_RESUME_STATE *)(UINTN)SmramDescriptor->Cp= uStart; diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf b/Uefi= CpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf index 9c9b6f3db3..890c588aa8 100644 --- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf +++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf @@ -67,6 +67,7 @@ LocalApicLib ReportStatusCodeLib LockBoxLib + MtrrLib [Guids] gEfiBootScriptExecutorVariableGuid ## SOMETIMES_CONSUMES ## U= NDEFINED # LockBox @@ -79,6 +80,7 @@ ## SOMETIMES_PRODUCES ## UNDEFINED # Install PPI ## SOMETIMES_CONSUMES ## UNDEFINED # Used to do smm communication gEdkiiS3SmmInitDoneGuid + gEdkiiS3MtrrSettingGuid [Ppis] gEfiPeiS3Resume2PpiGuid ## PRODUCES -- 2.31.1.windows.1 -=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 (#118838): https://edk2.groups.io/g/devel/message/118838 Mute This Topic: https://groups.io/mt/106018126/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --_000_MN6PR11MB824436428804D42D95EE29A78CE22MN6PR11MB8244namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Ray Ni <ray.ni@intel.com>



Thanks,
Ray

From: Tan, Dun <dun.tan@= intel.com>
Sent: Friday, May 10, 2024 18:08
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com>; Kumar, Rahul R <rahul.r.kum= ar@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Wu, Jiaxin <j= iaxin.wu@intel.com>
Subject: [PATCH 05/18] UefiCpuPkg: LoadMtrrData for all cpu in S3Res= ume
 
In this commit, S3Resume.c wakeup all Aps to run LoadMtrrData for all cpu before transfer to CpuS3.c
in smm cpu driver. The MtrrSetting table can be restored
by gEdkiiS3MtrrSettingGuid which is saved by lockbox in
PEI phase. This can avoid waking up APs in CpuS3.c.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
---
 UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c   &n= bsp;   | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf |  2 ++<= br>  2 files changed, 51 insertions(+)

diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c b/UefiCpuPkg= /Universal/Acpi/S3Resume2Pei/S3Resume.c
index 4cf676fb3e..3e85eab28f 100644
--- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
+++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
@@ -39,6 +39,7 @@
 #include <Library/DebugAgentLib.h>
 #include <Library/LocalApicLib.h>
 #include <Library/ReportStatusCodeLib.h>
+#include <Library/MtrrLib.h>
 
 #include <Library/HobLib.h>
 #include <Library/LockBoxLib.h>
@@ -938,6 +939,20 @@ S3ResumeExecuteBootScript (
   CpuDeadLoop ();
 }
 
+/**
+  Sync up the MTRR values for all processors.
+
+  @param[in] MtrrTable  Address of MTRR setting.
+**/
+VOID
+EFIAPI
+LoadMtrrData (
+  IN VOID  *MtrrTable
+  )
+{
+  MtrrSetAllMtrrs (MtrrTable);
+}
+
 /**
   Restores the platform to its preboot configuration for an S3 r= esume and
   jumps to the OS waking vector.
@@ -990,6 +1005,7 @@ S3RestoreConfig2 (
   BOOLEAN         &= nbsp;           &nbs= p;  InterruptStatus;
   IA32_CR0         =             &nb= sp; Cr0;
   EDKII_PEI_MP_SERVICES2_PPI     *MpService2= Ppi;
+  MTRR_SETTINGS         =          MtrrTable;
 
   TempAcpiS3Context       &nb= sp;         =3D 0;
   TempEfiBootScriptExecutorVariable =3D 0;
@@ -1082,6 +1098,39 @@ S3RestoreConfig2 (
       Status =3D SmmAccess->Open ((EFI_PE= I_SERVICES **)GetPeiServicesTablePointer (), SmmAccess, Index);
     }
 
+    //
+    // Get MP Services2 Ppi to pass it to Smm S3.
+    //
+    Status =3D PeiServicesLocatePpi (
+            &n= bsp;  &gEdkiiPeiMpServices2PpiGuid,
+            &n= bsp;  0,
+            &n= bsp;  NULL,
+            &n= bsp;  (VOID **)&MpService2Ppi
+            &n= bsp;  );
+    ASSERT_EFI_ERROR (Status);
+
+    //
+    // Restore MTRR setting
+    //
+    VarSize =3D sizeof (MTRR_SETTINGS);
+    Status  =3D RestoreLockBox (
+            &n= bsp;   &gEdkiiS3MtrrSettingGuid,
+            &n= bsp;   &MtrrTable,
+            &n= bsp;   &VarSize
+            &n= bsp;   );
+    ASSERT_EFI_ERROR (Status);
+
+    //
+    // Sync up the MTRR values for all processors.
+    //
+    Status =3D MpService2Ppi->StartupAllCPUs (
+            &n= bsp;            = ;     MpService2Ppi,
+            &n= bsp;            = ;     (EFI_AP_PROCEDURE)LoadMtrrData,
+            &n= bsp;            = ;     0,
+            &n= bsp;            = ;     (VOID *)&MtrrTable
+            &n= bsp;            = ;     );
+    ASSERT_EFI_ERROR (Status);
+
     SmramDescriptor  =3D (EFI_SMRAM_DESCRIPTOR *)= GET_GUID_HOB_DATA (GuidHob);
     SmmS3ResumeState =3D (SMM_S3_RESUME_STATE *)(UINTN= )SmramDescriptor->CpuStart;
 
diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf b/Uefi= CpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
index 9c9b6f3db3..890c588aa8 100644
--- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
+++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
@@ -67,6 +67,7 @@
   LocalApicLib
   ReportStatusCodeLib
   LockBoxLib
+  MtrrLib
 
 [Guids]
   gEfiBootScriptExecutorVariableGuid    &nbs= p;       ## SOMETIMES_CONSUMES ## UNDEFINED #= LockBox
@@ -79,6 +80,7 @@
   ## SOMETIMES_PRODUCES ## UNDEFINED # Install PPI
   ## SOMETIMES_CONSUMES ## UNDEFINED # Used to do smm communicat= ion
   gEdkiiS3SmmInitDoneGuid
+  gEdkiiS3MtrrSettingGuid
 
 [Ppis]
   gEfiPeiS3Resume2PpiGuid      &nb= sp;            =     ## PRODUCES
--
2.31.1.windows.1

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#118838) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--_000_MN6PR11MB824436428804D42D95EE29A78CE22MN6PR11MB8244namp_--