From nobody Thu Nov 14 17:00:47 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+71832+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+71832+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 1613725512581509.40438488980544; Fri, 19 Feb 2021 01:05:12 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id HJlJYY1788612xQWGsLcdMII; Fri, 19 Feb 2021 01:05:12 -0800 X-Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by mx.groups.io with SMTP id smtpd.web09.6097.1613725505888869563 for ; Fri, 19 Feb 2021 01:05:06 -0800 X-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11J93veV178541; Fri, 19 Feb 2021 09:05:02 GMT X-Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ag89s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Feb 2021 09:05:02 +0000 X-Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11J8uJSG131491; Fri, 19 Feb 2021 09:05:02 GMT X-Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2177.outbound.protection.outlook.com [104.47.55.177]) by aserp3020.oracle.com with ESMTP id 36prp2pa12-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Feb 2021 09:05:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BYK+xL6JGcNPMiYPF6xz2BkXaNBlTf2v0yTGDcnD0qzbUHpc1MbHJDpaktjAKjerooQVQ351XOSn8j0L36b8Uuva4T8uGppOHqUL85I4gOugxWtO5w0AjOQiaqW9vgZ0Ayt4eP8A6fJTkDqFjFpkd3Ta6xvdW54XdQn+WQ6ny0XRjMVojD6jp9KxJ1JGdD0qkVN7dhfFmaQXJDx0lx76RYNHRkKtxg+X6IgpriBS32uFsY6JEI3/zIgQKjx56RVGnRWvnEG9zOtBiN/W+zk9p4Y8qIo/mMJkmLYqRJXlY8+j9Yt7kOdyccQulEr0f6e59cL+vIN4mqyftim2ytT0yw== 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=VXvtoF+SKmGDItyPH0Kdn/0KjjYX0MqdyX+0VPs0ahxDh0Nd1BTIQzwSkmkrheWHWBQKfL4nB0dxkXjyVAZX2WtgBdLlacOS3yu4W+WzgWdHeNzWhrngjw6002RjW/plqSr19naIyiUaivF20OWCthW1bEUeuNAhc3B8bWeHyX1oi0u5ex18RiZyx11OEKp1HLYkZ3+x1nlHvjwZAHyTOvzEiUHMYPHrEVr5PAgRgCTrVLTfaPGAT4DSU/U48wehwzgcRCxUwZVvSpweQIH/z3SbJFyY20Iez2Q/WyFd/Wio/NT7gQFKLJ+xhp0ulBLZUM9ecjWAHVcXvQ7DMKXPGA== 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 BYAPR10MB3605.namprd10.prod.outlook.com (2603:10b6:a03:129::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Fri, 19 Feb 2021 09:04:59 +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.029; Fri, 19 Feb 2021 09:04:59 +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 v7 05/10] OvmfPkg/CpuHotplugSmm: define CPU_HOT_EJECT_DATA Date: Fri, 19 Feb 2021 01:04:39 -0800 Message-Id: <20210219090444.1332380-6-ankur.a.arora@oracle.com> In-Reply-To: <20210219090444.1332380-1-ankur.a.arora@oracle.com> References: <20210219090444.1332380-1-ankur.a.arora@oracle.com> X-Originating-IP: [148.87.23.5] X-ClientProxiedBy: MWHPR13CA0004.namprd13.prod.outlook.com (2603:10b6:300:16::14) 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.5) by MWHPR13CA0004.namprd13.prod.outlook.com (2603:10b6:300:16::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.8 via Frontend Transport; Fri, 19 Feb 2021 09:04:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 21165d02-4107-4184-4f10-08d8d4b56f64 X-MS-TrafficTypeDiagnostic: BYAPR10MB3605: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: O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KPJR1YxEwVwHAhGbN5PZ?= =?us-ascii?Q?/pmhwJP8XA6pCYNNa2RG7AhpWA1Bm+swNASsY9JqzVdlGK3nZcqh/LLlvFU+?= =?us-ascii?Q?iGwp+JA6GDtIYwa4cPx0V2Dlz8RrxUZbAxJKX7AmtqCg8hCs0wy9taOuTdjm?= =?us-ascii?Q?fG1rJ9MNyrZqAStjtbjyYfeM?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21165d02-4107-4184-4f10-08d8d4b56f64 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB4605.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2021 09:04:59.7790 (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: QLwoePifVPhmLu1CtRAuzzCFUZEOj535Vb7HZSnHWIOr94QOsJEBJsLrbCX73dPJyBjPGc0UBo1CZy4YAUO4Hav8TL5QyXEcdHTxEWbhIwI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3605 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: l7h2WaxkkZF1Fs9TeR0eoi61x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613725512; bh=Zv8phFI1iEF1M78VuODfS+UbBO8Z5JwrfJc6O6+Xbv8=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=vFHsy8kKtM3/961U9ZYkedo0dGkJQrrWFBlEjbxtMC15U7NNxPN5nxEZHpfA9Ew952h oKKIsQOJ2gBwGbmdCrU5rGgPX9wh6XRTFXf/kSfYLK+4CTcviwEOLeXeNQ/rG40fDCdyM BuCEsKzKv/gjtzUAmLdi0Q4TYYSYd5LAn6U= 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 (#71832): https://edk2.groups.io/g/devel/message/71832 Mute This Topic: https://groups.io/mt/80751396/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-