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.48407.1612245989653760549 for ; Mon, 01 Feb 2021 22:06:29 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=HeHz7j9/; 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 11264PRV131712; Tue, 2 Feb 2021 06:06:25 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=Z0akP07A3v8+BhtZtrvlpJ3oBRHEu8GUxHgVXx51DQs=; b=HeHz7j9/Iz2VBF9PPJr6OD7Ycii4NCsnacDBk18v7tpn80mVQJKYVfDUL901mj/WaqYM hdUJVbmvxaxbSl0qDXrm3gITgQRkBLR2RiUoRimGEMzamhb3oSqAD8QJwZAz2tDzmaXW 1d3BEVgWmcntFyX20VJCjpoKxfe76PtCQd9dZDlR+vAm3/oIWziqd/KUx79kj5vV2o4o SuGPLQdMP9W8uE9TGzBuaRW7Mte8Zhfi/ap8dRg9UlFJHxT9qxNw1bsv08qkgoQeKX7u qKaS+cN6rQryu+VgfNnGARLYOWYi1QTM1zJl/nVTqlE16YWsdk++eg9NFwmsfwvihqav pw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36cxvr1051-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Feb 2021 06:06:25 +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 11260ZhB017577; Tue, 2 Feb 2021 06:04:25 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2108.outbound.protection.outlook.com [104.47.55.108]) by userp3030.oracle.com with ESMTP id 36dhcw4g47-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Feb 2021 06:04:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dePHmeirvEwY+V79vkJ+tryZjv1oF5XTgtDl6wqVvikkbtYCK0H64YTibIw1nmiB0IDezogGMPvNY+Y1gv7u9oFKq9SLfZvrJR2apjhSGwy3ol7aYiMQg2uGIuIdC2/opbCYSKuB9iDKzqcypryh6fIPaerTYwXadxS3DMfheJ3c5AT2V9s3c9SdHmNmDyb5mm4+vGJ7IkL1hnQI9d5PCJR30nH0E7LYwmUpp2XOd04psUClTpU+5pT4yYEz1DfAOrKQUZ+EkCS2/inPsOWpmlTWqKZ5hp1MM0xlAr1/1MEgjREBbsleNPo4L5Lp9T7ryzel2iZZ5VzXsPW6zi4pIg== 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=Z0akP07A3v8+BhtZtrvlpJ3oBRHEu8GUxHgVXx51DQs=; b=B4ej7RNwA4Q4zbOH01JLHJZSsz1gBA9JARpzbbZQS6V8rE1JPNDvhHtkKyfKsrT3UwI0Do7vP5hrrnx19MSAKVLTGkJ42Nih1lz4SYtuw2LVn/7nKWtxuo8WbniVOhis8Rwi1Zm3iJ+vexFqHI608iBlE6aPbcuRwXk4ti0la38T4116FhaWMMulotYc9T2p4s9Cg+YKTEwOa3ltNRhKOXPsxTGVQp0V5rnDLjFPB/eZjSfMBd+gV+G2mTcIbRlRCmi9E8D9feqdwJVk+yDMXD+CyAf0kLRl2q8DmHwFnN33NmSdvH/rHpPStVUTCclcULnpsAwwT8jNnUaq1Xl+/g== 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=Z0akP07A3v8+BhtZtrvlpJ3oBRHEu8GUxHgVXx51DQs=; b=b++WHLbMwCC9mLeoioS73lwe5+y9mcbuSU4vE+wKfcVUgFso6VcEfkuuoBIEubLcHEfCN/0M0C7yaG2YZN+ygiApu/OUcO6lz4VAApp7OMx7awSCVVpwzlc1d6EZpEsfUi3iHIiooU76RBzIU9YFEIgVAZhCFL6HKuuAaPl/qmg= Received: from SJ0PR10MB4605.namprd10.prod.outlook.com (2603:10b6:a03:2d9::24) by BYAPR10MB3461.namprd10.prod.outlook.com (2603:10b6:a03:11e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.17; Tue, 2 Feb 2021 06:04:22 +0000 Received: from SJ0PR10MB4605.namprd10.prod.outlook.com ([fe80::b1e9:811d:aa8e:f62a]) by SJ0PR10MB4605.namprd10.prod.outlook.com ([fe80::b1e9:811d:aa8e:f62a%6]) with mapi id 15.20.3805.028; Tue, 2 Feb 2021 06:04:22 +0000 Subject: Re: [PATCH v6 3/9] 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: <20210129005950.467638-1-ankur.a.arora@oracle.com> <20210129005950.467638-4-ankur.a.arora@oracle.com> From: "Ankur Arora" Message-ID: Date: Mon, 1 Feb 2021 22:04:19 -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: [70.36.60.91] X-ClientProxiedBy: MWHPR18CA0072.namprd18.prod.outlook.com (2603:10b6:300:39::34) 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] (70.36.60.91) by MWHPR18CA0072.namprd18.prod.outlook.com (2603:10b6:300:39::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.17 via Frontend Transport; Tue, 2 Feb 2021 06:04:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c202ec0-19ef-48ca-7f33-08d8c74062d2 X-MS-TrafficTypeDiagnostic: BYAPR10MB3461: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HZINZMNWloWkk53BysXTcPL2z94Ejq2Y0q/VjWYSJEzVB8FBINj13TRjUY59ywlU72T7FLRxlmGhWhtSESFhWT1WmK3SGzsub2ITMtzGAwpo/1TKA8R4B409VdBNkFX/4Dna9kZ8PPA9xW2h058I5vXmeYo+p+AYaj79W+ruAYVWOCrKX8csyJyg31Xskxrx9f7cyg1a8cF1d5yOWR2Nvc89I+BtnzE1Uc2XYKwWXopcnxrovk8BKC6ZGbMZGOQ7KNNVDwiSBiJvYV9bPyDN0hk+prhrKvylMjdGcgrIZlnKlNEGc/uWRtCUH4gcK0gJCeX9y9n8c5uzRKQl1pHExiE3Wi2nwxqISZgeQZmlEVgUxU4G7G8vOq8LEOH4P4bukGSRc8OsWQ365zTzGW6poxHZAZHxK34Mn6udgpAnW2mjo9BGdDb55rcprkSpOnhpGvQxG0nmz/IBJ9v8AmCTOrvXF0BzuejN7Nas5GuDqGClTecqj5ZpGxyVeCP/aN0JiQM/vDEd80BbW2fX9RatOnQ+wqBdKdaEO2FqidZra3kps4VWvQABqCirZzmQmU3JBqfKLfFjwLZ2UMmsfz9KcZ9RUfe4kR3jsYwKalBpmGOid1yDxbEUTFIpQLBr3op+Q1ywAf8Zyrh4UAhBXSORByaK9pWz74LzPzLiK95ET/uonwUW/j1OznB4t40HZHNU 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:(136003)(366004)(396003)(346002)(376002)(39860400002)(66556008)(8676002)(66946007)(83380400001)(107886003)(66476007)(36756003)(316002)(966005)(16576012)(478600001)(54906003)(956004)(2906002)(5660300002)(16526019)(53546011)(86362001)(26005)(2616005)(31696002)(186003)(4326008)(31686004)(6486002)(8936002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?UWhhSkwwVlFOYnBCSDRFUFdZWUNDeTJMSHl2RXZPd3FnbmpOTytwd3hEUWNt?= =?utf-8?B?RG05b1BhZHpydEpCRFp0OE4xQ3NncEhIVWlrdU1kdjBwVk85dG1TNFZSZ1R4?= =?utf-8?B?V2VQeU8wUVhPNGY0QjhzYU1mK3BZN21XOHZZQU51eWJFK1BSOFRmd1V2UzNB?= =?utf-8?B?Y0Mza3pyUkpWbnpKS0JkQ0xjdXB5blM2RkVVaEh5cUZEbEpOU29zSVZ4Wk5E?= =?utf-8?B?S3pUWUN4djhUeGdhTlNiQUZFb3hUOHRsNXlMcHpaZkcwWVhzVmU3Y1UrdjF2?= =?utf-8?B?cno5Wk1UN2dXMGk3SjFEU2wyV0c2RGZlc1JiMGI3ZndtWC9KYzBHQkIwTFRL?= =?utf-8?B?eGxvc1czSC9ybU9sQXN1Q2JvSkI5WER3dXNqYVFpSmNQSDFCSmlobDNqNG1F?= =?utf-8?B?ZnpJYU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BZ1h2?= =?utf-8?B?UFp3MEEyNUE1eU1wTTJIZUNrQVkxQmZvTkJMNER5UVBCTlk4NWJYTThqVURS?= =?utf-8?B?ekdmVWRFS0tDNTJqYW9rdTBOd1NJcXA2dHlHLzFyaWhrcmtJVXZKWWVDQzlO?= =?utf-8?Q?JKzA2s1/?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c202ec0-19ef-48ca-7f33-08d8c74062d2 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB4605.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2021 06:04:22.4533 (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: IVdmtKlop6Qq5wonjlTqfZESgJ0RAOj6MwCnMfeMqrXiRdT8anvr/XbWAa3b+PtJBOcByGz25h6kvOcIDxslNdkK469z7htU2qw8CToxeEA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3461 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9882 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102020042 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9882 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102020042 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 2021-01-29 6:36 p.m., Laszlo Ersek wrote: > On 01/29/21 01:59, 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 >> --- >> 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 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 >> ); >> >> +VOID >> +QemuCpuhpWriteCpuStatus ( >> + IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo, >> + IN UINT8 CpuStatus >> + ); >> + >> UINT32 >> QemuCpuhpReadCommandData ( >> IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo >> diff --git a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c b/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c >> index f871e50c377b..ed44264de934 100644 >> --- a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c >> +++ b/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c >> @@ -67,6 +67,28 @@ QemuCpuhpReadCpuStatus ( >> return CpuStatus; >> } >> >> +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 (); >> + } >> +} >> + >> UINT32 >> QemuCpuhpReadCommandData ( >> IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo >> > > The code is fine, but please move the new function (both declaration and > definition) between QemuCpuhpWriteCpuSelector() and QemuCpuhpWriteCommand(). > > Reason: the pre-patch order of the functions matches the order of the > register descriptions in QEMU's "docs/specs/acpi_cpu_hotplug.txt". > > There, we first have a section called "read access", then another called > "write access". And in each section, registers are listed in increasing > offset order, within the hotplug register block. Will fix. Thanks Ankur > > Thanks! > Laszlo >