From nobody Tue May 7 11:04:21 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1678209289; cv=none; d=zohomail.com; s=zohoarc; b=cqWpgqG6kFCuhj7T3JUF7kUqhuoTOOQeo9swkMBMZ1IaIQe6yJ4yaiIj3yCF1KjY2NtlULXAsGInjvg342G5xmE0I7mK6t3RA2Noocndi/Cz7+iSZryM07ouQKpIEsY1nN+gvMAB9z2EcQsZwwgN6wacXVAarL8RYKpmZE6q4E0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678209289; 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=xE0yQBXzV+yjc9e7Qtv/0Ttwe1felOe0UurwBQvamP0=; b=Ak657V4+FtkCvmYMS92Hi2NcYR6YJjhuzrr7WKn4ps9AN6HMu9k7UxLxLXqjQqz/1ESxNifZiVxlAOtYodzD6FrVw/8JMNNqFFr83mBLccTL6ymr1bgIGIobKPGGpPWxXI0p4/sUJdeLjJyUduaM2ixv9A+G8BvvUQeLU7qbsJI= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1678209289235651.078223255622; Tue, 7 Mar 2023 09:14:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZasv-0007xS-7U; Tue, 07 Mar 2023 12:13:57 -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 1pZast-0007v0-8y for qemu-devel@nongnu.org; Tue, 07 Mar 2023 12:13:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZasq-0006Xf-U7 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 12:13:54 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-213-i9SdRgsTMzi9_t-BIGvW9Q-1; Tue, 07 Mar 2023 12:13:48 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C4336802C18; Tue, 7 Mar 2023 17:13:46 +0000 (UTC) Received: from [172.30.41.16] (unknown [10.22.16.79]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F621492C3E; Tue, 7 Mar 2023 17:13:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678209231; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xE0yQBXzV+yjc9e7Qtv/0Ttwe1felOe0UurwBQvamP0=; b=ZRebNGm30w8rgGFA4UKlBRZ+9s35+CEdJlMiGSzRc1JPUFw2yj14L5D5u3HU4cR01NAMx7 4ChlnaFZw/i15qaWYS3Qer1vngEOrHpXkruhkWOP4WHACUKbcoH/3F1t1QMN6+P8ReGgFo QUW4DnubcfX9whm2qXhJsL+eUnibD3g= X-MC-Unique: i9SdRgsTMzi9_t-BIGvW9Q-1 Subject: [PATCH v2] vfio/migration: Rename entry points From: Alex Williamson To: qemu-devel@nongnu.org Cc: alex.williamson@redhat.com, clg@redhat.com, yishaih@nvidia.com, jgg@nvidia.com, joao.m.martins@oracle.com, avihaih@nvidia.com Date: Tue, 07 Mar 2023 10:13:45 -0700 Message-ID: <167820912978.606734.12740287349119694623.stgit@omen> In-Reply-To: <167820819129.603802.2574672058630378188.stgit@omen> References: <167820819129.603802.2574672058630378188.stgit@omen> User-Agent: StGit/1.5.dev2+g9ce680a52bd9 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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 client-ip=170.10.129.124; envelope-from=alex.williamson@redhat.com; helo=us-smtp-delivery-124.mimecast.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_NONE=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 @redhat.com) X-ZM-MESSAGEID: 1678209290939100002 Pick names that align with the section drivers should use them from, avoiding the confusion of calling a _finalize() function from _exit() and generalizing the actual _finalize() to handle removing the viommu blocker. Signed-off-by: Alex Williamson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Joao Martins --- v2: ...but there's already a vfio_migration_exit(), it should really just be inlined, but for minimally invasive change, just rename to vfio_migration_free(). hw/vfio/common.c | 2 +- hw/vfio/migration.c | 8 ++++---- hw/vfio/pci.c | 6 +++--- include/hw/vfio/vfio-common.h | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 2b9bcf70aa36..dddd7a8e40f8 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -447,7 +447,7 @@ int vfio_block_giommu_migration(Error **errp) return ret; } =20 -void vfio_unblock_giommu_migration(void) +void vfio_migration_finalize(void) { if (!giommu_migration_blocker || vfio_viommu_preset()) { diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 5d1e66f69194..1a1a8659c859 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -521,7 +521,7 @@ static void vfio_migration_state_notifier(Notifier *not= ifier, void *data) } } =20 -static void vfio_migration_exit(VFIODevice *vbasedev) +static void vfio_migration_free(VFIODevice *vbasedev) { g_free(vbasedev->migration); vbasedev->migration =3D NULL; @@ -631,7 +631,7 @@ int64_t vfio_mig_bytes_transferred(void) return bytes_transferred; } =20 -int vfio_migration_probe(VFIODevice *vbasedev, Error **errp) +int vfio_migration_realize(VFIODevice *vbasedev, Error **errp) { int ret =3D -ENOTSUP; =20 @@ -669,7 +669,7 @@ add_blocker: return ret; } =20 -void vfio_migration_finalize(VFIODevice *vbasedev) +void vfio_migration_exit(VFIODevice *vbasedev) { if (vbasedev->migration) { VFIOMigration *migration =3D vbasedev->migration; @@ -677,7 +677,7 @@ void vfio_migration_finalize(VFIODevice *vbasedev) remove_migration_state_change_notifier(&migration->migration_state= ); qemu_del_vm_change_state_handler(migration->vm_state); unregister_savevm(VMSTATE_IF(vbasedev->dev), "vfio", vbasedev); - vfio_migration_exit(vbasedev); + vfio_migration_free(vbasedev); vfio_unblock_multiple_devices_migration(); } =20 diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 30a271eab38c..ec9a854361ac 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3145,7 +3145,7 @@ static void vfio_realize(PCIDevice *pdev, Error **err= p) } =20 if (!pdev->failover_pair_id) { - ret =3D vfio_migration_probe(vbasedev, errp); + ret =3D vfio_migration_realize(vbasedev, errp); if (ret) { error_report("%s: Migration disabled", vbasedev->name); } @@ -3185,7 +3185,7 @@ static void vfio_instance_finalize(Object *obj) */ vfio_put_device(vdev); vfio_put_group(group); - vfio_unblock_giommu_migration(); + vfio_migration_finalize(); } =20 static void vfio_exitfn(PCIDevice *pdev) @@ -3204,7 +3204,7 @@ static void vfio_exitfn(PCIDevice *pdev) } vfio_teardown_msi(vdev); vfio_bars_exit(vdev); - vfio_migration_finalize(&vdev->vbasedev); + vfio_migration_exit(&vdev->vbasedev); } =20 static void vfio_pci_reset(DeviceState *dev) diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 009bec34c4bc..eed244f25f34 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -223,7 +223,6 @@ bool vfio_mig_active(void); int vfio_block_multiple_devices_migration(Error **errp); void vfio_unblock_multiple_devices_migration(void); int vfio_block_giommu_migration(Error **errp); -void vfio_unblock_giommu_migration(void); int64_t vfio_mig_bytes_transferred(void); =20 #ifdef CONFIG_LINUX @@ -247,7 +246,8 @@ int vfio_spapr_create_window(VFIOContainer *container, int vfio_spapr_remove_window(VFIOContainer *container, hwaddr offset_within_address_space); =20 -int vfio_migration_probe(VFIODevice *vbasedev, Error **errp); -void vfio_migration_finalize(VFIODevice *vbasedev); +int vfio_migration_realize(VFIODevice *vbasedev, Error **errp); +void vfio_migration_exit(VFIODevice *vbasedev); +void vfio_migration_finalize(void); =20 #endif /* HW_VFIO_VFIO_COMMON_H */