Re: [Qemu-devel] [RFC] Functions bus_foreach and device_find from libqos virtio API

2014-06-24 Thread Marc Marí
Hello > > -/* Tests only initialization so far. TODO: Replace with functional > > tests */ -static void pci_nop(void) > > +#define TEST_IMAGE_SIZE (64 * 1024 * 1024) > > + > > +static char tmp_path[] = "/tmp/qtest.XX"; > > +extern QVirtioBus qvirtio_pci; > > + > > +static void pci_basic(void)

Re: [Qemu-devel] [RFC] Functions bus_foreach and device_find from libqos virtio API

2014-06-24 Thread Marc Marí
Hello > > +for (slot = 0; slot < 32; slot++) { > > +for (fn = 0; fn < 8; fn++) { > > +dev = g_malloc0(sizeof(*dev)); > > +dev->bus = bus; > > +dev->devfn = QPCI_DEVFN(slot, fn); > > + > > +if (qpci_config_readw(dev, PCI_VENDOR_ID) == 0xFF

Re: [Qemu-devel] [RFC] Functions bus_foreach and device_find from libqos virtio API

2014-06-23 Thread Fam Zheng
On Mon, 06/23 16:55, Marc Marí wrote: > diff --git a/tests/Makefile b/tests/Makefile > index 4caf7de..b85a036 100644 > --- a/tests/Makefile > +++ b/tests/Makefile > @@ -282,6 +282,7 @@ libqos-obj-y += tests/libqos/i2c.o > libqos-pc-obj-y = $(libqos-obj-y) tests/libqos/pci-pc.o > libqos-pc-obj-y +

Re: [Qemu-devel] [RFC] Functions bus_foreach and device_find from libqos virtio API

2014-06-23 Thread Stefan Hajnoczi
On Mon, Jun 23, 2014 at 04:55:22PM +0200, Marc Marí wrote: > +static QVirtioDevice *qpcidevice_to_qvirtiodevice(QPCIDevice *dpci) > +{ > +QVirtioDevice *dvirtio; > +dvirtio = g_malloc0(sizeof(*dvirtio)); > + > +if (dpci) { > +dvirtio->device_id = qpci_config_readw(dpci, PCI_DEVI

[Qemu-devel] [RFC] Functions bus_foreach and device_find from libqos virtio API

2014-06-23 Thread Marc Marí
Virtio header has been changed to compile and work with a real device. Functions bus_foreach and device_find have been implemented for PCI. Virtio-blk test case now opens a fake device. Signed-off-by: Marc Marí --- tests/Makefile|3 +- tests/libqos/virtio-pci.c | 123 +++