From nobody Thu Nov 14 23:13:14 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+72708+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+72708+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 16155304450911010.484750711073; Thu, 11 Mar 2021 22:27:25 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id LEnyYY1788612xiXjjoueTkn; Thu, 11 Mar 2021 22:27:24 -0800 X-Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by mx.groups.io with SMTP id smtpd.web11.4907.1615530438004316117 for ; Thu, 11 Mar 2021 22:27:18 -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 12C69ddh138956; Fri, 12 Mar 2021 06:27:14 GMT X-Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 373y8c14at-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Mar 2021 06:27:14 +0000 X-Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12C6PApm055289; Fri, 12 Mar 2021 06:27:13 GMT X-Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam07lp2049.outbound.protection.outlook.com [104.47.56.49]) by userp3020.oracle.com with ESMTP id 374kgw3bqs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Mar 2021 06:27:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NMbYBY6HRIJKGGHdtMyfCUPpsKdkJqxUMP5uTzan2PsMK+km9TRljJ66IVdPkWBZ2PAk/AZVuVVDYm4td0pSdQPmUt0ZzN7TTSpS7SW8T2lkOqwRnKiu+FDi8PcSAE4tZ2UOwogfiRqEgCP/pMP9OrJy1yrzQSKXZ+NL/v3svmf5C4wU2dMqMVuNBxoWmCd4CHq5uTRgmwjeo7czGPBaOyCJXODrww/scjyDhOMr0/P4nTDuJzWLs1o7BCzAgx1A99dMovQXp94yWbidPgtqC4Ht3AIoulZDU7enZaW3ZKV6NfNfstRgMNprFOo9DTnKivkNwNhEtUF3eM5PZ9r2QQ== 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=ZKwOjsA/j2uhFjAO7h8+5U4/CjyACPw7z4wyzxrfMKY=; b=ghB1m/DF7MnNlmXJ6IDYOl5tmedDC2eFv5DQHOvxQyWJn4ped3g+Kgey2e6bKGEWEQ9HZinXIaCUv0KZky6apJzn1XUE8xvEkzlVcaHYTao0GiPl4TDFGTcFhGsXXLDUZAAGLYY+AnQO4aVgKDcMEydxfuZ7pZntdTK8aWCXC3f1QzFulvU3gyGMEgAOuwR9x2KrStFWtBR/BLNOhvKBjEBDpTtMLKaJFC5lKZEP2+jQPxDfRj3loEA8jKZYeva5TJyfd+5zK3pnzi8vuoRJAQCvWI1+Nq3UoNUxbNJKXZwnS952nkgciSCV9B/9TeeR9Ce9n8CF38IC263mqoSk7Q== 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.3890.24; Fri, 12 Mar 2021 06:27:11 +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.3912.030; Fri, 12 Mar 2021 06:27:11 +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 v9 05/10] OvmfPkg: define CPU_HOT_EJECT_DATA Date: Thu, 11 Mar 2021 22:26:51 -0800 Message-Id: <20210312062656.2477515-6-ankur.a.arora@oracle.com> In-Reply-To: <20210312062656.2477515-1-ankur.a.arora@oracle.com> References: <20210312062656.2477515-1-ankur.a.arora@oracle.com> X-Originating-IP: [148.87.23.12] X-ClientProxiedBy: MWHPR02CA0018.namprd02.prod.outlook.com (2603:10b6:300:4b::28) 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.12) by MWHPR02CA0018.namprd02.prod.outlook.com (2603:10b6:300:4b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Fri, 12 Mar 2021 06:27:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a5ca63e7-b106-456c-5c02-08d8e51fde8e X-MS-TrafficTypeDiagnostic: BYAPR10MB3191: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:568; X-MS-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WYD9koAW1Zki8?= =?us-ascii?Q?t6s/XkW+fpaLE9YXB+8sHzWy9pP8L6Pvyt+fNXM/m0nb46L47ruEm4faLXKU?= =?us-ascii?Q?gBBZcBIwsZOAQSnWG+AR0s7f5/HJTB8kw13FZKXC8oP4Jx52mdhb1wrpkhuV?= =?us-ascii?Q?8jhlxb/XsgZ8Q6R9Q5aKrV0y?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a5ca63e7-b106-456c-5c02-08d8e51fde8e X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB4605.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2021 06:27:11.5335 (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: 2q6qFWT0hSBNuFIxbWToQUespVRlmBBzUDRrotBzCK4w8k8NEoJyiT3YN6nuno875Kfef4vz39Cv2f6btLhk2mU/UByJhqo3U4EDaXGG1iA= 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: XNgG4ZRbbsEID1AXPJ7eimNax1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1615530444; bh=RagIO/qagabkVnYx8ssT1Dbe2vG1A3eieRdodJC1LwY=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=lUwpToYVh+KPDYRMaRuaS9nzc0s82iD1MosA//F7ZJCdPh1yl/OEUrEBDPFwpKfj/dW 0O7RFYqbNiQzXb9thiG991Ojk0iEoPyAZAcXnmu4fwwRuI5RIRm3ZIODMbWykGIagNams pOczAngk/UkA1b5aeR/Sl9seOKRrFF3FT9c= 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 Reviewed-by: Laszlo Ersek --- Notes: Addresses the following comments from v8: =20 (1) Get rid of the unnecessary commit specifier from the subject. (2) s/MaxNumberOfCpus/PcdCpuMaxLogicalProcessorNumber/ (3) Shifted the comments to be above each structure field. OvmfPkg/OvmfPkg.dec | 4 +++ OvmfPkg/Include/Pcd/CpuHotEjectData.h | 60 +++++++++++++++++++++++++++++++= ++++ 2 files changed, 64 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..06714375526c --- /dev/null +++ b/OvmfPkg/Include/Pcd/CpuHotEjectData.h @@ -0,0 +1,60 @@ +/** @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 PcdCpuMaxLogicalProcessorNumber > 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 { + // + // Maps ProcessorNum -> QemuSelector for pending hot-ejects + // + volatile UINT64 *QemuSelectorMap; + // + // Handler to do the CPU ejection + // + volatile CPU_HOT_EJECT_HANDLER Handler; + // + // Entries in the QemuSelectorMap + // + UINT32 ArrayLength; +} 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 (#72708): https://edk2.groups.io/g/devel/message/72708 Mute This Topic: https://groups.io/mt/81273608/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-