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.30321.1610951714792259963 for ; Sun, 17 Jan 2021 22:35:14 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=gTrAIiBH; 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 10I6YUxY131333; Mon, 18 Jan 2021 06:35:11 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=g/VwDwfDAOLTt+/+Ed6UL4pO97VD3M6rv+O+qjzSBa8=; b=gTrAIiBH7QYg/YILq04L70YFQGALYCZSOrHUetjc5MJMjcXzRNKsCWyN41QgVuplgyEd w5cTKGytF5qArCnJ+YhK0gSyyzT1oejtmBsCi9AuL8tNjhLsJ/U2oRpybvTG3FUTEkKP qk+S21wxfxn8Kl7eIasTEtnwGR8x9XT6Pp8mKIUryM/kEYGltUn9UQAfb+iI9E38wEkL J5XjPih2cOaWfrl4jK7nMZq5qmqJQ3fgOFKYlzQzFgRYW7r3yqaOUmVN/J3zsz/ubK+S BoSxQQ+78I4wi5g7rhpk9HijnArvvTj/jGhzr4IyUJO2R5BBU9fGJWgd4YBeNqY1Q4zM pQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 363nnabtan-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Jan 2021 06:35:11 +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 10I6UqO4031773; Mon, 18 Jan 2021 06:35:10 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 3649wpejqd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Jan 2021 06:35:10 +0000 Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 10I6Z9lm001703; Mon, 18 Jan 2021 06:35:09 GMT Received: from prion.us.oracle.com (/10.159.226.191) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 17 Jan 2021 22:35:09 -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 v4 9/9] OvmfPkg/SmmControl2Dxe: negotiate CPU hot-unplug Date: Sun, 17 Jan 2021 22:34:57 -0800 Message-Id: <20210118063457.358581-10-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210118063457.358581-1-ankur.a.arora@oracle.com> References: <20210118063457.358581-1-ankur.a.arora@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9867 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101180038 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9867 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 spamscore=0 mlxlogscore=999 clxscore=1015 bulkscore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101180038 Content-Transfer-Encoding: quoted-printable As part of the negotiation treat ICH9_LPC_SMI_F_CPU_HOT_UNPLUG as a subfeature of 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/SmmControl2Dxe/SmiFeatures.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c b/OvmfPkg/SmmControl2Dxe/= SmiFeatures.c index c9d875543205..00185253a820 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 +// with control value ICH9_APM_CNT_CPU_HOT_UNPLUG upon hot unplug", in the +// "etc/smi/supported-features" and "etc/smi/requested-features" fw_cfg fi= les. +// Can only be negotiated alongside ICH9_LPC_SMI_F_CPU_HOTPLUG. +// +#define ICH9_LPC_SMI_F_CPU_HOT_UNPLUG BIT2 + //=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 @@ -112,7 +119,8 @@ NegotiateSmiFeatures ( QemuFwCfgReadBytes (sizeof mSmiFeatures, &mSmiFeatures);=0D =0D //=0D - // We want broadcast SMI, SMI on CPU hotplug, and nothing else.=0D + // We want broadcast SMI, SMI on CPU hotplug, on CPU hot-unplug + // and nothing else.=0D //=0D RequestedFeaturesMask =3D ICH9_LPC_SMI_F_BROADCAST;=0D if (!MemEncryptSevIsEnabled ()) {=0D @@ -120,8 +128,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 mSmiFeatures &=3D RequestedFeaturesMask;=0D + + if (!(mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOTPLUG) && + (mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOT_UNPLUG)) { + DEBUG ((DEBUG_WARN, "%a CPU host-features %Lx, requested mask %Lx\n", + __FUNCTION__, mSmiFeatures, RequestedFeaturesMask)); + + mSmiFeatures &=3D ~ICH9_LPC_SMI_F_CPU_HOT_UNPLUG; + } + QemuFwCfgSelectItem (mRequestedFeaturesItem);=0D QemuFwCfgWriteBytes (sizeof mSmiFeatures, &mSmiFeatures);=0D =0D @@ -162,8 +180,9 @@ 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", + __FUNCTION__, + (mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOT_UNPLUG) ? ", unplug" : "")); }=0D =0D //=0D --=20 2.9.3