From nobody Thu Nov 14 16:52:46 2024 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+71916+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+71916+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=oracle.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613978390890312.64889700495235; Sun, 21 Feb 2021 23:19:50 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id zb52YY1788612xHU9e67UYY3; Sun, 21 Feb 2021 23:19:50 -0800 X-Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by mx.groups.io with SMTP id smtpd.web12.31931.1613978389682934942 for ; Sun, 21 Feb 2021 23:19:49 -0800 X-Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11M7ExFi143584; Mon, 22 Feb 2021 07:19:47 GMT X-Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 36tqxbapqv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Feb 2021 07:19:47 +0000 X-Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11M7GNIO155898; Mon, 22 Feb 2021 07:19:46 GMT X-Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by userp3030.oracle.com with ESMTP id 36ucbvqk4f-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Feb 2021 07:19:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iry3pqXeMdFsXDiDIDfImr2W8lKozOPFCcDeCDVQ8BhjaDwDMnzIi63qq8nrmVDTuzuoj3pxOJwx9xNnZ2Ie2XJnBNHAHKK2ziaTHsqdAUcHDjUpugp8ioah1oyhjPNI09kramojRZbL3Id/WWuFR4qosDFYUVhH8mU1wfrLeJv/5p3VqOMdJHMtrPdSbfOpSEghHbfzLLC8Cz35tqIZXV7iqBkGTCrWbDYSts3ox9B3Qoxd9Ud2oVl/zpv3ZJhog9st7utNqoE0Qe1URw4XtFTyw48kWo5QTea1RYmRN9z0CPFXMt5ikmL+4x59I+IK6X/tx9ngW8MUPPpGoyG4KA== 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=+3bXinEZ60WMWrmk1NDiDkwT8uTwh3vAxcj3qYBEanA=; b=BCu2OKXrd62BvreSUG1+aeLZvFffYsv/iZJO61U7jEqx5/qAB2jrBCk+MpygFGS+MmOYd4xarDU76TM8Mg0wAxzdFczEMnXKprwh/QxfEpdeFNKGdgDzCmrAo00Y9YJtMm0ArBUUny9ORAP2NruPfX6IE/BuLnHG07TzRtN2hu5hzN4PRc9h0HDV60wk5rOsqANIrJQEWTjDnVz4VqepP1Ust6JAeT9nYEQsmigY6cG9Kk8RPVi3nClt+xQr+/0jSUZym5+RruQ/vJpPATFqA8i0L37yGXuPAFkQ3oWILreCcw6E6UerlXUEqCXm3OT7njNNRLFGJNC6KzxsL0gy0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none X-Received: from SJ0PR10MB4605.namprd10.prod.outlook.com (2603:10b6:a03:2d9::24) by BYAPR10MB3191.namprd10.prod.outlook.com (2603:10b6:a03:14f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.29; Mon, 22 Feb 2021 07:19:43 +0000 X-Received: from SJ0PR10MB4605.namprd10.prod.outlook.com ([fe80::a021:790:7ce6:6f16]) by SJ0PR10MB4605.namprd10.prod.outlook.com ([fe80::a021:790:7ce6:6f16%6]) with mapi id 15.20.3868.033; Mon, 22 Feb 2021 07:19:43 +0000 From: "Ankur Arora" To: devel@edk2.groups.io Cc: lersek@redhat.com, imammedo@redhat.com, boris.ostrovsky@oracle.com, Ankur Arora , Jordan Justen , Ard Biesheuvel , Aaron Young Subject: [edk2-devel] [PATCH v8 05/10] OvmfPkg/CpuHotplugSmm: define CPU_HOT_EJECT_DATA Date: Sun, 21 Feb 2021 23:19:23 -0800 Message-Id: <20210222071928.1401820-6-ankur.a.arora@oracle.com> In-Reply-To: <20210222071928.1401820-1-ankur.a.arora@oracle.com> References: <20210222071928.1401820-1-ankur.a.arora@oracle.com> X-Originating-IP: [148.87.23.11] X-ClientProxiedBy: MWHPR17CA0065.namprd17.prod.outlook.com (2603:10b6:300:93::27) To SJ0PR10MB4605.namprd10.prod.outlook.com (2603:10b6:a03:2d9::24) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from prion.us.oracle.com (148.87.23.11) by MWHPR17CA0065.namprd17.prod.outlook.com (2603:10b6:300:93::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 07:19:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 94b7e310-2368-4989-4ff4-08d8d70239f5 X-MS-TrafficTypeDiagnostic: BYAPR10MB3191: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-M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UL2N/uTnMNPf30xmM?= =?us-ascii?Q?nVoByG6N9iFgHqGZG6wzNVTvfEbnurb42cO5AXmtehGCB2MNvsncnBJcsVU/?= =?us-ascii?Q?uPdM//rdlK8iX6I7bXZ0fKI2WMSX5ipACYtwpGbLVDzUMKZiqMwUvkz6Aif7?= =?us-ascii?Q?AdtmAP7tp7EYMrPzpcc3YByH?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94b7e310-2368-4989-4ff4-08d8d70239f5 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB4605.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 07:19:43.7191 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OU982ffsjmS9WLNkgnsVREVVg7R/YswCZHr3HXrw4tdiHkJmaHhFwjlZuJKNaDiPs4wb85gFFuipmxRRzr4s822Cq28/XgBI7Ex41feo9U8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3191 Precedence: Bulk List-Unsubscribe: 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,ankur.a.arora@oracle.com X-Gm-Message-State: etWakY2v0Zcs96KW68PLLu1cx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613978390; bh=+NBkeVoVf8dNEb10Nb1+pWHcA3aZ4Mbtki/H5Jkscb4=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=SEsr7JdTqrr/ZftVTHqiQgFdZaG5QMT1NKkMR7hucEye/x6LAX1IxEsgSxCcnTQpk2w oYWauZgWtOWfZKVcRE6/dUhxTXlz4Y3OJCNy2xZxxSru6OxnrTQ9U2+XcRbtkW9sisoyP WwPnWq9mcPnJY1xZKxYYIFpFBcbGWgidteg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Define CPU_HOT_EJECT_DATA and add PCD PcdCpuHotEjectDataAddress, which will be used to share CPU ejection state between OvmfPkg/CpuHotPlugSmm and PiSmmCpuDxeSmm. Cc: Laszlo Ersek Cc: Jordan Justen Cc: Ard Biesheuvel Cc: Igor Mammedov Cc: Boris Ostrovsky Cc: Aaron Young Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3132 Signed-off-by: Ankur Arora --- Notes: Addresses the following review comments in v6: (1) Dropped modifications to LibraryClasses in OvmfPkg.dec (2,3) Cleanup comments around PCD PcdCpuHotEjectDataAddress. (4) Move PCD PcdCpuHotEjectDataAddress declaration in CpuHotplugSmm.inf to a patch-7 where it actually gets used. (5a,5b) Change the comment in the top block to use Laszlo's language. Also detail when the PCD would contain a valid value. (6) Move Library/CpuHotEjectData.h to Pcd/CpuHotEjectData.h (7,15,16) Fixup guard macro to be C namespace compliant. Also fixup the comment style near the endif guard. (8-10) Rename CPU_HOT_EJECT_FN to a more EDK2 compliant style. Also add a comment block and fix spacing. () Rename ApicIdMap -> QemuSelectorMap while keeping the type as UINT6= 4. Related to a comment in patch-8 ("... add worker to do CPU ejection".) (11a,11b) Rename CPU_EJECT_INVALID to CPU_EJECT_QEMU_SELECTOR_INVALID and add a comment about it. () Remove CPU_EJECT_WORKER based on review comment on a patch 8. (12,14) Remove CPU_HOT_EJECT_DATA fields Revision and Reserved. Reorder CPU_HOT_EJECT_DATA to minimize internal padding and ensure elements are properly aligned. (13a,13b) Change CpuIndex->ApicId map to ProcessorNum -> QemuSelector () Make CPU_HOT_EJECT_HANDLER->Handler, CPU_HOT_EJECT_HANDLER->QemuSelectorMap volatile. OvmfPkg/OvmfPkg.dec | 4 +++ OvmfPkg/Include/Pcd/CpuHotEjectData.h | 52 +++++++++++++++++++++++++++++++= ++++ 2 files changed, 56 insertions(+) create mode 100644 OvmfPkg/Include/Pcd/CpuHotEjectData.h diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index 4348bb45c64a..9629707020ba 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -352,6 +352,10 @@ [PcdsDynamic, PcdsDynamicEx] # This PCD is only accessed if PcdSmmSmramRequire is TRUE (see below). gUefiOvmfPkgTokenSpaceGuid.PcdQ35SmramAtDefaultSmbase|FALSE|BOOLEAN|0x34 =20 + ## This PCD adds a communication channel between OVMF's SmmCpuFeaturesLib + # instance in PiSmmCpuDxeSmm, and CpuHotplugSmm. + gUefiOvmfPkgTokenSpaceGuid.PcdCpuHotEjectDataAddress|0|UINT64|0x46 + [PcdsFeatureFlag] gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderPciTranslation|TRUE|BOOLEAN|0= x1c gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderMmioTranslation|FALSE|BOOLEAN= |0x1d diff --git a/OvmfPkg/Include/Pcd/CpuHotEjectData.h b/OvmfPkg/Include/Pcd/Cp= uHotEjectData.h new file mode 100644 index 000000000000..024a92726869 --- /dev/null +++ b/OvmfPkg/Include/Pcd/CpuHotEjectData.h @@ -0,0 +1,52 @@ +/** @file + Definition for the CPU_HOT_EJECT_DATA structure, which shares + CPU hot-eject state between OVMF's SmmCpuFeaturesLib instance in + PiSmmCpuDxeSmm, and CpuHotplugSmm. + + CPU_HOT_EJECT_DATA is allocated in SMRAM, and pointed-to by + PcdCpuHotEjectDataAddress. + + PcdCpuHotEjectDataAddress is valid when SMM_REQUIRE is TRUE + and MaxNumberOfCpus > 1. + + Copyright (C) 2021, Oracle Corporation. + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef CPU_HOT_EJECT_DATA_H_ +#define CPU_HOT_EJECT_DATA_H_ + +/** + CPU Hot-eject handler, called from SmmCpuFeaturesRendezvousExit() + on each CPU at exit from SMM. + + @param[in] ProcessorNum ProcessorNum denotes the CPU exiting SMM, + and will be used as an index into + CPU_HOT_EJECT_DATA->QemuSelectorMap. It is + identical to the processor handle in + EFI_SMM_CPU_SERVICE_PROTOCOL. +**/ +typedef +VOID +(EFIAPI *CPU_HOT_EJECT_HANDLER) ( + IN UINTN ProcessorNum + ); + +// +// CPU_EJECT_QEMU_SELECTOR_INVALID marks CPUs not being ejected in +// CPU_HOT_EJECT_DATA->QemuSelectorMap. +// +// QEMU CPU Selector is UINT32, so we choose an invalid value larger +// than that type. +// +#define CPU_EJECT_QEMU_SELECTOR_INVALID (MAX_UINT64) + +typedef struct { + volatile UINT64 *QemuSelectorMap; // Maps ProcessorNum -> QemuSele= ctor + // for pending hot-ejects + volatile CPU_HOT_EJECT_HANDLER Handler; // Handler to do the CPU ejection + UINT32 ArrayLength; // Entries in the QemuSelectorMap +} CPU_HOT_EJECT_DATA; + +#endif // CPU_HOT_EJECT_DATA_H_ --=20 2.9.3 -=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 (#71916): https://edk2.groups.io/g/devel/message/71916 Mute This Topic: https://groups.io/mt/80819860/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-