qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/4] pci: add default pci subsystem id for all d


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH 3/4] pci: add default pci subsystem id for all devices.
Date: Mon, 08 Sep 2008 10:45:03 +0200
User-agent: Thunderbird 2.0.0.16 (X11/20080723)

  Hi,

>> Each vendor can assign the device (and subdevice) IDs freely.
> 
> It's worth looking into because in virtio, we currently define the
> subvendor ID to be not the PCI vendor ID space.  I'll try to dig up a
> copy of the PCI spec and confirm.  If it's not required to be the PCI
> vendor ID space, then this patch is unnecessary.  We can just set it to
> a non-0 value of our choosing.

Ehrm, no.  I'll try a bit more verbose ...

Each PCI device has a PCI ID.  It should also have a PCI Subsystem ID.
The PCI subsystem ID wasn't mandatory in early PCI spec revisions, IIRC
2.0 added that requirement.  Thats why you usually get away without a
PCI subsystem ID, although it isn't correct.

Both IDs have a 16bit vendor and a 16bit device part.  The vendor IDs
are handed out by the PCI SIG.  The device IDs are assigned by the
vendor owning the vendor ID.

The PCI ID tells you which PCI chip is used, whereas the the PCI
Subsystem ID identifies the actual device (created using the PCI chip).

Example #1:  TV cards.  All TV cards using the bt878 chipset (first and
only one on the market for a few years in the 90-ies) have the same PCI
ID, the one of the bt878 chip.  But each TV card has different PCI
Subsystem IDs, which can be used to figure what the actual TV card is.

Example #2:  Laptops.  It is quite common to find the PCI Subsytem ID
pointing to the laptop vendor and model.  So the PCI ID says
'this is a intel ich7 ide controller', whereas the the PCI Subsystem ID
says 'this ich7 sits in a lenovo thinkpad', like this:

--------- cut here ----------
address@hidden ~]# lspci -vs1f.1
00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE
Controller (rev 02) (prog-if 8a [Master SecP PriP])
        Subsystem: Lenovo ThinkPad T60/R60 series
        [ ... more stuff snipped ... ]
--------- cut here ----------

In many cases it is enougth to know the PCI ID to handle a device
correctly.  Sometimes a device driver must identify the exact piece of
hardware (via PCI Subsystem ID) though.


Ok, now to qemu.  Right now the emulated PCI devices have no PCI
subsystem ID, only the PCI ID.  The discussed patch sets a default PCI
subsystem ID for all emulated devices.  Which will make the qemu devices
look pretty much like in the laptop case: all PCI subsystem IDs will
point to qemu by default.

If a driver emulates a very specific piece of hardware where it has to
emulate more than just the PCI chip, it can overwrite the PCI subsystem
ID without problems.  The es1370 driver does that for example.


Right now the patch uses the vendor ID 0xfffa.  XenSource grabbed a
temporary ID (before they got one official assigned) from the 0xfffx
space too.  We'll better get something official though, to avoid
clashes.  We could try to get a vendor ID assigned (no idea how
difficuilt and/or expensive that would be).  Or we could try get get a
device ID range from a vendor (like the qumranet-sponsored IDs for
virtio ...).

cheers,
  Gerd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]