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.web11.3165.1611882194308091904 for ; Thu, 28 Jan 2021 17:03:14 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=zpKPEz7O; 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 10T0dvT0041186; Fri, 29 Jan 2021 01:03:10 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=36qBbBe5dOPYeRoLF8Xd0QOYo8RDNVjRX3kTgxR0JyU=; b=zpKPEz7OQD/LFXbMWfGTQy9vM2gghUUZ5/9lGrgnFrUBN0rzVyVZlWaeNDM05QDPDxqN HpeHvj5VmVcOAy4vcB0xEk7aCtPYYwIyUuwYssBa+l6qhqQBnU+uFQW3I7b0NFMrxE7o BvDrxw6dvrHuidqC9y4+4/KtvtVAc13zMCZNJKjYROetAoYpuky6Egbkdn8Xqc45Ju9M ZXK+D34Bh38CkW8ymiZ1JaBw0REp6l4M6jTx2rzvk4U+8hb1mXla/Nvkrts7kwZsVA79 1Y+9rlqZ3zA595OX4JQ5PXTB4Qju5HA0S0UU5Sq1yuikyeqvlaAYwk3NP734xakMJx18 ew== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 368b7r6v8r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Jan 2021 01:03:09 +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 10T0duse084583; Fri, 29 Jan 2021 01:01:09 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2170.outbound.protection.outlook.com [104.47.56.170]) by userp3020.oracle.com with ESMTP id 368wjutpx7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Jan 2021 01:01:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cvn+FtmixTjPMFGiLq2KiSHKnzqxYl1tzQCJhJxPbjbtg7S4PYGj9PBcyl0Tsa0aP25jUVWVbsV1yHcTr13EHBwoUVFsAx2Kl4YBi06FgI33hNGhIgUUtKktLHGJX39/XZieeRzjhB3I2+wCYq4RSl7+Hvl4MmqpJ8dquySSBtBhc6Qg8AS3W0P6yUgLc83CNgSZeIs7CX9UULnzGWFXOGSl90ZporXvxjscDx1dMybUL616aohQ5lhYDgs3YgA3yD3Mx91nFqwEW80Bv9895mla7kUCAY/V9519KH6MD1X2fuZ6PiJA47woX0GvVTWn8/5oZKggCvwd5UAHJo8S6w== 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=36qBbBe5dOPYeRoLF8Xd0QOYo8RDNVjRX3kTgxR0JyU=; b=WVQb2bG/jeFeut5abVjwdquWSQsEqEPZjskrQPMPbb1/XgcK9IJB8bnMOL0VFCzcfY/q/SBEBRC1fO4dQQg+JnO2WH2KSFSo8YbAnP1lfUXWyGi4j2vv9UlAAF8GHrpuhsQw98+kjcR79/GNWpCYe3Y6lfV4yRHGtWi+O22rFJzV9kO74WTBFKDDWBMCY2uThkgCLJcXli3eHO6NqU7kqOPsJA5urlo1l0vFQACLBw+nP/YR+ZDW5RolKOQSFMkHCiEPesCb6cTfuJHg7Z0yM9Xnj4UM1trcKQ1452q00HFlrXZi4miIF9l3VO3Vam4my6RkqEEHJKfE023F96P+Tg== 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=36qBbBe5dOPYeRoLF8Xd0QOYo8RDNVjRX3kTgxR0JyU=; b=jZiJiyWlgT9iTwDDXTkHPeK6C0DQEhZSNeRJt6lyoN46e6vrk7tBDybLw57o9ahzmHkNxI8ywFMjzB+7DsxqZXIEqeAq3lpsVCn+bySOuB4BDEn+eCnIZAHl1EpfRHpB2pYZ7te9F51vIk9X0CxPWxkltOXFd8cTeSrxqvSzKV4= 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 CY4PR1001MB2246.namprd10.prod.outlook.com (2603:10b6:910:41::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.16; Fri, 29 Jan 2021 01:01:06 +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.3805.019; Fri, 29 Jan 2021 01:01: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 v6 9/9] OvmfPkg/SmmControl2Dxe: negotiate CPU hot-unplug Date: Thu, 28 Jan 2021 16:59:50 -0800 Message-Id: <20210129005950.467638-10-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210129005950.467638-1-ankur.a.arora@oracle.com> References: <20210129005950.467638-1-ankur.a.arora@oracle.com> X-Originating-IP: [148.87.23.8] X-ClientProxiedBy: MWHPR1401CA0022.namprd14.prod.outlook.com (2603:10b6:301:4b::32) To CY4PR10MB1718.namprd10.prod.outlook.com (2603:10b6:910:9::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prion.us.oracle.com (148.87.23.8) by MWHPR1401CA0022.namprd14.prod.outlook.com (2603:10b6:301:4b::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.17 via Frontend Transport; Fri, 29 Jan 2021 01:00:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ec8659c4-0b50-4212-4fe5-08d8c3f139c7 X-MS-TrafficTypeDiagnostic: CY4PR1001MB2246: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PSfKCr4ixzWzgbpxdu4H+SdG+gI1nZmF4GAbLPVQIcd+vUB25sGyPccNlRwFFgKIZFgeI9Sqyis8VSZp0Fgc6tYVKixl43vXjPa5UD1SEdebI2TwxGje1hbMzZ0nOhagmMr6g4zxLGtlU0dhNZwUIPvVuo8sLhJwv4xs9BCN78agNl81d534H7Oli/ReZZkV737HGk9Ol16swXeIFevhfZughL2D+f3YrwPQx1yr8bbjzH6n1/MKdi3qLEEIyBbn7YRbsKnreZz4XaXf2MkRisxi8dJSF68Evi2kIbNtm/DwX0qOQHmRNstZpHJPncEGuco0Ady/1uWI4drE79+qCUucbZaBbZdebMu1YL2b/5EoOtVRSmizqAdB8P/dxKlW1lMXuYaqaqBZcHAdCZdZq2aaVwdXigmjwWsz7m9ZO9De+jv4H7dxgP3zStrLp7oIH6p0J4xry8EH1nv/GPOUgOnFbBZPCuUL/0VHmZySSc3mACeR8IWORwTHI5Ag3BTkw25j5GPQeQ4UPRvpmTAD/+U4AWF518yizssKLAyQhbX+QcZWY3BMzpoDER15l/nYkYdNPp+yu50mGPGQ+WLkV0JlSu70fqPBCB/asKEYcmI= 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)(39860400002)(346002)(376002)(396003)(136003)(8936002)(107886003)(2906002)(66946007)(66476007)(66556008)(36756003)(1076003)(103116003)(16526019)(956004)(966005)(7696005)(478600001)(52116002)(54906003)(6486002)(86362001)(83380400001)(6666004)(8676002)(186003)(5660300002)(4326008)(19627235002)(6916009)(26005)(316002)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?4kIu5JAIE6IUBErz/c3xJyesRoz3XvSdb4in7Jh+N1Wak4P3PMESlpRqekxG?= =?us-ascii?Q?dHX0gsW9o/quxeuQhbRLsd9p0+XvMDHlEpMblhsccV0fDimH5oP5AUKRrbJU?= =?us-ascii?Q?6PTT3VlHXVxZxOxOTGmoeO4lZzrRbJCkSixk031IvpqBwF+1dCK6fgXT/D2b?= =?us-ascii?Q?Grtao4A7GSBKcSRQKzUIcWLgJ1wMweDtxcUrxFtHiaVsF9GNwxyTmdfMu0gd?= =?us-ascii?Q?6ib6xRcxSyyU3G61VUpYzbJylPZYMCTn/u7SlIbqddnwZ5Nai/NUJkE0zUuW?= =?us-ascii?Q?MP9O4tc9eVmh9ICI+utcZF3GBszZSHDErwWu2V8/kBdEEKSa3jzu7sebzVQB?= =?us-ascii?Q?X3dzrwGhZa7qAxok5/+rPT07EQUjyuST0Y+uhf+iDxl7/PoFMA0ruzFslLjF?= =?us-ascii?Q?NhmNholNKrHGeXq7oatZkMzIwjE7VCpgVhfkjlurVe5Mi0OAuvEhmPSOz1al?= =?us-ascii?Q?dLpAHF/ndN0wDJ0WL4vCRnROeEZxzGoXbVmx3yDp90uQD9vBggUcM6oLQ1Ak?= =?us-ascii?Q?wwHVKGQdAUZQ5TY6etRr/l2/4eJbFk8G7EgcHB+yLXolQGQVST3OVOCozCR+?= =?us-ascii?Q?tFIvL722ou8dyN2j4J5jUrQFNeKx0/yVScgfsTZGihIz7e8MwEIfgDs12oEB?= =?us-ascii?Q?6nfBuQKfuzPILQZIzVo2LfCTJrkFYdpWsI6WYqUbQy0h1qbxUDZ0o23MBk9z?= =?us-ascii?Q?Jk1NEN54Qatf6Ynp1F6R9JQUohuWG/95CPDhLVwnnrWQ0bUsjI604T1zQeO3?= =?us-ascii?Q?wVjQi5jnge1uPwBI9Cud+tbu/dNptaG2XCfI+IMVInt3uAppWiD4n/TwvRPk?= =?us-ascii?Q?SIc4V27ck1HjFmS3wehqE04D7wJDS/Z36Gi7fYy+6UBB2hA/YHyPh08+ytnu?= =?us-ascii?Q?rrHCnsfUqnmPcHN7aUsmGijZsVbCSTfBLbkyPFb3JUoCw4+ukqA36MwZFVOG?= =?us-ascii?Q?2uE9E4DmUbJXJwM35dwrsfbDW8A9H1hgU4lQ5o5Tm+zy/3xQCBEyAFjKIi8B?= =?us-ascii?Q?QN708PzmNQSlJUxKxzWiVyMI6HtETe1jXw6X0qgUj4T71zoK4KfXUpjaqWqH?= =?us-ascii?Q?gUNIOz9j?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec8659c4-0b50-4212-4fe5-08d8c3f139c7 X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1718.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2021 01:00:09.8952 (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: 4lONGSThHdZBDeHgCxovl2n4+VWnbrbHsPOGSxupWtzNCO9ZKIqprzT1+mvzqUThudl+ZBTVnY1MrWWqnoGp9f11fRfCgNISvcAwvNGoX4U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1001MB2246 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9878 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101290001 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9878 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-2101290001 Content-Transfer-Encoding: 8bit Content-Type: text/plain As part of the negotiation treat ICH9_LPC_SMI_F_CPU_HOT_UNPLUG as a subfeature of feature flag ICH9_LPC_SMI_F_CPU_HOTPLUG, so enable it only if the other is also being negotiated. 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/SmmControl2Dxe/SmiFeatures.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c b/OvmfPkg/SmmControl2Dxe/SmiFeatures.c index c9d875543205..e70f3f8b58cb 100644 --- a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c +++ b/OvmfPkg/SmmControl2Dxe/SmiFeatures.c @@ -29,6 +29,13 @@ // #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_HOT_UNPLUG upon hot unplug", in the +// "etc/smi/supported-features" and "etc/smi/requested-features" fw_cfg files. +// Is only negotiated alongside ICH9_LPC_SMI_F_CPU_HOTPLUG. +// +#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 +119,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, on CPU hot-unplug + // and nothing else. // RequestedFeaturesMask = ICH9_LPC_SMI_F_BROADCAST; if (!MemEncryptSevIsEnabled ()) { @@ -120,8 +128,18 @@ 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; + + if (!(mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOTPLUG) && + (mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOT_UNPLUG)) { + DEBUG ((DEBUG_WARN, "%a CPU host-features %Lx, requested mask %Lx\n", + __FUNCTION__, mSmiFeatures, RequestedFeaturesMask)); + + mSmiFeatures &= ~ICH9_LPC_SMI_F_CPU_HOT_UNPLUG; + } + QemuFwCfgSelectItem (mRequestedFeaturesItem); QemuFwCfgWriteBytes (sizeof mSmiFeatures, &mSmiFeatures); @@ -162,8 +180,9 @@ NegotiateSmiFeatures ( if ((mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOTPLUG) == 0) { DEBUG ((DEBUG_INFO, "%a: CPU hotplug not negotiated\n", __FUNCTION__)); } else { - DEBUG ((DEBUG_INFO, "%a: CPU hotplug with SMI negotiated\n", - __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a: CPU hotplug%s with SMI negotiated\n", + __FUNCTION__, + (mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOT_UNPLUG) ? ", unplug" : "")); } // -- 2.9.3