qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/3] Use macros for virtio-net PCI vendor/device IDs
@ 2009-01-16 11:12 Mark McLoughlin
  2009-01-16 11:12 ` [Qemu-devel] [PATCH 2/3] Add macro for virtio-console PCI device ID Mark McLoughlin
  0 siblings, 1 reply; 5+ messages in thread
From: Mark McLoughlin @ 2009-01-16 11:12 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Mark McLoughlin, qemu-devel

Gerd added these macros a while back.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 hw/virtio-net.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 54c0030..b13914a 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -320,7 +320,9 @@ void virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
     VirtIONet *n;
     static int virtio_net_id;
 
-    n = (VirtIONet *)virtio_init_pci(bus, "virtio-net", 6900, 0x1000,
+    n = (VirtIONet *)virtio_init_pci(bus, "virtio-net",
+                                     PCI_VENDOR_ID_REDHAT_QUMRANET,
+                                     PCI_DEVICE_ID_VIRTIO_NET,
                                      0, VIRTIO_ID_NET,
                                      0x02, 0x00, 0x00,
                                      sizeof(struct virtio_net_config),
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 2/3] Add macro for virtio-console PCI device ID
  2009-01-16 11:12 [Qemu-devel] [PATCH 1/3] Use macros for virtio-net PCI vendor/device IDs Mark McLoughlin
@ 2009-01-16 11:12 ` Mark McLoughlin
  2009-01-16 11:12   ` [Qemu-devel] [PATCH 3/3] Use the default subsystem vendor ID for virtio devices Mark McLoughlin
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mark McLoughlin @ 2009-01-16 11:12 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Mark McLoughlin, qemu-devel

Also use the existing macro for the PCI vendor ID

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 hw/pci.h            |    1 +
 hw/virtio-console.c |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/hw/pci.h b/hw/pci.h
index 76f4474..e791141 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -16,6 +16,7 @@ extern target_phys_addr_t pci_mem_base;
 #define PCI_DEVICE_ID_VIRTIO_NET         0x1000
 #define PCI_DEVICE_ID_VIRTIO_BLOCK       0x1001
 #define PCI_DEVICE_ID_VIRTIO_BALLOON     0x1002
+#define PCI_DEVICE_ID_VIRTIO_CONSOLE     0x1003
 
 typedef void PCIConfigWriteFunc(PCIDevice *pci_dev,
                                 uint32_t address, uint32_t data, int len);
diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index deae76d..ce20c91 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -126,7 +126,8 @@ void *virtio_console_init(PCIBus *bus, CharDriverState *chr)
     VirtIOConsole *s;
 
     s = (VirtIOConsole *)virtio_init_pci(bus, "virtio-console",
-                                         6900, 0x1003,
+                                         PCI_VENDOR_ID_REDHAT_QUMRANET,
+                                         PCI_DEVICE_ID_VIRTIO_CONSOLE,
                                          0, VIRTIO_ID_CONSOLE,
                                          0x03, 0x80, 0x00,
                                          0, sizeof(VirtIOConsole));
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 3/3] Use the default subsystem vendor ID for virtio devices
  2009-01-16 11:12 ` [Qemu-devel] [PATCH 2/3] Add macro for virtio-console PCI device ID Mark McLoughlin
@ 2009-01-16 11:12   ` Mark McLoughlin
  2009-01-16 11:56   ` [Qemu-devel] [PATCH 2/3] Add macro for virtio-console PCI device ID Gerd Hoffmann
       [not found]   ` <1232977378.3724.85.camel@blaa>
  2 siblings, 0 replies; 5+ messages in thread
From: Mark McLoughlin @ 2009-01-16 11:12 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Mark McLoughlin, qemu-devel

A subsystem vendor ID of zero isn't allowed, so we use our
default ID.

Gerd points out that although the PCI subsystem vendor ID is
treated by the guest as the virtio vendor ID:

   /* we use the subsystem vendor/device id as the virtio vendor/device
    * id.  this allows us to use the same PCI vendor/device id for all
    * virtio devices and to identify the particular virtio driver by
    * the subsytem ids */
    vp_dev->vdev.id.vendor = pci_dev->subsystem_vendor;
    vp_dev->vdev.id.device = pci_dev->subsystem_device;

it looks like only the device ID is used right now:

   # grep virtio modules.alias
   alias virtio:d00000001v* virtio_net
   alias virtio:d00000002v* virtio_blk
   alias virtio:d00000003v* virtio_console
   alias virtio:d00000004v* virtio-rng
   alias virtio:d00000005v* virtio_balloon
   alias pci:v00001AF4d*sv*sd*bc*sc*i* virtio_pci
   alias virtio:d00000009v* 9pnet_virtio

so setting the subsystem vendor id to something != zero shouldn't cause
trouble.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 hw/virtio-balloon.c |    3 ++-
 hw/virtio-blk.c     |    3 ++-
 hw/virtio-console.c |    3 ++-
 hw/virtio-net.c     |    3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
index 0765516..696a108 100644
--- a/hw/virtio-balloon.c
+++ b/hw/virtio-balloon.c
@@ -174,7 +174,8 @@ void *virtio_balloon_init(PCIBus *bus)
     s = (VirtIOBalloon *)virtio_init_pci(bus, "virtio-balloon",
                                          PCI_VENDOR_ID_REDHAT_QUMRANET,
                                          PCI_DEVICE_ID_VIRTIO_BALLOON,
-                                         0, VIRTIO_ID_BALLOON,
+                                         PCI_VENDOR_ID_REDHAT_QUMRANET,
+                                         VIRTIO_ID_BALLOON,
                                          0x05, 0x00, 0x00,
                                          8, sizeof(VirtIOBalloon));
     if (s == NULL)
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index e654cc5..847e221 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -227,7 +227,8 @@ void *virtio_blk_init(PCIBus *bus, BlockDriverState *bs)
     s = (VirtIOBlock *)virtio_init_pci(bus, "virtio-blk",
                                        PCI_VENDOR_ID_REDHAT_QUMRANET,
                                        PCI_DEVICE_ID_VIRTIO_BLOCK,
-                                       0, VIRTIO_ID_BLOCK,
+                                       PCI_VENDOR_ID_REDHAT_QUMRANET,
+                                       VIRTIO_ID_BLOCK,
                                        0x01, 0x80, 0x00,
                                        sizeof(struct virtio_blk_config), sizeof(VirtIOBlock));
     if (!s)
diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index ce20c91..333ffb1 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -128,7 +128,8 @@ void *virtio_console_init(PCIBus *bus, CharDriverState *chr)
     s = (VirtIOConsole *)virtio_init_pci(bus, "virtio-console",
                                          PCI_VENDOR_ID_REDHAT_QUMRANET,
                                          PCI_DEVICE_ID_VIRTIO_CONSOLE,
-                                         0, VIRTIO_ID_CONSOLE,
+                                         PCI_VENDOR_ID_REDHAT_QUMRANET,
+                                         VIRTIO_ID_CONSOLE,
                                          0x03, 0x80, 0x00,
                                          0, sizeof(VirtIOConsole));
     if (s == NULL)
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index b13914a..28f9280 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -323,7 +323,8 @@ void virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
     n = (VirtIONet *)virtio_init_pci(bus, "virtio-net",
                                      PCI_VENDOR_ID_REDHAT_QUMRANET,
                                      PCI_DEVICE_ID_VIRTIO_NET,
-                                     0, VIRTIO_ID_NET,
+                                     PCI_VENDOR_ID_REDHAT_QUMRANET,
+                                     VIRTIO_ID_NET,
                                      0x02, 0x00, 0x00,
                                      sizeof(struct virtio_net_config),
                                      sizeof(VirtIONet));
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] Add macro for virtio-console PCI device ID
  2009-01-16 11:12 ` [Qemu-devel] [PATCH 2/3] Add macro for virtio-console PCI device ID Mark McLoughlin
  2009-01-16 11:12   ` [Qemu-devel] [PATCH 3/3] Use the default subsystem vendor ID for virtio devices Mark McLoughlin
@ 2009-01-16 11:56   ` Gerd Hoffmann
       [not found]   ` <1232977378.3724.85.camel@blaa>
  2 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2009-01-16 11:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Mark McLoughlin

> +#define PCI_DEVICE_ID_VIRTIO_CONSOLE     0x1003

pci-ids.txt needs an update too (as vmchannel goes another route now
reassigning 1af4:1003 to the console is fine).

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] Re: [PATCH 3/3][RESEND] Use the default subsystem vendor ID for virtio devices
       [not found]   ` <1232977378.3724.85.camel@blaa>
@ 2009-01-26 15:17     ` Anthony Liguori
  0 siblings, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2009-01-26 15:17 UTC (permalink / raw)
  To: Mark McLoughlin; +Cc: qemu-devel

Mark McLoughlin wrote:
> A subsystem vendor ID of zero isn't allowed, so we use our
> default ID.
>
> Gerd points out that although the PCI subsystem vendor ID is
> treated by the guest as the virtio vendor ID:
>   

The thinking was to allow the subsystem vendor ID to be a virtio 
specific vendor ID.

If it's required to be a PCI vendor ID, then I guess that's what we'll 
have to do.

Regards,

Anthony Liguori

>    /* we use the subsystem vendor/device id as the virtio vendor/device
>     * id.  this allows us to use the same PCI vendor/device id for all
>     * virtio devices and to identify the particular virtio driver by
>     * the subsytem ids */
>     vp_dev->vdev.id.vendor = pci_dev->subsystem_vendor;
>     vp_dev->vdev.id.device = pci_dev->subsystem_device;
>
> it looks like only the device ID is used right now:
>
>    # grep virtio modules.alias
>    alias virtio:d00000001v* virtio_net
>    alias virtio:d00000002v* virtio_blk
>    alias virtio:d00000003v* virtio_console
>    alias virtio:d00000004v* virtio-rng
>    alias virtio:d00000005v* virtio_balloon
>    alias pci:v00001AF4d*sv*sd*bc*sc*i* virtio_pci
>    alias virtio:d00000009v* 9pnet_virtio
>
> so setting the subsystem vendor id to something != zero shouldn't cause
> trouble.
>
> Signed-off-by: Mark McLoughlin <markmc@redhat.com>
> ---
>  hw/virtio-balloon.c |    3 ++-
>  hw/virtio-blk.c     |    3 ++-
>  hw/virtio-console.c |    3 ++-
>  hw/virtio-net.c     |    3 ++-
>  4 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
> index 0765516..696a108 100644
> --- a/hw/virtio-balloon.c
> +++ b/hw/virtio-balloon.c
> @@ -174,7 +174,8 @@ void *virtio_balloon_init(PCIBus *bus)
>      s = (VirtIOBalloon *)virtio_init_pci(bus, "virtio-balloon",
>                                           PCI_VENDOR_ID_REDHAT_QUMRANET,
>                                           PCI_DEVICE_ID_VIRTIO_BALLOON,
> -                                         0, VIRTIO_ID_BALLOON,
> +                                         PCI_VENDOR_ID_REDHAT_QUMRANET,
> +                                         VIRTIO_ID_BALLOON,
>                                           0x05, 0x00, 0x00,
>                                           8, sizeof(VirtIOBalloon));
>      if (s == NULL)
> diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
> index e654cc5..847e221 100644
> --- a/hw/virtio-blk.c
> +++ b/hw/virtio-blk.c
> @@ -227,7 +227,8 @@ void *virtio_blk_init(PCIBus *bus, BlockDriverState *bs)
>      s = (VirtIOBlock *)virtio_init_pci(bus, "virtio-blk",
>                                         PCI_VENDOR_ID_REDHAT_QUMRANET,
>                                         PCI_DEVICE_ID_VIRTIO_BLOCK,
> -                                       0, VIRTIO_ID_BLOCK,
> +                                       PCI_VENDOR_ID_REDHAT_QUMRANET,
> +                                       VIRTIO_ID_BLOCK,
>                                         0x01, 0x80, 0x00,
>                                         sizeof(struct virtio_blk_config), sizeof(VirtIOBlock));
>      if (!s)
> diff --git a/hw/virtio-console.c b/hw/virtio-console.c
> index ce20c91..333ffb1 100644
> --- a/hw/virtio-console.c
> +++ b/hw/virtio-console.c
> @@ -128,7 +128,8 @@ void *virtio_console_init(PCIBus *bus, CharDriverState *chr)
>      s = (VirtIOConsole *)virtio_init_pci(bus, "virtio-console",
>                                           PCI_VENDOR_ID_REDHAT_QUMRANET,
>                                           PCI_DEVICE_ID_VIRTIO_CONSOLE,
> -                                         0, VIRTIO_ID_CONSOLE,
> +                                         PCI_VENDOR_ID_REDHAT_QUMRANET,
> +                                         VIRTIO_ID_CONSOLE,
>                                           0x03, 0x80, 0x00,
>                                           0, sizeof(VirtIOConsole));
>      if (s == NULL)
> diff --git a/hw/virtio-net.c b/hw/virtio-net.c
> index b13914a..28f9280 100644
> --- a/hw/virtio-net.c
> +++ b/hw/virtio-net.c
> @@ -323,7 +323,8 @@ void virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
>      n = (VirtIONet *)virtio_init_pci(bus, "virtio-net",
>                                       PCI_VENDOR_ID_REDHAT_QUMRANET,
>                                       PCI_DEVICE_ID_VIRTIO_NET,
> -                                     0, VIRTIO_ID_NET,
> +                                     PCI_VENDOR_ID_REDHAT_QUMRANET,
> +                                     VIRTIO_ID_NET,
>                                       0x02, 0x00, 0x00,
>                                       sizeof(struct virtio_net_config),
>                                       sizeof(VirtIONet));
>   

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-01-26 17:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-16 11:12 [Qemu-devel] [PATCH 1/3] Use macros for virtio-net PCI vendor/device IDs Mark McLoughlin
2009-01-16 11:12 ` [Qemu-devel] [PATCH 2/3] Add macro for virtio-console PCI device ID Mark McLoughlin
2009-01-16 11:12   ` [Qemu-devel] [PATCH 3/3] Use the default subsystem vendor ID for virtio devices Mark McLoughlin
2009-01-16 11:56   ` [Qemu-devel] [PATCH 2/3] Add macro for virtio-console PCI device ID Gerd Hoffmann
     [not found]   ` <1232977378.3724.85.camel@blaa>
2009-01-26 15:17     ` [Qemu-devel] Re: [PATCH 3/3][RESEND] Use the default subsystem vendor ID for virtio devices Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).