All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Shameer Kolothum Thodi <skolothumtho@nvidia.com>
Cc: Gavin Shan <gshan@redhat.com>,
	"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"eric.auger@redhat.com" <eric.auger@redhat.com>,
	"alex@shazbot.org" <alex@shazbot.org>,
	"clg@redhat.com" <clg@redhat.com>,
	"cohuck@redhat.com" <cohuck@redhat.com>,
	"mst@redhat.com" <mst@redhat.com>,
	Nicolin Chen <nicolinc@nvidia.com>,
	Nathan Chen <nathanc@nvidia.com>, Matt Ochs <mochs@nvidia.com>,
	"jonathan.cameron@huawei.com" <jonathan.cameron@huawei.com>,
	"zhenzhong.duan@intel.com" <zhenzhong.duan@intel.com>,
	"vivek.kasireddy@intel.com" <vivek.kasireddy@intel.com>,
	Krishnakant Jaju <kjaju@nvidia.com>,
	"meshetty@redhat.com" <meshetty@redhat.com>
Subject: Re: [PATCH v4 3/3] hw/vfio/region: Create dmabuf for PCI BAR per region
Date: Wed, 5 Aug 2026 09:18:52 -0300	[thread overview]
Message-ID: <20260805121852.GN27883@nvidia.com> (raw)
In-Reply-To: <SJ0PR12MB86148329F85C2A4A22D0C67FABD32@SJ0PR12MB8614.namprd12.prod.outlook.com>

On Wed, Aug 05, 2026 at 08:33:06AM +0000, Shameer Kolothum Thodi wrote:
> > > +    dma_buf = (void *)feature->data;
> > > +    *dma_buf = (struct vfio_device_feature_dma_buf) {
> > > +        .region_index = region->nr,
> > > +        .open_flags = O_RDWR,
> > > +        .nr_ranges = region->nr_mmaps,
> > > +    };
> > > +
> > > +    for (i = 0; i < region->nr_mmaps; i++) {
> > > +        dma_buf->dma_ranges[i].offset = region->mmaps[i].offset;
> > > +        dma_buf->dma_ranges[i].length = region->mmaps[i].size;
> > > +    }
> > > +
> > 
> > Shall we check if @offset and @size is aligned to PAGE_SIZE? If they're not,
> > I guess we need to skip populating DMA buffer instead of preventing the
> > device from being passed through to the guest.
> 
> Hmm..does it prevent passthrough in this case? The intention was not to do that.
> vfio_region_mmap() returns 0 irrespective of dma-buf outcome.

I think you should always be able to create a dmabuf, even with
irregular offsets and sizes.

The resulting dmabuf may not be mmap'able though.

Jason


  parent reply	other threads:[~2026-08-05 12:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21 11:41 [PATCH v4 0/3] vfio: Add DMABUF support for PCI BAR regions Shameer Kolothum
2026-01-21 11:41 ` [PATCH v4 1/3] linux-headers: Update to Linux v6.19-rc1 Shameer Kolothum
2026-01-21 14:00   ` Cédric Le Goater
2026-01-21 14:21     ` Peter Maydell
2026-01-21 17:12       ` Jason Gunthorpe
2026-01-23 14:26         ` Cédric Le Goater
2026-01-21 11:41 ` [PATCH v4 2/3] hw/vfio: Add helper to retrieve device feature Shameer Kolothum
2026-01-21 11:41 ` [PATCH v4 3/3] hw/vfio/region: Create dmabuf for PCI BAR per region Shameer Kolothum
2026-08-05  1:09   ` Gavin Shan
2026-08-05  8:33     ` Shameer Kolothum Thodi
2026-08-05  9:43       ` Gavin Shan
2026-08-05 12:18       ` Jason Gunthorpe [this message]
2026-08-05  8:49     ` Cédric Le Goater
2026-08-05  9:45       ` Gavin Shan
2026-01-21 12:36 ` [PATCH v4 0/3] vfio: Add DMABUF support for PCI BAR regions Michael S. Tsirkin
2026-01-21 12:49 ` 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=20260805121852.GN27883@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alex@shazbot.org \
    --cc=clg@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=gshan@redhat.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=kjaju@nvidia.com \
    --cc=meshetty@redhat.com \
    --cc=mochs@nvidia.com \
    --cc=mst@redhat.com \
    --cc=nathanc@nvidia.com \
    --cc=nicolinc@nvidia.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=skolothumtho@nvidia.com \
    --cc=vivek.kasireddy@intel.com \
    --cc=zhenzhong.duan@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.