[PATCH v3 27/28] drm/intel/pciids: Add match with VFIO override

Michał Winiarski posted 28 patches 3 months, 1 week ago
There is a newer version of this series
[PATCH v3 27/28] drm/intel/pciids: Add match with VFIO override
Posted by Michał Winiarski 3 months, 1 week ago
In order to allow VFIO users to choose the right driver override, VFIO
driver variant used for VF migration needs to use Intel Graphics PCI
IDs.
Add INTEL_VGA_VFIO_DEVICE match that sets VFIO override_only.

Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
---
 include/drm/intel/pciids.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/drm/intel/pciids.h b/include/drm/intel/pciids.h
index b258e79b437ac..d14ce43139a28 100644
--- a/include/drm/intel/pciids.h
+++ b/include/drm/intel/pciids.h
@@ -43,6 +43,13 @@
 	.class = PCI_BASE_CLASS_DISPLAY << 16, .class_mask = 0xff << 16, \
 	.driver_data = (kernel_ulong_t)(_info), \
 }
+
+#define INTEL_VGA_VFIO_DEVICE(_id, _info) { \
+	PCI_DEVICE(PCI_VENDOR_ID_INTEL, (_id)), \
+	.class = PCI_BASE_CLASS_DISPLAY << 16, .class_mask = 0xff << 16, \
+	.driver_data = (kernel_ulong_t)(_info), \
+	.override_only = PCI_ID_F_VFIO_DRIVER_OVERRIDE, \
+}
 #endif
 
 #define INTEL_I810_IDS(MACRO__, ...) \
-- 
2.50.1

Re: [PATCH v3 27/28] drm/intel/pciids: Add match with VFIO override
Posted by Lucas De Marchi 3 months, 1 week ago
On Thu, Oct 30, 2025 at 09:31:34PM +0100, Michał Winiarski wrote:
>In order to allow VFIO users to choose the right driver override, VFIO
>driver variant used for VF migration needs to use Intel Graphics PCI
>IDs.
>Add INTEL_VGA_VFIO_DEVICE match that sets VFIO override_only.
>
>Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
>---
> include/drm/intel/pciids.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
>diff --git a/include/drm/intel/pciids.h b/include/drm/intel/pciids.h
>index b258e79b437ac..d14ce43139a28 100644
>--- a/include/drm/intel/pciids.h
>+++ b/include/drm/intel/pciids.h
>@@ -43,6 +43,13 @@
> 	.class = PCI_BASE_CLASS_DISPLAY << 16, .class_mask = 0xff << 16, \
> 	.driver_data = (kernel_ulong_t)(_info), \
> }
>+
>+#define INTEL_VGA_VFIO_DEVICE(_id, _info) { \
>+	PCI_DEVICE(PCI_VENDOR_ID_INTEL, (_id)), \
>+	.class = PCI_BASE_CLASS_DISPLAY << 16, .class_mask = 0xff << 16, \
>+	.driver_data = (kernel_ulong_t)(_info), \
>+	.override_only = PCI_ID_F_VFIO_DRIVER_OVERRIDE, \

why do we need this and can't use PCI_DRIVER_OVERRIDE_DEVICE_VFIO()
directly? Note that there are GPUs that wouldn't match the display class
above.

	edb660ad79ff ("drm/intel/pciids: Add match on vendor/id only")
	5e0de2dfbc1b ("drm/xe/cri: Add CRI platform definition")

Lucas De Marchi

>+}
> #endif
>
> #define INTEL_I810_IDS(MACRO__, ...) \
>-- 
>2.50.1
>
Re: [PATCH v3 27/28] drm/intel/pciids: Add match with VFIO override
Posted by Michał Winiarski 3 months, 1 week ago
On Mon, Nov 03, 2025 at 03:30:49PM -0600, Lucas De Marchi wrote:
> On Thu, Oct 30, 2025 at 09:31:34PM +0100, Michał Winiarski wrote:
> > In order to allow VFIO users to choose the right driver override, VFIO
> > driver variant used for VF migration needs to use Intel Graphics PCI
> > IDs.
> > Add INTEL_VGA_VFIO_DEVICE match that sets VFIO override_only.
> > 
> > Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
> > ---
> > include/drm/intel/pciids.h | 7 +++++++
> > 1 file changed, 7 insertions(+)
> > 
> > diff --git a/include/drm/intel/pciids.h b/include/drm/intel/pciids.h
> > index b258e79b437ac..d14ce43139a28 100644
> > --- a/include/drm/intel/pciids.h
> > +++ b/include/drm/intel/pciids.h
> > @@ -43,6 +43,13 @@
> > 	.class = PCI_BASE_CLASS_DISPLAY << 16, .class_mask = 0xff << 16, \
> > 	.driver_data = (kernel_ulong_t)(_info), \
> > }
> > +
> > +#define INTEL_VGA_VFIO_DEVICE(_id, _info) { \
> > +	PCI_DEVICE(PCI_VENDOR_ID_INTEL, (_id)), \
> > +	.class = PCI_BASE_CLASS_DISPLAY << 16, .class_mask = 0xff << 16, \
> > +	.driver_data = (kernel_ulong_t)(_info), \
> > +	.override_only = PCI_ID_F_VFIO_DRIVER_OVERRIDE, \
> 
> why do we need this and can't use PCI_DRIVER_OVERRIDE_DEVICE_VFIO()
> directly? Note that there are GPUs that wouldn't match the display class
> above.
> 
> 	edb660ad79ff ("drm/intel/pciids: Add match on vendor/id only")
> 	5e0de2dfbc1b ("drm/xe/cri: Add CRI platform definition")
> 
> Lucas De Marchi
> 

I'll define it on xe-vfio-pci side and use
PCI_DRIVER_OVERRIDE_DEVICE_VFIO() internally.

Thanks,
-Michał

> > +}
> > #endif
> > 
> > #define INTEL_I810_IDS(MACRO__, ...) \
> > -- 
> > 2.50.1
> > 
Re: [PATCH v3 27/28] drm/intel/pciids: Add match with VFIO override
Posted by Lucas De Marchi 3 months ago
On Tue, Nov 04, 2025 at 01:59:45PM +0100, Michał Winiarski wrote:
>On Mon, Nov 03, 2025 at 03:30:49PM -0600, Lucas De Marchi wrote:
>> On Thu, Oct 30, 2025 at 09:31:34PM +0100, Michał Winiarski wrote:
>> > In order to allow VFIO users to choose the right driver override, VFIO
>> > driver variant used for VF migration needs to use Intel Graphics PCI
>> > IDs.
>> > Add INTEL_VGA_VFIO_DEVICE match that sets VFIO override_only.
>> >
>> > Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
>> > ---
>> > include/drm/intel/pciids.h | 7 +++++++
>> > 1 file changed, 7 insertions(+)
>> >
>> > diff --git a/include/drm/intel/pciids.h b/include/drm/intel/pciids.h
>> > index b258e79b437ac..d14ce43139a28 100644
>> > --- a/include/drm/intel/pciids.h
>> > +++ b/include/drm/intel/pciids.h
>> > @@ -43,6 +43,13 @@
>> > 	.class = PCI_BASE_CLASS_DISPLAY << 16, .class_mask = 0xff << 16, \
>> > 	.driver_data = (kernel_ulong_t)(_info), \
>> > }
>> > +
>> > +#define INTEL_VGA_VFIO_DEVICE(_id, _info) { \
>> > +	PCI_DEVICE(PCI_VENDOR_ID_INTEL, (_id)), \
>> > +	.class = PCI_BASE_CLASS_DISPLAY << 16, .class_mask = 0xff << 16, \
>> > +	.driver_data = (kernel_ulong_t)(_info), \
>> > +	.override_only = PCI_ID_F_VFIO_DRIVER_OVERRIDE, \
>>
>> why do we need this and can't use PCI_DRIVER_OVERRIDE_DEVICE_VFIO()
>> directly? Note that there are GPUs that wouldn't match the display class
>> above.
>>
>> 	edb660ad79ff ("drm/intel/pciids: Add match on vendor/id only")
>> 	5e0de2dfbc1b ("drm/xe/cri: Add CRI platform definition")
>>
>> Lucas De Marchi
>>
>
>I'll define it on xe-vfio-pci side and use

but no matter where it's defined, why do you need it to match on the
class? The vid/devid should be sufficient.

Lucas De Marchi
Re: [PATCH v3 27/28] drm/intel/pciids: Add match with VFIO override
Posted by Jason Gunthorpe 3 months ago
On Tue, Nov 04, 2025 at 11:41:53AM -0600, Lucas De Marchi wrote:

> > > > +#define INTEL_VGA_VFIO_DEVICE(_id, _info) { \
> > > > +	PCI_DEVICE(PCI_VENDOR_ID_INTEL, (_id)), \
> > > > +	.class = PCI_BASE_CLASS_DISPLAY << 16, .class_mask = 0xff << 16, \
> > > > +	.driver_data = (kernel_ulong_t)(_info), \
> > > > +	.override_only = PCI_ID_F_VFIO_DRIVER_OVERRIDE, \
> > > 
> > > why do we need this and can't use PCI_DRIVER_OVERRIDE_DEVICE_VFIO()
> > > directly? Note that there are GPUs that wouldn't match the display class
> > > above.
> > > 
> > > 	edb660ad79ff ("drm/intel/pciids: Add match on vendor/id only")
> > > 	5e0de2dfbc1b ("drm/xe/cri: Add CRI platform definition")
> > > 
> > > Lucas De Marchi
> > > 
> > 
> > I'll define it on xe-vfio-pci side and use
> 
> but no matter where it's defined, why do you need it to match on the
> class? The vid/devid should be sufficient.

+1

Jason
Re: [PATCH v3 27/28] drm/intel/pciids: Add match with VFIO override
Posted by Michał Winiarski 3 months ago
On Tue, Nov 04, 2025 at 03:27:14PM -0400, Jason Gunthorpe wrote:
> On Tue, Nov 04, 2025 at 11:41:53AM -0600, Lucas De Marchi wrote:
> 
> > > > > +#define INTEL_VGA_VFIO_DEVICE(_id, _info) { \
> > > > > +	PCI_DEVICE(PCI_VENDOR_ID_INTEL, (_id)), \
> > > > > +	.class = PCI_BASE_CLASS_DISPLAY << 16, .class_mask = 0xff << 16, \
> > > > > +	.driver_data = (kernel_ulong_t)(_info), \
> > > > > +	.override_only = PCI_ID_F_VFIO_DRIVER_OVERRIDE, \
> > > > 
> > > > why do we need this and can't use PCI_DRIVER_OVERRIDE_DEVICE_VFIO()
> > > > directly? Note that there are GPUs that wouldn't match the display class
> > > > above.
> > > > 
> > > > 	edb660ad79ff ("drm/intel/pciids: Add match on vendor/id only")
> > > > 	5e0de2dfbc1b ("drm/xe/cri: Add CRI platform definition")
> > > > 
> > > > Lucas De Marchi
> > > > 
> > > 
> > > I'll define it on xe-vfio-pci side and use
> > 
> > but no matter where it's defined, why do you need it to match on the
> > class? The vid/devid should be sufficient.
> 
> +1
> 
> Jason

I don't need to match on class.

With PCI_DRIVER_OVERRIDE_DEVICE_VFIO it just becomes:
#define INTEL_PCI_VFIO_DEVICE(_id) { \
	PCI_DRIVER_OVERRIDE_DEVICE_VFIO(PCI_VENDOR_ID_INTEL, (_id)) \
}

static const struct pci_device_id xe_vfio_pci_table[] = {
	INTEL_PTL_IDS(INTEL_PCI_VFIO_DEVICE),
	INTEL_WCL_IDS(INTEL_PCI_VFIO_DEVICE),
	INTEL_BMG_IDS(INTEL_PCI_VFIO_DEVICE),
	{}
};

So, no matching on class, but I still do need a helper macro.

Thanks,
-Michał
Re: [PATCH v3 27/28] drm/intel/pciids: Add match with VFIO override
Posted by Lucas De Marchi 3 months ago
On Wed, Nov 05, 2025 at 04:20:33PM +0100, Michał Winiarski wrote:
>On Tue, Nov 04, 2025 at 03:27:14PM -0400, Jason Gunthorpe wrote:
>> On Tue, Nov 04, 2025 at 11:41:53AM -0600, Lucas De Marchi wrote:
>>
>> > > > > +#define INTEL_VGA_VFIO_DEVICE(_id, _info) { \
>> > > > > +	PCI_DEVICE(PCI_VENDOR_ID_INTEL, (_id)), \
>> > > > > +	.class = PCI_BASE_CLASS_DISPLAY << 16, .class_mask = 0xff << 16, \
>> > > > > +	.driver_data = (kernel_ulong_t)(_info), \
>> > > > > +	.override_only = PCI_ID_F_VFIO_DRIVER_OVERRIDE, \
>> > > >
>> > > > why do we need this and can't use PCI_DRIVER_OVERRIDE_DEVICE_VFIO()
>> > > > directly? Note that there are GPUs that wouldn't match the display class
>> > > > above.
>> > > >
>> > > > 	edb660ad79ff ("drm/intel/pciids: Add match on vendor/id only")
>> > > > 	5e0de2dfbc1b ("drm/xe/cri: Add CRI platform definition")
>> > > >
>> > > > Lucas De Marchi
>> > > >
>> > >
>> > > I'll define it on xe-vfio-pci side and use
>> >
>> > but no matter where it's defined, why do you need it to match on the
>> > class? The vid/devid should be sufficient.
>>
>> +1
>>
>> Jason
>
>I don't need to match on class.
>
>With PCI_DRIVER_OVERRIDE_DEVICE_VFIO it just becomes:
>#define INTEL_PCI_VFIO_DEVICE(_id) { \
>	PCI_DRIVER_OVERRIDE_DEVICE_VFIO(PCI_VENDOR_ID_INTEL, (_id)) \
>}
>
>static const struct pci_device_id xe_vfio_pci_table[] = {
>	INTEL_PTL_IDS(INTEL_PCI_VFIO_DEVICE),
>	INTEL_WCL_IDS(INTEL_PCI_VFIO_DEVICE),
>	INTEL_BMG_IDS(INTEL_PCI_VFIO_DEVICE),
>	{}
>};
>
>So, no matching on class, but I still do need a helper macro.

yeah, that lgtm

thanks
Lucas De Marchi

>
>Thanks,
>-Michał
Re: [PATCH v3 27/28] drm/intel/pciids: Add match with VFIO override
Posted by Jason Gunthorpe 3 months ago
On Wed, Nov 05, 2025 at 04:20:33PM +0100, Michał Winiarski wrote:
> On Tue, Nov 04, 2025 at 03:27:14PM -0400, Jason Gunthorpe wrote:
> > On Tue, Nov 04, 2025 at 11:41:53AM -0600, Lucas De Marchi wrote:
> > 
> > > > > > +#define INTEL_VGA_VFIO_DEVICE(_id, _info) { \
> > > > > > +	PCI_DEVICE(PCI_VENDOR_ID_INTEL, (_id)), \
> > > > > > +	.class = PCI_BASE_CLASS_DISPLAY << 16, .class_mask = 0xff << 16, \
> > > > > > +	.driver_data = (kernel_ulong_t)(_info), \
> > > > > > +	.override_only = PCI_ID_F_VFIO_DRIVER_OVERRIDE, \
> > > > > 
> > > > > why do we need this and can't use PCI_DRIVER_OVERRIDE_DEVICE_VFIO()
> > > > > directly? Note that there are GPUs that wouldn't match the display class
> > > > > above.
> > > > > 
> > > > > 	edb660ad79ff ("drm/intel/pciids: Add match on vendor/id only")
> > > > > 	5e0de2dfbc1b ("drm/xe/cri: Add CRI platform definition")
> > > > > 
> > > > > Lucas De Marchi
> > > > > 
> > > > 
> > > > I'll define it on xe-vfio-pci side and use
> > > 
> > > but no matter where it's defined, why do you need it to match on the
> > > class? The vid/devid should be sufficient.
> > 
> > +1
> > 
> > Jason
> 
> I don't need to match on class.
> 
> With PCI_DRIVER_OVERRIDE_DEVICE_VFIO it just becomes:
> #define INTEL_PCI_VFIO_DEVICE(_id) { \
> 	PCI_DRIVER_OVERRIDE_DEVICE_VFIO(PCI_VENDOR_ID_INTEL, (_id)) \
> }
> 
> static const struct pci_device_id xe_vfio_pci_table[] = {
> 	INTEL_PTL_IDS(INTEL_PCI_VFIO_DEVICE),
> 	INTEL_WCL_IDS(INTEL_PCI_VFIO_DEVICE),
> 	INTEL_BMG_IDS(INTEL_PCI_VFIO_DEVICE),
> 	{}
> };
> 
> So, no matching on class, but I still do need a helper macro.

Yes, that looks right to me.

Jason