From nobody Mon Nov 25 06:34:50 2024 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=1717068083; cv=pass; d=zohomail.com; s=zohoarc; b=aEerV8VX60r8r+38S0fWkrlBxPt6kKP/2gsMaSU9rTAup6xj2SqRvbO6sC0xKyJHpjMcq5hKz2+wcLdNdBUWFdmzC9aeW9J/BeQFQ3ORlTQ2nJZDAEsBhmtyBvzTfEBZZnJC76gJWDk6zvygqTYWdcd9cCDHt1Nzgj+0wD0m7bA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717068083; 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=lK582yi5N6LQWquzavDKpZxHAPKtDQeXVB1+CawH+kM=; b=buefabsZGx9welZzm6efQFewwLbsXtL8IaM5i1jZVd0uugtQi9Ojo9UT5Ma+Qw6JPFcN8DWdmVRshKjUYSILR3ULfbCyloqw1+H4hTj3c3OGF9kvNyCBs3+kIu0JOBGNbrPwaCM52hPRw46kAeB8ZKbdhy2V+v+nyKZhnU9g/fE= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171706808379612.670497311091708; Thu, 30 May 2024 04:21:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCdmK-0005xY-Mq; Thu, 30 May 2024 07:17:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCdmI-0005vQ-G7 for qemu-devel@nongnu.org; Thu, 30 May 2024 07:17:02 -0400 Received: from mail-mw2nam10on20605.outbound.protection.outlook.com ([2a01:111:f403:2412::605] helo=NAM10-MW2-obe.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 1sCdmD-0001Qr-Np for qemu-devel@nongnu.org; Thu, 30 May 2024 07:17:02 -0400 Received: from BN1PR14CA0016.namprd14.prod.outlook.com (2603:10b6:408:e3::21) by IA0PR12MB8206.namprd12.prod.outlook.com (2603:10b6:208:403::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.19; Thu, 30 May 2024 11:16:50 +0000 Received: from BN2PEPF00004FBC.namprd04.prod.outlook.com (2603:10b6:408:e3:cafe::89) by BN1PR14CA0016.outlook.office365.com (2603:10b6:408:e3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30 via Frontend Transport; Thu, 30 May 2024 11:16:50 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by BN2PEPF00004FBC.mail.protection.outlook.com (10.167.243.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Thu, 30 May 2024 11:16:50 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 30 May 2024 06:16:48 -0500 Received: from pankaj-M75q.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Thu, 30 May 2024 06:16:47 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hz8cEvZl5qgoJSYL3doxdbqX65uDVeSdXh0FcroSW3E1Jj4cy+5bOIlPOFBGmUUe/mzZZ1SH1AeoUSAhSJWR2ctTaUX8Lf3CJ/5GlrZ5r812LcEreyvUmXc3TUJq7c5IwIc/ZVAmHUEc70yGIFpknP8Ymr8IhEYICEmendpVcwtgc6OJtTRusvNWbmDYPBGHBWprN+7EDllu8IezRs9KHitqxGA9ScoAVUO5oFFsQfA4CwhqESikMs3Z+2lchbC6Q3gm55oK3OJQ2vSHWELioEEhNLXesoGJeBk8nAEut0d8w6UTvpARCllV0IhRftpElQvlEhMVf0UEVIwVfRWPHg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lK582yi5N6LQWquzavDKpZxHAPKtDQeXVB1+CawH+kM=; b=A6ykCzzD4A7yxBOBgpxMF7JWMLAjFPfTCGKfwfRg1pXBpHdXzPyOQkQLwh3/1PzR1NknPkVyNSnUX5DrlEcmZ2PmtFs+X4iZ9l8jVM60vVVa+XUmM/gel6UbwA2lG3PrXcD0yQ9hiQNJ43vYf0leHcf1nLoBA2Ee9iniYCXwmy7roYJ7F3AaaC9491Frb6aH3POB91YAXUjr/PdQXSv0UVOH3srWqHBgP2Au5YvQ6TjZ7RSsEcaHJ8fW6GTxdZ16aarq13dLpryx20Wj2H5p8h2W+if/WI2fx8mEH4y0MLbRNiBefUytVxYaF95RqmvEhOufkYf2/d05iVfLP4GWYA== 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=lK582yi5N6LQWquzavDKpZxHAPKtDQeXVB1+CawH+kM=; b=u5zjV0i4C4ckNvyfNglE+LNCJ86wvzd549E+nnVC6PjkI6pX3aObK3VZ1mDqmffkHJ+YEoALt/3vfbi5NwaKwmPEpiwKngu9hdtBTo8I9Y1g5T84fCacZwAqQ5Zt35KhYK6kMB3YzJKDTyFyexrGR88A1L2n7XURx2DXB1JxvQw= 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=lists.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=SATLEXMB03.amd.com; pr=C From: Pankaj Gupta To: CC: , , , , , , , , , , , Subject: [PATCH v4 06/31] i386/sev: Move sev_launch_finish to separate class method Date: Thu, 30 May 2024 06:16:18 -0500 Message-ID: <20240530111643.1091816-7-pankaj.gupta@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530111643.1091816-1-pankaj.gupta@amd.com> References: <20240530111643.1091816-1-pankaj.gupta@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB03.amd.com: pankaj.gupta@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF00004FBC:EE_|IA0PR12MB8206:EE_ X-MS-Office365-Filtering-Correlation-Id: b8f213e2-572e-4c37-d6d4-08dc809a008d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|1800799015|82310400017|36860700004; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?HLr9S2Z2xgXKxeAivEfarl2gcqTVWmXoha7MOSoYTVVZPj7n/VpQlWKCsdbm?= =?us-ascii?Q?XuH90b7CmnXUreUmUKFykMWC5Vlbh50i7ivjUo52QnXZbPR3OSxgx9RHnaN5?= =?us-ascii?Q?isv5wII7XJTmUknn+FeGPtatkB/xRYYGU+pdofisXKyO87SdsKRTDpQPC9CK?= =?us-ascii?Q?cb8rsi8OEvEpfnjAQK2iD2USxxf4e2/YGmW9j4I/aIcDtcROi5VwshXwQuZw?= =?us-ascii?Q?C6DbBZ8G4z4RA4zpO5Xsp21dHLGdGVCaXuXdq9QJVnHGjgJPil3ooKjnotzY?= =?us-ascii?Q?wkqaAGMVnf0ArArB9ESkLEZkQjGiXUdLJh6qqXx/6mvCDphGWoo95hUKpsOQ?= =?us-ascii?Q?XC/1pea8yXMiSUGMzyKCAi2Lx4dgxd+jnv9mQtDTG6G0S7oIyCnv9qCvH+Kv?= =?us-ascii?Q?NRuF7tQA2gwGuCI0fM30sN9PtUCyqEhVSH/9AMxUkop5AVxTrD+ZQ68zH7eO?= =?us-ascii?Q?FKEcju3InsCP0cqRyKfyKsTpmZ8OMSDSHRJ/fquKx2ngz773Vi7bLVxHYhVQ?= =?us-ascii?Q?/6mbrR2P7j7VCzEZ0GsIoOWwiS5GEYKLQrD4Pby6E2kGBrxl97iHfhrUmASz?= =?us-ascii?Q?Aem3eWJfjUXf6UtVOIVXaHnxlMqm+bYpi+7ahZAoWMF9UL87MKIUmQHpm4Wd?= =?us-ascii?Q?JpC53+kj6po/p3ra3rWIzKknUdkck7y3ttJDGa8fQbvLhOq8qgWangFuGw4D?= =?us-ascii?Q?JNz7HraBowZwstDiG5+VI/xt38DvqeTNgEPKH8ZmfxlLePwZdMCBXe9j9U7Y?= =?us-ascii?Q?acHSJ7Q3HtpBBe58oqdxNXiNoLgXgIr4feLo4Y9z9opII6kTLqu8zcjCntvv?= =?us-ascii?Q?+Ngcy0qRHQcX+kX63GGD6c4J4djBIkhoIo6smE8SJQjH41NGWOl04KwOzlUx?= =?us-ascii?Q?/OG5GuDTpUfbfeCP+Q9Kbs/erCRWn1Ky8ctNR1X3J1MoT3sWRAfEp1LiWeFu?= =?us-ascii?Q?tlHTWP7kV572xQnVusuzlRPAfwHAukpxa/JsC6dFLLj36PLngN5SiRdHq1BH?= =?us-ascii?Q?JYDw8IG2HWx7Dh+fJz7WZM9TY3s2NkSnJw2GHQRfQBjtWNS6AEmuWzR43C0w?= =?us-ascii?Q?Vydll70vdvHJ+ahaOj3hZ06wVGS/HLLZgatH5M7cN4TP/PgD7BQEjwzi+3EE?= =?us-ascii?Q?yBtpXmsIYqEw251wnP8YaJTuO52xsNCBGJpLMnsoqnwapa2plPLZME5dco3+?= =?us-ascii?Q?Jm/CNIKIk5DB5an7GmV6NefrmUvXh+OS6C5V3Tc6n+2eD5IvCTARPQzwWEwW?= =?us-ascii?Q?VPi6E3JkuU9tk7AsExitcZYWIgRUATqsbURlYBO14hhgWGSeKkrCrjqgBIO9?= =?us-ascii?Q?dVhNkSE3BY+9zhcH4301Uz2ZPOi8U3SjhXwkSZluaYE6MUnBdq3OFOx6oral?= =?us-ascii?Q?Q8l6GKQ4GpNN7SvGzFXnPIlmOgrW?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(376005)(1800799015)(82310400017)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2024 11:16:50.2069 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b8f213e2-572e-4c37-d6d4-08dc809a008d 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN2PEPF00004FBC.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8206 Received-SPF: permerror client-ip=2a01:111:f403:2412::605; envelope-from=Pankaj.Gupta@amd.com; helo=NAM10-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.085, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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: 1717068085133100003 Content-Type: text/plain; charset="utf-8" When sev-snp-guest objects are introduced there will be a number of differences in how the launch finish is handled compared to the existing sev-guest object. Move sev_launch_finish() to a class method to make it easier to implement SNP-specific launch update functionality later. Signed-off-by: Pankaj Gupta --- target/i386/sev.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 3bdb88f2ed..c141f4fed4 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -71,6 +71,7 @@ struct SevCommonStateClass { =20 /* public */ int (*launch_start)(SevCommonState *sev_common); + void (*launch_finish)(SevCommonState *sev_common); }; =20 /** @@ -805,12 +806,12 @@ static Notifier sev_machine_done_notify =3D { }; =20 static void -sev_launch_finish(SevGuestState *sev_guest) +sev_launch_finish(SevCommonState *sev_common) { int ret, error; =20 trace_kvm_sev_launch_finish(); - ret =3D sev_ioctl(SEV_COMMON(sev_guest)->sev_fd, KVM_SEV_LAUNCH_FINISH= , 0, + ret =3D sev_ioctl(sev_common->sev_fd, KVM_SEV_LAUNCH_FINISH, 0, &error); if (ret) { error_report("%s: LAUNCH_FINISH ret=3D%d fw_error=3D%d '%s'", @@ -818,7 +819,7 @@ sev_launch_finish(SevGuestState *sev_guest) exit(1); } =20 - sev_set_guest_state(SEV_COMMON(sev_guest), SEV_STATE_RUNNING); + sev_set_guest_state(sev_common, SEV_STATE_RUNNING); =20 /* add migration blocker */ error_setg(&sev_mig_blocker, @@ -830,10 +831,11 @@ static void sev_vm_state_change(void *opaque, bool running, RunState state) { SevCommonState *sev_common =3D opaque; + SevCommonStateClass *klass =3D SEV_COMMON_GET_CLASS(opaque); =20 if (running) { if (!sev_check_state(sev_common, SEV_STATE_RUNNING)) { - sev_launch_finish(SEV_GUEST(sev_common)); + klass->launch_finish(sev_common); } } } @@ -1461,6 +1463,7 @@ sev_guest_class_init(ObjectClass *oc, void *data) SevCommonStateClass *klass =3D SEV_COMMON_CLASS(oc); =20 klass->launch_start =3D sev_launch_start; + klass->launch_finish =3D sev_launch_finish; =20 object_class_property_add_str(oc, "dh-cert-file", sev_guest_get_dh_cert_file, --=20 2.34.1