From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by mx.groups.io with SMTP id smtpd.web12.8811.1611643497571663911 for ; Mon, 25 Jan 2021 22:44:57 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=lQzqeJbw; spf=pass (domain: oracle.com, ip: 141.146.126.79, mailfrom: ankur.a.arora@oracle.com) 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 10Q6ZvEf058587; Tue, 26 Jan 2021 06:44:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=W+6TEr5s+CeCtyf1xQDHO0aOpEswCDJxoKuz5AorSlc=; b=lQzqeJbwF5LtjIzQJX6eGQU5YSZegHnBiovrwI+2Y7jZ3LWLGN/zFCshuei7ixd7+ZQf 0Z/xOC5IgDPUy8NaoNFmbNv1IHsek+LBQV+7/Lz7htyxRWWzuDbB4wC8M9wxKwT8U47I VrRxUUoQGvPBPIaJ+/L70KOw/NPUZ/heLQIKCf/19IsZjldFc9Kheog9sP21Gfz175Cy ZKYrKD1iC+KUUhNzMdCAE5/lwIl7Jfik6FAKQxd2r6TVMfuDTbzDNwdjVXShQlyhW/IU h0xIM33zC00/dP3nMY17CKttZ5pV/zlx2jrTS3+NEd7eQYBA5SrLBcgg7CGFAcSSxQ15 TA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 3689aagu0y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Jan 2021 06:44:53 +0000 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 10Q6ZWIw002707; Tue, 26 Jan 2021 06:44:52 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2173.outbound.protection.outlook.com [104.47.58.173]) by userp3020.oracle.com with ESMTP id 368wjqs12b-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Jan 2021 06:44:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JzrzSMuCSt6B3iiGyDMuE462iXQvAGbUu6QiDvyFqbKhsUav/AUXi/hq2qszWsupYb8e4KxDYY75WiQ4FEWG8W1AA/y9X1jCbxqzl8St+yXUVdyBVue0xx9m6FL+5hbHmn74qfiNHmWTFPgi8RRe65ulb7/S9C7aR54a+pZjE7z7enZgiKb54sjQpnEHaGrV/AECmY7474D+nZ0rFy7VQFikGz6tvmReZGhhDyWZNjZbgzUhPtyz18cDTD7y9Q2Cr2lIxnRZuLTADbHvLsSpNgi7BjSCXI5r2jIfQSmM9o/mRypHHhVeD31y+mWVcbgvFl0DZ2ePXVEMizckWW8qYQ== 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=W+6TEr5s+CeCtyf1xQDHO0aOpEswCDJxoKuz5AorSlc=; b=MjvgcuUjTZLuqbsEHYYIOpnT2g+mJXt3M1SRRep5Z1L+apYp0810Z/v8zIg9BnR7YkHe9ZcJo+X12gSHcbjrxj7T9fJ3o5HY9sxY4bCx7Rf3VzTAhwqpDqni2tEC+Hjrxym8I+fcv+LT95uzk17P2HEjL/QZOVTyrcNeb9dF8fWxbTs7gb1hVyZxYVWixiXW5wdteN7JxC0VPbXgrpFxMSNobeWC0arTmAcUyNli5bDS6m5B9EjJvfPUabGty+PNbWozQjNLUFBlsBbGtpYJM9eHbO/Hn24+iy2bXRdRs/6ITpeHh8sNI+mpTrtWDz6NW4zCHTcv2P/Ewlo0x48uWQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W+6TEr5s+CeCtyf1xQDHO0aOpEswCDJxoKuz5AorSlc=; b=Gd3dClUfvxOm5HHc/CpEXgJCkf9IBdy2yp2PTJi6mmTX/sT4XLec1VrzneWPrF01CbjsFz9XRgUJtQ5nh4L3ztG0myOnm3hQDt/5XpddmfAR3up5TiaYuCaw5CNBZjlgK/38S+lTxt8GuAAnEYXTFtSXNVhCCSMXBV5Zy6G3bDo= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=oracle.com; Received: from CY4PR10MB1718.namprd10.prod.outlook.com (2603:10b6:910:9::17) by CY4PR10MB1781.namprd10.prod.outlook.com (2603:10b6:910:a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11; Tue, 26 Jan 2021 06:44:50 +0000 Received: from CY4PR10MB1718.namprd10.prod.outlook.com ([fe80::39dc:6ba7:9397:cb6]) by CY4PR10MB1718.namprd10.prod.outlook.com ([fe80::39dc:6ba7:9397:cb6%6]) with mapi id 15.20.3784.019; Tue, 26 Jan 2021 06:44:50 +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: [PATCH v5 1/9] OvmfPkg/CpuHotplugSmm: refactor hotplug logic Date: Mon, 25 Jan 2021 22:44:32 -0800 Message-Id: <20210126064440.299596-2-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210126064440.299596-1-ankur.a.arora@oracle.com> References: <20210126064440.299596-1-ankur.a.arora@oracle.com> X-Originating-IP: [70.36.60.91] X-ClientProxiedBy: MWHPR18CA0061.namprd18.prod.outlook.com (2603:10b6:300:39::23) To CY4PR10MB1718.namprd10.prod.outlook.com (2603:10b6:910:9::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (70.36.60.91) by MWHPR18CA0061.namprd18.prod.outlook.com (2603:10b6:300:39::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Tue, 26 Jan 2021 06:44:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eb4c4c04-6a93-4a18-9b86-08d8c1c5e100 X-MS-TrafficTypeDiagnostic: CY4PR10MB1781: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T71wLEgAlWpwRK/7tcF6/5MFMu1j2MZ+2MGIas7FDt1jLfeeDyxgV2mtMw9uh33MQWwHobJmHk8atN5y/yjQYfEabcmF1tXjd6oEyPjAsrlHBKqTen/1ZtKrzfirEAFZdaAWLEfdUVI08xP+PZLy9nmgpWeYMGGXbYPbpbMkGGb5FS9CEo/wOLguHUhHD78ebZ21WgMYFgmTO2DiPEyNH3OlhXcIHy4jZD2uxz+nQuhZd6d9V5WpKa8BumB2Q8E6gAeq3dTQcNMn+YUVd/bL4P2egZzn/lwgIDgamakotHSZLmO5gDBQFFIiJKvN5vP0bG8aVB+U8kzbKZsYMvhvrWOPENyQ04Q4xWlzlNlfF+5vo+OIQnKaokgNhb3PrXsWt8pb4ImJO+z0wI1J5yHoFY+dzFDsW1QOeYaP8dY67gzn3lA0nxakl12fbrFE/iDrucaH8enBVTcDMTf+SWEXcqMbioAAgCErj9FjHTYQpAQStgzy3qjitX7/LXHIJ+hEEAI9qwuFisEcRdpkZGFoEQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR10MB1718.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(39860400002)(376002)(396003)(366004)(136003)(346002)(83380400001)(6666004)(6512007)(4326008)(8936002)(2616005)(316002)(107886003)(36756003)(103116003)(16526019)(478600001)(956004)(66556008)(6506007)(66476007)(52116002)(66946007)(186003)(2906002)(26005)(5660300002)(69590400011)(8676002)(6916009)(86362001)(1076003)(966005)(54906003)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?8N8fRVRz9+WNxKu5/XAoavB7NDGKgvYsr1dbhj4gGtd50AIb1At8PhuUD4mL?= =?us-ascii?Q?eWySzN5yg/qPQMGs97leQE4Y1Rrx5aFygMRQXZZANprqKn8CuPiROpDznXXT?= =?us-ascii?Q?wql6qe73ArgW/QUbs2L8CWEDfPLTYkvcX3LPBr2AYIBY0ZGGTt/Sj8bQW64p?= =?us-ascii?Q?Q3FkjlIuLgDFrRcVPl1/1ElNKUAD+AW/MQM1FYiVoR0573cELcbIlHhja6b8?= =?us-ascii?Q?MHpQJfYq/xk/aTcsPjK6Zf5pgdngQJ8kYSY4yIMaDghiddtdLcbHN6I/vAum?= =?us-ascii?Q?t5lbsFvdN9hlposnFFzqgdcW6K1dOTijONh9PhrdYc5fst7XbG/6KznnU2zT?= =?us-ascii?Q?AtGIxg+Nk76XEIXt6EjYW3WIOdqM5bnZXo1vAav6aK1jNys2hAWn9/rmhzqZ?= =?us-ascii?Q?Pk6aL3V1u9RcoixJpvrR+2DvEoEhh1rCwKt7m5NfUMPyXqo+vbaIe5Y1+xpj?= =?us-ascii?Q?r2t1RbKOaiYJqw+J6pK09wF6hEJ30Nw5kFvGCmS+n1cfMVFBIQeYwp9wsvoa?= =?us-ascii?Q?pfuVNqifVkVFGz74Mx/4PcLt40f6WGXqWz+f/eVY+z3HMH8i/1STMrBrTMNo?= =?us-ascii?Q?Agr6JcEa84F87bOSfQAUbn1QsVQOZypH+9kFaNPaXu/Yk9pNoj/ViJxV/bih?= =?us-ascii?Q?A4+74By61g0EOzz8CAcQrtb5GMHeUI5qhcyXpnyXRwgD91W0HtPnCjVI6KWY?= =?us-ascii?Q?rs/UKInyZMCkDNEqWmwm1yUlGRe4Fy+AeF0BwK/bV7cBkKzH+e5MCi3hvRjC?= =?us-ascii?Q?sJSHt1upH74jbx385bm6eIU2PPnrujF0x5qWscxgJouIZLVAZGZ4X5bJq4Pb?= =?us-ascii?Q?0B9aNvssGq2yo9B+jz0ju/K/5VxALlF/0q4I0QW5fyQgBnRINnCfHvsYzd3W?= =?us-ascii?Q?V3k0J+51HnCTPvuZ4FPxCW0XfRXFIFVKiNd0DkSfP3g/S3HN5JcB5EjA0sLD?= =?us-ascii?Q?SoTe4hWh8l1S/aIGGS+SkAB2WjWV2g3gwXgjSmT/f8KfrKZA7NbCKQQolhf9?= =?us-ascii?Q?qbFp09XKcNXjYdoO5kG06SjmEd/Ry81RYWyUW7iZBSZs+1fqhMnbi3VDb79K?= =?us-ascii?Q?8QEdob7Z?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb4c4c04-6a93-4a18-9b86-08d8c1c5e100 X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1718.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2021 06:44:50.2445 (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: AXBBhGRZ4vU0cGTbuuHdvL/8JR/FDnChDb11UoshxrHNnn/eu79vhuL5PftsNfhkeeXNumlwZlFVckB/0OBYX9HqGk/bAZwTXMDrv2IgPdY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR10MB1781 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9875 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101260035 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9875 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 phishscore=0 bulkscore=0 spamscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101260035 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Refactor CpuHotplugMmi() to pull out the CPU hotplug logic into PlugCpus(). This is in preparation for supporting CPU hot-unplug. 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 --- OvmfPkg/CpuHotplugSmm/CpuHotplug.c | 208 ++++++++++++++++++++++-----------= ---- 1 file changed, 123 insertions(+), 85 deletions(-) diff --git a/OvmfPkg/CpuHotplugSmm/CpuHotplug.c b/OvmfPkg/CpuHotplugSmm/Cpu= Hotplug.c index cfe698ed2b5e..a5052a501e5a 100644 --- a/OvmfPkg/CpuHotplugSmm/CpuHotplug.c +++ b/OvmfPkg/CpuHotplugSmm/CpuHotplug.c @@ -62,6 +62,124 @@ STATIC UINT32 mPostSmmPenAddress; //=0D STATIC EFI_HANDLE mDispatchHandle;=0D =0D +/**=0D + CPU Hotplug handler function.=0D +=0D + @param[in] PluggedApicIds List of APIC IDs to be plugged.=0D +=0D + @param[in] PluggedCount Count of APIC IDs to be plugged.=0D +=0D + @retval EFI_SUCCESS Some of the requested APIC IDs were hot-p= lugged.=0D +=0D + @retval EFI_INTERRUPT_PENDING Fatal error while hot-plugging.=0D +=0D +**/=0D +STATIC=0D +EFI_STATUS=0D +EFIAPI=0D +PlugCpus(=0D + IN APIC_ID *PluggedApicIds,=0D + IN UINT32 PluggedCount=0D + )=0D +{=0D + EFI_STATUS Status;=0D + UINT32 PluggedIdx;=0D + UINT32 NewSlot;=0D +=0D + //=0D + // Process hot-added CPUs.=0D + //=0D + // The Post-SMM Pen need not be reinstalled multiple times within a sing= le=0D + // root MMI handling. Even reinstalling once per root MMI is only pruden= ce;=0D + // in theory installing the pen in the driver's entry point function sho= uld=0D + // suffice.=0D + //=0D + SmbaseReinstallPostSmmPen (mPostSmmPenAddress);=0D +=0D + PluggedIdx =3D 0;=0D + NewSlot =3D 0;=0D + while (PluggedIdx < PluggedCount) {=0D + APIC_ID NewApicId;=0D + UINT32 CheckSlot;=0D + UINTN NewProcessorNumberByProtocol;=0D +=0D + NewApicId =3D PluggedApicIds[PluggedIdx];=0D +=0D + //=0D + // Check if the supposedly hot-added CPU is already known to us.=0D + //=0D + for (CheckSlot =3D 0;=0D + CheckSlot < mCpuHotPlugData->ArrayLength;=0D + CheckSlot++) {=0D + if (mCpuHotPlugData->ApicId[CheckSlot] =3D=3D NewApicId) {=0D + break;=0D + }=0D + }=0D + if (CheckSlot < mCpuHotPlugData->ArrayLength) {=0D + DEBUG ((DEBUG_VERBOSE, "%a: APIC ID " FMT_APIC_ID " was hot-plugged = "=0D + "before; ignoring it\n", __FUNCTION__, NewApicId));=0D + PluggedIdx++;=0D + continue;=0D + }=0D +=0D + //=0D + // Find the first empty slot in CPU_HOT_PLUG_DATA.=0D + //=0D + while (NewSlot < mCpuHotPlugData->ArrayLength &&=0D + mCpuHotPlugData->ApicId[NewSlot] !=3D MAX_UINT64) {=0D + NewSlot++;=0D + }=0D + if (NewSlot =3D=3D mCpuHotPlugData->ArrayLength) {=0D + DEBUG ((DEBUG_ERROR, "%a: no room for APIC ID " FMT_APIC_ID "\n",=0D + __FUNCTION__, NewApicId));=0D + goto Fatal;=0D + }=0D +=0D + //=0D + // Store the APIC ID of the new processor to the slot.=0D + //=0D + mCpuHotPlugData->ApicId[NewSlot] =3D NewApicId;=0D +=0D + //=0D + // Relocate the SMBASE of the new CPU.=0D + //=0D + Status =3D SmbaseRelocate (NewApicId, mCpuHotPlugData->SmBase[NewSlot]= ,=0D + mPostSmmPenAddress);=0D + if (EFI_ERROR (Status)) {=0D + goto RevokeNewSlot;=0D + }=0D +=0D + //=0D + // Add the new CPU with EFI_SMM_CPU_SERVICE_PROTOCOL.=0D + //=0D + Status =3D mMmCpuService->AddProcessor (mMmCpuService, NewApicId,=0D + &NewProcessorNumberByProtocol);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a: AddProcessor(" FMT_APIC_ID "): %r\n",=0D + __FUNCTION__, NewApicId, Status));=0D + goto RevokeNewSlot;=0D + }=0D +=0D + DEBUG ((DEBUG_INFO, "%a: hot-added APIC ID " FMT_APIC_ID ", SMBASE 0x%= Lx, "=0D + "EFI_SMM_CPU_SERVICE_PROTOCOL assigned number %Lu\n", __FUNCTION__,= =0D + NewApicId, (UINT64)mCpuHotPlugData->SmBase[NewSlot],=0D + (UINT64)NewProcessorNumberByProtocol));=0D +=0D + NewSlot++;=0D + PluggedIdx++;=0D + }=0D +=0D + //=0D + // We've handled this hotplug.=0D + //=0D + return EFI_SUCCESS;=0D +=0D +RevokeNewSlot:=0D + mCpuHotPlugData->ApicId[NewSlot] =3D MAX_UINT64;=0D +=0D +Fatal:=0D + return EFI_INTERRUPT_PENDING;=0D +}=0D =0D /**=0D CPU Hotplug MMI handler function.=0D @@ -122,8 +240,6 @@ CpuHotplugMmi ( UINT8 ApmControl;=0D UINT32 PluggedCount;=0D UINT32 ToUnplugCount;=0D - UINT32 PluggedIdx;=0D - UINT32 NewSlot;=0D =0D //=0D // Assert that we are entering this function due to our root MMI handler= =0D @@ -179,87 +295,12 @@ CpuHotplugMmi ( goto Fatal;=0D }=0D =0D - //=0D - // Process hot-added CPUs.=0D - //=0D - // The Post-SMM Pen need not be reinstalled multiple times within a sing= le=0D - // root MMI handling. Even reinstalling once per root MMI is only pruden= ce;=0D - // in theory installing the pen in the driver's entry point function sho= uld=0D - // suffice.=0D - //=0D - SmbaseReinstallPostSmmPen (mPostSmmPenAddress);=0D + if (PluggedCount > 0) {=0D + Status =3D PlugCpus(mPluggedApicIds, PluggedCount);=0D + }=0D =0D - PluggedIdx =3D 0;=0D - NewSlot =3D 0;=0D - while (PluggedIdx < PluggedCount) {=0D - APIC_ID NewApicId;=0D - UINT32 CheckSlot;=0D - UINTN NewProcessorNumberByProtocol;=0D -=0D - NewApicId =3D mPluggedApicIds[PluggedIdx];=0D -=0D - //=0D - // Check if the supposedly hot-added CPU is already known to us.=0D - //=0D - for (CheckSlot =3D 0;=0D - CheckSlot < mCpuHotPlugData->ArrayLength;=0D - CheckSlot++) {=0D - if (mCpuHotPlugData->ApicId[CheckSlot] =3D=3D NewApicId) {=0D - break;=0D - }=0D - }=0D - if (CheckSlot < mCpuHotPlugData->ArrayLength) {=0D - DEBUG ((DEBUG_VERBOSE, "%a: APIC ID " FMT_APIC_ID " was hot-plugged = "=0D - "before; ignoring it\n", __FUNCTION__, NewApicId));=0D - PluggedIdx++;=0D - continue;=0D - }=0D -=0D - //=0D - // Find the first empty slot in CPU_HOT_PLUG_DATA.=0D - //=0D - while (NewSlot < mCpuHotPlugData->ArrayLength &&=0D - mCpuHotPlugData->ApicId[NewSlot] !=3D MAX_UINT64) {=0D - NewSlot++;=0D - }=0D - if (NewSlot =3D=3D mCpuHotPlugData->ArrayLength) {=0D - DEBUG ((DEBUG_ERROR, "%a: no room for APIC ID " FMT_APIC_ID "\n",=0D - __FUNCTION__, NewApicId));=0D - goto Fatal;=0D - }=0D -=0D - //=0D - // Store the APIC ID of the new processor to the slot.=0D - //=0D - mCpuHotPlugData->ApicId[NewSlot] =3D NewApicId;=0D -=0D - //=0D - // Relocate the SMBASE of the new CPU.=0D - //=0D - Status =3D SmbaseRelocate (NewApicId, mCpuHotPlugData->SmBase[NewSlot]= ,=0D - mPostSmmPenAddress);=0D - if (EFI_ERROR (Status)) {=0D - goto RevokeNewSlot;=0D - }=0D -=0D - //=0D - // Add the new CPU with EFI_SMM_CPU_SERVICE_PROTOCOL.=0D - //=0D - Status =3D mMmCpuService->AddProcessor (mMmCpuService, NewApicId,=0D - &NewProcessorNumberByProtocol);=0D - if (EFI_ERROR (Status)) {=0D - DEBUG ((DEBUG_ERROR, "%a: AddProcessor(" FMT_APIC_ID "): %r\n",=0D - __FUNCTION__, NewApicId, Status));=0D - goto RevokeNewSlot;=0D - }=0D -=0D - DEBUG ((DEBUG_INFO, "%a: hot-added APIC ID " FMT_APIC_ID ", SMBASE 0x%= Lx, "=0D - "EFI_SMM_CPU_SERVICE_PROTOCOL assigned number %Lu\n", __FUNCTION__,= =0D - NewApicId, (UINT64)mCpuHotPlugData->SmBase[NewSlot],=0D - (UINT64)NewProcessorNumberByProtocol));=0D -=0D - NewSlot++;=0D - PluggedIdx++;=0D + if (EFI_ERROR(Status)) {=0D + goto Fatal;=0D }=0D =0D //=0D @@ -267,9 +308,6 @@ CpuHotplugMmi ( //=0D return EFI_SUCCESS;=0D =0D -RevokeNewSlot:=0D - mCpuHotPlugData->ApicId[NewSlot] =3D MAX_UINT64;=0D -=0D Fatal:=0D ASSERT (FALSE);=0D CpuDeadLoop ();=0D --=20 2.9.3