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.web08.4638.1607405702936204678 for ; Mon, 07 Dec 2020 21:35:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=h5IBErYH; 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 0B85PGPu160159; Tue, 8 Dec 2020 05:35:02 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=Sql8hzO5iLaVnQIMFdHBhiNrNYkDpEcRWPRtBLf45Vs=; b=h5IBErYHych5Mz8Cifbx2oqEWHce0pu/pgrqaN6arDHkvInyLrjR6Zi/vbO4LleWAS4B gZ9MAfzA4snb+Tm9C/kK2D8U9ABRuYGz7fPvsICNKUiSyqHtaUdwgQnGEpPuWo8W2Qmx ffosoPhyL8dNbhDBBtGLIysTWn/4GZdfALPysol+j1/tdG3n2vlPs8fipuBv5GFqyVQM vWOU8q7exxjXhQCWTZ1YZ8S8f6PBD9+KB1N1rJ6qFmpf2rZIUWDOiqX46MnqoB7OPDBc SbK0PV+/vcbaEFBo0d8RUaoOhqCDDROF/cNniRJ/N3ou/hM6OyUAfSnuwKlICBLpVJqO yA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 357yqbs09x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 08 Dec 2020 05:35:02 +0000 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 0B85QScH057736; Tue, 8 Dec 2020 05:35:02 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 358m3x8mhm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Dec 2020 05:35:02 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0B85Z0S3012616; Tue, 8 Dec 2020 05:35:00 GMT Received: from localhost.localdomain (/70.36.60.91) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 07 Dec 2020 21:35:00 -0800 From: "Ankur Arora" To: devel@edk2.groups.io Cc: imammedo@redhat.com, lersek@redhat.com, boris.ostrovsky@oracle.com, Ankur Arora Subject: [RFC PATCH 5/5] OvmfPkg/SmmControl2Dxe: negotiate ICH9_LPC_SMI_F_CPU_HOT_UNPLUG Date: Mon, 7 Dec 2020 21:34:32 -0800 Message-Id: <20201208053432.2690694-6-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201208053432.2690694-1-ankur.a.arora@oracle.com> References: <20201208053432.2690694-1-ankur.a.arora@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9828 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 adultscore=0 bulkscore=0 phishscore=0 suspectscore=1 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012080032 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9828 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 mlxlogscore=999 clxscore=1015 malwarescore=0 bulkscore=0 phishscore=0 adultscore=0 spamscore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012080032 Content-Transfer-Encoding: quoted-printable We treat ICH9_LPC_SMI_F_CPU_HOT_UNPLUG as a subset of the ICH9_LPC_SMI_F_CPU_HOTPLUG feature flag. Signed-off-by: Ankur Arora --- OvmfPkg/CpuHotplugSmm/CpuHotplug.c | 5 ----- OvmfPkg/SmmControl2Dxe/SmiFeatures.c | 21 +++++++++++++++++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/OvmfPkg/CpuHotplugSmm/CpuHotplug.c b/OvmfPkg/CpuHotplugSmm/Cpu= Hotplug.c index 0a839ae52215..cdf8e55b8d91 100644 --- a/OvmfPkg/CpuHotplugSmm/CpuHotplug.c +++ b/OvmfPkg/CpuHotplugSmm/CpuHotplug.c @@ -367,11 +367,6 @@ CpuHotplugMmi ( if (EFI_ERROR (Status)) {=0D goto Fatal;=0D }=0D - if (ToUnplugCount > 0) {=0D - DEBUG ((DEBUG_ERROR, "%a: hot-unplug is not supported yet\n",=0D - __FUNCTION__));=0D - goto Fatal;=0D - }=0D =0D if (PluggedCount > 0) {=0D Status =3D PlugCpus(mPluggedApicIds, PluggedCount);=0D diff --git a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c b/OvmfPkg/SmmControl2Dxe/= SmiFeatures.c index c9d875543205..b95827051c2b 100644 --- a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c +++ b/OvmfPkg/SmmControl2Dxe/SmiFeatures.c @@ -29,6 +29,13 @@ //=0D #define ICH9_LPC_SMI_F_CPU_HOTPLUG BIT1=0D =0D +// The following bit value stands for "enable CPU hot unplug, and inject a= n SMI=0D +// with control value ICH9_APM_CNT_CPU_HOT_UNPLUG upon hot unplug", in the= =0D +// "etc/smi/supported-features" and "etc/smi/requested-features" fw_cfg fi= les.=0D +// Can only be negotiated alongside ICH9_LPC_SMI_F_CPU_HOTPLUG.=0D +//=0D +#define ICH9_LPC_SMI_F_CPU_HOT_UNPLUG BIT2=0D +=0D //=0D // Provides a scratch buffer (allocated in EfiReservedMemoryType type memo= ry)=0D // for the S3 boot script fragment to write to and read from.=0D @@ -120,8 +127,18 @@ NegotiateSmiFeatures ( // For now, we only support hotplug with SEV disabled.=0D //=0D RequestedFeaturesMask |=3D ICH9_LPC_SMI_F_CPU_HOTPLUG;=0D + RequestedFeaturesMask |=3D ICH9_LPC_SMI_F_CPU_HOT_UNPLUG;=0D }=0D mSmiFeatures &=3D RequestedFeaturesMask;=0D +=0D + if (!(mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOTPLUG) &&=0D + (mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOT_UNPLUG)) {=0D + DEBUG ((DEBUG_WARN, "%a CPU host-feat %x, requested mask %Lx\n",=0D + __FUNCTION__, mSmiFeatures, RequestedFeaturesMask));=0D +=0D + mSmiFeatures &=3D ~ICH9_LPC_SMI_F_CPU_HOT_UNPLUG;=0D + }=0D +=0D QemuFwCfgSelectItem (mRequestedFeaturesItem);=0D QemuFwCfgWriteBytes (sizeof mSmiFeatures, &mSmiFeatures);=0D =0D @@ -162,8 +179,8 @@ NegotiateSmiFeatures ( if ((mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOTPLUG) =3D=3D 0) {=0D DEBUG ((DEBUG_INFO, "%a: CPU hotplug not negotiated\n", __FUNCTION__))= ;=0D } else {=0D - DEBUG ((DEBUG_INFO, "%a: CPU hotplug with SMI negotiated\n",=0D - __FUNCTION__));=0D + DEBUG ((DEBUG_INFO, "%a: CPU hotplug%s with SMI negotiated\n",=0D + __FUNCTION__, (mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOT_UNPLUG) ? ", un= plug" : ""));=0D }=0D =0D //=0D --=20 2.25.4