From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.201.48 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796534069; b=1cp/c+NCFXJeHdh+K2pzXVi80SbO6x1/LrABXVph+iK0O28hQ//XSXkSTu0DJTczZzFj QTuWIA77lTdOi25hGpTP1ogpMIXmTUOMCrc+3UDWXvCni415wKn/50jgRpIGaug1OjyvS xQrKvjjHaagbswKxQeJ1a7qCmSkg2GOvkwkaRWRR3+YTfVaQAEsNdtdZ+Wklsx1bIhNlb qYBa3yOURqeM80n8LD7/qXlnQAdsGVH7hty4l3al86Znsf63uJbG/YI1oam5yAgkFO9+2 RSwNp6IN5yq6dj+aFp86nTXp8DWyHww5UG2Oa4IAeu/avOMUWy3HSzebZAsGWPdWD0A== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796534069; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=ZD8hp3Im4rWsh00dB62AtOM1W+4C2KpXu9/YXh/tj7M=; b=XlN4sxQdClw3ZWJNz7My5VKB4YFi+CFmttkhWwUVOG2GVtPE34tW4376ajxf+1a2SLiJ XO0hlptKc4lZDNPpjJXztvvlCfJjgFwLcPPfnsRMOZBS/PfEjAZQDH29Q37wbNT9WZY2U e/proADqAQ8lhunw2c7vkYews8uV2Q8/j9RRZxuS3STkEWr3bH43qhSIf6qNBw58TF1Pi fHglwRKnkMFMN2BmwXfHCfwOzVDuh/lUXbNhh0Ex8flLnnsR9IVihXNXRG1xEq1b65EGZ p+MkmUzgnAC1qxFw2YcOtk+5Sa5l9lOyy5Sy04IK7p9Y9sFPfu0L2Wkp6cE+GAk9mOw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=xVymlHyo; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.201.48 Received: from CY3PR05CU001.outbound.protection.outlook.com (mail-westcentralusazon11013048.outbound.protection.outlook.com [40.93.201.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF165606A31F for ; Sun, 6 Dec 2026 05:14:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AF165606A31F 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, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=xVymlHyo ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XAeh/BB9mHNTJOIlGe06NT0x+nKyfVwL8AvGM7bmSZkIKWNGD+9ak/QNwHnqsxurQ4DIbRVeEsdbQwho090L2rb/MtO0M0LaO8VUNgNYdQYDRD0z1eKZVl99DKv7ATFW37vDjadtixq4oMElBfHoWF9RoACcgszyjjYNXyEVE3T/XtzXmF8asn5wuFuCR5jn/sa6ja0JAA4a9NQFOLbWKOQ6pc6kpdaIGe4o7XJW/qNz4Rq+I173iYVd0ZHwBXvuv+wDXxbL6CQhAGJkYAf3yxqQ2vHlMyQji+FN9704MyHmeFdvVJiBXJIyaXcit4NCHm8FhBv8qneKiMlz2TRopg== 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=ZD8hp3Im4rWsh00dB62AtOM1W+4C2KpXu9/YXh/tj7M=; b=wqjyr1oYYKm+z6J6d7R8TwhutNf100SywiDb3ouu7lqL/bvftxJBmLiDJnuAKaHEWfplxmZm29y/1wmP5n6vD/1tBVlZKUxitdPimW10M6rUacxqATvBRf/2GjaF78kPT6mV7r7OEz51vYdrdQtn76RB7iwg+HTBXi8eIVQTqRVQM1Ln45Av+nD1leI0pLIgPra9U25LYiMjQ7fvgZMDIgTBS5REMsjY3lLun0nsEeBU/JVTieZcPXMUyTrQaVoKjynNJcTStJCcSHIBnYl0QYF7dOHK3+ooUTXfYuUXKUqg/pzWFHMLI+6vxr7Sy7Yh833/lHVSPMpjoeH2heLI1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=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=ZD8hp3Im4rWsh00dB62AtOM1W+4C2KpXu9/YXh/tj7M=; b=xVymlHyoKmVCXZ6NQuatMxfOwMapO8sDGanxQUyeByZj4Qqm2i9GT4Y/azhG+Pmh6OT11nP1m5x1nBijO10hCdCauxXrveZQlle8McHnS7RYYIhuyuYetaO+i9in+tZWmpEULQWHuYe8PkV0DT5Zj0ZsYTRQWM26T3cYYuCoK3I= Received: from CH0PR04CA0007.namprd04.prod.outlook.com (2603:10b6:610:76::12) by PH8PR12MB6890.namprd12.prod.outlook.com (2603:10b6:510:1ca::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.15; Sun, 6 Dec 2026 05:14:22 +0000 Received: from CH1PEPF0005BD62.namprd02.prod.outlook.com (2603:10b6:610:76:cafe::6) by CH0PR04CA0007.outlook.office365.com (2603:10b6:610:76::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.15 via Frontend Transport; Sun, 6 Dec 2026 05:14:22 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; 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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by CH1PEPF0005BD62.mail.protection.outlook.com (10.167.244.251) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.709.6 via Frontend Transport; Sun, 6 Dec 2026 05:14:22 +0000 Received: from purico-9dcchost.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Sat, 5 Dec 2026 23:14:21 -0600 From: Melody Wang To: CC: LKML , Tom Lendacky , , Melody Wang Subject: [PATCH v7 04/10] x86/sev: Add a config option for Alternate Injection Date: Sun, 6 Dec 2026 05:13:06 +0000 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0005BD62:EE_|PH8PR12MB6890:EE_ X-MS-Office365-Filtering-Correlation-Id: efc11ddf-32d3-487c-3e8b-08df5357c9bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|1800799024|376014|23010399003|82310400026|10067099003|56012099006|261022105027099003|261021121427099003|261021123027099003|261022075727099003|261009223027099003|261102123227099003|261028144727099003|261026140227099003|261026121527099003|22082099003|18002099003|11063799006|6133799003; X-Microsoft-Antispam-Message-Info: UgoVa7I9oNMzvCEG5Jd/5jMin/mMDYZTx6zl82bqyQL9fLLijXKc//wZ/WaTu4rxGxLSehuJT8bvuJKkhE4cI6h304HBXlzFLN1iUQ89WeAzyPtoaxVQVrNYeXBwOhggeyrWL5AA5A1bXnfM1jD6H/w8AsQWVH0UHdWsHivfDdNnR1k9fQN3Y/K40lwIzwqtqalwtlyzcZB9lq9NByTFBfG+uqKr13we4eiwjxCuyHUIOOoXV2+Wh8RURuGLbXt9Bb+4+CmJpSCWd97qRX8Jd/5OnFZQ0lFMGL2BKheX+IyypqgFvPxZ4Mu8PrGz02AhJbtvvKN1ewBKIzykvjApTUVO7h7yWoyCaXrBBz4hNEmsOf69CP2R5No5/wtBopNs3+XmDPJmanML/Xqb/bXr4m5E+LTSzF9qJMz6gPYUXPavaZky8segBUcxUydmO6/6R7j6PoOHkOUZOxLsHpVuxgiEhCIELSJvIEiH84F14Ro+rFvBulSLbe+fUhLVdklS/uQ8xsXZqvwRMUpQlWXfzAEBooykCvR2p9eQraitL4cDZzrkLiHxRlJGETq/s49w2el2P2JYzobAciLadRNXZAScJHdvxMhDCXSsOFmcwmGVb/KPcmi5DdXB2yn4iD1nyMDtTRVDD9Xj2LEptNbhy4DOewKnI0S5hE12BnfG1OGrQ+dCH6ESiJUeTatKnySLBWJx8CIQCgNKAXXw1hn2Gg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(1800799024)(376014)(23010399003)(82310400026)(10067099003)(56012099006)(261022105027099003)(261021121427099003)(261021123027099003)(261022075727099003)(261009223027099003)(261102123227099003)(261028144727099003)(261026140227099003)(261026121527099003)(22082099003)(18002099003)(11063799006)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kAj7mCOGe3i208JFdSsYJAnFMfFQ+TZ/t/ar51uTk3wPfSuwpIWop5EZ2CCG/k4fmArW5jvkGuJ/roLcRcrTjw26rD40dKoCs+tpS9cnxAM4nXCDtDAyzgEz2w5VHtGXUWme3xObbtdCQadseL0LESruMTFbFDj8zN9UXo+jIcKgT1ecKdmCbadAd0aWE+btdWPhKZrPWUhSVqbrPrux4zB7leiKdXQo76GF/c7C+Iy7a+EMO8TthzVEnI5YORjW1nnVNZMVXCVYwYcGJyaEAbJEuoOjRDXUJyAxmDQxIKwReKMlG272rmlttQG9gIFE68JKsOwtaKmx2JrJnDjTqI05OXiKEEuYz4MNVZolUFkuos6wJRWUJFqeqhmSZn6MzStlJYDPyvB5+Armxcr3HsDO5p3DUNfZdS8W1tr42uh33QQ5Uapb9TS0h9mJApfD X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2026 05:14:22.1110 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: efc11ddf-32d3-487c-3e8b-08df5357c9bb 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0005BD62.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6890 Alternate Injection is a method to protect a SNP guest from malicious injection attacks by allowing the guest to control the injection. When this feature is enabled, interrupts are injected with the help of an agent called a Secure VM Service Module (SVSM) which executes in the security realm of the guest and uses Restricted Injection as the sole method to receive interrupts from the hypervisor. Signed-off-by: Melody Wang --- arch/x86/Kconfig | 14 ++++++++++++++ arch/x86/boot/compressed/sev.c | 2 +- arch/x86/coco/core.c | 3 +++ arch/x86/coco/sev/core.c | 2 +- arch/x86/include/asm/msr-index.h | 4 ++-- include/linux/cc_platform.h | 8 ++++++++ tools/arch/x86/include/asm/msr-index.h | 4 ++-- 7 files changed, 31 insertions(+), 6 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index ff90a8fef0f2..50da07983f56 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -494,6 +494,20 @@ config AMD_SECURE_AVIC If you don't know what to do here, say N. +config AMD_ALTERNATE_INJ + bool "Support Alternate Injection" + depends on X86_X2APIC && AMD_MEM_ENCRYPT + help + Enable AMD Alternate Injection support for SNP guests. + + The Alternate Injection feature of SEV-SNP enhances the security of + a confidential VM by preventing the untrusted host from presenting + unexpected interrupts or exceptions, while still preserving the + standard interrupt dispatch semantics inherent to the x86 + architecture. + + If you don't know what to do here, say N. + config X86_POSTED_MSI bool "Enable MSI and MSI-x delivery by posted interrupts" depends on X86_64 && IRQ_REMAP diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c index c6512f2ea31e..fc2029746c50 100644 --- a/arch/x86/boot/compressed/sev.c +++ b/arch/x86/boot/compressed/sev.c @@ -179,7 +179,7 @@ bool sev_es_check_ghcb_fault(unsigned long address) #define SNP_FEATURES_IMPL_REQ (MSR_AMD64_SNP_VTOM | \ MSR_AMD64_SNP_REFLECT_VC | \ MSR_AMD64_SNP_RESTRICTED_INJ | \ - MSR_AMD64_SNP_ALT_INJ | \ + MSR_AMD64_SNP_ALTERNATE_INJ | \ MSR_AMD64_SNP_DEBUG_SWAP | \ MSR_AMD64_SNP_VMPL_SSS | \ MSR_AMD64_SNP_SECURE_TSC | \ diff --git a/arch/x86/coco/core.c b/arch/x86/coco/core.c index 989ca9f72ba3..aabda3ddc0e2 100644 --- a/arch/x86/coco/core.c +++ b/arch/x86/coco/core.c @@ -107,6 +107,9 @@ static bool noinstr amd_cc_platform_has(enum cc_attr attr) case CC_ATTR_SNP_SECURE_AVIC: return sev_status & MSR_AMD64_SNP_SECURE_AVIC; + case CC_ATTR_SNP_ALTERNATE_INJECTION: + return sev_status & MSR_AMD64_SNP_ALTERNATE_INJ; + default: return false; } diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c index 91a3ff5b1f27..6d2691170a95 100644 --- a/arch/x86/coco/sev/core.c +++ b/arch/x86/coco/sev/core.c @@ -78,7 +78,7 @@ static const char * const sev_status_feat_names[] = { [MSR_AMD64_SNP_VTOM_BIT] = "vTom", [MSR_AMD64_SNP_REFLECT_VC_BIT] = "ReflectVC", [MSR_AMD64_SNP_RESTRICTED_INJ_BIT] = "RI", - [MSR_AMD64_SNP_ALT_INJ_BIT] = "AI", + [MSR_AMD64_SNP_ALTERNATE_INJ_BIT] = "AI", [MSR_AMD64_SNP_DEBUG_SWAP_BIT] = "DebugSwap", [MSR_AMD64_SNP_PREVENT_HOST_IBS_BIT] = "NoHostIBS", [MSR_AMD64_SNP_BTB_ISOLATION_BIT] = "BTBIsol", diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 1c7b5d29556e..86926fb73d61 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -730,8 +730,8 @@ #define MSR_AMD64_SNP_REFLECT_VC BIT_ULL(MSR_AMD64_SNP_REFLECT_VC_BIT) #define MSR_AMD64_SNP_RESTRICTED_INJ_BIT 5 #define MSR_AMD64_SNP_RESTRICTED_INJ BIT_ULL(MSR_AMD64_SNP_RESTRICTED_INJ_BIT) -#define MSR_AMD64_SNP_ALT_INJ_BIT 6 -#define MSR_AMD64_SNP_ALT_INJ BIT_ULL(MSR_AMD64_SNP_ALT_INJ_BIT) +#define MSR_AMD64_SNP_ALTERNATE_INJ_BIT 6 +#define MSR_AMD64_SNP_ALTERNATE_INJ BIT_ULL(MSR_AMD64_SNP_ALTERNATE_INJ_BIT) #define MSR_AMD64_SNP_DEBUG_SWAP_BIT 7 #define MSR_AMD64_SNP_DEBUG_SWAP BIT_ULL(MSR_AMD64_SNP_DEBUG_SWAP_BIT) #define MSR_AMD64_SNP_PREVENT_HOST_IBS_BIT 8 diff --git a/include/linux/cc_platform.h b/include/linux/cc_platform.h index 559353ad64ac..80d9f1de2ae8 100644 --- a/include/linux/cc_platform.h +++ b/include/linux/cc_platform.h @@ -104,6 +104,14 @@ enum cc_attr { * to run SEV-SNP guests with full Secure AVIC capabilities. */ CC_ATTR_SNP_SECURE_AVIC, + + /** + * @CC_ATTR_SNP_ALTERNATE_INJECTION: AMD Alternate Injection enabled. + * + * A Secure VM Service Module (SVSM) has started the guest with + * Alternate Injection enabled. + */ + CC_ATTR_SNP_ALTERNATE_INJECTION, }; #ifdef CONFIG_ARCH_HAS_CC_PLATFORM diff --git a/tools/arch/x86/include/asm/msr-index.h b/tools/arch/x86/include/asm/msr-index.h index 1c7b5d29556e..86926fb73d61 100644 --- a/tools/arch/x86/include/asm/msr-index.h +++ b/tools/arch/x86/include/asm/msr-index.h @@ -730,8 +730,8 @@ #define MSR_AMD64_SNP_REFLECT_VC BIT_ULL(MSR_AMD64_SNP_REFLECT_VC_BIT) #define MSR_AMD64_SNP_RESTRICTED_INJ_BIT 5 #define MSR_AMD64_SNP_RESTRICTED_INJ BIT_ULL(MSR_AMD64_SNP_RESTRICTED_INJ_BIT) -#define MSR_AMD64_SNP_ALT_INJ_BIT 6 -#define MSR_AMD64_SNP_ALT_INJ BIT_ULL(MSR_AMD64_SNP_ALT_INJ_BIT) +#define MSR_AMD64_SNP_ALTERNATE_INJ_BIT 6 +#define MSR_AMD64_SNP_ALTERNATE_INJ BIT_ULL(MSR_AMD64_SNP_ALTERNATE_INJ_BIT) #define MSR_AMD64_SNP_DEBUG_SWAP_BIT 7 #define MSR_AMD64_SNP_DEBUG_SWAP BIT_ULL(MSR_AMD64_SNP_DEBUG_SWAP_BIT) #define MSR_AMD64_SNP_PREVENT_HOST_IBS_BIT 8 -- 2.43.0