On Mon, Apr 16, 2012 at 7:07 PM, Anthony Liguori <anth...@codemonkey.ws> wrote: > On 04/13/2012 09:27 AM, Stefan Hajnoczi wrote: >> >> Signed-off-by: Stefan Hajnoczi<stefa...@linux.vnet.ibm.com> >> --- >> tests/Makefile | 3 +- >> tests/virtio-test.c | 88 >> +++++++++++++++++++++++++++++++++++++++++++++++++++ >> 2 files changed, 90 insertions(+), 1 deletion(-) >> create mode 100644 tests/virtio-test.c >> >> diff --git a/tests/Makefile b/tests/Makefile >> index a98a848..fd0abf1 100644 >> --- a/tests/Makefile >> +++ b/tests/Makefile >> @@ -18,7 +18,7 @@ check-block-$(CONFIG_POSIX) += >> tests/qemu-iotests-quick.sh >> >> # All QTests for now are POSIX-only, but the dependencies are >> # really in libqtest, not in the testcases themselves. >> -check-qtest-i386-y = tests/rtc-test >> +check-qtest-i386-y = tests/rtc-test tests/virtio-test >> check-qtest-x86_64-y = $(check-qtest-i386-y) >> >> GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h >> tests/test-qmp-commands.h >> @@ -64,6 +64,7 @@ tests/test-qmp-input-strict$(EXESUF): >> tests/test-qmp-input-strict.o $(test-qapi- >> tests/test-qmp-commands$(EXESUF): tests/test-qmp-commands.o >> tests/test-qmp-marshal.o $(test-qapi-obj-y) >> >> tests/rtc-test$(EXESUF): tests/rtc-test.o $(trace-obj-y) >> +tests/virtio-test$(EXESUF): tests/virtio-test.o tests/libpci.o >> $(trace-obj-y) >> >> # QTest rules >> >> diff --git a/tests/virtio-test.c b/tests/virtio-test.c >> new file mode 100644 >> index 0000000..7ed564e >> --- /dev/null >> +++ b/tests/virtio-test.c >> @@ -0,0 +1,88 @@ >> +/* >> + * QTest testcase demo for virtio-pci devices >> + * >> + * Copyright IBM, Corp. 2012 >> + * >> + * Authors: >> + * Stefan Hajnoczi<stefa...@linux.vnet.ibm.com> >> + * >> + * This work is licensed under the terms of the GNU GPL, version 2 or >> later. >> + * See the COPYING file in the top-level directory. >> + * >> + */ >> + >> +#include<glib.h> >> +#include<string.h> >> +#include "bswap.h" >> +#include "libpci.h" >> +#include "hw/virtio-defs.h" >> +#include "hw/virtio-pci-defs.h" >> +#include "libqtest.h" >> + >> +enum { >> + /* Device address for this test */ >> + TEST_PCI_SLOT = 5, >> + TEST_PCI_FUNC = 0, >> + TEST_BAR0_IOADDR = 0x1000, > > > IIRC, PCI ioport space starts at 0xc000.
I got this from cat /proc/ioports but now that I look again I don't see a PCI device there. I'll switch to 0xc000. Stefan