From patchwork Fri Jan 3 08:18:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Manali Shukla X-Patchwork-Id: 13925315 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2087.outbound.protection.outlook.com [40.107.243.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 504AF1BD032; Fri, 3 Jan 2025 08:18:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735892333; cv=fail; b=o9kp0jFg/pBq0cJ83LAZ/YAVDwkSAu/nA1P7tRFOiTNA5aRXiZOfuMut0QxMO0QLVqOCmNOEEItB0zdia6fZOLEaieusXBasFjsYd0HEI9lPyyZMunkkFfqCGoeWrjqBJK1FHUr9Rw7Pp+MjIaziMB1QaaXHqeOaEWBAqWTUfsY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735892333; c=relaxed/simple; bh=kA7GPfQNp1IychYU31YWxUwLV2fDIPZJTzndjrTvihE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=J5zV1Mo2pzxVGRgSDWnPPrVg+FT4tRKKCDBkR661wxb03ThcF2QEem5gvrWJjRe0/pygT0iZsrEYA4YjBKQWd9jeD1t2Ac0vDFgKf418Ga0oZdweJ+/Z0oViKNSDLt2foPkxbOFXnlxTQ2mPsXb6ykF8dordsEizdoqDDIgAVF4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=pJZhBYlI; arc=fail smtp.client-ip=40.107.243.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="pJZhBYlI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bkH8FDBYNJpPk73m6yfVqiHkwIBw2PcL9s6aQBdwfZMl5uATSuqAZM04p/BsaRlQOBnc6Z6TnVQW5RyXMp2+GGyMkNawZTHvke2nULvD2CJLdNCPZRESdHgXpJTI4W+XLgdMLwJHAYA/JsXaOnBcwBHI17NHSckTQB72XoovwBwM7R1L20GNkqTsiJb3e/0kzRcs+8+VgElh/J+SQyrWFC4LtbUbNKCYtx4U2r51E41RFZibCdmsvnTXDj57gb7PKAdsXMAPwd1xXD0YsIMk2YZ95lwyporFAK4Y+k+xj94Ae3hZLu6ymCQHfVI8s/rvse8TI4Oi1snMbMoCnA7AlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AIEsdXFDlozR9ou1amcSBTWy5yqNsRgDFe60vxAccVM=; b=Kbk/DTKXul3l5Hfb+nIzWjImfFd15GbsLwAJsq5yuVpSLMlsVK+LiRAV/gVH+1CILS1C8+vuVhuumhatAA8s2D+jeizoSVWHdbWYenUTgm6u6hBve9eQFFnio5bggiwLFP3qdzYpH7sB75uSIGWbYEaTxyw8IHNDyVgI26QeDy6sAAZXf7/n92k2w3srRuPvv1AJ6JZ0GvkHBcXwHe2Gwvx2/rt77wHUpqWqP1Z4QdWcbwzvF49r17SL0oYtvC55nvMlcL/+aAc+GKEFM4QvpUWDsdmWtglm40/IsaDv4g17iNnQxe5oaNJHDKKcEewrSeyCSJ7yaIuciBqBurDFpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AIEsdXFDlozR9ou1amcSBTWy5yqNsRgDFe60vxAccVM=; b=pJZhBYlInwjTZzBbQzOS0RRJ259iQCv9ENJ8UmE31WmIUSDBva4jJhIHZmo8DdEtoXej6DH0WPB1g0D4PCwKy8BasrAdH3BYBf7/ExF5FLc6I5IiTiQihbetfgHoDRxYzPoz3JUNZ7SB/kyVwJQ/mPWTGCnFE6XE9o4MjSv0ewQ= Received: from DS7PR07CA0014.namprd07.prod.outlook.com (2603:10b6:5:3af::17) by DS0PR12MB8219.namprd12.prod.outlook.com (2603:10b6:8:de::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.12; Fri, 3 Jan 2025 08:18:45 +0000 Received: from CY4PEPF0000EDD0.namprd03.prod.outlook.com (2603:10b6:5:3af:cafe::cc) by DS7PR07CA0014.outlook.office365.com (2603:10b6:5:3af::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.14 via Frontend Transport; Fri, 3 Jan 2025 08:18:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EDD0.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8314.11 via Frontend Transport; Fri, 3 Jan 2025 08:18:44 +0000 Received: from chalupa-d178host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 3 Jan 2025 02:18:43 -0600 From: Manali Shukla To: , CC: , , , , , , , , Subject: [PATCH v5 1/3] x86/cpufeatures: Add CPUID feature bit for Idle HLT intercept Date: Fri, 3 Jan 2025 08:18:26 +0000 Message-ID: <20250103081828.7060-2-manali.shukla@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250103081828.7060-1-manali.shukla@amd.com> References: <20250103081828.7060-1-manali.shukla@amd.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EDD0:EE_|DS0PR12MB8219:EE_ X-MS-Office365-Filtering-Correlation-Id: 994f70dc-6243-4635-b292-08dd2bcf3db2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?hdUNfYBQvvYKPO13p08Rzyu/QGjQTOU?= =?utf-8?q?1PIuBFf4nmkZYIIGZDsSQIrWK4zSCuTJGbOVSPssOjApILnvzJvs14tuOWCIE0UVp?= =?utf-8?q?Z0ZUZutAcej3+7E9GPAVF23kGcLBUGQhHgSaMlpv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qfTeimGoZkEtx?= =?utf-8?q?CDQThSRVzVave9240npRyyeICpkwtgjLsMjLdlFkVNlFAZYZf3rMIewY1IEm1FYPr?= =?utf-8?q?61EmVgN+nrqjgATdqh/CckT6u3LZmmTyRrq9/+4A5F3OrzjB5xmFfvhofofu90f0M?= =?utf-8?q?mhwjuJMO0Yhb7GpVD2iVl4Las6x75z8UjkzVpGyPtiy5ewdL5/T/bAyGR0lkDLfA6?= =?utf-8?q?Ls5Wibtx52JJNntCTUTNE2enrx2gfYbMr7Wut+qJIrDZYrLdAkmAzVwLJvHYJFwk4?= =?utf-8?q?2r6lD0KQHCaXHZA8ZDjbcIn1IXlUpvEKMg3mTbaElnTzIOi6ZiVwqjt9V2ol6u1Hr?= =?utf-8?q?224auAwaJeHfNQdt+/j1OPP9ICrkt51qJtqv3zY1pPQQlqglf7LAWnKUhr3yeuz+q?= =?utf-8?q?B3jBS+H/JvoQUABkLgaRbm8RewBJ56cHSRDW9RhxaX6CISII4NRtNY=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2025 08:18:44.8261 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 994f70dc-6243-4635-b292-08dd2bcf3db2 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EDD0.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8219 From: Manali Shukla The Idle HLT Intercept feature allows for the HLT instruction execution by a vCPU to be intercepted by the hypervisor only if there are no pending events (V_INTR and V_NMI) for the vCPU. When the vCPU is expected to service the pending events (V_INTR and V_NMI), the Idle HLT intercept won’t trigger. The feature allows the hypervisor to determine if the vCPU is idle and reduces wasteful VMEXITs. In addition to the aforementioned use case, the Idle HLT intercept feature is also used for enlightened guests who aim to securely manage events without the hypervisor’s awareness. If a HLT occurs while a virtual event is pending and the hypervisor is unaware of this pending event (as could be the case with enlightened guests), the absence of the Idle HLT intercept feature could result in a vCPU being suspended indefinitely. Presence of Idle HLT intercept feature for guests is indicated via CPUID function 0x8000000A_EDX[30]. Signed-off-by: Manali Shukla Acked-by: Borislav Petkov (AMD) --- arch/x86/include/asm/cpufeatures.h | 1 + 1 file changed, 1 insertion(+) base-commit: 13e98294d7cec978e31138d16824f50556a62d17 prerequisite-patch-id: cb345fc0d814a351df2b5788b76eee0eef9de549 prerequisite-patch-id: 71806f400cffe09f47d6231cb072cbdbd540de1b prerequisite-patch-id: 9ea0412aab7ecd8555fcee3e9609dbfe8456d47b prerequisite-patch-id: 3504df50cdd33958456f2e56139d76867273525c prerequisite-patch-id: 674e56729a56cc487cb85be1a64ef561eb7bac8a prerequisite-patch-id: 48e87354f9d6e6bd121ca32ab73cd0d7f1dce74f prerequisite-patch-id: 74daffd7677992995f37e5a5cb784b8d4357e342 prerequisite-patch-id: 509018dc2fc1657debc641544e86f5a92d04bc1a prerequisite-patch-id: 4a50c6a4dc3b3c8c8c640a86072faafb7bae4384 diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 645aa360628d..4fef0533f764 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -386,6 +386,7 @@ #define X86_FEATURE_V_SPEC_CTRL (15*32+20) /* "v_spec_ctrl" Virtual SPEC_CTRL */ #define X86_FEATURE_VNMI (15*32+25) /* "vnmi" Virtual NMI */ #define X86_FEATURE_SVME_ADDR_CHK (15*32+28) /* SVME addr check */ +#define X86_FEATURE_IDLE_HLT (15*32+30) /* IDLE HLT intercept */ /* Intel-defined CPU features, CPUID level 0x00000007:0 (ECX), word 16 */ #define X86_FEATURE_AVX512VBMI (16*32+ 1) /* "avx512vbmi" AVX512 Vector Bit Manipulation instructions*/