From nobody Mon Sep 16 18:53:52 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nvidia.com); dmarc=pass(p=reject dis=none) header.from=nvidia.com ARC-Seal: i=2; a=rsa-sha256; t=1673878410; cv=pass; d=zohomail.com; s=zohoarc; b=gdQw5MmWxaZhVQL8tyCisWvehfR1U0JYM73tQDHohWbNF8QSSmHUVVCvyc75AJl339PlDgxrXAddX4Em9s0alNC4Ehy7ToTOLebhhA2djZpcq3z2Weqayzw5RCSiMRC/bftEy0ByXzTV2w8rnwdUuGjw3rOXnmXKKAbN2+IvtnM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673878410; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=990RdlHobaKINLfW1v2lE0ON2KORr+9bN5Rb1wYRUCQ=; b=GmUIZpcxDmBi/vZyCVjlC9SmBF0MDqVXFD2LrhsvzNFvvoXb+nhmkApfZPAwvsh1nFnRjhEXgrqAYqXRER31pl5yMvmuYtamz9lwhupGHfXBxrN3OTzxySf1FCnEasnKmVhKeA+fNBoziZgYNvGB5O8sQN6gzd2iLiYBEYRHlE0= 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+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=nvidia.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673878410305662.6827605397852; Mon, 16 Jan 2023 06:13:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHQEQ-0002tm-KS; Mon, 16 Jan 2023 09:13:02 -0500 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 1pHQEO-0002m3-PN; Mon, 16 Jan 2023 09:13:01 -0500 Received: from mail-co1nam11on2059.outbound.protection.outlook.com ([40.107.220.59] helo=NAM11-CO1-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 1pHQEM-0002R8-3E; Mon, 16 Jan 2023 09:13:00 -0500 Received: from DS7PR05CA0021.namprd05.prod.outlook.com (2603:10b6:5:3b9::26) by CH0PR12MB8508.namprd12.prod.outlook.com (2603:10b6:610:18c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13; Mon, 16 Jan 2023 14:12:53 +0000 Received: from DM6NAM11FT037.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b9:cafe::5c) by DS7PR05CA0021.outlook.office365.com (2603:10b6:5:3b9::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6023.12 via Frontend Transport; Mon, 16 Jan 2023 14:12:52 +0000 Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT037.mail.protection.outlook.com (10.13.172.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13 via Frontend Transport; Mon, 16 Jan 2023 14:12:52 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Mon, 16 Jan 2023 06:12:42 -0800 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Mon, 16 Jan 2023 06:12:42 -0800 Received: from vdi.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.36 via Frontend Transport; Mon, 16 Jan 2023 06:12:35 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D8+JwzzEjBwwwxDlvLa8UDJDQV0PlWHWF2OSGunXadHLO8P1+OhPnjbhHNiWQBeO8BeANnk2tK2pOgeFfWQEpg1Yosg6kcGSVTtsi/kaO03uSNjqPOqy34Fxpq0DLtM+C5CYA6KiCzvZTdqkYq4xrYRy9uZqxtQkIl8yD8K/rcgi1kTSgkcG+usfXS+S8OEGEUAmyeLVG0WyLyu5n/W+vNBmxXS5rcwz3uckfDdc9pANnSPgvaQingIwwwYnPo2fgfPzOu3GUzV3YOhEA+P5Odcn8mnGEDOgkYamXygClpMRFKd2qA67ooY1lict4CIdiyAOXfGmlk5TRcvczudu5A== 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=990RdlHobaKINLfW1v2lE0ON2KORr+9bN5Rb1wYRUCQ=; b=CmscU2bOVDXMtQqWNt3pRILfMNONWT39YGteo7U1UZQ9hhWu6DawsmnHVaG2ieAoGOEY9pdTaXIPGYsWprtAmEEVRszdm8gVulePxlW4vc2fG3ya8Dvcz3/CG9jBXw0II7rfFmMIKpv8oBl3fE0YbpdppYjF3hBetKUi1dXrPu9ETu7TssdyA4A7kgInHg/oLJc4Qd5Al/KWWqprkg6pZIQXpz7p7GNzNYWsWc6wuWX+50qVJeLCLkVD2hjaxECKo4XNZpse5NICY1L5bDrejCqHUzR7q8BwW41zSD09XBvk+mCbBvtHB9b9DMAe5bIkrH8297RiGOqrVikGC57zyw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=nongnu.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=990RdlHobaKINLfW1v2lE0ON2KORr+9bN5Rb1wYRUCQ=; b=s6m30AQ+phBYZdL2Qljop/SctVvqRy631wrNeCGtebgUGGMc0+N96HDx7NhHBzJpsGQNuBHZWgc7fsO3+iqN5Sj7tVUiynYAY2VdiHHrRlB0piWF3KSwz/cwCWpsjWgYftNDW4/dB94pJP0EWAsuw5/HtaFk0mbJtnFEugQ7F5LsWQxUXrlYIq3YP9ti4IT+TZj9BlV9Q0jUelFFRsll//zl8riSYrLRLhlkMne/IKfxnG4Jnv2JY2mvLyY/9ewj0j3jQVC68Ti3EHgdN4MqYfBcj8NXZTY8o7KYnS573WgB+s4cP+SvkoCeBTNvD/6PaPh60q05hP9CH/+zlg67SQ== X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C From: Avihai Horon To: CC: Alex Williamson , Halil Pasic , Christian Borntraeger , Eric Farman , Richard Henderson , David Hildenbrand , "Ilya Leoshkevich" , Thomas Huth , "Juan Quintela" , "Dr. David Alan Gilbert" , "Michael S. Tsirkin" , Cornelia Huck , Paolo Bonzini , Stefan Hajnoczi , Fam Zheng , Eric Blake , Vladimir Sementsov-Ogievskiy , John Snow , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , , , Yishai Hadas , Jason Gunthorpe , Maor Gottlieb , Avihai Horon , Kirti Wankhede , Tarun Gupta , Joao Martins Subject: [PATCH v8 08/13] vfio/migration: Rename functions/structs related to v1 protocol Date: Mon, 16 Jan 2023 16:11:30 +0200 Message-ID: <20230116141135.12021-9-avihaih@nvidia.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20230116141135.12021-1-avihaih@nvidia.com> References: <20230116141135.12021-1-avihaih@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT037:EE_|CH0PR12MB8508:EE_ X-MS-Office365-Filtering-Correlation-Id: 320a7bf3-5ce0-4e8a-49bb-08daf7cbc1de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qewtnoH8zpVTgsPn6NaYQtcQe1RCWlQE/bPvvHcypGSh/ktSsS8uCOK0/sAPI31N7tu//wJYubvvOKjz3MX5gT4nXEt0sUUUfCvcpQxTN9sLgeW1Q3fC4l48PKEfcryps6xn2nVKZazg77QfEKJ4exTUbgYpjhHHUQcDwSBWF1dKJlXZxbrsQlWeAxo+KjcW7AHT6CIHKowQCOP/mwmrCvU8/bUPDZomrZZuzQLlJdtDAwO+PL8iDNf7RsSZ2kqCS+9CXd50sLHPdp8G7+EGT64BEa7+J9HvsQb8AEHW15Qmkbr1ipGWQ4VSrFz9OfI6tLN4KiGFFrAssMiBxt/Shs7Q7FVBhV4ry1q6j1GYHKYl/jy62WXdMo1CqZa36GnsqCnRHiNfh7rGPre/e2WIYwxko430qPALjBGduaY3NX5XS3HEGPhLu2KvO/UNlSR6cW7H8TJ+Vd+8zwkwcsvmeqRDgMzWa2DyE0X1WtxV7IoLNV/Eei7GRMOoQOM1asMbJlG/Mq1BenLq2Ptl5U5XQ6f6y6ecNEMdCS5K9Vo8IgR0ZA9e8oJa/WdlB+Met3spiT2J8Zv6GrRnQAwYuysCJbfNdB878TP8cBwr+5OO4dqa5n/R3LvptUt/YNB10helBYTsiTFVuSUVZv+DeNlMZmSMqzjak6C5nHGpFIoEoUoA4fREafp9rIBA4PXvZGqrTcr+cnDlbjoYCw6ujKP+9g== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(346002)(396003)(136003)(376002)(451199015)(36840700001)(40470700004)(46966006)(70206006)(41300700001)(47076005)(66574015)(70586007)(2616005)(186003)(26005)(4326008)(8676002)(6916009)(426003)(36756003)(82310400005)(86362001)(5660300002)(83380400001)(336012)(36860700001)(82740400003)(30864003)(8936002)(6666004)(54906003)(478600001)(40480700001)(1076003)(316002)(7696005)(2906002)(7636003)(7416002)(356005)(40460700003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2023 14:12:52.7776 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 320a7bf3-5ce0-4e8a-49bb-08daf7cbc1de X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT037.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB8508 Received-SPF: softfail client-ip=40.107.220.59; envelope-from=avihaih@nvidia.com; helo=NAM11-CO1-obe.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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @Nvidia.com) X-ZM-MESSAGEID: 1673878411520100001 To avoid name collisions, rename functions and structs related to VFIO migration protocol v1. This will allow the two protocols to co-exist when v2 protocol is added, until v1 is removed. No functional changes intended. Signed-off-by: Avihai Horon Reviewed-by: C=C3=A9dric Le Goater --- include/hw/vfio/vfio-common.h | 2 +- hw/vfio/common.c | 6 +- hw/vfio/migration.c | 106 +++++++++++++++++----------------- hw/vfio/trace-events | 12 ++-- 4 files changed, 63 insertions(+), 63 deletions(-) diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index e573f5a9f1..bbaf72ba00 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -62,7 +62,7 @@ typedef struct VFIOMigration { struct VFIODevice *vbasedev; VMChangeStateEntry *vm_state; VFIORegion region; - uint32_t device_state; + uint32_t device_state_v1; int vm_running; Notifier migration_state; uint64_t pending_bytes; diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 3a35f4afad..550b2d7ded 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -355,8 +355,8 @@ static bool vfio_devices_all_dirty_tracking(VFIOContain= er *container) return false; } =20 - if ((vbasedev->pre_copy_dirty_page_tracking =3D=3D ON_OFF_AUTO= _OFF) - && (migration->device_state & VFIO_DEVICE_STATE_V1_RUNNING= )) { + if ((vbasedev->pre_copy_dirty_page_tracking =3D=3D ON_OFF_AUTO= _OFF) && + (migration->device_state_v1 & VFIO_DEVICE_STATE_V1_RUNNING= )) { return false; } } @@ -385,7 +385,7 @@ static bool vfio_devices_all_running_and_mig_active(VFI= OContainer *container) return false; } =20 - if (migration->device_state & VFIO_DEVICE_STATE_V1_RUNNING) { + if (migration->device_state_v1 & VFIO_DEVICE_STATE_V1_RUNNING)= { continue; } else { return false; diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 977da64411..9df859f4d3 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -107,8 +107,8 @@ static int vfio_mig_rw(VFIODevice *vbasedev, __u8 *buf,= size_t count, * an error is returned. */ =20 -static int vfio_migration_set_state(VFIODevice *vbasedev, uint32_t mask, - uint32_t value) +static int vfio_migration_v1_set_state(VFIODevice *vbasedev, uint32_t mask, + uint32_t value) { VFIOMigration *migration =3D vbasedev->migration; VFIORegion *region =3D &migration->region; @@ -145,8 +145,8 @@ static int vfio_migration_set_state(VFIODevice *vbasede= v, uint32_t mask, return ret; } =20 - migration->device_state =3D device_state; - trace_vfio_migration_set_state(vbasedev->name, device_state); + migration->device_state_v1 =3D device_state; + trace_vfio_migration_v1_set_state(vbasedev->name, device_state); return 0; } =20 @@ -260,8 +260,8 @@ static int vfio_save_buffer(QEMUFile *f, VFIODevice *vb= asedev, uint64_t *size) return ret; } =20 -static int vfio_load_buffer(QEMUFile *f, VFIODevice *vbasedev, - uint64_t data_size) +static int vfio_v1_load_buffer(QEMUFile *f, VFIODevice *vbasedev, + uint64_t data_size) { VFIORegion *region =3D &vbasedev->migration->region; uint64_t data_offset =3D 0, size, report_size; @@ -288,7 +288,7 @@ static int vfio_load_buffer(QEMUFile *f, VFIODevice *vb= asedev, data_size =3D 0; } =20 - trace_vfio_load_state_device_data(vbasedev->name, data_offset, siz= e); + trace_vfio_v1_load_state_device_data(vbasedev->name, data_offset, = size); =20 while (size) { void *buf; @@ -394,7 +394,7 @@ static int vfio_load_device_config_state(QEMUFile *f, v= oid *opaque) return qemu_file_get_error(f); } =20 -static void vfio_migration_cleanup(VFIODevice *vbasedev) +static void vfio_migration_v1_cleanup(VFIODevice *vbasedev) { VFIOMigration *migration =3D vbasedev->migration; =20 @@ -405,13 +405,13 @@ static void vfio_migration_cleanup(VFIODevice *vbased= ev) =20 /* ---------------------------------------------------------------------- = */ =20 -static int vfio_save_setup(QEMUFile *f, void *opaque) +static int vfio_v1_save_setup(QEMUFile *f, void *opaque) { VFIODevice *vbasedev =3D opaque; VFIOMigration *migration =3D vbasedev->migration; int ret; =20 - trace_vfio_save_setup(vbasedev->name); + trace_vfio_v1_save_setup(vbasedev->name); =20 qemu_put_be64(f, VFIO_MIG_FLAG_DEV_SETUP_STATE); =20 @@ -431,8 +431,8 @@ static int vfio_save_setup(QEMUFile *f, void *opaque) } } =20 - ret =3D vfio_migration_set_state(vbasedev, VFIO_DEVICE_STATE_MASK, - VFIO_DEVICE_STATE_V1_SAVING); + ret =3D vfio_migration_v1_set_state(vbasedev, VFIO_DEVICE_STATE_MASK, + VFIO_DEVICE_STATE_V1_SAVING); if (ret) { error_report("%s: Failed to set state SAVING", vbasedev->name); return ret; @@ -448,18 +448,18 @@ static int vfio_save_setup(QEMUFile *f, void *opaque) return 0; } =20 -static void vfio_save_cleanup(void *opaque) +static void vfio_v1_save_cleanup(void *opaque) { VFIODevice *vbasedev =3D opaque; =20 - vfio_migration_cleanup(vbasedev); + vfio_migration_v1_cleanup(vbasedev); trace_vfio_save_cleanup(vbasedev->name); } =20 -static void vfio_save_pending(void *opaque, uint64_t threshold_size, - uint64_t *res_precopy_only, - uint64_t *res_compatible, - uint64_t *res_postcopy_only) +static void vfio_v1_save_pending(void *opaque, uint64_t threshold_size, + uint64_t *res_precopy_only, + uint64_t *res_compatible, + uint64_t *res_postcopy_only) { VFIODevice *vbasedev =3D opaque; VFIOMigration *migration =3D vbasedev->migration; @@ -472,8 +472,8 @@ static void vfio_save_pending(void *opaque, uint64_t th= reshold_size, =20 *res_precopy_only +=3D migration->pending_bytes; =20 - trace_vfio_save_pending(vbasedev->name, *res_precopy_only, - *res_postcopy_only, *res_compatible); + trace_vfio_v1_save_pending(vbasedev->name, *res_precopy_only, + *res_postcopy_only, *res_compatible); } =20 static int vfio_save_iterate(QEMUFile *f, void *opaque) @@ -523,15 +523,15 @@ static int vfio_save_iterate(QEMUFile *f, void *opaqu= e) return 0; } =20 -static int vfio_save_complete_precopy(QEMUFile *f, void *opaque) +static int vfio_v1_save_complete_precopy(QEMUFile *f, void *opaque) { VFIODevice *vbasedev =3D opaque; VFIOMigration *migration =3D vbasedev->migration; uint64_t data_size; int ret; =20 - ret =3D vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_V1_RUNNI= NG, - VFIO_DEVICE_STATE_V1_SAVING); + ret =3D vfio_migration_v1_set_state(vbasedev, ~VFIO_DEVICE_STATE_V1_RU= NNING, + VFIO_DEVICE_STATE_V1_SAVING); if (ret) { error_report("%s: Failed to set state STOP and SAVING", vbasedev->name); @@ -568,13 +568,14 @@ static int vfio_save_complete_precopy(QEMUFile *f, vo= id *opaque) return ret; } =20 - ret =3D vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_V1_SAVIN= G, 0); + ret =3D vfio_migration_v1_set_state(vbasedev, ~VFIO_DEVICE_STATE_V1_SA= VING, + 0); if (ret) { error_report("%s: Failed to set state STOPPED", vbasedev->name); return ret; } =20 - trace_vfio_save_complete_precopy(vbasedev->name); + trace_vfio_v1_save_complete_precopy(vbasedev->name); return ret; } =20 @@ -591,7 +592,7 @@ static void vfio_save_state(QEMUFile *f, void *opaque) } } =20 -static int vfio_load_setup(QEMUFile *f, void *opaque) +static int vfio_v1_load_setup(QEMUFile *f, void *opaque) { VFIODevice *vbasedev =3D opaque; VFIOMigration *migration =3D vbasedev->migration; @@ -607,8 +608,8 @@ static int vfio_load_setup(QEMUFile *f, void *opaque) } } =20 - ret =3D vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_MASK, - VFIO_DEVICE_STATE_V1_RESUMING); + ret =3D vfio_migration_v1_set_state(vbasedev, ~VFIO_DEVICE_STATE_MASK, + VFIO_DEVICE_STATE_V1_RESUMING); if (ret) { error_report("%s: Failed to set state RESUMING", vbasedev->name); if (migration->region.mmaps) { @@ -618,11 +619,11 @@ static int vfio_load_setup(QEMUFile *f, void *opaque) return ret; } =20 -static int vfio_load_cleanup(void *opaque) +static int vfio_v1_load_cleanup(void *opaque) { VFIODevice *vbasedev =3D opaque; =20 - vfio_migration_cleanup(vbasedev); + vfio_migration_v1_cleanup(vbasedev); trace_vfio_load_cleanup(vbasedev->name); return 0; } @@ -660,7 +661,7 @@ static int vfio_load_state(QEMUFile *f, void *opaque, i= nt version_id) uint64_t data_size =3D qemu_get_be64(f); =20 if (data_size) { - ret =3D vfio_load_buffer(f, vbasedev, data_size); + ret =3D vfio_v1_load_buffer(f, vbasedev, data_size); if (ret < 0) { return ret; } @@ -681,21 +682,21 @@ static int vfio_load_state(QEMUFile *f, void *opaque,= int version_id) return ret; } =20 -static SaveVMHandlers savevm_vfio_handlers =3D { - .save_setup =3D vfio_save_setup, - .save_cleanup =3D vfio_save_cleanup, - .save_live_pending =3D vfio_save_pending, +static SaveVMHandlers savevm_vfio_v1_handlers =3D { + .save_setup =3D vfio_v1_save_setup, + .save_cleanup =3D vfio_v1_save_cleanup, + .save_live_pending =3D vfio_v1_save_pending, .save_live_iterate =3D vfio_save_iterate, - .save_live_complete_precopy =3D vfio_save_complete_precopy, + .save_live_complete_precopy =3D vfio_v1_save_complete_precopy, .save_state =3D vfio_save_state, - .load_setup =3D vfio_load_setup, - .load_cleanup =3D vfio_load_cleanup, + .load_setup =3D vfio_v1_load_setup, + .load_cleanup =3D vfio_v1_load_cleanup, .load_state =3D vfio_load_state, }; =20 /* ---------------------------------------------------------------------- = */ =20 -static void vfio_vmstate_change(void *opaque, bool running, RunState state) +static void vfio_v1_vmstate_change(void *opaque, bool running, RunState st= ate) { VFIODevice *vbasedev =3D opaque; VFIOMigration *migration =3D vbasedev->migration; @@ -735,21 +736,21 @@ static void vfio_vmstate_change(void *opaque, bool ru= nning, RunState state) } } =20 - ret =3D vfio_migration_set_state(vbasedev, mask, value); + ret =3D vfio_migration_v1_set_state(vbasedev, mask, value); if (ret) { /* * Migration should be aborted in this case, but vm_state_notify() * currently does not support reporting failures. */ error_report("%s: Failed to set device state 0x%x", vbasedev->name, - (migration->device_state & mask) | value); + (migration->device_state_v1 & mask) | value); if (migrate_get_current()->to_dst_file) { qemu_file_set_error(migrate_get_current()->to_dst_file, ret); } } vbasedev->migration->vm_running =3D running; - trace_vfio_vmstate_change(vbasedev->name, running, RunState_str(state), - (migration->device_state & mask) | value); + trace_vfio_v1_vmstate_change(vbasedev->name, running, RunState_str(sta= te), + (migration->device_state_v1 & mask) | value); } =20 static void vfio_migration_state_notifier(Notifier *notifier, void *data) @@ -768,10 +769,10 @@ static void vfio_migration_state_notifier(Notifier *n= otifier, void *data) case MIGRATION_STATUS_CANCELLED: case MIGRATION_STATUS_FAILED: bytes_transferred =3D 0; - ret =3D vfio_migration_set_state(vbasedev, - ~(VFIO_DEVICE_STATE_V1_SAVING | - VFIO_DEVICE_STATE_V1_RESUMING), - VFIO_DEVICE_STATE_V1_RUNNING); + ret =3D vfio_migration_v1_set_state(vbasedev, + ~(VFIO_DEVICE_STATE_V1_SAVING | + VFIO_DEVICE_STATE_V1_RESUMING), + VFIO_DEVICE_STATE_V1_RUNNING); if (ret) { error_report("%s: Failed to set state RUNNING", vbasedev->name= ); } @@ -815,7 +816,7 @@ static int vfio_migration_init(VFIODevice *vbasedev) } =20 vbasedev->migration =3D g_new0(VFIOMigration, 1); - vbasedev->migration->device_state =3D VFIO_DEVICE_STATE_V1_RUNNING; + vbasedev->migration->device_state_v1 =3D VFIO_DEVICE_STATE_V1_RUNNING; vbasedev->migration->vm_running =3D runstate_is_running(); =20 ret =3D vfio_region_setup(obj, vbasedev, &vbasedev->migration->region, @@ -846,12 +847,11 @@ static int vfio_migration_init(VFIODevice *vbasedev) } strpadcpy(id, sizeof(id), path, '\0'); =20 - register_savevm_live(id, VMSTATE_INSTANCE_ID_ANY, 1, &savevm_vfio_hand= lers, - vbasedev); + register_savevm_live(id, VMSTATE_INSTANCE_ID_ANY, 1, + &savevm_vfio_v1_handlers, vbasedev); =20 - migration->vm_state =3D qdev_add_vm_change_state_handler(vbasedev->dev, - vfio_vmstate_ch= ange, - vbasedev); + migration->vm_state =3D qdev_add_vm_change_state_handler( + vbasedev->dev, vfio_v1_vmstate_change, vbasedev); migration->migration_state.notify =3D vfio_migration_state_notifier; add_migration_state_change_notifier(&migration->migration_state); return 0; diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index b259dcc644..9eb9aff295 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -149,20 +149,20 @@ vfio_display_edid_write_error(void) "" =20 # migration.c vfio_migration_probe(const char *name) " (%s)" -vfio_migration_set_state(const char *name, uint32_t state) " (%s) state %d" -vfio_vmstate_change(const char *name, int running, const char *reason, uin= t32_t dev_state) " (%s) running %d reason %s device state %d" +vfio_migration_v1_set_state(const char *name, uint32_t state) " (%s) state= %d" +vfio_v1_vmstate_change(const char *name, int running, const char *reason, = uint32_t dev_state) " (%s) running %d reason %s device state %d" vfio_migration_state_notifier(const char *name, const char *state) " (%s) = state %s" -vfio_save_setup(const char *name) " (%s)" +vfio_v1_save_setup(const char *name) " (%s)" vfio_save_cleanup(const char *name) " (%s)" vfio_save_buffer(const char *name, uint64_t data_offset, uint64_t data_siz= e, uint64_t pending) " (%s) Offset 0x%"PRIx64" size 0x%"PRIx64" pending 0x%= "PRIx64 vfio_update_pending(const char *name, uint64_t pending) " (%s) pending 0x%= "PRIx64 vfio_save_device_config_state(const char *name) " (%s)" -vfio_save_pending(const char *name, uint64_t precopy, uint64_t postcopy, u= int64_t compatible) " (%s) precopy 0x%"PRIx64" postcopy 0x%"PRIx64" compati= ble 0x%"PRIx64 +vfio_v1_save_pending(const char *name, uint64_t precopy, uint64_t postcopy= , uint64_t compatible) " (%s) precopy 0x%"PRIx64" postcopy 0x%"PRIx64" comp= atible 0x%"PRIx64 vfio_save_iterate(const char *name, int data_size) " (%s) data_size %d" -vfio_save_complete_precopy(const char *name) " (%s)" +vfio_v1_save_complete_precopy(const char *name) " (%s)" vfio_load_device_config_state(const char *name) " (%s)" vfio_load_state(const char *name, uint64_t data) " (%s) data 0x%"PRIx64 -vfio_load_state_device_data(const char *name, uint64_t data_offset, uint64= _t data_size) " (%s) Offset 0x%"PRIx64" size 0x%"PRIx64 +vfio_v1_load_state_device_data(const char *name, uint64_t data_offset, uin= t64_t data_size) " (%s) Offset 0x%"PRIx64" size 0x%"PRIx64 vfio_load_cleanup(const char *name) " (%s)" vfio_get_dirty_bitmap(int fd, uint64_t iova, uint64_t size, uint64_t bitma= p_size, uint64_t start) "container fd=3D%d, iova=3D0x%"PRIx64" size=3D 0x%"= PRIx64" bitmap_size=3D0x%"PRIx64" start=3D0x%"PRIx64 vfio_iommu_map_dirty_notify(uint64_t iova_start, uint64_t iova_end) "iommu= dirty @ 0x%"PRIx64" - 0x%"PRIx64 --=20 2.26.3