Skip to contentSkip to conversation

add virtio vendor capability support

PATCH Applied Gerd Hoffmann 2 participants 5 messages Jan 21, 2015 – Jan 23, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 add virtio vendor capability support

virtio uses vendor-specific capabilities to specify the location of the virtio register ranges. The specification can be found here:

http://docs.oasis-open.org/virtio/virtio/v1.0/cs01/virtio-v1.0-cs01.html#x1-690004

This patch adds support for decoding these capabilities to lspci.

---
 Makefile         |  2 +-
 ls-caps-vendor.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 ls-caps.c        |  2 +-
 lspci.h          |  4 +++
 4 files changed, 82 insertions(+), 2 deletions(-)
 create mode 100644 ls-caps-vendor.c
Makefile +1 -1
index 8d49afa..39a07d1 100644
@@ -69,7 +69,7 @@ force:
 lib/config.h lib/config.mk:
 	cd lib && ./configure
 
-lspci: lspci.o ls-vpd.o ls-caps.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o common.o lib/$(PCILIB)
+lspci: lspci.o ls-vpd.o ls-caps.o ls-caps-vendor.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o common.o lib/$(PCILIB)
 setpci: setpci.o common.o lib/$(PCILIB)
 
 LSPCIINC=lspci.h pciutils.h $(PCIINC)
ls-caps-vendor.c new file +76 -0

76 lines not on this page · raw message

ls-caps.c +1 -1
index 7de55ef..c145ed6 100644
@@ -1315,7 +1315,7 @@ show_caps(struct device *d, int where)
 	      cap_ht(d, where, cap);
 	      break;
 	    case PCI_CAP_ID_VNDR:
-	      printf("Vendor Specific Information: Len=%02x <?>\n", BITS(cap, 0, 8));
+	      show_vendor_caps(d, where, cap);
 	      break;
 	    case PCI_CAP_ID_DBG:
 	      cap_debug_port(cap);
lspci.h +4 -0
index 86429b2..a3fc9d0 100644
@@ -70,6 +70,10 @@ void show_caps(struct device *d, int where);
 
 void show_ext_caps(struct device *d);
 
+/* ls-caps-vendor.c */
+
+void show_vendor_caps(struct device *d, int where, int cap);
+
 /* ls-kernel.c */
 
 void show_kernel_machine(struct device *d UNUSED);
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 1 line · Martin Mares

lspci -vxxx

Attached is a dump of a virtio-net device (both verbose=2 and hex).

cheers,
Gerd

00:09.0 Ethernet controller: Red Hat, Inc Virtio network device

	Subsystem: Red Hat, Inc Virtio network device
	Physical Slot: 9
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 10
	Region 0: I/O ports at c060 [size=32]
	Region 1: Memory at febd6000 (32-bit, non-prefetchable) [size=4K]
	Region 2: Memory at fea00000 (32-bit, non-prefetchable) [size=512K]
	Expansion ROM at feb80000 [disabled] [size=256K]
	Capabilities: [84] MSI-X: Enable+ Count=3 Masked-
		Vector table: BAR=1 offset=00000000
		PBA: BAR=1 offset=00000800
	Capabilities: [70] VirtIO: Notify
		BAR=2 offset=00003000 size=00040000
		multiplier=00001000
	Capabilities: [60] VirtIO: DeviceCfg
		BAR=2 offset=00002000 size=00001000
	Capabilities: [50] VirtIO: ISR
		BAR=2 offset=00001000 size=00001000
	Capabilities: [40] VirtIO: CommonCfg
		BAR=2 offset=00000000 size=00001000
	Kernel driver in use: virtio-pci

00: f4 1a 00 10 07 05 10 00 00 00 00 02 00 00 00 00 10: 61 c0 00 00 00 60 bd fe 00 00 a0 fe 00 00 00 00 20: 00 00 00 00 00 00 00 00 00 00 00 00 f4 1a 01 00 30: 00 00 b8 fe 84 00 00 00 00 00 00 00 0a 01 00 00 40: 09 00 10 01 02 00 00 00 00 00 00 00 00 10 00 00 50: 09 40 10 03 02 00 00 00 00 10 00 00 00 10 00 00 60: 09 50 10 04 02 00 00 00 00 20 00 00 00 10 00 00 70: 09 60 14 02 02 00 00 00 00 30 00 00 00 00 04 00 80: 00 10 00 00 11 70 02 80 01 00 00 00 01 08 00 00 90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

_______________________________________________
Virtualization mailing list [email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 1 line

Attached is a dump of a virtio-net device (both verbose=2 and hex).

Thanks!

I have cleaned up the code a little, could you please check that it still works for you?

Martin

#5 lore raw
Quoted 6 lines · Martin Mares
Quoted 1 line

Attached is a dump of a virtio-net device (both verbose=2 and hex).

Thanks!

I have cleaned up the code a little, could you please check that it still works for you?

Works fine.

cheers,
Gerd