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.web10.31718.1613978386341564918 for ; Sun, 21 Feb 2021 23:19:46 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=Kjc4ax5P; 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 11M7FDtv133395; Mon, 22 Feb 2021 07:19:43 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=8fO67yOsbQGfKTZwTbqUZ414s/0CVrpbiuLZpLVLgDQ=; b=Kjc4ax5PglLBStPkNVJTolbQCW0JVWEg0EsT4PBMvD1vgbDgEUQbYCQGlvJyDa6OSDpd UJs/M2rg54Dcsqn8kveUNaNibXPGxyg6T1dk33qQ85FE/6qZ6GFtmRyEOYrbgnzlvdWe MqYCroC/uXE8SFUdDCpI2YImnQXirDcY1j/+Y3FsTgmTfGyFIqdlwLlY0vNQDglorNkc 64Nke0+XXOLeQBUHtwwOLahYtb5Sb0BmzmWuixS6+CDBkwdn7DYZvQvl4i3zcomZWlle hIbFmscjH0iWShnhWbyZq9UKpId9tlPrTi5BkwTNoUjA1bEC/6HsyV+hYwMigcJpdgVy nw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 36tsuqtkts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Feb 2021 07:19:43 +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 11M7GCDu126471; Mon, 22 Feb 2021 07:19:42 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by userp3020.oracle.com with ESMTP id 36uc6pynae-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Feb 2021 07:19:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lOJIBUbUqOrpnuExeQzQ5zQM5N0bS35YCCsizsxiRslZcgA8pqgB745hulEI/wjBO/5qSzFP4UKsxTrF3QZAkM/Grd9sYZE6DLfegOyzN2zyBoYrLpQCmmj6u3dgyICv/DA9+2ZZE5BykEfjKI1y2K6EGWAn8fRB7QJ24P7KX9lQDeCEbBp7xAIYqBhFf8R8AoRPAO3G2CZBqfFALvYSAK144RjmkHBgEHAOEKJ3xB63sOgsVkGzxh7yQfE7kUC6KWPsM+Sq79IqanyhW+QD/rCiumM/z+jV9Fok6BJAkISuHmNCbcQS2BZwQeQjhgRQLdjIXx32/ZSaOCXDhc9Eaw== 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=8fO67yOsbQGfKTZwTbqUZ414s/0CVrpbiuLZpLVLgDQ=; b=bR5TQsUsLtgVrWbHYA6czpMiWJHrguYqDjpqH9qkXb5TG3hk9wQ8ls85h9cewQuXLgWAtnmRw8emPKIQMcynfJVDeuZKp63L6wTeeJRmyMb4dcdh0brOMq2jnohyY5mYrmHCeCGkvTayvVlzeo3OT0YzvYUi9tlqsEzQNMM0Fi/Ua0lyLqbAD+GvbjYDHOuO+8nrM2njZe0LaJsExKm3exuwtTmlHXPuRWNzt3Zqr3ElzJkpxWQ6HCqcXb7vPbsMpx/g0LiTep/x6KbEKTT1H9rnnmScxTRHBAsGfpHbviXQ4hQKnvRi5hHf15mS1YHLuU4p33eaB+TWqhDxuyV33A== 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=8fO67yOsbQGfKTZwTbqUZ414s/0CVrpbiuLZpLVLgDQ=; b=aMSiRw5fs5ilQ8LosG0eoARkJO7mBweu0TQWNYy59bGPotcEdGWxsN3cXQd7tfOcxYRvXhPjz8rUPmEctXAuIunmOzq7RCgsZY3NJxKvNf/U4ZA9QiwH4QhwKNw5g4L1OO4Fb1hDSjIM8FMubXKrEvN3PH2+MWC3Giuq2jCsaNI= 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 SJ0PR10MB4605.namprd10.prod.outlook.com (2603:10b6:a03:2d9::24) by BYAPR10MB3191.namprd10.prod.outlook.com (2603:10b6:a03:14f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.29; Mon, 22 Feb 2021 07:19:41 +0000 Received: from SJ0PR10MB4605.namprd10.prod.outlook.com ([fe80::a021:790:7ce6:6f16]) by SJ0PR10MB4605.namprd10.prod.outlook.com ([fe80::a021:790:7ce6:6f16%6]) with mapi id 15.20.3868.033; Mon, 22 Feb 2021 07:19:41 +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 v8 03/10] OvmfPkg/CpuHotplugSmm: add Qemu Cpu Status helper Date: Sun, 21 Feb 2021 23:19:21 -0800 Message-Id: <20210222071928.1401820-4-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210222071928.1401820-1-ankur.a.arora@oracle.com> References: <20210222071928.1401820-1-ankur.a.arora@oracle.com> X-Originating-IP: [148.87.23.11] X-ClientProxiedBy: MWHPR17CA0065.namprd17.prod.outlook.com (2603:10b6:300:93::27) To SJ0PR10MB4605.namprd10.prod.outlook.com (2603:10b6:a03:2d9::24) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prion.us.oracle.com (148.87.23.11) by MWHPR17CA0065.namprd17.prod.outlook.com (2603:10b6:300:93::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 07:19:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0c380061-ebbe-45cd-bdc3-08d8d702388b X-MS-TrafficTypeDiagnostic: BYAPR10MB3191: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LgrIL9qO49/O8uGGhU6v46lXq9TY10dOUaBVtXvBAtQChPo20e4z6Ve26xp+8OkgdnIlC33Z3MwXcGF9L273VZonIxHiMOlt6IlLeuGqc9vR6UnfUDbBAlebfOBx8xQZ/fa/W706Kjx0SF2Gk9xzvwclhV3tbfih3zf/HVSyB5PyBUG2nW68N3Qg41hsuDrblTrlofvVFi4VAgPQjV/8e0TqvKO66ROSWllzdzuIKbwGaHPp3XrbU+bWPDrNUL1GK6i8lJ1w6/R2TUmX/HhyKcBaTe0PJKkO9XCeNyli9ICLNVIVF9aIAi54Rs6S/nFIokUduWPOJoiuavDpMOjSQ48A9aHGLfeaEVGrf7h1rOelXf7DircL3gl2Pp6f0vNxfeHKUHo9551jkHTm8nzXkdGBcWXWW0WzSJtdvo2RR1/IfAdIfqlQMl7nOqPUIDe5b6v7y9vpft7S0xJ3bU0Gd+TZJ8AlG9fCqS5BG/kOsOWxO7sWSA5yphIrDLFQWrmSxhIkCJ6ecpHMkLd1RRAUD0GuYN0qbAwh8zN28Wja6bYQ43wTKWqmkDdQP+Nr4GWBV5J4Jh64eZ2ul1vm+HD+m6EphJKBNngg6Y0lAYrBmng= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB4605.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(39860400002)(136003)(346002)(376002)(396003)(366004)(2906002)(8936002)(54906003)(316002)(83380400001)(478600001)(86362001)(8676002)(6916009)(6486002)(2616005)(186003)(16526019)(956004)(26005)(107886003)(5660300002)(7696005)(52116002)(66946007)(6666004)(66476007)(66556008)(36756003)(1076003)(4326008)(966005)(103116003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?bNk4l9+ptwDuBlUPgMShMYRhkKQ4b5GdPlgJJ3OmgBj5DW6DRQvtB/bD30A1?= =?us-ascii?Q?payUUnvdq6iW0PITEsEWC3Nt3KSSQ7CKxwggOnM53e/jZH5Dbcl9s4Z19WLa?= =?us-ascii?Q?HM2xmheQVxKMm/4PEsFDWaiy+t/yTsIOCZSztU5oE5Cf/NncEoT0O/j+9k6T?= =?us-ascii?Q?Qm2w/fIPKwQzaqwaR5sf15gNgesJyI2oXxtrrLqFzTnoOD9Gr3x2t6V70w4u?= =?us-ascii?Q?LL42IzdR0CHqoB/B++53Bb2Jd6pEj0Qnd3xSql/rooe4qPlXPNaEAkgVLlie?= =?us-ascii?Q?vahouYBRuHjeDH4elYxMIFe2xSxEBrm1FqPU+RDLLRgmNpOAQge4KUDDN84c?= =?us-ascii?Q?BRN/Cr39mL9eC7fhYLGxQ7cdJ108dXvflCB6ecoffhujpJgl43bNCg/JjwtI?= =?us-ascii?Q?EjI2tUk4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Xq49F5MLLzUbu1iK1wLc/TBY1REBW?= =?us-ascii?Q?9t3PFHDWPj2wPisuMCOL0eTF?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c380061-ebbe-45cd-bdc3-08d8d702388b X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB4605.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 07:19:41.2668 (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: MmSk/yxS4kFMt7kssIIQW+iHduTqY8w1DC9DW1CKUugT3QdUn1K/e5VjDFYAt3GEmYaGUZUn9Pan6fsxbBTWzx1d4OPse0ugPG8SepfG5dQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3191 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9902 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102220064 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9902 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 mlxscore=0 malwarescore=0 clxscore=1015 phishscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102220064 Content-Transfer-Encoding: 8bit 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=3132 Signed-off-by: Ankur Arora --- Notes: Address this review comment: () Move QemuCpuhpWriteCpuStatus() (declaration and definition) between QemuCpuhpWriteCpuSelector() and QemuCpuhpWriteCommand() to match the order of the register descriptions in QEMU. 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/QemuCpuhp.h index 1e23b150910e..859412c1a173 100644 --- a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.h +++ b/OvmfPkg/CpuHotplugSmm/QemuCpuhp.h @@ -42,6 +42,12 @@ QemuCpuhpWriteCpuSelector ( ); VOID +QemuCpuhpWriteCpuStatus ( + IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo, + IN UINT8 CpuStatus + ); + +VOID QemuCpuhpWriteCommand ( IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo, IN UINT8 Command diff --git a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c b/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c index 36372a5e6193..9434bb14dd4e 100644 --- a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c +++ b/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c @@ -114,6 +114,28 @@ QemuCpuhpWriteCpuSelector ( } VOID +QemuCpuhpWriteCpuStatus ( + IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo, + IN UINT8 CpuStatus + ) +{ + EFI_STATUS Status; + + Status = MmCpuIo->Io.Write ( + MmCpuIo, + MM_IO_UINT8, + ICH9_CPU_HOTPLUG_BASE + QEMU_CPUHP_R_CPU_STAT, + 1, + &CpuStatus + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status)); + ASSERT (FALSE); + CpuDeadLoop (); + } +} + +VOID QemuCpuhpWriteCommand ( IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo, IN UINT8 Command -- 2.9.3