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.4506.1607405699695896174 for ; Mon, 07 Dec 2020 21:34:59 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=uXD/JqAx; 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 0B85XrWV025044; Tue, 8 Dec 2020 05:34:59 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=EPlkbNta2sCeLEzzEbuGGSCdLazNjLXlg4VqroPyDA8=; b=uXD/JqAxN1C5StWE847JjYoYK+IZ4T6ig+pNT9Jn979zAgGx81zrFL8G+IVAzuXuRAIZ 99djts+tho/FPo75ZjZmtwu3VbiSiHRAaXeNIfYQhVIy/NZPsKi72uUwwGLTAoOnILEp uAgESci+8zWjnECOCZc6XlUQb2dX07NkYfGXeRhC48Ge8OpPJIPLvxP1jehbYeCJHZrw RXy8wIyAZ21ZqRqutKfxlYwjje1QO4VVXvk3hE4c4DYdTbq+4OK9CFmdyncw045Noeqj MocBcdufmHJTPzBb24Kbajem+4OR7ortmK6Rf72cr7tp17Lu3BA8uqssR9CTSVPpBVXi RQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 3581mqrun7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 08 Dec 2020 05:34:59 +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 0B85YkWF116126; Tue, 8 Dec 2020 05:34:58 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 358ksn3e4w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Dec 2020 05:34:58 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0B85YvUn006142; Tue, 8 Dec 2020 05:34:57 GMT Received: from localhost.localdomain (/70.36.60.91) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 07 Dec 2020 21:34:57 -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 3/5] OvmfPkg/CpuHotplugSmm: add CpuStatus helper function Date: Mon, 7 Dec 2020 21:34:30 -0800 Message-Id: <20201208053432.2690694-4-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 mlxlogscore=999 suspectscore=1 bulkscore=0 malwarescore=0 phishscore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012080033 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 priorityscore=1501 adultscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 impostorscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012080033 Content-Transfer-Encoding: quoted-printable Add QemuCpuhpWriteCpuStatus() which writes to the QEMU CPU status register. On error, it hangs in similar fashion to the other helper functions. Signed-off-by: Ankur Arora --- OvmfPkg/CpuHotplugSmm/QemuCpuhp.c | 23 +++++++++++++++++++++++ OvmfPkg/CpuHotplugSmm/QemuCpuhp.h | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c b/OvmfPkg/CpuHotplugSmm/Qemu= Cpuhp.c index 2dd783ebf42e..14145696aa50 100644 --- a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c +++ b/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c @@ -67,6 +67,29 @@ QemuCpuhpReadCpuStatus ( return CpuStatus;=0D }=0D =0D +UINT8=0D +QemuCpuhpWriteCpuStatus (=0D + IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,=0D + IN UINT8 CpuStatus=0D + )=0D +{=0D + EFI_STATUS Status;=0D +=0D + Status =3D MmCpuIo->Io.Write(=0D + MmCpuIo,=0D + MM_IO_UINT8,=0D + ICH9_CPU_HOTPLUG_BASE + QEMU_CPUHP_R_CPU_STAT,=0D + 1,=0D + &CpuStatus=0D + );=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status));=0D + ASSERT (FALSE);=0D + CpuDeadLoop ();=0D + }=0D + return Status;=0D +}=0D +=0D UINT32=0D QemuCpuhpReadCommandData (=0D IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo=0D diff --git a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.h b/OvmfPkg/CpuHotplugSmm/Qemu= Cpuhp.h index 8adaa0ad91f0..9f084d199fd4 100644 --- a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.h +++ b/OvmfPkg/CpuHotplugSmm/QemuCpuhp.h @@ -30,6 +30,12 @@ QemuCpuhpReadCpuStatus ( IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo=0D );=0D =0D +UINT8=0D +QemuCpuhpWriteCpuStatus (=0D + IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,=0D + IN UINT8 CpuStatus=0D + );=0D +=0D UINT32=0D QemuCpuhpReadCommandData (=0D IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo=0D --=20 2.25.4