summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2009-11-09Documentation: Add documentation for -chardevMatthew Booth1-4/+230
Adds documentation for all -chardev backends. Signed-off-by: Matthew Booth <mbooth@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09Added imlpementation for qemu_error for non-qemu executablesNaphtali Sprei1-0/+9
Now qemu_error can be called also from shared files, e.g. block.c. Signed-off-by: Naphtali Sprei <nsprei@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09eepro100: Improve support for different devicesStefan Weil1-25/+143
* Add device properties (size of statistical data, extended tcb support) to EEPRO100State and set these values for the different devices. * Fix PCI configuration for existing devices. * Add initialisation code for missing devices. * Remove function device_supports_eTxCB. It is no longer needed. * Fix dump of statistical data. It now respects the real size of the statistical data. An endianess issue was fixed here, too. * CU_SHOWSTATS, CU_DUMPSTATS now write a completion value after the statistical data. There is no need to keep this value in eepro100_stats_t, so member "complete" could be removed. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci/monitor: print out bridge's filtering values and so on.Isaku Yamahata1-0/+25
make pci_info_device() print out bridge's filtering value like io base/limit, subbus and subordinate bus. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: implement pci bridge filtering.Isaku Yamahata2-7/+151
This patch implements pci bridge filtering. TODO: currently almost all the map funcions assumes filtered_size == size and addr & ~(size - 1) == addr. However with bridge filtering, they aren't always true. Teach them such cases, such that filtered_size < size and addr & (size - 1) != 0. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: factor out pci_for_each_device().Isaku Yamahata1-7/+14
split out device iteration logic from pci_for_each_device(). factored out function, pci_for_each_device_under_bus() will be used later. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: cosmetic on pci_upadte_mappings()Isaku Yamahata1-70/+76
Remove one indentation of pci_update_mappings. Just for cosmetics, no logic change. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: initialize pci config headers depending it pci header type.Isaku Yamahata3-5/+67
- Only sets default subsystem id for header type 00.(normal header type) because header type 01 doesn't have subsystem id, and uses the register for other purpose. So setting default subsystem id doesn't make sense. - initialize wmask more for header type 01.(bridge header type) Without those wmasks, linux was confused not boot, and lspci was confused not to print out expected IO/memory range. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: teach pci_default_config_write() ROM bar for normal/bridge device .Isaku Yamahata1-0/+2
When updated ROM expantion address of header type 0, it missed to update mappings. Add PCI_ROM_ADDRESS check whether to call pci_update_mappings() Also update pci mapping when PCI_ROM_ADDRESS1 is written for header type 1. pci_update_mapping() path isn't performance critical, so call it even independent of header type. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: use range helper functions.Isaku Yamahata1-6/+2
clean up pci_default_write_config() by the range helper functions. Suggested by Michael S. Tsirkin <mst@redhat.com> Cc: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: add helper functions to check ranges overlap.Isaku Yamahata1-0/+29
add helper function to check ranges overlap suggested by Michael S. Tsirkin <mst@redhat.com>. His original suggestion was to use [first, last], however I chosen to use offset, length pair, i.e. [offset, offset + length) because pci configuration space related functions all uses offset and length pair, so it helps to avoid to type constant twice. Cc: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: pcie host and mmcfg support.Isaku Yamahata6-19/+349
This patch adds common routines for pcie host bridge and pcie mmcfg. This will be used by q35 based chipset emulation. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09vmstate: introduce VMSTATE_BUFFER_UNSAFE_INFO.Isaku Yamahata1-2/+5
VMSTATE_BUFFER_UNSAFE_INFO for as a buffer with specified VMStateInfo. It will be used later. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci_host: change the signature of pci_data_{read, write}.Isaku Yamahata2-6/+4
change the first argument, void *opaque to PCIBus *s of the pci_data_{read, write}. They aren't used as direct callback so the argument type don't have to be void*. So change it to the right type. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: move pci host stuff from pci.c to pci_host.cIsaku Yamahata2-67/+63
Move pci host stuff from pci.c to pci_host.c. And add some comments. Later pcie host bridge functions will be defined in pcie_host.c not to bloat pci.c. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: factor out the conversion logic from io port address into pci device.Isaku Yamahata1-14/+18
factor out the logic which converts io port address into pci device and offset in PCI configuration space. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: make pci configuration transaction more accurate.Isaku Yamahata3-36/+108
This patch sorts out/enhances pci code to track pci bus topology more accurately. - Track host bus bridge with pci domain number. Although the current qemu implementation supports only pci domian 0 yet. - Track pci bridge parent-child relationship. When looking down from pci host bus for pci sub bus, be aware of secondary bus/subordinate bus. Thus pci configuration transaction is more accurately emulated. This patch adds new member to PCIBus to track pci bus topology. Since qdev already tracks down bus relationship, those new member wouldn't be necessary. However it would be addressed later because not all the pci device isn't converted to qdev yet. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: remove bus_num member from struct PCIBus.Isaku Yamahata1-11/+10
Since It can be retrieved from pci configuration space, the member is unnecessary. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: 64bit bar support.Isaku Yamahata2-5/+31
implemented pci 64bit bar support. The tricky bit is pci_update_mapping(). An OS is allowed to set the BAR such that OS can't address the area pointed by BAR. It doesn't make sense, though. In that case, don't map the BAR. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: typedef pcibus_t as uint64_t instead of uint32_t.Isaku Yamahata2-3/+10
This patch is preliminary for 64bit bar. For 64bit bar support, change pcibus_t which represents pci bus addr/size from uint32_t to uint64_t. And also change FMT_pcibus for printf. In pci_update_mapping() checks 32bit overflow. So the check must be updated too. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: introduce FMT_PCIBUS for printf format for pcibus_t.Isaku Yamahata6-12/+24
This patch is preliminary for 64bit BAR. Later pcibus_t will be changed from uint32_t to uint64_t. Introduce FMT_PCIBUS for printf format for pcibus_t. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: introduce pcibus_t to represent pci bus address/size instead of uint32_tIsaku Yamahata24-40/+43
This patch is preliminary for 64 bit BAR support. Introduce dedicated type, pcibus_t, to represent pci bus address/size instead of uint32_t. Later this type will be changed to uint64_t. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci_host: consolidate pci config address access.Isaku Yamahata8-223/+121
consolidate pci_config address access into pci_host.c Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci_host.h: move functions in pci_host.h into .c file.Isaku Yamahata12-217/+208
split static functions in pci_host.h into pci_host.c and pci_host_template.h. Later a structures declared in pci_host.h, PCIHostState, will be used. However pci_host.h doesn't allow to include itself easily. This patches addresses it. pci_host.h includes functions which are instantiated in .c by including pci_host.h with typedefing pci_addr_t. pci_addr_t is per pci host bridge and is typedef'ed to uint32_t for ioio or target_phys_addr_t for mmio in .c file. That prevents from including pci_host.h to use PCIHostState because of requiring type, pci_addr_t. Its purpose to include is to instantiate io function for mmio or ioio depending on which pci host bridge requires ioio or mmio. To avoid including code, we always instantiate both version. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: make pci_bar() aware of header type 1.Isaku Yamahata2-6/+13
make pci_bar() aware of header type 1. When PCI_ROM_SLOT it should return PCI_ROM_ADDRESS1 (!= PCI_ROM_ADDRESS) Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: clean up of pci_default_read_config.Isaku Yamahata1-21/+5
This patch cleans up pci_default_read_config() removing ugly length and range check. Suggested by "Michael S. Tsirkin" <mst@redhat.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: s/PCI_ADDRESS_SPACE_/PCI_BASE_ADDRESS_SPACE_/ to match pci_regs.hIsaku Yamahata22-51/+53
make constants for pci base address match pci_regs.h by renaming PCI_ADDRESS_SPACE_xxx to PCI_BASE_ADDRESS_SPACE_xxx. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: clean up pci_init_wmask()Isaku Yamahata1-2/+2
use pci_set_word() for pci command register. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci/bridge: clean up of pci_bridge_initfn()Isaku Yamahata1-11/+25
- use symbolic constant - use helper function pci_set_xxx() - removed lines which initializes to 0. It is unnecessary because it is already zeroed. - add some comments on command registers. Some initial values are suspicious because they seems to be specific to apb_pci.c which is the only user of pci bridge right now. For now don't touch those values to avoid breakage. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: use helper functions to access pci config space.Isaku Yamahata1-15/+15
use pci_[gs]et_{byte, word, long}() to access pci configuration space. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: helper functions to access PCIDevice::configIsaku Yamahata1-0/+12
add helper functions to get/set PCIDevice::config Those will be used later. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: define a constant to represent a unmapped bar and use it.Isaku Yamahata3-10/+11
define a constant to represent a unmapped bar instead of -1 and use it. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: use PCI_SLOT() and PCI_FUNC().Isaku Yamahata2-6/+8
use PCI_SLOT() and PCI_FUNC() where appropriate instead of direct use of bit operation. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: introduce constant PCI_NUM_PINS for the number of interrupt pins, 4.Isaku Yamahata2-3/+5
introduce constant PCI_NUM_PINS for the number of interrupt pins, 4. and use it. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: fix PCI_DPRINTF() wrt variadic macro.Isaku Yamahata1-1/+1
add missing ## in PCI_DPRINTF() to compile. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09Makefile: make qemu-io dependent on config-host.hPaolo Bonzini1-0/+2
This is needed also for qemu-io, but not for qemu-nbd. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09scsi: move scsi-disk.h -> scsi.hGerd Hoffmann10-9/+76
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09scsi: move scsi.h -> esp.hGerd Hoffmann5-4/+3
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09Makefile: make qemu-img dependant on config-host.hUri Lublin1-1/+1
Since config-host.h is generated by the Makefile (1215c6e76), building (only) qemu-img fails: [user@f12-uri qemu]$ make distclean (or git clone qemu) [user@f12-uri qemu]$ ./configure ... [user@f12-uri qemu]$ make qemu-img GEN config-all-devices.mak GEN qemu-img-cmds.h CC qemu-img.o In file included from qemu-img.c:24: qemu-common.h:32:25: error: config-host.h: No such file or directory Signed-off-by: Uri Lublin <uril@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09whitelist host virtio networking featuresDustin Kirkland1-4/+4
This patch is a followup to 8eca6b1bc770982595db2f7207c65051572436cb, fixing crashes when guests with 2.6.25 virtio drivers have saturated virtio network connections. https://bugs.edge.launchpad.net/ubuntu/+source/qemu-kvm/+bug/458521 That patch should have been whitelisting *_HOST_* rather than the the *_GUEST_* features. I tested this by running an Ubuntu 8.04 Hardy guest (2.6.24 kernel + 2.6.25-virtio driver). I saturated both the incoming, and outgoing network connection with nc, seeing sustained 6MB/s up and 6MB/s down bitrates for ~20 minutes. Previously, this crashed immediately. Now, the guest does not crash and maintains network connectivity throughout the test. Signed-off-by: Dustin Kirkland <kirkland@canonical.com> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09qemu-img: Allow creating zero sized imagesKevin Wolf1-3/+6
A size of 0 should be valid and cannot be treated as "missing value". Use -1 for this purpose instead. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09tap: drain queue in tap_send()Mark McLoughlin1-13/+16
Okay, let's try re-enabling the drain-entire-queue behaviour, with a difference - before each subsequent packet, use qemu_can_send_packet() to check that we can send it. This is similar to how we check before polling the tap fd and avoids having to drop a packet if the receiver cannot handle it. This patch should be a performance improvement since we no longer have to go through the mainloop for each packet. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09virtio-net: split the has_buffers() logic from can_receive()Mark McLoughlin1-9/+12
We should only return zero from receive() for a condition which we'll get notification of when it changes. Currently, we're returning zero if the guest driver is not ready, but we won't ever flush our queue when that status changes. Also, don't check buffer space in can_receive(), but instead just allow receive() to return zero when this condition occurs and have the caller handle queueing the packet. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09net/queue: queue packets even if sender doesn't supply a callbackMark McLoughlin1-3/+3
Now that we disable any receiver whose queue is full, we do not require senders to handle a zero return by supplying a sent callback. This is a second step towards allowing can_receive() handlers to return true even if no buffer space is available. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09net: disable receiving if client returns zeroMark McLoughlin2-11/+39
If a receiver returns zero, that means its queue is full and it will notify us when room is available using qemu_flush_queued_packets(). Take note of that and disable that receiver until it flushes its queue. This is a first step towards allowing can_receive() handlers to return true even if no buffer space is available. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09tap: disable draining queue in one goMark McLoughlin1-16/+13
If qemu_send_packet_async() returns zero, it means the packet has been queued and the sent callback will be invoked once it has been flushed. This is only possible where the NIC's receive() handler returns zero and promises to notify the networking core that room is available in its queue again. In the case where the receive handler does not have this capability (and its queue fills up) it returns -1 and the networking core does not queue up the packet. This condition is indicated by a -1 return from qemu_send_packet_async(). Currently, tap handles this condition simply by dropping the packet. It should do its best to avoid getting into this situation by checking such NIC's have room for a packet before copying the packet from the tap interface. tap_send() used to achieve this by only reading a single packet before returning to the mainloop. That way, tap_can_send() is called before reading each packet. tap_send() was changed to completely drain the tap interface queue without taking into account the situation where the NIC returns an error and the packet is not queued. Let's start fixing this by reverting to the previous behaviour of reading one packet at a time. Reported-by: Scott Tsai <scottt.tw@gmail.com> Tested-by: Sven Rudolph <Sven_Rudolph@drewag.de> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09Configurable block format whitelistMarkus Armbruster7-5/+58
We have code for a quite a few block formats. While I trust that all of these formats are useful at least for some people in some circumstances, some of them are of a kind that friends don't let friends use in production. This patch provides an optional block format whitelist, default off. If a whitelist is configured with --block-drv-whitelist, QEMU proper can use only whitelisted formats. Other programs, like qemu-img, are not affected. Drivers for formats off the whitelist still participate in format probing, to ensure all programs probe exactly the same. Without that, QEMU proper would be prone to treat images with a format off the whitelist as raw when the image's format is probed. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09qdev: Tag isa-fdc, PIIX3 IDE and PIIX4 IDE as no-userMarkus Armbruster2-0/+3
These devices are created automatically, and attempting to create another one with -device fails with "qemu: hardware error: register_ioport_write: invalid opaque". Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09Pass the drive's readonly attribute to the guest OSNaphtali Sprei2-1/+5
Implemented for virtio-blk and for scsi Signed-off-by: Naphtali Sprei <nsprei@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09Added readonly flag to -drive commandNaphtali Sprei4-4/+29
This is a slightly revised patch for adding readonly flag to the -drive command. Even though this patch is "stand-alone", it assumes a previous related patch (in Anthony staging tree), that passes the readonly attribute of the drive to the guest OS, applied first. This enables sharing same image between guests, with readonly access. Implementaion mark the drive as read_only and changes the flags when actually opening the file. The readonly attribute of a qcow also passed to it's base file. For ide that cannot pass the readonly attribute to the guest OS, disallow the readonly flag. Also, return error code from bdrv_truncate for readonly drive. Signed-off-by: Naphtali Sprei <nsprei@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>