qemu
14 years agoqemu-io: Improve portability (win32 now supported).
Stefan Weil [Mon, 31 Aug 2009 20:16:16 +0000 (22:16 +0200)]
qemu-io: Improve portability (win32 now supported).

* Add missing include for struct timeval.
* Replace non-portable strsep by local qemu_strsep.
* Use POSIX basename by including libgen.h.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoFix spelling in comment.
Stefan Weil [Mon, 31 Aug 2009 19:42:16 +0000 (21:42 +0200)]
Fix spelling in comment.

The company which made Virtual PC was Connectix.
They use the magic string "conectix" in their disk images.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqdev: convert tcx to reset + vmsd
Gerd Hoffmann [Tue, 1 Sep 2009 07:56:15 +0000 (09:56 +0200)]
qdev: convert tcx to reset + vmsd

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqdev: integrate vmstate
Gerd Hoffmann [Tue, 1 Sep 2009 07:56:14 +0000 (09:56 +0200)]
qdev: integrate vmstate

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqdev: convert rtl8139 to reset
Gerd Hoffmann [Tue, 1 Sep 2009 07:56:13 +0000 (09:56 +0200)]
qdev: convert rtl8139 to reset

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqdev: integrate reset
Gerd Hoffmann [Tue, 1 Sep 2009 07:56:12 +0000 (09:56 +0200)]
qdev: integrate reset

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqdev/scsi+usb: convert usb-storage to qdev.
Gerd Hoffmann [Mon, 31 Aug 2009 12:24:05 +0000 (14:24 +0200)]
qdev/scsi+usb: convert usb-storage to qdev.

Full coverage with properties and everything.  You can add virtual usb
sticks this way now:

  -drive if=none,id=pendrive,path=/some/where
  -device usb-storage,drive=pendrive

-usbdevice disk:/path/to/image continues to work.

Other side effects:
usb storage is listed in 'info block' now.
kvm tree should be able to boot from usb via extboot (untested though).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqdev/scsi: add scsi bus support to qdev, convert drivers.
Gerd Hoffmann [Mon, 31 Aug 2009 12:24:04 +0000 (14:24 +0200)]
qdev/scsi: add scsi bus support to qdev, convert drivers.

* Add SCSIBus.
 * Add SCSIDeviceInfo, move device callbacks here.
 * add qdev/scsi helper functions.
 * convert drivers.

Adding scsi disks via -device works now, i.e. you can do:

 -drive id=sda,if=none,...
 -device lsi
 -device scsi-disk,drive=sda

legacy command lines (-drive if=scsi,...) continue to work.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqdev/usb: convert ohci.
Gerd Hoffmann [Mon, 31 Aug 2009 12:24:03 +0000 (14:24 +0200)]
qdev/usb: convert ohci.

Drop num_ports argument for usb_ohci_init_pci(), everybody
calls it with num_ports == 3, so it is pointless.

Convert ohci pci device into qdev.
TODO: convert non-pci ohci adapters.

You can add a OHCI USB Controller to your virtual pc now using
'-device pci-ohci'.  Specifying a id is a good idea, so you can
attach usb devices to it, like this:

  -device pci-ohci,id=ohci
  -device usb-mouse,bus=ohci.0

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqdev/usb: convert uhci.
Gerd Hoffmann [Mon, 31 Aug 2009 12:24:02 +0000 (14:24 +0200)]
qdev/usb: convert uhci.

Hookup pci device into qdev.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqdev/usb: add some convinience aliases.
Gerd Hoffmann [Mon, 31 Aug 2009 12:24:01 +0000 (14:24 +0200)]
qdev/usb: add some convinience aliases.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqdev/usb: make qemu aware of usb busses.
Gerd Hoffmann [Mon, 31 Aug 2009 12:24:00 +0000 (14:24 +0200)]
qdev/usb: make qemu aware of usb busses.

Move usb code from vl.c to usb-bus.c and make it use the new data
structures added by qdev conversion.  qemu usb core should be able
to handle multiple USB busses just fine now (untested though).

Kill some usb_*_init() legacy functions, use usb_create_simple()
instead.

Kill some FIXMEs added by the first qdev/usb patch.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqdev/usb: add usb bus support to qdev, convert drivers.
Gerd Hoffmann [Mon, 31 Aug 2009 12:23:59 +0000 (14:23 +0200)]
qdev/usb: add usb bus support to qdev, convert drivers.

* Add USBBus.
 * Add USBDeviceInfo, move device callbacks here.
 * Add usb-qdev helper functions.
 * Switch drivers to qdev.

TODO:
 * make the rest of qemu aware of usb busses and kill the FIXMEs
   added by this patch.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqdev: add error message to qdev_device_add().
Gerd Hoffmann [Mon, 31 Aug 2009 12:23:58 +0000 (14:23 +0200)]
qdev: add error message to qdev_device_add().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoallow passing null machine pointer to drive_init().
Gerd Hoffmann [Mon, 31 Aug 2009 12:23:57 +0000 (14:23 +0200)]
allow passing null machine pointer to drive_init().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agosavevm: Convert loadvm handlers list to LIST
Juan Quintela [Tue, 1 Sep 2009 00:12:33 +0000 (02:12 +0200)]
savevm: Convert loadvm handlers list to LIST

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoAdd LIST_FOREACH_SAFE() definition
Juan Quintela [Tue, 1 Sep 2009 00:12:32 +0000 (02:12 +0200)]
Add LIST_FOREACH_SAFE() definition

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agosavevm: Convert savevm handlers list to TAILQ
Juan Quintela [Tue, 1 Sep 2009 00:12:31 +0000 (02:12 +0200)]
savevm: Convert savevm handlers list to TAILQ

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agocirrus_vga: CIRRUS_HOOK_* is not used anymore
Juan Quintela [Mon, 31 Aug 2009 14:07:33 +0000 (16:07 +0200)]
cirrus_vga: CIRRUS_HOOK_* is not used anymore

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agocirrus_vga: rename cirrus_hook_write_cr() cirrus_vga_write_cr()
Juan Quintela [Mon, 31 Aug 2009 14:07:32 +0000 (16:07 +0200)]
cirrus_vga: rename cirrus_hook_write_cr() cirrus_vga_write_cr()

Simplify the logic to do everything inside the function.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agocirrus_vga: rename cirrus_hook_read_cr() cirrus_vga_read_cr()
Juan Quintela [Mon, 31 Aug 2009 14:07:31 +0000 (16:07 +0200)]
cirrus_vga: rename cirrus_hook_read_cr() cirrus_vga_read_cr()

Simplify the logic to do everything inside the function.  Return 0xff if index is out of range independetly of DEBUG_CIRRUS

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agocirrus_vga: rename cirrus_hook_write_gr() cirrus_vga_write_gr()
Juan Quintela [Mon, 31 Aug 2009 14:07:30 +0000 (16:07 +0200)]
cirrus_vga: rename cirrus_hook_write_gr() cirrus_vga_write_gr()

Simplify the logic to do everything inside the function.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agocirrus_vga: rename cirrus_hook_read_gr() cirrus_vga_read_gr()
Juan Quintela [Mon, 31 Aug 2009 14:07:29 +0000 (16:07 +0200)]
cirrus_vga: rename cirrus_hook_read_gr() cirrus_vga_read_gr()

Simplify the logic to do everything inside the function.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agocirrus_vga: rename cirrus_hook_write_palette() cirrus_vga_write_palette()
Juan Quintela [Mon, 31 Aug 2009 14:07:28 +0000 (16:07 +0200)]
cirrus_vga: rename cirrus_hook_write_palette() cirrus_vga_write_palette()

Simplify the logic to do everything inside the function

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agocirrus_vga: rename cirrus_hook_read_palette() cirrus_vga_read_palette()
Juan Quintela [Mon, 31 Aug 2009 14:07:27 +0000 (16:07 +0200)]
cirrus_vga: rename cirrus_hook_read_palette() cirrus_vga_read_palette()

Simplify the logic to do everything inside the function

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agocirrus_vga: rename cirrus_hook_write_sr() cirrus_vga_write_sr()
Juan Quintela [Mon, 31 Aug 2009 14:07:26 +0000 (16:07 +0200)]
cirrus_vga: rename cirrus_hook_write_sr() cirrus_vga_write_sr()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agocirrus_vga: rename cirrus_hook_read_sr() cirrus_vga_read_sr()
Juan Quintela [Mon, 31 Aug 2009 14:07:25 +0000 (16:07 +0200)]
cirrus_vga: rename cirrus_hook_read_sr() cirrus_vga_read_sr()

And make it a real function

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovga: Rename last VGAState occurrences to VGACommonState
Juan Quintela [Mon, 31 Aug 2009 14:07:24 +0000 (16:07 +0200)]
vga: Rename last VGAState occurrences to VGACommonState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovga and cirrus_vga: substitute switch for equivalent assigntment
Juan Quintela [Mon, 31 Aug 2009 14:07:23 +0000 (16:07 +0200)]
vga and cirrus_vga: substitute switch for equivalent assigntment

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agocirrus_vga: make cirrus_read_hidden_dac() return its result
Juan Quintela [Mon, 31 Aug 2009 14:07:22 +0000 (16:07 +0200)]
cirrus_vga: make cirrus_read_hidden_dac() return its result

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovga: change tabs to spaces
Juan Quintela [Mon, 31 Aug 2009 14:07:21 +0000 (16:07 +0200)]
vga: change tabs to spaces

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agocirrus_vga: Add a VGACommonState local var to cirrus_vga_ioport_{read, write}
Juan Quintela [Mon, 31 Aug 2009 14:07:20 +0000 (16:07 +0200)]
cirrus_vga: Add a VGACommonState local var to cirrus_vga_ioport_{read, write}

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovga and cirrus_vga: create vga_ioport_invalid() and use it everywhere
Juan Quintela [Mon, 31 Aug 2009 14:07:19 +0000 (16:07 +0200)]
vga and cirrus_vga: create vga_ioport_invalid() and use it everywhere

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovga: split vga-isa-mm.o
Juan Quintela [Mon, 31 Aug 2009 14:07:18 +0000 (16:07 +0200)]
vga: split vga-isa-mm.o

It is only used in mips softmmu, compile only there.
it_shift field was only used for vga_isa_mm, move it from VGACommonState
to ISAVGAMMstate.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovga: export vga_mem_{read,write}
Juan Quintela [Mon, 31 Aug 2009 14:07:17 +0000 (16:07 +0200)]
vga: export vga_mem_{read,write}

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovga: split isa bits inco vga-isa.c
Juan Quintela [Mon, 31 Aug 2009 14:07:16 +0000 (16:07 +0200)]
vga: split isa bits inco vga-isa.c

Adjust all the VGAState in VGACommonState
Compile vga-isa.o in the targets that use it

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovga: split pci bits into vga-pci.c
Juan Quintela [Mon, 31 Aug 2009 14:07:15 +0000 (16:07 +0200)]
vga: split pci bits into vga-pci.c

Adjust all the VGAState in VGACommonState
Compile vga-pci.o only for targets that use it.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovga: split vga_{load, save} into pci and common parts
Juan Quintela [Mon, 31 Aug 2009 14:07:14 +0000 (16:07 +0200)]
vga: split vga_{load, save} into pci and common parts

Once there adjust VGAState <-> VGACommonState
Export vga_common_save/vga_common_load (nreeded by wmvare_vga
Remove vga.pci_dev field, it is not needed anymore

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovga: export vga_ioport_{read,write}
Juan Quintela [Mon, 31 Aug 2009 14:07:13 +0000 (16:07 +0200)]
vga: export vga_ioport_{read,write}

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agocirrus_vga: prefix vga_ioport_{read, write} with cirrus
Juan Quintela [Mon, 31 Aug 2009 14:07:12 +0000 (16:07 +0200)]
cirrus_vga: prefix vga_ioport_{read, write} with cirrus

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovga: remove useless cast from void *
Juan Quintela [Mon, 31 Aug 2009 14:07:11 +0000 (16:07 +0200)]
vga: remove useless cast from void *

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoUSB: use opaque parameter passing for monitor handle
Blue Swirl [Mon, 7 Sep 2009 19:00:18 +0000 (19:00 +0000)]
USB: use opaque parameter passing for monitor handle

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoSparc64: use ISA bus for i8042
Blue Swirl [Sun, 6 Sep 2009 16:34:18 +0000 (16:34 +0000)]
Sparc64: use ISA bus for i8042

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoSparc64: remove unused variables
Blue Swirl [Sun, 6 Sep 2009 16:32:34 +0000 (16:32 +0000)]
Sparc64: remove unused variables

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoMake ioport default tables const
Blue Swirl [Sun, 6 Sep 2009 16:32:13 +0000 (16:32 +0000)]
Make ioport default tables const

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoFix indentation
Blue Swirl [Sun, 6 Sep 2009 16:31:58 +0000 (16:31 +0000)]
Fix indentation

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoWhen targeting PPU use rlwinm instead of andi. if possible
malc [Sun, 6 Sep 2009 02:31:09 +0000 (06:31 +0400)]
When targeting PPU use rlwinm instead of andi. if possible

andi. is microcoded and slow there.

Signed-off-by: malc <av1474@comtv.ru>

14 years agoChecks in select_soundhw were never intended to accept abbreviations
malc [Sun, 6 Sep 2009 02:49:03 +0000 (06:49 +0400)]
Checks in select_soundhw were never intended to accept abbreviations

Signed-off-by: malc <av1474@comtv.ru>

14 years agoFix Sparse warnings: add "static"
Blue Swirl [Sat, 5 Sep 2009 10:14:07 +0000 (10:14 +0000)]
Fix Sparse warnings: add "static"

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoesp: handle "select without attention"
Artyom Tarasenko [Sat, 5 Sep 2009 06:24:47 +0000 (06:24 +0000)]
esp: handle "select without attention"

Up to now "select without attention" was handled the same way as
"select with attention". According to

http://www.ibiblio.org/pub/historic-linux/early-ports/Sparc/NCR/NCR53C9X.txt

select without ATN sends the CDB (Command Descriptor Block) directly,
whereas select with ATN sends one message phase byte
followed by 6, 10, or 12 command phase bytes.

The attached patch implements the behaviour described above.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
[blauwirbel@gmail.com: cleaned up formatting]
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoInclude sys-queue.h early to override system queue definitions on BSD
Blue Swirl [Fri, 4 Sep 2009 17:47:09 +0000 (17:47 +0000)]
Include sys-queue.h early to override system queue definitions on BSD

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoShuffle lines to avoid gcc 3 warning about redundant redeclaration
Blue Swirl [Fri, 4 Sep 2009 17:43:37 +0000 (17:43 +0000)]
Shuffle lines to avoid gcc 3 warning about redundant redeclaration

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoBring pcbios, seabios, and vgabios into the tree as git submodules. Right now,
Anthony Liguori [Fri, 4 Sep 2009 15:13:29 +0000 (10:13 -0500)]
Bring pcbios, seabios, and vgabios into the tree as git submodules.  Right now,
they aren't integrated into the build but we can do that incrementally.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomips malta: Fix fdc regression and use qdev for i8042 setup
Stefan Weil [Fri, 28 Aug 2009 17:37:00 +0000 (19:37 +0200)]
mips malta: Fix fdc regression and use qdev for i8042 setup

8baf73adf664e79eae201c3f618078a220a661d9 (qdev/isa: convert fdc)
breaks MIPS Malta:

Tried to create isa device isa-fdc with no isa bus present

Fix this by creating an isa bus for piix4.
This change also requires some more qdev related changes
(similar changes were applied to pc.c) and allows
cleaning of piix3/piix4 code.

Thanks to Gerd Hoffmann for his hints.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoIntroduce QDict unit-tests
Luiz Capitulino [Fri, 28 Aug 2009 18:27:32 +0000 (15:27 -0300)]
Introduce QDict unit-tests

This suite contains tests to assure that QDict API works as expected.

To execute it you should have check installed and build QEMU with
check support enabled (--enable-check-utests) and then run:

$ ./check-qdict

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoIntroduce QDict test data file
Luiz Capitulino [Fri, 28 Aug 2009 18:27:31 +0000 (15:27 -0300)]
Introduce QDict test data file

This file is used by the QDict stress test, it adds 5k nodes
on the dictionary and performs various operations.

My original file had 21k entries and almost 400k of size. After
some discussion with Eduardo Habkost, I decided to reduce the
size.

There are ways to generate this kind of data dynamically, but
it has its problems too.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoIntroduce QString unit-tests
Luiz Capitulino [Fri, 28 Aug 2009 18:27:30 +0000 (15:27 -0300)]
Introduce QString unit-tests

This suite contains tests to assure that QString API works as expected.

To execute it you should have check installed and build QEMU with
check support enabled (--enable-check-utests) and then run:

$ ./check-qstring

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoIntroduce QInt unit-tests
Luiz Capitulino [Fri, 28 Aug 2009 18:27:29 +0000 (15:27 -0300)]
Introduce QInt unit-tests

This suite contains tests to assure that QInt API works as expected.

To execute it you should have check installed and build QEMU with
check support enabled (--enable-check-utests) and then run:

$ ./check-qint

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoAdd check support
Luiz Capitulino [Fri, 28 Aug 2009 18:27:28 +0000 (15:27 -0300)]
Add check support

Check is a unit testing framework for C.

All the QObjects have unit-tests and more will be written for the
future data types.

More info about check can be found at:

http://check.sourceforge.net/

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Update supported types documentation
Luiz Capitulino [Fri, 28 Aug 2009 18:27:27 +0000 (15:27 -0300)]
monitor: Update supported types documentation

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: fail when 'i' type is greater than 32-bit
Luiz Capitulino [Fri, 28 Aug 2009 18:27:26 +0000 (15:27 -0300)]
monitor: fail when 'i' type is greater than 32-bit

The 'i' argument type is for 32-bit only and most handlers
will use an 'int' to store its value.

It's better to fail gracefully when the user enters a value
greater than 32-bit than to get subtle casting bugs.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Drop args[] handling code
Luiz Capitulino [Fri, 28 Aug 2009 18:27:25 +0000 (15:27 -0300)]
monitor: Drop args[] handling code

This commit drops all the code used to handle the 'args[]' array,
as now we use a dictionary to pass arguments.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Drop str_allocated[]
Luiz Capitulino [Fri, 28 Aug 2009 18:27:24 +0000 (15:27 -0300)]
monitor: Drop str_allocated[]

It's not used anymore, as QDict is now used to handle string
memory allocation/deallocation.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Drop unused macros
Luiz Capitulino [Fri, 28 Aug 2009 18:27:23 +0000 (15:27 -0300)]
monitor: Drop unused macros

GET_TLONG() and GET_TPHYSADDR() are not needed anymore, QInt can
handle such conversions.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Split monitor_handle_command()
Luiz Capitulino [Fri, 28 Aug 2009 18:27:22 +0000 (15:27 -0300)]
monitor: Split monitor_handle_command()

In order to help the integration with unit-tests and having a better
design, this commit splits monitor_handle_command() into two parts.

The parsing code is moved to a function called monitor_parse_command(),
while allocating memory and calling the handler is still done by
monitor_handle_command().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Port handler_10 to use QDict
Luiz Capitulino [Fri, 28 Aug 2009 18:27:21 +0000 (15:27 -0300)]
monitor: Port handler_10 to use QDict

This commit ports command handlers that receive ten arguments to use
the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Drop handler_8 and handler_9
Luiz Capitulino [Fri, 28 Aug 2009 18:27:20 +0000 (15:27 -0300)]
monitor: Drop handler_8 and handler_9

Commit 79c4f6b08009a1d23177c2be8bd003253cf3686a added handler_8 and
handler_9 handling, but there isn't any command handler with those
number of arguments.

Just drop them.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Port handler_7 to use QDict
Luiz Capitulino [Fri, 28 Aug 2009 18:27:19 +0000 (15:27 -0300)]
monitor: Port handler_7 to use QDict

This commit ports command handlers that receive seven arguments to
use the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Port handler_6 to use QDict
Luiz Capitulino [Fri, 28 Aug 2009 18:27:18 +0000 (15:27 -0300)]
monitor: Port handler_6 to use QDict

This commit ports command handlers that receive six arguments to use
the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Port handler_5 to use QDict
Luiz Capitulino [Fri, 28 Aug 2009 18:27:17 +0000 (15:27 -0300)]
monitor: Port handler_5 to use QDict

This commit ports command handlers that receive five arguments to use
the new monitor's dictionary.

Note that GET_TLONG() and GET_TPHYSADDR() macros are not used anymore.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Port handler_4 to use QDict
Luiz Capitulino [Fri, 28 Aug 2009 18:27:16 +0000 (15:27 -0300)]
monitor: Port handler_4 to use QDict

This commit ports command handlers that receive four arguments to use
the new monitor's dictionary.

Note that GET_TLONG() and GET_TPHYSADDR() macros are not used anymore.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Port handler_3 to use QDict
Luiz Capitulino [Fri, 28 Aug 2009 18:27:15 +0000 (15:27 -0300)]
monitor: Port handler_3 to use QDict

This commit ports command handlers that receive three arguments to use
the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Port handler_2 to use QDict
Luiz Capitulino [Fri, 28 Aug 2009 18:27:14 +0000 (15:27 -0300)]
monitor: Port handler_2 to use QDict

This commit ports command handlers that receive two arguments to use
the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Port handler_1 to use QDict
Luiz Capitulino [Fri, 28 Aug 2009 18:27:13 +0000 (15:27 -0300)]
monitor: Port handler_1 to use QDict

This commit ports command handlers that receive one argument to use
the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Port handler_0 to use QDict
Luiz Capitulino [Fri, 28 Aug 2009 18:27:12 +0000 (15:27 -0300)]
monitor: Port handler_0 to use QDict

This commit ports command handlers that receive no arguments to use
the new monitor's dictionary.

It might seem no sense to do this, as the handlers have no arguments,
but at the end of this porting work all handlers will have the same
structure.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Export QDict header
Luiz Capitulino [Fri, 28 Aug 2009 18:27:11 +0000 (15:27 -0300)]
monitor: Export QDict header

Command handlers will have to use QDict functions, so export
qdict.h through monitor.h.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: Setup a QDict with arguments to handlers
Luiz Capitulino [Fri, 28 Aug 2009 18:27:10 +0000 (15:27 -0300)]
monitor: Setup a QDict with arguments to handlers

With this commit monitor_handle_command() will be able to setup a
QDict with arguments to command handlers.

However, the current 'args[]' method is still being used, next
changes will port commands to get their arguments from the dictionary.

Two changes are worth noting:

1. The '/' argument type always adds the following standard keys in the
dictionary: 'count', 'format' and 'size'. This way, the argument
name used in the 'args_type' string doesn't matter

2. The optional argument type '?' doesn't need to pass the additional
'has_arg' argument, hanlders can do the same check with qdict_haskey()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomonitor: New format for handlers argument types
Luiz Capitulino [Fri, 28 Aug 2009 18:27:09 +0000 (15:27 -0300)]
monitor: New format for handlers argument types

Current handlers argument types, as defined in qemu-monitor.hx file,
are a sequence of chars where each one represents one argument type
of the command handler. The number of chars is also used to know how
many arguments a given handler accepts.

This commit defines a new format, which makes mandatory the use of
a name for each argument.

For example, do_eject() command handler is currently defined as:

{ "eject", "-fB", do_eject, ... }

With the new format it becomes:

{ "eject", "force:-f,filename:B", do_eject, ... }

This way the Monitor will be capable of setting up a dictionary, using
each argument's name as the key and the argument itself as the value.

This commit also adds two new functions: key_get_info() and
next_arg_type(), both are used to parse the new format.

Currently key_get_info() consumes the 'key' part of the new format and
discards it, this way the current parsing code is not affected by this
change.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoAdd wrappers to functions used by the Monitor
Luiz Capitulino [Fri, 28 Aug 2009 18:27:08 +0000 (15:27 -0300)]
Add wrappers to functions used by the Monitor

Some functions exported to be used by the Monitor as command
handlers are also called in other places as regular functions.

When those functions got ported to use the Monitor dictionary
to pass argments, the callers will have to setup a dictionary
to be able to call them.

To avoid this problem, this commit add wrappers to those functions,
so that we change the wrapper to accept the dictionary, letting
the current functions as is.

The following wrappers are being added:

- do_help_cmd()
- do_pci_device_hot_remove()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoIntroduce QDict
Luiz Capitulino [Fri, 28 Aug 2009 18:27:07 +0000 (15:27 -0300)]
Introduce QDict

QDict is a high-level dictionary data type that can be used to store a
collection of QObjects. A unique key is associated with only one
QObject.

The following functions are available:

- qdict_new()    Create a new QDict
- qdict_put()    Add a new 'key:object' pair
- qdict_get()    Get the QObject of a given key
- qdict_del()    Delete a 'key:object' pair
- qdict_size()   Return the size of the dictionary
- qdict_haskey() Check if a given 'key' exists

Some high-level helpers to operate on QStrings and QInts objects
are also provided.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoIntroduce QString
Luiz Capitulino [Fri, 28 Aug 2009 18:27:06 +0000 (15:27 -0300)]
Introduce QString

QString is a high-level data type that can be used to represent
C strings.

The following functions are available:

- qstring_from_str() Create a new QString
- qstring_get_str()  Get a pointer to the stored string

Note that qstring_get_str() is too low-level for a data type like
this, but it's interesting for quick read-only accesses.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoIntroduce QInt
Luiz Capitulino [Fri, 28 Aug 2009 18:27:05 +0000 (15:27 -0300)]
Introduce QInt

QInt is a high-level data type that can be used to represent integers,
internally it stores an int64_t value.

The following functions are available:

- qint_from_int() Create a new QInt
- qint_get_int()  Get the stored integer

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoIntroduce QObject
Luiz Capitulino [Fri, 28 Aug 2009 18:27:04 +0000 (15:27 -0300)]
Introduce QObject

This commit introduces the qobject.h header file, it contains
basic QObject definitions and helper macros.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoide: move cmd+irq from IDEState to IDEBus.
Gerd Hoffmann [Fri, 28 Aug 2009 14:37:42 +0000 (16:37 +0200)]
ide: move cmd+irq from IDEState to IDEBus.

These variables are per bus, not per drive.  Lets move them and
cleanup things a bit.  And fix the cmd migration bug for real.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoide: pass down DriveInfo instead of BlockDriverState
Gerd Hoffmann [Fri, 28 Aug 2009 13:47:03 +0000 (15:47 +0200)]
ide: pass down DriveInfo instead of BlockDriverState

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoSupport for multiple -monitor devices
Jan Kiszka [Thu, 27 Aug 2009 17:51:16 +0000 (19:51 +0200)]
Support for multiple -monitor devices

Rebased version of Anthony's patch: Allow to specify more than one
monitor terminal via the -monitor command line switch. This is
particularly useful when libvirt or some other management tool already
occupies the primary monitor but you need another one for debugging.
The current clumsy workaround is to multiplex such additional terminals
over a qemu character device (e.g. -serial mon:<device>).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agonet: Fix send queue ordering
Jan Kiszka [Wed, 26 Aug 2009 10:47:04 +0000 (12:47 +0200)]
net: Fix send queue ordering

Ensure that packets enqueued for delayed delivery are dequeued in FIFO
order. At least one simplistic guest TCP/IP stack became unhappy due to
sporadically reordered packet streams.

At this chance, switch the send queue implementation to TAILQ.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agodo not issue ioctl from within the io thread
Glauber Costa [Tue, 25 Aug 2009 22:13:36 +0000 (18:13 -0400)]
do not issue ioctl from within the io thread

According to Documentation/kvm/api.txt, (and well, to common sense),
we should not be calling vcpu ioctls from within the iothread.
Since vcpu initialization issues a vcpu ioctl, move it a little bit
further in time to prevent it.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoDelay sighandler_setup()
Juan Quintela [Fri, 28 Aug 2009 17:25:15 +0000 (19:25 +0200)]
Delay sighandler_setup()

If we are using --serial telnet:0:5555,server  or similar, ^C will not
kill qemu.  We need to first connect using telnet, and the the ^C takes
effect.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoRemove typedef for bool from eepro100.c
Amit Shah [Thu, 27 Aug 2009 12:31:24 +0000 (18:01 +0530)]
Remove typedef for bool from eepro100.c

eepro100.c shouldn't have the need to do this in its local header file.

And I recently started getting this:

$ make -j3
...
CC x86_64-softmmu/eepro100.o
/home/amit/src/qemu/hw/eepro100.c:112: error: two or more data types
in declaration specifiers
/home/amit/src/qemu/hw/eepro100.c:112: warning: useless type name in
empty declaration
make[1]: *** [eepro100.o] Error 1

so just remove the typedef and include <stdbool.h> instead.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoadd documentation for multi-core features
Andre Przywara [Fri, 28 Aug 2009 08:49:57 +0000 (10:49 +0200)]
add documentation for multi-core features

extend QEMU's internal help and man page to cover the recently
added multi-core feature.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agopiix3: use new vmstate infrastructure
Juan Quintela [Fri, 28 Aug 2009 13:28:27 +0000 (15:28 +0200)]
piix3: use new vmstate infrastructure

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoi440fx: use new vmstate infrastructure
Juan Quintela [Fri, 28 Aug 2009 13:28:26 +0000 (15:28 +0200)]
i440fx: use new vmstate infrastructure

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoVMState: Fix sub-structs versioning
Juan Quintela [Fri, 28 Aug 2009 13:28:25 +0000 (15:28 +0200)]
VMState: Fix sub-structs versioning

We can't check the version in a substruct, it is not stored anywhere

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoUpdate SaveVM versions
Juan Quintela [Fri, 28 Aug 2009 13:28:24 +0000 (15:28 +0200)]
Update SaveVM versions

Now that we have all fields belonging to a PCIDevice, save each field
on the device that it belongs.  This means moving pci_irq_levels
from PCII440FXState to PIIX3State.
Old formats are loaded, but we only save on the new saner format.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agopci_irq_levels[] belong to PIIX3State
Juan Quintela [Fri, 28 Aug 2009 13:28:23 +0000 (15:28 +0200)]
pci_irq_levels[] belong to PIIX3State

With previous cleanups, now it is possible to put it where it belongs

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoSave irq_state into PCII440FXState
Juan Quintela [Fri, 28 Aug 2009 13:28:22 +0000 (15:28 +0200)]
Save irq_state into PCII440FXState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoWe can add piix3_dev now to PIIX3IrqState
Juan Quintela [Fri, 28 Aug 2009 13:28:21 +0000 (15:28 +0200)]
We can add piix3_dev now to PIIX3IrqState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoFold piix3_init() intto i440fx_init
Juan Quintela [Fri, 28 Aug 2009 13:28:20 +0000 (15:28 +0200)]
Fold piix3_init() intto i440fx_init

i440fx_init will now work properly if we don't setup piix3

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoIntroduce PIIX3IrqState for piix3 irq's state
Juan Quintela [Fri, 28 Aug 2009 13:28:19 +0000 (15:28 +0200)]
Introduce PIIX3IrqState for piix3 irq's state

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>