From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by mx.groups.io with SMTP id smtpd.web12.1355.1614032534906920399 for ; Mon, 22 Feb 2021 14:22:15 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=QDsjOqTq; spf=pass (domain: oracle.com, ip: 141.146.126.78, mailfrom: ankur.a.arora@oracle.com) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11MMDwqP100040; Mon, 22 Feb 2021 22:22:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2020-01-29; bh=QIGAJZeXD72Pk1DVdB0RpI+BMsPfBTiBWC2eWDX2DRU=; b=QDsjOqTqjv1D8piR9fBnVkpY5Jcda0TkBK9Mpa9jCb2lUFZ+f3K71JJuVCo8CyD6uBbD 7GQcYN2AawC0ygKZyLd9bO5OTngvs7WCjnXDTM92sM31oToKYYEj0JLWUpJoAlx6LvlC PbIZzg+tCpbEjhXR3MKFyNpgpLrzeguqIV9BDJQEQi5EsLhRaifmyTLBfFpait91wqN6 8WjTpDIrPBg4SjZLfejC0rjK3yVLAvzYhXkSUiZCcHDU9dV7v33whHlkKwtxBLVd3iVF TP5z4g84tZ5gZFwbkUCBeJ6g9XoJFsu7/sV3p+//H4vRvU3vOC9d0oRHRI69UWKhw5rL QQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36ttcm5aut-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Feb 2021 22:22: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 11MMK44C194901; Mon, 22 Feb 2021 22:22:10 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by userp3020.oracle.com with ESMTP id 36uc6qxjx1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Feb 2021 22:22:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UsVKmLXxBAqUGeEbCUMHwuWsAqNgZ7B6D35XfFW3QqH3LfsXbyIOYB1/EW3u2ZGw/MSV+KNUAdHXdIRetp6b+J5zROzCwt8RnIWWbqqlBHx0xeoV39B35WdrAsALdMprMjpZmXrKPKBJmzqkTkFpYHnbFCBfcHHVy2LRU1H5C0kNGESc/GUWHONVlQ6mCqCQwUgAaYSkzZmeGFFskgsUn3oMycTR4sWQ2Mh2vk2svGd7i+li2t57xOMnGI8mnwHDjLP6kzwC9YeGyrqTVPBsSCQNIj12DojepqpbvW8IIfgRoWiictNLOUgNyYwqOE4T4HJ9iRFmbxznVGp7KK+UdA== 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=QIGAJZeXD72Pk1DVdB0RpI+BMsPfBTiBWC2eWDX2DRU=; b=Jq2UogapcfA/zboz3+jtyvCOpKSSAE/DW1WIwLYuY9WzsLtwL46wQKWuoFaiBXZlvLOmfxVYvsJM7nGITHIog/efy3+eMTx5dAkXl2FTaau7FdIhBq7VU4MUXjbai4f3Wsx9aOD2M62rJjFIEAEhGkOT+v7woaK0JEQtHVrDGdue6S+A3dL5pylZEUfehiB3VYcp+xvDEjGCZlKE1eTa83R51iNGk7vXkbwbk7lBKr/n1lnctZQqCiXrQ6c04lAjt83VmZDD/N1fBJTZjm5kYwd4sRDhMD3WuJYXl5ThzsP35YBEwicE0lCCoVo26cqHxBhBnKwxmZOINxXNfQwTOg== 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=QIGAJZeXD72Pk1DVdB0RpI+BMsPfBTiBWC2eWDX2DRU=; b=B7wsyRJqT0WMrovuMBGpxJfN1Uqy826BClH/mtWv3yt1JugowVdDk7ucQ1MSkPk3fIEySlYVR0cUOBo/Hgc1Rqyk/UTFs2sBRrHu5PjVLFJUZlz5GobtMQlo0Ne18a/a9Pf5dIbBF2NE+YKyfguhZES8HHym/y3+NKU5RXijtFs= Received: from SJ0PR10MB4605.namprd10.prod.outlook.com (2603:10b6:a03:2d9::24) by BYAPR10MB4085.namprd10.prod.outlook.com (2603:10b6:a03:11f::13) 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 22:22:08 +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 22:22:08 +0000 Subject: Re: [edk2-devel] [PATCH v8 03/10] OvmfPkg/CpuHotplugSmm: add Qemu Cpu Status helper To: Laszlo Ersek , devel@edk2.groups.io Cc: imammedo@redhat.com, boris.ostrovsky@oracle.com, Jordan Justen , Ard Biesheuvel , Aaron Young References: <20210222071928.1401820-1-ankur.a.arora@oracle.com> <20210222071928.1401820-4-ankur.a.arora@oracle.com> From: "Ankur Arora" Message-ID: <1a2eba3a-b12f-d7b0-b0d9-c496b98e25db@oracle.com> Date: Mon, 22 Feb 2021 14:22:05 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 In-Reply-To: X-Originating-IP: [148.87.23.13] X-ClientProxiedBy: MW4PR03CA0094.namprd03.prod.outlook.com (2603:10b6:303:b7::9) To SJ0PR10MB4605.namprd10.prod.outlook.com (2603:10b6:a03:2d9::24) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.0.108] (148.87.23.13) by MW4PR03CA0094.namprd03.prod.outlook.com (2603:10b6:303:b7::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.28 via Frontend Transport; Mon, 22 Feb 2021 22:22:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0649e846-3f51-4438-b397-08d8d7804aab X-MS-TrafficTypeDiagnostic: BYAPR10MB4085: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8YkUBQaHciMQbySX1O1RXUEtFjoReKV1Z83gIXuLVP6VspyacKHw4jjqn8jXKd+pKD7CqL/8BMax+bA9mTHlGWCUHFpI+AvszVpbIreCsqcz4hSM6+ke8QeCj30xS48Vvsr+TbstXVTJJriJLGdU0qYkqHkKIsvUZS6A2XRlN/yVKriA9t3rAmkt5wQvHKvVgHTr2iKY83jM8tsLQgbNVj/FFLsmXWZ/OE5Yf1f6nLhNsR3mocGaBflVE0biz+JXdGODD+ptDWPIiMmTzXlH/TW9mhBBHqQL6kBGWXrOViBX0SZABld7o4sjbv/vg0y9FI1tjLR41YRPJlbEQgplaq/1H8N9j51r+YCaxNnoaF8uOMHLiTEI5JeekUUMbfNjQcCMRh1AInDvq8+dPr3BY5oa0RKTs0aou6lDIhLKErt45JDs2g8uMpeu0T68aQ03hmAoSajZUX2V5u9tCVw41qKmYnAI9Eaovip3dGneIZGioHiioM3bVu4bpY+C/pg6a0V63hoC69DFYU8JyMjpZUsURR4Rv0h8tWGDeiNqarlXdAZ27XUV0X5VKIKOI900A9QsUeCFtaRhqDKVfJbZISElSH3KsttdHGxNs5I/htvc/DAyhb5OaI6YhCGYJWCTgNxNh50KspVo7/ny2/HdsiYXNq9l3SJWgw2l+1Tq+3vSByR7tqdlPCGpWF9ZA0Jf 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)(366004)(376002)(396003)(346002)(136003)(36756003)(8676002)(16526019)(2906002)(5660300002)(478600001)(16576012)(83380400001)(54906003)(31696002)(31686004)(107886003)(66946007)(66556008)(86362001)(8936002)(6486002)(26005)(186003)(956004)(4326008)(966005)(53546011)(2616005)(316002)(66476007)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?Um14b1pieUxoOGJneU1TL1lQYW1BUnltUWh0UHRlMEpGWTRSd05OQndUUGtW?= =?utf-8?B?S0pGdXZma0ViY2dabGM5UHVpUnF3MnBKeVFYZHhQQXB1RjZOdWVWMGkrR01B?= =?utf-8?B?bTYxblNMbFg1dmE1N1ZOOEh3bGtzVHoyVW1iZ0dWTGtsWmlDKzlMT2N3MXdE?= =?utf-8?B?SE1yNWR6dndOSlBzN2hibEJ0N3BUOUpnYlZsTE9saVF3WXgvSzZXNWFycElJ?= =?utf-8?B?SGVWWW1Ec3IxVEtrS2ZseVYwcE1nc3grbyt3SklMYjhtSWE0UTNJcTAvbHB5?= =?utf-8?B?RGk4dXlUZlY3YUd3UjYrc1JPVGhMSGNGSVJTR1NJMEN5bGE0ZG5kZC9JSitI?= =?utf-8?B?Sk5NMWd0Tmd3dmhnR0dYbVFPcnltci92Qmh5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N0U084MXh5UHFZSWlVY09taVcxN2UyaFdSV2RYcmpYZjZF?= =?utf-8?B?V0QyenNyRmVHWnFDcHRPTHZLV0FrUWpWdXp2UmpIVmJJVU1oQitQNldDcE1P?= =?utf-8?B?RVMrU25scWZXZ09UeS9acHhLK2g5bENXN3FiZkZjU1VGMlJaejBVbCtTd093?= =?utf-8?B?S3djaEN1R0wvNkxjRDBQODZCRGFPOVFzQzVwRUQzRGZhRS8wY2RXSlYwY2lX?= =?utf-8?B?QklleEo0WmpkY3pqTHZidVcwTFc4T3JjV3h6NlpGa0lZdUpJL1RSOUV2a201?= =?utf-8?B?WmtMQlB0UmVMVDlwSE14anBqckFYWVNUcHlvQk95cnhRbklZbitjUlcxaVlu?= =?utf-8?B?Nzc4SERQMjFreWNTbS9oVm05S1Bya3ByTzdkY1lNMGtLcWhMdUFjWXpMQjhH?= =?utf-8?B?UmtnMjZLeFNOWW9FWGFQeDd0TUwva2JIeGJXU0tJbTV0NWowRFYwTkNjWHpS?= =?utf-8?Q?QabsTRTvdfCdhouYSXjI0MrdOsdO0esmitqUY68?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0649e846-3f51-4438-b397-08d8d7804aab X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB4605.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 22:22:08.3638 (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: N/+k0arBO/sBAQFJCL+IciFZO/uQO3CGI7RqU5gLAZu/J1o6u9VQxUDgehrDwJPsWUNabpVrMTMRM3POM3RCBfYr8bM8xI8upLKM4arxMVA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB4085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9903 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-2102220192 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9903 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 lowpriorityscore=0 spamscore=0 mlxscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 impostorscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102220191 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 2021-02-22 4:31 a.m., Laszlo Ersek wrote: > On 02/22/21 08:19, Ankur Arora wrote: >> 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 >> > > Reviewed-by: Laszlo Ersek Thanks! Ankur