From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by mx.groups.io with SMTP id smtpd.web12.6146.1613725515382964226 for ; Fri, 19 Feb 2021 01:05:15 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=satsxwO5; spf=pass (domain: oracle.com, ip: 156.151.31.85, mailfrom: ankur.a.arora@oracle.com) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11J94GeV111126; Fri, 19 Feb 2021 09:05:11 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=9bkWGfoq1y7L5hpHb9XwV6nCkXOVbulHM1KyVz0wRtg=; b=satsxwO51saKPHekwP0nCct9u8j0Brwem/S5nLXEYal1JBjQwlDdPDUzCKQJrekxOvav O4MkbX43EODiCkEafHFz+slT/G5pauOHkWYhTS6hCv4w81BCxiSFHMY0jZKHNhIIu+/l q6iKFjoPpgy/O/kT9YpMXEiJdzkQhvTzEDC41LkfymOkwuUUqxoPeYXAJhdUF1Od7aR3 rB5NhVD1dluT4GD7ZGfBVi3B2YrDt+5cUjPMG6NfAWUI9pmNHL6UOlbpWJtXXF7iKWlb FORTD30fOsr4Pxwp3r/rS/qK5ZR+EGu9hwnKFLETrCz6gSOcl3ZSxTm6psrDt05CBmMf xg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 36p7dnrn88-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Feb 2021 09:05:11 +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 11J8uU7G011766; Fri, 19 Feb 2021 09:05:10 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by aserp3030.oracle.com with ESMTP id 36prbrwvyu-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Feb 2021 09:05:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SYcQt47fpLS4M28oXpv2qmFn7XmuCSoYWe/QzWsJ+SNIFKqqigJvPmvMyVFjySDV4+VQQXqiSWk5zvt/u6nXJAtttHj67YpX1TvKgbpexzE3FsldDOQmAjlkj+cruJtvL0ZXje647kN+2AJ6iqhX0VRD3nzLZwte9XPIAbfExZRj2d/bUskw3Bdtp+cPtRofN8gGT04ndugSKXV/osBwf1Y5OxaOnB/qB+b7vVDPeYLZoATaznPKvNS99QwWJqJXTWE/Oy6ejjkx3AiW2+aEVsLKTJvgghQb+J10qF17X/7RFRzED9cz9Waoy7YeK686iY+fvrSCSROTEBXJhZX1AQ== 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=9bkWGfoq1y7L5hpHb9XwV6nCkXOVbulHM1KyVz0wRtg=; b=EugBkJnKhrf8lOxlyocXIOH/ZhKra2r3nx9H8HV/pecFQuCztSVEDnOjhFFEkzHucoVYxeNyK8vHglNazVgvz5ADHjldsQFz36lskEXazZYpHEpyQMwLapQX+yrr6QoX3q4HfPwfwFqubh1nyxu+BRcuhCaTTGbP+hRAsHQ7eVuzdjZ621MIU1N8ZmEvVULijERKxin+GAaCp4W8r2SoUwX6eUr+KvKihwwxRxe4S3rHy+hodpOzrYBWnQyv3dox1Uwc+i7ntzmT13hs/qPR4gU/bAVjveZLxkpwdN58yeXqZwrf9QlKhURb2RiqzAFoi/7WlNPBeUz7cU1LOiVNjQ== 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=9bkWGfoq1y7L5hpHb9XwV6nCkXOVbulHM1KyVz0wRtg=; b=MEXI8mNMIF52mJ47x75xwCLZrm6eTe0iCPgoA8m7dlJvD4vORva5hwEd4w4a/+1bDs+7gNofiUAlwr5Fb86B117sbPOneGH/qFwv3ImnH6cECvNGvfwULM7bWHnlA/iGqvKIifopxeV0HukW/uv/iE9tIhc4UW3M4j2VFSiwuQ4= 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 BYAPR10MB3605.namprd10.prod.outlook.com (2603:10b6:a03:129::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Fri, 19 Feb 2021 09:05:06 +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.029; Fri, 19 Feb 2021 09:05:06 +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 v7 10/10] OvmfPkg/SmmControl2Dxe: negotiate CPU hot-unplug Date: Fri, 19 Feb 2021 01:04:44 -0800 Message-Id: <20210219090444.1332380-11-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210219090444.1332380-1-ankur.a.arora@oracle.com> References: <20210219090444.1332380-1-ankur.a.arora@oracle.com> X-Originating-IP: [148.87.23.5] X-ClientProxiedBy: MWHPR13CA0004.namprd13.prod.outlook.com (2603:10b6:300:16::14) 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.5) by MWHPR13CA0004.namprd13.prod.outlook.com (2603:10b6:300:16::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.8 via Frontend Transport; Fri, 19 Feb 2021 09:05:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 95113c2f-49d5-4855-4afc-08d8d4b57318 X-MS-TrafficTypeDiagnostic: BYAPR10MB3605: 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: bllc3OA64aTBxhK3cZuxM0pdlMKvcl6cSY8wdj1VWijYtWpuLzpMLVnW6iYuSDvYBESqXpT33wvcfcZc8zMVm6eIFO81uS0OAae7akqOOvaKn062Ojmm5oUCXXdjDG+2Rv6EHldMGmRUK6+3dI3BxeNjoKGIz3HIgpTu7y6vGiYZJupDyYREQfdrjMBedBKf9PR6XDYnkxqdt16d7pd1q4yABKWUfiYEg/fkilnPvfDQpMQN/VVGXxONhKLUqM0a6l/3yhmoE5of4F/3T0G0Af4WNCvVUwhR4q40f4COIxRmG8GjZJ34VtAaPonzFE2IFtPZ8a2rZIfHOYj9+HRwq2IRbdGeDAy/DDDNFxaEmpnLMJhNId2BNqh8vU/YY6oq7KVoYksuGiwWmNg6vQRatw7hxE6iqMDvl30/w48eW75GZOkZiHxnpXDxE9w5UyVknqxi0RPISmYvosqVi+27XjbApSSGDi47TPiEuhfMad1O8bjSwvhWAsQYTBZg6vXnP3Djn4cQL8PS4Do7Dh8nX442AqiyLPzS20wnhL+zjiDpo1DrnNO9WGZUSFx64CeaPPfuY2OWTml7CVZ7XKRtvqBpCbST3MaQ9iTjH5vZZhQ= 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:(366004)(376002)(39860400002)(346002)(396003)(136003)(83380400001)(7696005)(66946007)(2616005)(66556008)(6486002)(36756003)(86362001)(316002)(6666004)(54906003)(966005)(8676002)(66476007)(52116002)(478600001)(956004)(4326008)(19627235002)(5660300002)(6916009)(8936002)(2906002)(107886003)(1076003)(186003)(103116003)(26005)(16526019);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?GbnF/+7K1FS1ORnzrSkYDs9oblkh0G6f/UgQ0fpdwSskpiCCDOyAA+OTQxox?= =?us-ascii?Q?beKNegHx7dlY5dqiJeHmY2hAhxDK6vr4O7M7hzt1VV4PAUooSBREeE2jVe36?= =?us-ascii?Q?JMEDEvB9IltFdS9IkVh5gNNG8hcoTSg4j+52n0zXCnOnAQVb0V5zRlMTUeCw?= =?us-ascii?Q?IAraq1U6YiogXf5dNEAlx2s5beDZXqoxvx+QMZ1R0vDhnE7jWOzFGVhcpgAa?= =?us-ascii?Q?rHlrtdaZG3Z7wOieZEEUVDspXGtMJPREQYn1GW98pgDOyiN2aVQ/6/KAvJNh?= =?us-ascii?Q?j6817b9Nz2KLZD4BCWPZXX07kpO34P2ui3olp6704hQkql/Fw9HpjY0ym0kW?= =?us-ascii?Q?N9mxyO1IE4W8I0uZVyhgNkXG3Ijo8nZY0HmRkDzF+MiFT9EsrZrZIrJZE/ju?= =?us-ascii?Q?585PWBs3DSnvoStVoLANJHPCpLVTYy37ZQMa8/45fhG1mDvE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?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95113c2f-49d5-4855-4afc-08d8d4b57318 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB4605.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2021 09:05:06.0266 (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: Bi89IOPSEU6J4YVBPM0cbTqg1shi7gOmzUdqXfEjRy+GImi/QwDGAQZI0hbHTIqJc2yCdl5/DvHWXPRsQrTnnM5sds8u6HUBR4Qfei0B7/I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3605 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9899 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102190070 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9899 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102190071 Content-Transfer-Encoding: 8bit Content-Type: text/plain Advertise OVMF support for CPU hot-unplug and negotiate it if QEMU requests the feature. 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: Addresses the following review comments: (1,3) s/hot unplug/hot-unplug/ (2) Get rid of the reference to the made up ICH9_APM_CNT_CPU_HOT_UNPLUG (4,6) Remove the artificial tie in between ICH9_LPC_SMI_F_CPU_HOTPLUG, ICH9_LPC_SMI_F_CPU_HOT_UNPLUG. (5) Fully spell out "SMI on CPU hot-unplug". (7) Emit separate messages on negotiation (or not) of ICH9_LPC_SMI_F_CPU_HOT_UNPLUG. OvmfPkg/SmmControl2Dxe/SmiFeatures.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c b/OvmfPkg/SmmControl2Dxe/SmiFeatures.c index c9d875543205..b1d59a559dae 100644 --- a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c +++ b/OvmfPkg/SmmControl2Dxe/SmiFeatures.c @@ -29,6 +29,12 @@ // #define ICH9_LPC_SMI_F_CPU_HOTPLUG BIT1 +// The following bit value stands for "enable CPU hot-unplug, and inject an SMI +// with control value ICH9_APM_CNT_CPU_HOTPLUG upon hot-unplug", in the +// "etc/smi/supported-features" and "etc/smi/requested-features" fw_cfg files. +// +#define ICH9_LPC_SMI_F_CPU_HOT_UNPLUG BIT2 + // // Provides a scratch buffer (allocated in EfiReservedMemoryType type memory) // for the S3 boot script fragment to write to and read from. @@ -112,7 +118,8 @@ NegotiateSmiFeatures ( QemuFwCfgReadBytes (sizeof mSmiFeatures, &mSmiFeatures); // - // We want broadcast SMI, SMI on CPU hotplug, and nothing else. + // We want broadcast SMI, SMI on CPU hotplug, SMI on CPU hot-unplug + // and nothing else. // RequestedFeaturesMask = ICH9_LPC_SMI_F_BROADCAST; if (!MemEncryptSevIsEnabled ()) { @@ -120,8 +127,10 @@ NegotiateSmiFeatures ( // For now, we only support hotplug with SEV disabled. // RequestedFeaturesMask |= ICH9_LPC_SMI_F_CPU_HOTPLUG; + RequestedFeaturesMask |= ICH9_LPC_SMI_F_CPU_HOT_UNPLUG; } mSmiFeatures &= RequestedFeaturesMask; + QemuFwCfgSelectItem (mRequestedFeaturesItem); QemuFwCfgWriteBytes (sizeof mSmiFeatures, &mSmiFeatures); @@ -166,6 +175,13 @@ NegotiateSmiFeatures ( __FUNCTION__)); } + if ((mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOT_UNPLUG) == 0) { + DEBUG ((DEBUG_INFO, "%a: CPU hot-unplug not negotiated\n", __FUNCTION__)); + } else { + DEBUG ((DEBUG_INFO, "%a: CPU hot-unplug with SMI negotiated\n", + __FUNCTION__)); + } + // // Negotiation successful (although we may not have gotten the optimal // feature set). -- 2.9.3