From: "Kasireddy, Vivek" <vivek.kasireddy@intel.com>
To: "Cédric Le Goater" <clg@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Alex Williamson <alex@shazbot.org>
Subject: RE: [PATCH v12 06/10] vfio/region: Add a helper to get VFIO region from memory region
Date: Tue, 24 Mar 2026 05:47:49 +0000 [thread overview]
Message-ID: <IA0PR11MB7185B25C65D09D10D18F0915F848A@IA0PR11MB7185.namprd11.prod.outlook.com> (raw)
In-Reply-To: <ab984d46-3b70-4f6e-b035-3895187164e7@redhat.com>
> Subject: Re: [PATCH v12 06/10] vfio/region: Add a helper to get VFIO
> region from memory region
>
> On 3/19/26 06:15, Vivek Kasireddy wrote:
> > Having a way to get the VFIO region associated with a memory region
> > is helpful in various scenarios. For example, this capability can
> > be useful in retrieving the region info such as index and offset
> > needed for mapping a part of a VFIO region or creating a dmabuf.
> >
> > Cc: Alex Williamson <alex@shazbot.org>
> > Cc: Cédric Le Goater <clg@redhat.com>
> > Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
> > ---
> > hw/vfio/vfio-region.h | 10 ++++++++++
> > hw/vfio/region.c | 11 +++++++++++
> > 2 files changed, 21 insertions(+)
> >
> > diff --git a/hw/vfio/vfio-region.h b/hw/vfio/vfio-region.h
> > index 9b21d4ee5b..3dd47f77f6 100644
> > --- a/hw/vfio/vfio-region.h
> > +++ b/hw/vfio/vfio-region.h
> > @@ -45,4 +45,14 @@ void vfio_region_unmap(VFIORegion *region);
> > void vfio_region_exit(VFIORegion *region);
> > void vfio_region_finalize(VFIORegion *region);
> >
> > +/**
> > + * Return the VFIO region associated with a given MemoryRegion.
> This can
> > + * be useful in retrieving region info such as index and offset.
> > + *
> > + * @mr: MemoryRegion to use
> > + *
> > + * Returns the region or NULL on error.
> > + */
> > +void *vfio_get_region_from_mr(MemoryRegion *mr);
> > +
> > #endif /* HW_VFIO_REGION_H */
> > diff --git a/hw/vfio/region.c b/hw/vfio/region.c
> > index 47fdc2df34..9d7ac339c9 100644
> > --- a/hw/vfio/region.c
> > +++ b/hw/vfio/region.c
> > @@ -539,3 +539,14 @@ void
> vfio_region_mmaps_set_enabled(VFIORegion *region, bool enabled)
> >
> trace_vfio_region_mmaps_set_enabled(memory_region_name(region-
> >mem),
> > enabled);
> > }
> > +
> > +void *vfio_get_region_from_mr(MemoryRegion *mr)
>
> can we return a "VFIORegion *" ?
Sure, I'll make the change.
Thanks,
Vivek
>
> Thanks,
>
> C.
>
> > +{
> > + while (mr->container) {
> > + if (mr->ops == &vfio_region_ops) {
> > + return mr->opaque;
> > + }
> > + mr = mr->container;
> > + }
> > + return NULL;
> > +}
next prev parent reply other threads:[~2026-03-24 5:48 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 5:15 [PATCH v12 00/10] vfio: Create dmabuf from multiple VFIO ranges and use it in virtio-gpu Vivek Kasireddy
2026-03-19 5:15 ` [PATCH v12 01/10] virtio-gpu: Recreate the resource's dmabuf if new backing is attached Vivek Kasireddy
2026-03-19 5:15 ` [PATCH v12 02/10] virtio-gpu: Find hva for Guest's DMA addr associated with a ram device Vivek Kasireddy
2026-03-19 5:15 ` [PATCH v12 03/10] virtio-gpu: Rename udmabuf files and helpers to dmabuf Vivek Kasireddy
2026-03-19 5:15 ` [PATCH v12 04/10] virtio-gpu-dmabuf: Remove rcu_read_lock/unlock from virtio_gpu_create_udmabuf() Vivek Kasireddy
2026-03-19 5:15 ` [PATCH v12 05/10] virtio-gpu-dmabuf: Use g_autofree for the list pointer Vivek Kasireddy
2026-03-19 5:15 ` [PATCH v12 06/10] vfio/region: Add a helper to get VFIO region from memory region Vivek Kasireddy
2026-03-23 17:38 ` Cédric Le Goater
2026-03-24 5:47 ` Kasireddy, Vivek [this message]
2026-03-19 5:15 ` [PATCH v12 07/10] vfio/device: Add support for creating dmabuf from multiple ranges Vivek Kasireddy
2026-03-23 18:02 ` Cédric Le Goater
2026-03-24 5:47 ` Kasireddy, Vivek
2026-03-19 5:15 ` [PATCH v12 08/10] vfio/device: Add a helper to mmap a dmabuf Vivek Kasireddy
2026-03-19 5:15 ` [PATCH v12 09/10] virtio-gpu-dmabuf: Improve error handling with 'Error **' and err enum Vivek Kasireddy
2026-03-23 17:51 ` Cédric Le Goater
2026-03-24 5:53 ` Kasireddy, Vivek
2026-03-24 8:58 ` Akihiko Odaki
2026-03-25 5:31 ` Kasireddy, Vivek
2026-03-25 8:27 ` Akihiko Odaki
2026-03-26 5:54 ` Kasireddy, Vivek
2026-03-19 5:15 ` [PATCH v12 10/10] virtio-gpu-dmabuf: Create dmabuf for blobs associated with VFIO devices Vivek Kasireddy
2026-03-24 9:11 ` Akihiko Odaki
2026-03-25 5:29 ` Kasireddy, Vivek
2026-03-25 8:02 ` Akihiko Odaki
2026-03-26 5:52 ` Kasireddy, Vivek
2026-03-26 6:15 ` Akihiko Odaki
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=IA0PR11MB7185B25C65D09D10D18F0915F848A@IA0PR11MB7185.namprd11.prod.outlook.com \
--to=vivek.kasireddy@intel.com \
--cc=alex@shazbot.org \
--cc=clg@redhat.com \
--cc=qemu-devel@nongnu.org \
/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