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.web11.2147.1610049335981401378 for ; Thu, 07 Jan 2021 11:55:36 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=yMx3gG6+; 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 107JtRVT150438; Thu, 7 Jan 2021 19:55:33 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=eMyDqjcM1HqGutp0Jm9XOC+M74C/qLZtmXM3wSQXOF8=; b=yMx3gG6+ski6tlX5ss4GOLfyXlPL64lNEP3/yoKHcvXr2KvXmwOJaeG9yQLafXJ90FAG bhGsDIQBsSUneMknxFPrf1g91QSiDB7/muy6j3TZL4TRV2oWazIR4SIUcSp8atxMCaS9 eevuGnh16ZFvjTYe+2kTv9lOUmd8vYu30kC0SYrFM2XBgmrnFs99hniE/HTJ8ywFmnUK HSQYQ/SV4kQtdRlhG1sqge17eSqAqd3zKoXC5R6/BEETZiH5nEaJ8m1NlsQG8ACPChbH TZsMwrEpsdC40ELT0g+dJd0RYVokWHxUwjyX4CCHmBti+bVbjtRz3fNtAVLIXzUynMYm AA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 35wcuxxeee-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 07 Jan 2021 19:55:33 +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 107JaWPd024045; Thu, 7 Jan 2021 19:55:32 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 35v4ree7su-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Jan 2021 19:55:32 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 107JtVTF015277; Thu, 7 Jan 2021 19:55:31 GMT Received: from localhost.localdomain (/70.36.60.91) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 07 Jan 2021 11:55:31 -0800 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 v2 09/10] OvmfPkg/SmmControl2Dxe: negotiate ICH9_LPC_SMI_F_CPU_HOT_UNPLUG Date: Thu, 7 Jan 2021 11:55:14 -0800 Message-Id: <20210107195515.106158-10-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210107195515.106158-1-ankur.a.arora@oracle.com> References: <20210107195515.106158-1-ankur.a.arora@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9857 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 bulkscore=0 suspectscore=0 spamscore=0 adultscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101070114 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9857 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 clxscore=1015 spamscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 adultscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101070115 Content-Transfer-Encoding: quoted-printable Treat ICH9_LPC_SMI_F_CPU_HOT_UNPLUG as a subfeature of the feature flag ICH9_LPC_SMI_F_CPU_HOTPLUG, so enable it only if the other is also being negotiated. 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 | 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 379c9a66f261..1f9fd31dfe43 100644 --- a/OvmfPkg/CpuHotplugSmm/CpuHotplug.c +++ b/OvmfPkg/CpuHotplugSmm/CpuHotplug.c @@ -391,11 +391,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.9.3