From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by mx.groups.io with SMTP id smtpd.web09.1080.1610696867114815838 for ; Thu, 14 Jan 2021 23:47:47 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=ArpZrCPb; spf=pass (domain: oracle.com, ip: 156.151.31.86, mailfrom: ankur.a.arora@oracle.com) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10F7jMv1124591; Fri, 15 Jan 2021 07:47:46 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 : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=1KpqiVyBKSwRQ2nXg8AYGAP/PT3cj3Af2HM0De05LZg=; b=ArpZrCPbXGRgpgvYZicfEcvVoSVbe+1v4bYqJ3ULEEjP3iMfU1BOdbfVpsalyrYa01OI XfPHkaeUh4OY4rJmJn5Wq9TRy+g3PSvKvjmvszwdkJMyh05LLzFfGZvHzXRw/GIECcAa qIpHMwM/PVmG9VvqXaF8GLtemeCief06wzvMslcMvW3lFWFByT1h51cGzhc/RI3g3Riv uKVfr8BgNNeHezNXp/BbzT1SQLfNxzKWxeYXMQy7+eFFz/nTzV4XJ/2KjLJe6d0IRqln RHYK66fMC6gHwi6oh8kfAiugrhqY8SAFuBx3FIAk0ydiMX+wCOgRBaLicPBU7IjLbJWN IA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 360kvkbnnr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Jan 2021 07:47:46 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10F7eJE6043453; Fri, 15 Jan 2021 07:45:45 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 360kf33v0q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Jan 2021 07:45:45 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 10F7jhgT013343; Fri, 15 Jan 2021 07:45:43 GMT Received: from localhost.localdomain (/70.36.60.91) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 14 Jan 2021 23:45:43 -0800 From: "Ankur Arora" To: devel@edk2.groups.io Cc: imammedo@redhat.com, lersek@redhat.com, Ankur Arora , Eric Dong , Ray Ni , Rahul Kumar , Boris Ostrovsky , Aaron Young Subject: [PATCH v3 04/10] UefiCpuPkg: add CPU ejection support Date: Thu, 14 Jan 2021 23:45:27 -0800 Message-Id: <20210115074533.277448-5-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210115074533.277448-1-ankur.a.arora@oracle.com> References: <20210115074533.277448-1-ankur.a.arora@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9864 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 malwarescore=0 suspectscore=0 adultscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101150044 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9864 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 impostorscore=0 spamscore=0 mlxscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101150044 Content-Transfer-Encoding: quoted-printable Define CPU_HOT_EJECT_DATA and add PCD PcdCpuHotEjectDataAddress,=20=20 which would be used to share CPU ejection state between PiSmmCpuDxeSmm and OvmfPkg/CpuHotPlugSmm. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Boris Ostrovsky Cc: Aaron Young Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3132 Signed-off-by: Ankur Arora --- UefiCpuPkg/Include/CpuHotPlugData.h | 21 +++++++++++++++++++++ UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 1 + UefiCpuPkg/UefiCpuPkg.dec | 5 +++++ UefiCpuPkg/UefiCpuPkg.uni | 4 ++++ 4 files changed, 31 insertions(+) diff --git a/UefiCpuPkg/Include/CpuHotPlugData.h b/UefiCpuPkg/Include/CpuHo= tPlugData.h index 6321a149fa52..86f964550655 100644 --- a/UefiCpuPkg/Include/CpuHotPlugData.h +++ b/UefiCpuPkg/Include/CpuHotPlugData.h @@ -2,6 +2,7 @@ Definition for a structure sharing information for CPU hot plug.=0D =0D Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
=0D +Copyright (c) 2021, Oracle Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D **/=0D @@ -24,4 +25,24 @@ typedef struct { UINT32 SmrrSize;=0D } CPU_HOT_PLUG_DATA;=0D =0D +typedef +VOID +(EFIAPI *CPU_HOT_EJECT_FN)( + IN UINTN ProcessorNum + ); + +#define CPU_EJECT_INVALID (MAX_UINT64) +#define CPU_EJECT_WORKER (MAX_UINT64-1) + +#define CPU_HOT_EJECT_DATA_REVISION_1 0x00000001 + +typedef struct { + UINT32 Revision; // Used for version identification f= or this structure + UINT32 ArrayLength; // The entries number of the followi= ng ApicId array and SmBase array + + UINT64 *ApicIdMap; // Pointer to CpuIndex->ApicId map. = Holds APIC IDs for pending ejects + CPU_HOT_EJECT_FN Handler; // Handler for CPU ejection + UINT64 Reserved; +} CPU_HOT_EJECT_DATA; + #endif=0D diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf b/UefiCpuPkg/PiSm= mCpuDxeSmm/PiSmmCpuDxeSmm.inf index 76b146299679..f79c874d74f1 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf @@ -131,6 +131,7 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout ## CONS= UMES=0D gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ## SOME= TIMES_CONSUMES=0D gUefiCpuPkgTokenSpaceGuid.PcdCpuHotPlugDataAddress ## SOME= TIMES_PRODUCES=0D + gUefiCpuPkgTokenSpaceGuid.PcdCpuHotEjectDataAddress ## SOME= TIMES_PRODUCES gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmCodeAccessCheckEnable ## CONS= UMES=0D gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode ## CONS= UMES=0D gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmShadowStackSize ## SOME= TIMES_CONSUMES=0D diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index d83c084467b3..704ccc05f662 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -339,6 +339,11 @@ # @ValidList 0x80000001 | 0=0D gUefiCpuPkgTokenSpaceGuid.PcdCpuHotPlugDataAddress|0x0|UINT64|0x60000011= =0D =0D + ## Contains the pointer to a CPU Hot Eject Data structure if CPU hot-plu= g is supported. + # @Prompt The pointer to CPU Hot Eject Data. + # @ValidList 0x80000001 | 0 + gUefiCpuPkgTokenSpaceGuid.PcdCpuHotEjectDataAddress|0x0|UINT64|0x60000017 + ## Indicates processor feature capabilities, each bit corresponding to a= specific feature.=0D # @Prompt Processor feature capabilities.=0D # @ValidList 0x80000001 | 0=0D diff --git a/UefiCpuPkg/UefiCpuPkg.uni b/UefiCpuPkg/UefiCpuPkg.uni index 219c1963bf08..b1721f256632 100644 --- a/UefiCpuPkg/UefiCpuPkg.uni +++ b/UefiCpuPkg/UefiCpuPkg.uni @@ -140,6 +140,10 @@ =0D #string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuHotPlugDataAddress_HELP #lang= uage en-US "Contains the pointer to a CPU Hot Plug Data structure if CPU ho= t-plug is supported."=0D =0D +#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuHotEjectDataAddress_PROMPT #l= anguage en-US "The pointer to CPU Hot Eject Data" + +#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuHotEjectDataAddress_HELP #lan= guage en-US "Contains the pointer to a CPU Hot Eject Data structure if CPU = hot-plug is supported." + #string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuNumberOfReservedVariableMtrrs_= PROMPT #language en-US "Number of reserved variable MTRRs"=0D =0D #string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuNumberOfReservedVariableMtrrs_= HELP #language en-US "Specifies the number of variable MTRRs reserved for = OS use."=0D --=20 2.9.3