On Tue, Jun 10, 2025 at 01:57:23PM +0200, Cédric Le Goater wrote: > On 6/10/25 13:27, John Levon wrote: > > On Tue, Jun 10, 2025 at 11:58:18AM +0100, Mark Cave-Ayland wrote: > > > > > > + /* Use the per-region fd if set, or the shared fd. */ > > > > + fd = region->vbasedev->region_fds ? > > > > + region->vbasedev->region_fds[region->nr] : > > > > + region->vbasedev->fd, > > > > + > > > > > > This feels a bit odd: if you're asking to map a VFIORegion then shouldn't > > > that contain all the information required for the mapping, including the > > > fd? > > > > > > (goes and looks) > > > > > > It appears that there is already a fd field in VFIORegion so is there a > > > reason why we can't use this instead of adding region_fds to vbasedev? > > > > region->fd was in earlier patchsets, but dropped as requested by Cédric. So > > we > > must look it up here. > > yes. It didn't seem necessary to store the same information under > multiple structs.
And the reason we have ->region_fds at all rather than just storing directly in region->fd is that vfio_device_get_region_info() doesn't take a VFIORegion argument, as it's used in other contexts too. regards john