From nobody Mon Nov 23 05:24:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1789413557; cv=pass; d=zohomail.com; s=zohoarc; b=TPYyK0zBH2vDh2wQzB6DDsfElxEutSHAxeTkCg7EUrbNTPIlm0DLvddIMt9adXvk4OcEbJddwh+3N5woSO6rGVcM30ZjnAeBm8JVTg7KxN/dnNsLwb0+Uj2U046MlYFjhYyaurh5mfLu0ypwI6v9fWOPeix3W96XQSYGFHlhAig= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789413557; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cJQLQZClHL+ncNIYxtkuP85ZkOPqMq4ELLElU8u9H7U=; b=npo89VUtD8k1LVYsZyStKJrmqHFdUAtMDM5urbTa9uDDBnPyziGrRF/yo6I7hNxK9tjVwq8ptKbZv16CYesnfWFbvOBeerwtT5h3zFLtX0/CZIbVmDKfyYRxOtlWkROS32+ecUrYVTTaKg7yktQRzkNDEGmP95N0kKOxUG0FvKU= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789413557658454.671834971815; Mon, 14 Sep 2026 12:19:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6CBv-0004wc-2E; Mon, 14 Sep 2026 15:18:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x69Sc-0003WW-JL for qemu-devel@nongnu.org; Mon, 14 Sep 2026 12:23:21 -0400 Received: from mail-northcentralusazlp170120005.outbound.protection.outlook.com ([2a01:111:f403:c105::5] helo=CH5PR02CU005.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x69Sa-0000U5-AL for qemu-devel@nongnu.org; Mon, 14 Sep 2026 12:23:14 -0400 Received: from BL1PR13CA0407.namprd13.prod.outlook.com (2603:10b6:208:2c2::22) by CYYPR12MB8869.namprd12.prod.outlook.com (2603:10b6:930:bf::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.10; Mon, 14 Sep 2026 16:23:02 +0000 Received: from BN1PEPF0001854B.namprd05.prod.outlook.com (2603:10b6:208:2c2:cafe::33) by BL1PR13CA0407.outlook.office365.com (2603:10b6:208:2c2::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.428.8 via Frontend Transport; Mon, 14 Sep 2026 16:23:02 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BN1PEPF0001854B.mail.protection.outlook.com (10.167.248.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.428.7 via Frontend Transport; Mon, 14 Sep 2026 16:23:02 +0000 Received: from speedway8455host.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.49; Mon, 14 Sep 2026 11:23:00 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vqBOcE5sfevQOIkRh4ZOBODjgHw35/2FyumOHY6MoQLHQHJAOHYcRZW4Vu0gFtQaIhi77JL5xldwFzU/8XWXb8x/fKveizoDE7EhDY+9FpNpNQ1JV55+sl/rkRyBCME674wLyk9n2RhjCbwRXPhT2ujZGabHqp6Pm3xB83dAYnVDd8dJ/yqL/Mtqi0TIqnJIwirDRJHxwIUi4H259qceDAgMqZhVS6WvvUDbHWgmDm4JLr+tVI2ASmwh/NVK2ig7HLqSBl5Bki0w0pMI2jV7Towv0jXDHMVqXoPiu0aMyxxUR2bHSAJgtojIO2lwQZDGc4RN82lJLWjiO3bwvqDE7A== 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=cJQLQZClHL+ncNIYxtkuP85ZkOPqMq4ELLElU8u9H7U=; b=t1nmXK4WtdCJ3MJqcCB3dPDQ8LRAhngkKJz4skeYGgPICay4kKChc0awtE59A7Xt72NPZ5C3hLdJqo56knh9r57wZpXURENF3k5gcuBPRB/A+xs7PvMPzACDzU/w9HF90wQMYuf0mwDumq4T7ip8+liM8zzGGJJxejvlY9j1VP21o1BRQQoub1ScKnlyYAniF6kTf3/g8urumyesx/tpLEjMISFRlysZmEhrSKNAbZuAcYc03YRCcLTwylTL0cO1sgbE8lSLn9P6nf9u16XIWKXO4jfu4zRNMO18gJnAkOac0N8+HEJSQIB7Gyz3aAc9QvyRQEZTMhvTeMjKYw0xVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.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=cJQLQZClHL+ncNIYxtkuP85ZkOPqMq4ELLElU8u9H7U=; b=BpemcmWgRoUkqY65tJDrsWMgXixO8PIwLHHhFi+DMavF4MOSIXQrNk5pZeUrWYdCmrMEII+sDpmXSdBgefRI6/rm27fw0TFApboQn8mOYUeFP+G24LxLiRmbYIJ3zZgxn/9q6K4O7K7OmFJRTxuO2TGf9Og7Iy280xKq3Oy2Rjc= 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; 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 From: "Pratik R. Sampat" To: CC: , , , , , Subject: [PATCH 1/2] i386/sev: Introduce Enhanced SMT Protection for SEV-SNP Date: Mon, 14 Sep 2026 16:22:43 +0000 Message-ID: <771196a9b02a0b7d33265b574894cdd99c33cc96.1789399242.git.prsampat@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF0001854B:EE_|CYYPR12MB8869:EE_ X-MS-Office365-Filtering-Correlation-Id: 92a6b20b-5de9-4c3c-f3bd-08df127c72e8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700016|23010399003|82310400026|1800799024|10067099003|56012099006|11063799006|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: GJSTSsKCuhrATMPlnJDJARm6qUrpfGpOyb+hrjr6EMUXRQHRayu2/GUkTgiLv5ins8xYQothPm3DpkHKYrftaRX6W4+yEiACYdTM3WQFN5KXmOpwRHKrE1fYlJVPkt08Nz2jxqDRru8pcdy0NIcyMbbUAs9ATXrIPHAxu/1nHkUqNcPmSpfxq2hy2O2oA6nKuETNR36/2Gi0Ys6vgfkXP1kbEzHrdy5KPJYhu5zTW2NWEsEGYIgIPQtfNU3F3pnjjCnG0laqilasYKozanjqQl3Wz6hMMpXU6kvniQizxwR/OO6iXIOJudH+Mr9PmsxLjlA8JxkRqjhwvXcAwAVWDFqSE51YD4UmC/vSI2wCHL1+2ulAohUs2wNPY+5yMM/JOl2DnXIwwPlw9Ka29ZOWEYRh96Kk/GnAkpQaKtgZl5aGde4gv+gumimdCvuhQKLw9wblVH9FVx8UpuG90oR+uXhidJufwRhsoKmXwTGR9bjxvvbqNa2fqMCGw9pLhXvwvstf51m81wxadEbsKSjSW4GtwCX9PGP8WsXur/dxMYDk1eF4x2HE2QswbwVJpnFrtmkKH06Tog282zg/03E9ga8WUTElzcmrHsrha0vj4qof6nflqh5g0MjEPmE53zi8IYeqLLMs05tha/qYyQYnfgh1nERT4MMdFqiBCOanzfmgi2oxhw+0gjzV+/85WqiUaZiCdpxuvqvpO+DmCDVx7g== 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)(376014)(36860700016)(23010399003)(82310400026)(1800799024)(10067099003)(56012099006)(11063799006)(22082099003)(18002099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VHxNu7Pwh5rK4D6AtanlovGX4UkQ3Bmxu1DgUPf5ha3JRrhtP4BeVPURutEVEX3zFcUHq2s2p91GgOFps2FGMezeTmWgxlPqAWoDcbGIjk3huFb2aXR6Fv9hLnfxbZDNOqBoK8YC8I2+VZ3EeXi0oGkzIgKyZHLG0zpmiMcZ2yR2U1xpmEdZyo6Xf9Kl3+HFjf0KWCa8aCG/s3gs/uWGx1lTqFBoX6ucBZAvWBBpKsxKrGcaVtVvh6K9n3GrlgFj1eXRMdc7LmM4VrDC4wgmHPHMNtRZ2YVQXqW1kJHSS9DHG0FmH+IWVGYZDrp3/97oloRzVkHHmZgWPoabFOvWRLGOjXOgH+K1TsfLrJ+IQ1vyY0ZqgU+DZtd7LipWfxly7Mm8mGITnkbBMwmlQjB22VoDaztRbdVCutd6/QSRwUJNGKxfjz2EIkmUAxOo2Fec X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2026 16:23:02.2583 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 92a6b20b-5de9-4c3c-f3bd-08df127c72e8 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: BN1PEPF0001854B.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8869 Received-SPF: permerror client-ip=2a01:111:f403:c105::5; envelope-from=PratikRajesh.Sampat@amd.com; helo=CH5PR02CU005.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 14 Sep 2026 15:17:58 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1789413558722158500 Content-Type: text/plain; charset="utf-8" Enhanced SMT Protection (ESMTP) protects an SEV-SNP guest from sibling side channels by requiring that, while a vCPU is in guest mode, its SMT sibling thread is either idle in host mode or executing a vCPU the guest has declared to be a legal sibling. Add an "esmtp" property to request and use it to advertize this feature for KVM to write it into the launch-time VMSAs. Sample command-line: -object sev-snp-guest,id=3Dsev0,policy=3D0xb0000,cbitpos=3D51,reduced-phy= s-bits=3D1,esmtp=3Don Signed-off-by: Pratik R. Sampat --- qapi/qom.json | 9 ++++++++- target/i386/sev.c | 15 +++++++++++++++ target/i386/sev.h | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/qapi/qom.json b/qapi/qom.json index 4a9b7f908844..010c5cc2bb82 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -1119,6 +1119,12 @@ # @tsc-frequency: set secure TSC frequency. Only valid if Secure TSC # is enabled (default: zero) (since 11.1) # +# @esmtp: Enable Enhanced SMT Protection support for the guest. Adds +# corresponding VMSA feature bit to KVM_SEV_INIT2 vmsa_features so +# the host applies it to each vCPU's VMSA. Opt-in feature as it +# provides additional protection but with runtime overhead. +# (default: false) (since 11.2) +# # Since: 9.1 ## { 'struct': 'SevSnpGuestProperties', @@ -1132,7 +1138,8 @@ '*host-data': 'str', '*vcek-disabled': 'bool', '*secure-tsc': 'bool', - '*tsc-frequency': 'uint32' } } + '*tsc-frequency': 'uint32', + '*esmtp': 'bool' } } =20 ## # @TdxGuestProperties: diff --git a/target/i386/sev.c b/target/i386/sev.c index cc16c6b07123..0b5767057175 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -3255,6 +3255,18 @@ sev_snp_guest_set_tsc_frequency(Object *obj, Visitor= *v, const char *name, SEV_SNP_GUEST(obj)->tsc_khz =3D value / 1000; } =20 +static bool +sev_snp_guest_get_esmtp(Object *obj, Error **errp) +{ + return is_sev_feature_set(SEV_COMMON(obj), SVM_SEV_FEAT_ESMTP); +} + +static void +sev_snp_guest_set_esmtp(Object *obj, bool value, Error **errp) +{ + sev_set_feature(SEV_COMMON(obj), SVM_SEV_FEAT_ESMTP, value); +} + static void sev_snp_guest_class_init(ObjectClass *oc, const void *data) { @@ -3296,6 +3308,9 @@ sev_snp_guest_class_init(ObjectClass *oc, const void = *data) object_class_property_add(oc, "tsc-frequency", "uint32", sev_snp_guest_get_tsc_frequency, sev_snp_guest_set_tsc_frequency, NULL, NULL); + object_class_property_add_bool(oc, "esmtp", + sev_snp_guest_get_esmtp, + sev_snp_guest_set_esmtp); } =20 static void diff --git a/target/i386/sev.h b/target/i386/sev.h index 7725f92e1959..6b4128dea4ae 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -49,6 +49,7 @@ bool sev_snp_enabled(void); #define SVM_SEV_FEAT_SNP_ACTIVE BIT(0) #define SVM_SEV_FEAT_DEBUG_SWAP BIT(5) #define SVM_SEV_FEAT_SECURE_TSC BIT(9) +#define SVM_SEV_FEAT_ESMTP BIT(17) =20 typedef struct SevKernelLoaderContext { char *setup_data; --=20 2.43.0 From nobody Mon Nov 23 05:24:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1789413541; cv=pass; d=zohomail.com; s=zohoarc; b=Up2WFOobOLIEgJPAuihImg/uc8aM06dD0L9v9vXuUsk3guq6V46V0WI45EXV8MQlfjmskJBkNU+g/yPqdTLaDYUcLFGMj/GNzEmcCI8y1HJgKvvOXseI+O0vHa8g8k7P74iL+V3KpsWejdPvu1hHtSX9ATkoXNChNHZc/ldHAVs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789413541; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=S2iAafxZy7At3JkbI0+LFEr/Pb38QiZwOI3lBaiFKGE=; b=nfsZigQLI4CbXjC7AwPzpHI7k/ku45klDBMBAX38MOYUNPBqeTmgXmXxUmzCpIYcoEeN4YtPmI5DWSSUKbPNoO3Tj/bE5TMKQi59qudUptctE/CEIAzsdlZLxWAbTiKtMM0kn7hlj4Mg3UCwHrqSCBjoNnmnwLVNGRrKOUT3084= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17894135412311012.622305903313; Mon, 14 Sep 2026 12:19:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6CBl-0004uf-IC; Mon, 14 Sep 2026 15:18:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x69Su-0003Zp-3H for qemu-devel@nongnu.org; Mon, 14 Sep 2026 12:23:37 -0400 Received: from mail-westcentralusazlp170100005.outbound.protection.outlook.com ([2a01:111:f403:c112::5] helo=CY7PR03CU001.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x69Ss-0000VA-6q for qemu-devel@nongnu.org; Mon, 14 Sep 2026 12:23:31 -0400 Received: from BL1PR13CA0388.namprd13.prod.outlook.com (2603:10b6:208:2c0::33) by SJ5PPF7B9E98CB6.namprd12.prod.outlook.com (2603:10b6:a0f:fc02::99a) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.10; Mon, 14 Sep 2026 16:23:13 +0000 Received: from BN1PEPF00018546.namprd05.prod.outlook.com (2603:10b6:208:2c0:cafe::6c) by BL1PR13CA0388.outlook.office365.com (2603:10b6:208:2c0::33) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.382.9 via Frontend Transport; Mon, 14 Sep 2026 16:23:12 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BN1PEPF00018546.mail.protection.outlook.com (10.167.248.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.428.7 via Frontend Transport; Mon, 14 Sep 2026 16:23:11 +0000 Received: from speedway8455host.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.49; Mon, 14 Sep 2026 11:23:11 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RgiEwepYod3WftD1T3OcfPUffwgp4kIWdDosoNS2EcYdgODNl1z59jbbKMyWpkj7yBXcM+jBMwnk2BWeFsl38k6ejEEiFwaIJGcd5Yhe4UR0iK6xCwsKeWwBhyGnxqk8wlcP9IOcNsBKOmXhz/MjO0QFuJeZZmzob+iJDjPNp1v1uL5+av+fo6Hkh8sPbcd1cKvVL2QJSPvRIEiIx/KP0WMy2oq/iStFK4RLVcvxuf0T3ZUOvHFLzBpU2AFzxX0NSBvthl2uj+4fib6s/Ktby+HvZlnZpeGZnLzd5rquCdqMoB9TT0rXT1v4Q8lKuQOWRbZarkjSQyWS7mtujmpjAg== 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=S2iAafxZy7At3JkbI0+LFEr/Pb38QiZwOI3lBaiFKGE=; b=Ikz3EmnRHLTOAkdz0MyRBXYh6NBMdgrFWa3yRRdMB2eiqbuADkEcFIpt0n4+5NJODYAYqUcdJ0wEIxXkdM1DSYLXge1LZsvex16akI5LGEe2ws2MSyYOr7SGNsORWE5uITzRyFgtzfbqnxPg1+H2xbn007garl/KqHhhMQ4b44tQFfGHYOETZT4rAPJ+Y7ie2TowX57u/eVezPArWi2+wk7djyeDqLyTnayOi7UXrTwIFcLhNcELTr/ft1oZCpEm2E5bc3kP0W7fw79WXCbFFmJwMCb5pmChlIBLxYYD4QAy6ApHWG8/DFz97ByQAzDRLCSSSFx8/g8rxLJFtvJwEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.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=S2iAafxZy7At3JkbI0+LFEr/Pb38QiZwOI3lBaiFKGE=; b=cfYYf9j94oNjWzimpNbX25Am6/CZt6f8Tru+HJbLasldjThAXkNf1hMoBjPPZVxd/XCU3s84GuOGWWcLohTZ1za3DCdeNe65t5SSs0bxI6NEXyasy5U2rtgq5mCyMP6h1/wQhlwiqRdYHiksdAOiyUOMLbClv1Ezpx7ta0J3d/A= 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; 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 From: "Pratik R. Sampat" To: CC: , , , , , Subject: [PATCH 2/2] i386/sev: Add core scheduling for ESMTP enabled guests Date: Mon, 14 Sep 2026 16:22:44 +0000 Message-ID: <90672d57592d0f449c4611d48ac24e5855de6e69.1789399242.git.prsampat@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00018546:EE_|SJ5PPF7B9E98CB6:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ca29999-f26f-4514-59cf-08df127c7895 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700016|82310400026|1800799024|23010399003|5023799004|11063799006|56012099006|10067099003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: lw9V2zW77uLK+2h5wQLOIYfBQNiqYOw68XKdBSYva776gcnhgzvruRGABOGL4Q2EOV6xHs2L6dX/yIxU3co6cOdHbjQuIm5EfcxAsb/ALm81oPMs5GYLV0RomBIk4Sz5iXfHolo7LkLyS1g2O2OnvM6YZjEbBoAy7lKqGjW1TAH+OTMPSM5LhthN87q3XVZH07hGaJbZXVBscB/UyJHnGImJQZLGwciq6S1Qumk9hBrppzfxdHGbzxiCn4ZRM4nan5ggr0PeM4Lfs7a7AGDsM9Y1KqpGXH/6lYpTdi+huXHDqrw56igfLxXMLlILPjtsBikQxyCamHUJsLUj5W131X/23VsiMn91a6HdMZdNqcNIKDum4nA/upvvUgpLaKqCYCSqy7jhibLMDw3xUJ3BZF2WAOTtIubDul2568b8DKeUIT7lTf1UNNO9AbIHbJm4jKKaumjdlVTjUrbnCyKxPHYW78EiYM7gBHNTdvdlpn5CT3ol6gveTYWB5BXGp4b4rSjofgVq5IFUQo7gsEbi0AtvM7lGRYd77itMgepSFaMNIqN0PyX/yxExiYxSlKaoT8+zw+q9rxanB7Vt0GdMPmB6Gtt29SBBAn5jcBT536ZykbMAsw5dKTyTRcoMkekO29IQgsz7AT1EcfLeiWvw6cjf2Z9TXzhCrS4CU7c/OiMYquV779HmmJCQn1r8hLxgTv5Rd47HjnVvUnnN5gubxA== 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)(376014)(36860700016)(82310400026)(1800799024)(23010399003)(5023799004)(11063799006)(56012099006)(10067099003)(18002099003)(22082099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7hS4uAEOo9a/8xuG/BXtP68qICue/Isv9CdJsJ57PkrINb9El3iIhusSnXlE0ceKQN0Y++57ml7Feh8J1X91tq3ieCY2SD7wzTUSdIXEOZ0mbl5GtkKpM2iJBk9aTndb98wqQKu48SSZg2u3XEKdri2nkOkxSJTn8ErohoGWDCmKLOnq6kQtpo8FOlBfHO+9KVNqEMmORp6Wc8EGCAEQpZ0P/SRDroNPmq9ijHV0RSFjLrLhLkq2GS5UDygq4pAiK8bRTzQYe0W6OsSQ9O/8PU+f6n1/ORCb6rwjWnvyVdp4ddPa9QZoa7Sa77s0C9wsAhAcTNMgw8osnieBf6x9YRCP9orjLl0eHs+A/O/nSD7KAKiV4PPC622FGLe6PsE4kF8gaitA4p3t6cd1I66VPTO/kp0EmmLtzGzfyphhqYcnZnka4wqqXlBIdMdGOWmr X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2026 16:23:11.7815 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ca29999-f26f-4514-59cf-08df127c7895 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: BN1PEPF00018546.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ5PPF7B9E98CB6 Received-SPF: permerror client-ip=2a01:111:f403:c112::5; envelope-from=PratikRajesh.Sampat@amd.com; helo=CY7PR03CU001.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 14 Sep 2026 15:17:58 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1789413544074158500 Content-Type: text/plain; charset="utf-8" Group the vCPU threads for core scheduling such that trusted siblings share cookies and can be co-scheduled on the same core. The grouping cannot affect isolation. Hardware checks each pairing against the mask in the VMSA, which only the guest writes, so nothing chosen here can bring about a pairing hardware would have refused. It does decide whether the guest makes progress. Co-scheduling two vCPUs whose masks disagree makes every VMRUN exit with VMEXIT_ILLSIB, which KVM can only answer by retrying, and that never converges. Signed-off-by: Pratik R. Sampat --- target/i386/sev.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/target/i386/sev.c b/target/i386/sev.c index 0b5767057175..34d9851d4e94 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -18,6 +18,7 @@ #include =20 #include +#include =20 #include "qapi/error.h" #include "qom/object_interfaces.h" @@ -2031,6 +2032,47 @@ static int sev_kvm_init(ConfidentialGuestSupport *cg= s, Error **errp) return 0; } =20 +/* + * Mint a cookie for the first vCPU and copy it to all the others, so that + * every vCPU thread of this guest ends up in one core-scheduling group. + */ +static void esmtp_core_sched_setup(CPUState *leader, run_on_cpu_data arg) +{ + CPUState *cpu; + int ret; + + ret =3D prctl(PR_SCHED_CORE, PR_SCHED_CORE_CREATE, leader->thread_id, + PR_SCHED_CORE_SCOPE_THREAD, 0); + if (ret < 0) { + error_report("vCPU %lu: failed to create core-sched cookie: %s", + kvm_arch_vcpu_id(leader), strerror(errno)); + return; + } + + CPU_FOREACH(cpu) { + if (cpu =3D=3D leader) { + continue; + } + + ret =3D prctl(PR_SCHED_CORE, PR_SCHED_CORE_SHARE_TO, cpu->thread_i= d, + PR_SCHED_CORE_SCOPE_THREAD, 0); + if (ret < 0) { + error_report("vCPU %lu: failed to share core-sched cookie: %s", + kvm_arch_vcpu_id(cpu), strerror(errno)); + return; + } + } +} + +static void esmtp_core_sched_notify(Notifier *notifier, void *data) +{ + run_on_cpu(first_cpu, esmtp_core_sched_setup, RUN_ON_CPU_NULL); +} + +static Notifier sev_snp_esmtp_notify =3D { + .notify =3D esmtp_core_sched_notify, +}; + static int sev_snp_kvm_init(ConfidentialGuestSupport *cgs, Error **errp) { MachineState *ms =3D MACHINE(qdev_get_machine()); @@ -2049,6 +2091,11 @@ static int sev_snp_kvm_init(ConfidentialGuestSupport= *cgs, Error **errp) g_free(sev_snp_guest->kernel_hashes_data); sev_snp_guest->kernel_hashes_data =3D NULL; =20 + /* Setup core scheduling cookies for esmtp after the vCPUS are all up = */ + if (is_sev_feature_set(sev_common, SVM_SEV_FEAT_ESMTP)) { + qemu_add_machine_init_done_notifier(&sev_snp_esmtp_notify); + } + return 0; } =20 --=20 2.43.0