From: Eric Auger <eric.auger@redhat.com>
To: eric.auger.pro@gmail.com, eric.auger@redhat.com,
treding@nvidia.com, vbhadram@nvidia.com, jonathanh@nvidia.com,
mperttunen@nvidia.com, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, alex.williamson@redhat.com, clg@redhat.com,
alexandre.torgue@foss.st.com, joabreu@synopsys.com
Cc: msalter@redhat.com
Subject: [RFC PATCH v2 3/6] vfio-platform: Move region initialization to vfio_platform_init_common
Date: Tue, 17 Sep 2024 11:38:11 +0200 [thread overview]
Message-ID: <20240917093851.990344-4-eric.auger@redhat.com> (raw)
In-Reply-To: <20240917093851.990344-1-eric.auger@redhat.com>
We plan to introduce a new reset module init() callback. This latter
would need to have vdev->regions populated. At the moment this latter
is allocated and populated later on device open.
Call vfio_platform_regions_init() in vfio_platform_init_common()
instead.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
drivers/vfio/platform/vfio_platform_common.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c
index 976864d2e2f0..cd0f2ebff586 100644
--- a/drivers/vfio/platform/vfio_platform_common.c
+++ b/drivers/vfio/platform/vfio_platform_common.c
@@ -243,7 +243,6 @@ void vfio_platform_close_device(struct vfio_device *core_vdev)
ret, extra_dbg ? extra_dbg : "");
}
pm_runtime_put(vdev->device);
- vfio_platform_regions_cleanup(vdev);
vfio_platform_irq_cleanup(vdev);
}
EXPORT_SYMBOL_GPL(vfio_platform_close_device);
@@ -255,13 +254,9 @@ int vfio_platform_open_device(struct vfio_device *core_vdev)
const char *extra_dbg = NULL;
int ret;
- ret = vfio_platform_regions_init(vdev);
- if (ret)
- return ret;
-
ret = vfio_platform_irq_init(vdev);
if (ret)
- goto err_irq;
+ return ret;
ret = pm_runtime_get_sync(vdev->device);
if (ret < 0)
@@ -280,8 +275,6 @@ int vfio_platform_open_device(struct vfio_device *core_vdev)
err_rst:
pm_runtime_put(vdev->device);
vfio_platform_irq_cleanup(vdev);
-err_irq:
- vfio_platform_regions_cleanup(vdev);
return ret;
}
EXPORT_SYMBOL_GPL(vfio_platform_open_device);
@@ -658,12 +651,17 @@ int vfio_platform_init_common(struct vfio_platform_device *vdev)
return ret;
vdev->device = dev;
+ ret = vfio_platform_regions_init(vdev);
+ if (ret)
+ return ret;
+
mutex_init(&vdev->igate);
ret = vfio_platform_get_reset(vdev);
if (ret && vdev->reset_required) {
dev_err(dev, "No reset function found for device %s\n",
vdev->name);
+ vfio_platform_regions_cleanup(vdev);
return ret;
}
@@ -674,6 +672,7 @@ EXPORT_SYMBOL_GPL(vfio_platform_init_common);
void vfio_platform_release_common(struct vfio_platform_device *vdev)
{
vfio_platform_put_reset(vdev);
+ vfio_platform_regions_cleanup(vdev);
}
EXPORT_SYMBOL_GPL(vfio_platform_release_common);
--
2.41.0
next prev parent reply other threads:[~2024-09-17 9:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-17 9:38 [RFC PATCH v2 0/6] vfio: platform: reset: Introduce tegra234 mgbe reset module Eric Auger
2024-09-17 9:38 ` [RFC PATCH v2 1/6] vfio_platform: Introduce vfio_platform_get_region helper Eric Auger
2024-09-17 9:38 ` [RFC PATCH v2 2/6] vfio_platform: reset: Prepare for additional reset ops Eric Auger
2024-09-17 9:38 ` Eric Auger [this message]
2024-09-17 9:38 ` [RFC PATCH v2 4/6] vfio_platform: reset: Introduce new init and release callbacks Eric Auger
2024-09-17 9:38 ` [RFC PATCH v2 5/6] vfio-platform: Add a new handle to store reset data Eric Auger
2024-09-17 9:38 ` [RFC PATCH v2 6/6] vfio/platform: Add tegra234-mgbe vfio platform reset module Eric Auger
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=20240917093851.990344-4-eric.auger@redhat.com \
--to=eric.auger@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=alexandre.torgue@foss.st.com \
--cc=clg@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=joabreu@synopsys.com \
--cc=jonathanh@nvidia.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mperttunen@nvidia.com \
--cc=msalter@redhat.com \
--cc=treding@nvidia.com \
--cc=vbhadram@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®