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.web12.8812.1611643498248855445 for ; Mon, 25 Jan 2021 22:44:58 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=EjPFERGg; 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 10Q6Z79B054283; Tue, 26 Jan 2021 06:44:54 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 : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=5EaL+ZxMNT/nlKN0K1jN7X0CrnwOY2RVEUXcZfsweZY=; b=EjPFERGgp8qyBpsDL2+Azf1/WgqXZmXbjqe0atq2eDeQPTeX6PvzHZP+OwGe7GeYOJB9 kAFZaZJVWsh0363q5+3iimv5oyurovvW8+vOS9KQEtjZvnKjcusJ75mPYRjY7UAFNN18 brOKLSr5aHPjGHU1fPDQp78tXL/B/7mR9C0T2wh/4nM5969W7O0mayLWaQnR1xkufgmw vyeWe6ogn8NRamRpUB7890mw9Dg+DT7GHNCPkyssqtOY530pnVT5SXxv80W+PLIzXmA+ iHkUQzQJ0k/bvgpfZ2LB6UDfFzE3PgNpA3EkkF+EMQM1nW2OTTdvx2ce7a4hzevl6mpn +A== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 368b7qrnuf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Jan 2021 06:44:54 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10Q6a5jQ097050; Tue, 26 Jan 2021 06:44:54 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2046.outbound.protection.outlook.com [104.47.74.46]) by userp3030.oracle.com with ESMTP id 368wqw1qb8-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Jan 2021 06:44:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nkd0xoHw6qSrNxY2LurZsoK4xAlUJ9PKYkZqZctj6e/QUR2XykyrYJvJ9k0K0vNO2qGOkBqJhhv24vKvjg9E/lv/GWJetr61Ypq+bhuo7JzDfQLQg1PESSgV17rmz1s+C6+Qhct3nRFyAZym2zeeHI0T0CG274ruxz0c++AejBP8JN9uYvyPULsAzs0KfIbbiGsKLF1Lo353PVEKjkMQZSU1JN2rKv5ol0gouJgMANO2l8D3ddIQDUNi0nTcU/1KANX1HREXebNPKjiCNKQ0VnUCSYwAXfNErnmV0V9tX+oiA9q+9y8rPlYEIr820gmssB9dYNAV9bUkSQiU+zj0+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5EaL+ZxMNT/nlKN0K1jN7X0CrnwOY2RVEUXcZfsweZY=; b=oRMODvJglnVWaDwI19AIzIyqwMTw3YibCMZL9yaSaZAv6ffeD9tn4NNPBij8IsN3mTYFPM1u+ehH0rbemwm7vApxX3cNkHc5Nq+nywqpZLin2877yJttwK3eQdnZ4X0v8JR98y6J6KYF5dsY0/MPCLEU1UtRVZD7VGf/nKg93Mi940LIch9aX/kcUEp4SgxXaoidili4nsRkoGdPL7sG13/4XjSLNspew+osJbPgOHmxTMnpeSKcEdkPprBgKgDZCYJWNAraN7QS8916c1DivheKAfJBVyNaXLmpF4GcOqhLKHvg5WVsEpAc8WkqTN48qz2B6hWkzlmgqsfvcmml8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5EaL+ZxMNT/nlKN0K1jN7X0CrnwOY2RVEUXcZfsweZY=; b=zQ/YYnK+GYFXv4p1G0zlxa58PmITxy1HkRINZAqjxiunWPY3NxjyZmHCvkHkzkWUA7/RS0OhjncHgRWMgz+Cdz2MabuELB+C4r2eRsH4i5U/4rxAyNPNr0q6x0zfFNXpljK2eGcxhrO4VeH73QVr0JOlji+37BvUC5xhCr0sChQ= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=oracle.com; Received: from CY4PR10MB1718.namprd10.prod.outlook.com (2603:10b6:910:9::17) by CY4PR1001MB2184.namprd10.prod.outlook.com (2603:10b6:910:45::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.14; Tue, 26 Jan 2021 06:44:52 +0000 Received: from CY4PR10MB1718.namprd10.prod.outlook.com ([fe80::39dc:6ba7:9397:cb6]) by CY4PR10MB1718.namprd10.prod.outlook.com ([fe80::39dc:6ba7:9397:cb6%6]) with mapi id 15.20.3784.019; Tue, 26 Jan 2021 06:44:51 +0000 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 v5 3/9] OvmfPkg/CpuHotplugSmm: add Qemu Cpu Status helper Date: Mon, 25 Jan 2021 22:44:34 -0800 Message-Id: <20210126064440.299596-4-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210126064440.299596-1-ankur.a.arora@oracle.com> References: <20210126064440.299596-1-ankur.a.arora@oracle.com> X-Originating-IP: [70.36.60.91] X-ClientProxiedBy: MWHPR18CA0061.namprd18.prod.outlook.com (2603:10b6:300:39::23) To CY4PR10MB1718.namprd10.prod.outlook.com (2603:10b6:910:9::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (70.36.60.91) by MWHPR18CA0061.namprd18.prod.outlook.com (2603:10b6:300:39::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Tue, 26 Jan 2021 06:44:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 41aa5cab-edef-4736-dd2a-08d8c1c5e1e3 X-MS-TrafficTypeDiagnostic: CY4PR1001MB2184: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7zqbh09pLnJyY1j2p5Qitpz3L9hes3GFlP5Nb86T54yZZEIG56HG8uPZryto9KVO0ivS8/CFotLDrlGvRL4QRRlJ+VU0gjP5DzvwcYb89MshepHNlZNuCDXgpGWLhf1LNoiGpPAa9ZOhK/q3gIQzcAe0CiwFiaQS2l4n9EFO60y7OYHYNxX4SIrZftIUcslP6qbF0GzLADkBjEacCkkU5RzYlBheXCajpXw6nIG4/4h0HjxVuLq6UM18rFIwvns1ZpG+d3+zuO5YKGZceLkpSsJFc9K52/Bse+VmWJoxB4M6l80H0ubnaDCUj+Y5I5ZXUj/RdhhwHjERVYr+56aDKsZsFMNHGRsioHZKjFyPofXCX51rE31DdYsgrh1wYyyYDbK3FNY5wGrEqJWanyp6nZN8GHMTQgizeFP00zL4gjI78BsCkJGHi33//Hkaeg+MenqjI/HJVJMpx5EFG1V1pufCrJNqYsozqLSXG0YyiuP37OPkrIZQANuEhUWzNI8Wf4sqakiQM8KP0Eep3O5KZA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR10MB1718.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(396003)(39860400002)(376002)(346002)(136003)(69590400011)(6916009)(2616005)(4326008)(6512007)(52116002)(956004)(66556008)(6486002)(36756003)(186003)(6506007)(26005)(66476007)(6666004)(478600001)(8676002)(8936002)(83380400001)(966005)(1076003)(2906002)(86362001)(5660300002)(66946007)(103116003)(316002)(54906003)(16526019)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?ae5ertf05/Z6qNr+dZ6i8f3lyfXEbQYMn+vLvBpUC4fLppBm52EM6LT721vJ?= =?us-ascii?Q?q3FD106cNBuYnTDvadevgDRa2bYu4o2M2O57SSAAtAfmmJzGirprAXwxNmCJ?= =?us-ascii?Q?IkIhh8RV7ZhGsSz68K4zTtMdDlszhCikpvgLEPSsHBpbNpLZ81vC0SHXOAKx?= =?us-ascii?Q?V2USEMnfaKoPIytPHdBpsmCs7Mvh9qOb+p/E1RCJ4mHwBVNum1RjwOiOut3Q?= =?us-ascii?Q?/oGf8+nQO0Yi8OxFtuy3zQxwEoKq3ixHMnEHUf+c4fyUpAEmPpsw7NZ59a9E?= =?us-ascii?Q?3+4L118dEphqHsnG/R0Anor2DWZ5nX3JrzcpKbaOHaoD1v7g0qSR7i2D1laZ?= =?us-ascii?Q?8qXEsOMSx5PJNqeNc3dW09kJUNy1FS6/NVMmqJFH3GeS5HrE0WChka+I2jSM?= =?us-ascii?Q?3F4HwU6XiPKv7q28I5u8HMF2t7ATeewRRRbmJIKtobyzYb2lkFBc6SPKuMrh?= =?us-ascii?Q?6XvFTiLUO33qiAhJhMuJ9z8toJVOmbgaLkRbZniVgKzXexTQtFy6y45y7CNS?= =?us-ascii?Q?onHwI1K1ef9GLaZDgg8cqifzM2Yv+OvYZFZa5L41tOr/FfeNedh+h/qVYTzQ?= =?us-ascii?Q?vT0Da5i8yxSOT9Njb6aOiJJMfzCgKPn8RRMmaatPgKLhoewinRuv3DIEJF78?= =?us-ascii?Q?57/h2okcQH9LJS9FemOHOA7t5dKxwCwteEMXyNJdFRe7xQkLJFYB3Z5oSinp?= =?us-ascii?Q?v3xTl+ElsrqCm2erL8xNe+IHlwrD1IXFLu1BlC4XCOwZe9O2MFs/JKMiu6s7?= =?us-ascii?Q?55KnYSMAOnOTdQCnc4eqfVCLjWQjwiU4g54vas55WPLsUBqv9GiJdGOg+6lo?= =?us-ascii?Q?bcCXBOZSLc1KwLm/YfRh9arpx16cXXTvOG3sOHs6gIU8Fv9qWq6oO+RaY6y4?= =?us-ascii?Q?YCYDMNUFSylCDEZVmFHa2AOWIwQ5opICoKQI/+T5RDPTZq+ViP11M6XLk1n4?= =?us-ascii?Q?7+buo/UceCme4nUcqeh2WlGsUHqnia3ISKBNO5wYZcHCBAMARrseBK+gc+EZ?= =?us-ascii?Q?I5YCYMQtDsBWtW11H+0XAEYkE2l4qSNVV30ejlccmePG+RdHYvImfacT+Oda?= =?us-ascii?Q?oXgt+G4b?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 41aa5cab-edef-4736-dd2a-08d8c1c5e1e3 X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1718.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2021 06:44:51.9248 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ysAuM/fONkPtY+5tULDSF0br5h1qD7KKbBUtiO90mEh9T0D5ny3tY1RG/NBGW+TZd56ZKw06zN8r+DG/7zpymQXUFEAO80xBf8vxmT5APB0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1001MB2184 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9875 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 phishscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101260035 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9875 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 phishscore=0 adultscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101260035 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Add QemuCpuhpWriteCpuStatus() which will be used to update the QEMU CPU status register. On error, it hangs in a similar fashion as other helper functions. 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/QemuCpuhp.h | 6 ++++++ OvmfPkg/CpuHotplugSmm/QemuCpuhp.c | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.h b/OvmfPkg/CpuHotplugSmm/Qemu= Cpuhp.h index 8adaa0ad91f0..804809846890 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 +VOID=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 diff --git a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c b/OvmfPkg/CpuHotplugSmm/Qemu= Cpuhp.c index 2dd783ebf42e..c35ae31d2db0 100644 --- a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c +++ b/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c @@ -67,6 +67,28 @@ QemuCpuhpReadCpuStatus ( return CpuStatus;=0D }=0D =0D +VOID=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 +}=0D +=0D UINT32=0D QemuCpuhpReadCommandData (=0D IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo=0D --=20 2.9.3