Re: [PATCH 26/26] vfio/xe: Add vendor-specific vfio_pci driver for Intel graphics

Jason Gunthorpe
2025-10-22T13:02:16Z

On Tue, Oct 21, 2025 at 06:15:19PM -0700, Matthew Brost wrote:

> Ok, I think I see what you're getting at. The idea is to call
> dev_set_drvdata on the Xe side, then use pci_iov_get_pf_drvdata on the
> VFIO side to retrieve that data. This allows passing whatever Xe sets
> via dev_set_drvdata between the module interfaces, while only
> forward-declaring the interface struct in the shared header.

Yes. The other email looks good:

struct xe_device *xe_sriov_vfio_get_xe_device(struct pci_dev *pdev);

Should call pci_iov_get_pf_drvdata() internally.

And 'struct xe_device' can be a forward declared type that cannot be
dereferenced by VFIO to enforce some code modularity.

Using strong types is obviously better than passing around pci_dev and
hoping for the best :)

Jason