* [PATCH] virtio: remove explicit pci ids from virtio_pci.c
@ 2008-01-21 0:30 Rusty Russell
[not found] ` <200801211130.51401.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Rusty Russell @ 2008-01-21 0:30 UTC (permalink / raw)
To: kvm-devel; +Cc: virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Qumranet let us use their PCI vendor ID, with device ids >= 0x1000.
We can specify that we accept all of them in the device ID table, and
then return -ENODEV in the probe routine.
modprobe will load all the modules which match a given alias so we
might be loaded when we're not needed, but that's the worst that can
happen.
Signed-off-by: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
---
drivers/virtio/virtio_pci.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff -r 4edff5e24614 drivers/virtio/virtio_pci.c
--- a/drivers/virtio/virtio_pci.c Sun Jan 20 21:01:32 2008 +1100
+++ b/drivers/virtio/virtio_pci.c Mon Jan 21 11:05:19 2008 +1100
@@ -62,10 +62,9 @@ struct virtio_pci_vq_info
struct list_head node;
};
-/* We have to enumerate here all virtio PCI devices. */
+/* Qumranet donated their vendor ID and devices >= 0x1000 */
static struct pci_device_id virtio_pci_id_table[] = {
- { 0x1af4, 0x1000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* virtio net */
- { 0x1af4, 0x1001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* virtio blk */
+ { 0x1af4, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ 0 },
};
@@ -303,6 +302,10 @@ static int __devinit virtio_pci_probe(st
struct virtio_pci_device *vp_dev;
int err;
+ /* We only own device ids >= 0x1000 */
+ if (pci_dev->device < 0x1000)
+ return -ENODEV;
+
/* allocate our structure and fill it out */
vp_dev = kzalloc(sizeof(struct virtio_pci_device), GFP_KERNEL);
if (vp_dev == NULL)
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply [flat|nested] 4+ messages in thread[parent not found: <200801211130.51401.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>]
* Re: [PATCH] virtio: remove explicit pci ids from virtio_pci.c [not found] ` <200801211130.51401.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org> @ 2008-01-21 4:34 ` Anthony Liguori [not found] ` <479420D2.7050902-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Anthony Liguori @ 2008-01-21 4:34 UTC (permalink / raw) To: Rusty Russell Cc: kvm-devel, Avi Kivity, virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA Rusty Russell wrote: > Qumranet let us use their PCI vendor ID, with device ids >= 0x1000. > We can specify that we accept all of them in the device ID table, and > then return -ENODEV in the probe routine. > I thought the device id range was smaller. Avi? Regards, Anthony Liguori > modprobe will load all the modules which match a given alias so we > might be loaded when we're not needed, but that's the worst that can > happen. > > Signed-off-by: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org> > --- > drivers/virtio/virtio_pci.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff -r 4edff5e24614 drivers/virtio/virtio_pci.c > --- a/drivers/virtio/virtio_pci.c Sun Jan 20 21:01:32 2008 +1100 > +++ b/drivers/virtio/virtio_pci.c Mon Jan 21 11:05:19 2008 +1100 > @@ -62,10 +62,9 @@ struct virtio_pci_vq_info > struct list_head node; > }; > > -/* We have to enumerate here all virtio PCI devices. */ > +/* Qumranet donated their vendor ID and devices >= 0x1000 */ > static struct pci_device_id virtio_pci_id_table[] = { > - { 0x1af4, 0x1000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* virtio net */ > - { 0x1af4, 0x1001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* virtio blk */ > + { 0x1af4, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, > { 0 }, > }; > > @@ -303,6 +302,10 @@ static int __devinit virtio_pci_probe(st > struct virtio_pci_device *vp_dev; > int err; > > + /* We only own device ids >= 0x1000 */ > + if (pci_dev->device < 0x1000) > + return -ENODEV; > + > /* allocate our structure and fill it out */ > vp_dev = kzalloc(sizeof(struct virtio_pci_device), GFP_KERNEL); > if (vp_dev == NULL) > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <479420D2.7050902-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] virtio: remove explicit pci ids from virtio_pci.c [not found] ` <479420D2.7050902-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> @ 2008-01-21 9:12 ` Avi Kivity [not found] ` <4794620E.7010900-atKUWr5tajBWk0Htik3J/w@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Avi Kivity @ 2008-01-21 9:12 UTC (permalink / raw) To: Anthony Liguori Cc: kvm-devel, virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA Anthony Liguori wrote: > Rusty Russell wrote: >> Qumranet let us use their PCI vendor ID, with device ids >= 0x1000. >> We can specify that we accept all of them in the device ID table, and >> then return -ENODEV in the probe routine. >> > > I thought the device id range was smaller. Avi? > Yes, 0x1000-0x10ff IIRC. Also, if we break compatibility in the future, won't this claim devices we don't actually support? -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <4794620E.7010900-atKUWr5tajBWk0Htik3J/w@public.gmane.org>]
* Re: [PATCH] virtio: remove explicit pci ids from virtio_pci.c [not found] ` <4794620E.7010900-atKUWr5tajBWk0Htik3J/w@public.gmane.org> @ 2008-01-21 11:22 ` Rusty Russell 0 siblings, 0 replies; 4+ messages in thread From: Rusty Russell @ 2008-01-21 11:22 UTC (permalink / raw) To: Avi Kivity Cc: kvm-devel, virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA On Monday 21 January 2008 20:12:46 Avi Kivity wrote: > Anthony Liguori wrote: > > Rusty Russell wrote: > >> Qumranet let us use their PCI vendor ID, with device ids >= 0x1000. > >> We can specify that we accept all of them in the device ID table, and > >> then return -ENODEV in the probe routine. > > > > I thought the device id range was smaller. Avi? > > Yes, 0x1000-0x10ff IIRC. > > Also, if we break compatibility in the future, won't this claim devices > we don't actually support? Yep, I reduced it to 0x1000 - 0x103F for the moment. We can always expand long before we get our 64th device type. Cheers, Rusty. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-01-21 11:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-21 0:30 [PATCH] virtio: remove explicit pci ids from virtio_pci.c Rusty Russell
[not found] ` <200801211130.51401.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
2008-01-21 4:34 ` Anthony Liguori
[not found] ` <479420D2.7050902-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-01-21 9:12 ` Avi Kivity
[not found] ` <4794620E.7010900-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-21 11:22 ` Rusty Russell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox