From: "Michał Winiarski" <michal.winiarski@intel.com>
To: Jason Gunthorpe <jgg@ziepe.ca>,
Alex Williamson <alex@shazbot.org>,
"Kevin Tian" <kevin.tian@intel.com>,
Yishai Hadas <yishaih@nvidia.com>,
Longfang Liu <liulongfang@huawei.com>,
Shameer Kolothum <skolothumtho@nvidia.com>,
"Brett Creeley" <brett.creeley@amd.com>,
Giovanni Cabiddu <giovanni.cabiddu@intel.com>,
<kvm@vger.kernel.org>, <qat-linux@intel.com>,
<virtualization@lists.linux.dev>, <linux-kernel@vger.kernel.org>
Cc: "Michał Winiarski" <michal.winiarski@intel.com>
Subject: [PATCH 4/6] vfio/qat: Use .migration_reset_state() callback
Date: Thu, 20 Nov 2025 13:36:45 +0100 [thread overview]
Message-ID: <20251120123647.3522082-5-michal.winiarski@intel.com> (raw)
In-Reply-To: <20251120123647.3522082-1-michal.winiarski@intel.com>
Move the migration device state reset code from .reset_done() to
dedicated callback.
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
---
drivers/vfio/pci/qat/main.c | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/drivers/vfio/pci/qat/main.c b/drivers/vfio/pci/qat/main.c
index a19b68043eb2e..fe65301a4cdc8 100644
--- a/drivers/vfio/pci/qat/main.c
+++ b/drivers/vfio/pci/qat/main.c
@@ -474,13 +474,6 @@ static struct file *qat_vf_pci_step_device_state(struct qat_vf_core_device *qat_
return ERR_PTR(-EINVAL);
}
-static void qat_vf_reset_done(struct qat_vf_core_device *qat_vdev)
-{
- qat_vdev->mig_state = VFIO_DEVICE_STATE_RUNNING;
- qat_vfmig_reset(qat_vdev->mdev);
- qat_vf_disable_fds(qat_vdev);
-}
-
static struct file *qat_vf_pci_set_device_state(struct vfio_device *vdev,
enum vfio_device_mig_state new_state)
{
@@ -526,6 +519,21 @@ static int qat_vf_pci_get_device_state(struct vfio_device *vdev,
return 0;
}
+static void qat_vf_pci_reset_device_state(struct vfio_device *vdev)
+{
+ struct qat_vf_core_device *qat_vdev = container_of(vdev,
+ struct qat_vf_core_device, core_device.vdev);
+
+ if (!qat_vdev->mdev)
+ return;
+
+ mutex_lock(&qat_vdev->state_mutex);
+ qat_vdev->mig_state = VFIO_DEVICE_STATE_RUNNING;
+ qat_vfmig_reset(qat_vdev->mdev);
+ qat_vf_disable_fds(qat_vdev);
+ mutex_unlock(&qat_vdev->state_mutex);
+}
+
static int qat_vf_pci_get_data_size(struct vfio_device *vdev,
unsigned long *stop_copy_length)
{
@@ -542,6 +550,7 @@ static int qat_vf_pci_get_data_size(struct vfio_device *vdev,
static const struct vfio_migration_ops qat_vf_pci_mig_ops = {
.migration_set_state = qat_vf_pci_set_device_state,
.migration_get_state = qat_vf_pci_get_device_state,
+ .migration_reset_state = qat_vf_pci_reset_device_state,
.migration_get_data_size = qat_vf_pci_get_data_size,
};
@@ -628,18 +637,6 @@ static struct qat_vf_core_device *qat_vf_drvdata(struct pci_dev *pdev)
return container_of(core_device, struct qat_vf_core_device, core_device);
}
-static void qat_vf_pci_aer_reset_done(struct pci_dev *pdev)
-{
- struct qat_vf_core_device *qat_vdev = qat_vf_drvdata(pdev);
-
- if (!qat_vdev->mdev)
- return;
-
- mutex_lock(&qat_vdev->state_mutex);
- qat_vf_reset_done(qat_vdev);
- mutex_unlock(&qat_vdev->state_mutex);
-}
-
static int
qat_vf_vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
@@ -683,7 +680,6 @@ static const struct pci_device_id qat_vf_vfio_pci_table[] = {
MODULE_DEVICE_TABLE(pci, qat_vf_vfio_pci_table);
static const struct pci_error_handlers qat_vf_err_handlers = {
- .reset_done = qat_vf_pci_aer_reset_done,
.error_detected = vfio_pci_core_aer_err_detected,
};
--
2.51.2
next prev parent reply other threads:[~2025-11-20 12:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 12:36 [PATCH 0/6] vfio: Reset migration device state using dedicated callback Michał Winiarski
2025-11-20 12:36 ` [PATCH 1/6] vfio: Introduce .migration_reset_state() callback Michał Winiarski
2025-11-21 7:13 ` Tian, Kevin
2025-11-24 21:29 ` Winiarski, Michal
2025-11-21 18:16 ` Alex Williamson
2025-11-24 21:44 ` Michał Winiarski
2025-11-20 12:36 ` [PATCH 2/6] hisi_acc_vfio_pci: Use " Michał Winiarski
2025-11-20 12:36 ` [PATCH 3/6] vfio/pds: " Michał Winiarski
2025-11-20 12:36 ` Michał Winiarski [this message]
2025-11-20 12:36 ` [PATCH 5/6] vfio/mlx5: " Michał Winiarski
2025-11-20 12:36 ` [PATCH 6/6] vfio/virtio: " Michał Winiarski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251120123647.3522082-5-michal.winiarski@intel.com \
--to=michal.winiarski@intel.com \
--cc=alex@shazbot.org \
--cc=brett.creeley@amd.com \
--cc=giovanni.cabiddu@intel.com \
--cc=jgg@ziepe.ca \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liulongfang@huawei.com \
--cc=qat-linux@intel.com \
--cc=skolothumtho@nvidia.com \
--cc=virtualization@lists.linux.dev \
--cc=yishaih@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®