summaryrefslogtreecommitdiff
path: root/hw
AgeCommit message (Collapse)AuthorFilesLines
2009-07-09qdev: convert ac97.Gerd Hoffmann1-20/+22
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-07-09qdev: convert es1370.Gerd Hoffmann1-19/+22
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-07-09qdev/pci: misc fixes.Gerd Hoffmann1-2/+3
* fix secondary bus setup. * use base->name instead of "FIXME" for device name. Yes, the device name is redundant. Only for drivers converted to qdev already though. Once all drivers are converted we can and should kill it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-07-09qdev: remove DeviceTypeGerd Hoffmann2-27/+18
The only purpose DeviceType serves is creating a linked list of DeviceInfo structs. This removes DeviceType and add a next field to DeviceInfo instead, so the DeviceInfo structs can be changed that way. Elimitates a pointless extra level of indirection. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-07-09qdev: replace bus_type enum with bus_info struct.Gerd Hoffmann6-62/+103
BusInfo is filled with name and size (pretty much like I did for DeviceInfo as well). There is also a function pointer to print bus-specific device information to the monitor. sysbus is hooked up there, I've also added a print function for PCI. Device creation is slightly modified as well: The device type search loop now also checks the bus type while scanning the list instead of complaining thereafter in case of a mismatch. This effectively gives each bus a private namespace for device names. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-07-09qdev: update pci device registration.Gerd Hoffmann10-36/+103
Makes pci_qdev_register take a PCIDeviceInfo struct instead of a bunch of parameters. Also adds config_read and config_write callbacks to PCIDeviceInfo, so drivers needing these can be converted to the qdev device API too. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-07-05Fix the PCI header type of APBBlue Swirl1-1/+1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-07-05Fix Sparse warningBlue Swirl1-1/+2
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-29Replace -no-virtio-balloon by -balloonMarkus Armbruster1-2/+3
We want to do (at least) two things to the virtio-balloon device: suppress it, and control its PCI address. Option -no-virtio-balloon lets us do only the former. To get the latter, replace -no-virtio-balloon with -balloon none disable balloon device -balloon virtio[,addr=str] enable virtio balloon device (default) Syntax suggested by Anthony Liguori. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29x86: Factor out pc_new_cpuJan Kiszka1-14/+22
At this point, this refactoring looks like overkill. But we will need it for CPU hotplugging, and qemu-kvm already carries it. Merging it early would help qemu-kvm when rebasing against upstream. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29Revert "Introduce reset notifier order"Jan Kiszka81-114/+114
This reverts commit 8217606e6edb49591b4a6fd5a0d1229cebe470a9 (and updates later added users of qemu_register_reset), we solved the problem it originally addressed less invasively. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29monitor: Make pci_add device options truely optionalJan Kiszka1-0/+4
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29kvm: Rework VCPU synchronizationJan Kiszka1-0/+3
During startup and after reset we have to synchronize user space to the in-kernel KVM state. Namely, we need to transfer the VCPU registers when they change due to VCPU as well as APIC reset. This patch refactors the required hooks so that kvm_init_vcpu registers its own per-VCPU reset handler and adds a cpu_synchronize_state to the APIC reset. That way we no longer depend on the new reset order (and can drop this disliked interface again) and we can even drop a KVM hook in main(). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29monitor: Drop pci_addr prefix from hotplug commandsJan Kiszka3-20/+21
The "pci_addr=" prefix currently required by pci_add/remove and drive_add has no practical use. Drop it, but still silently accept it for backward compatibility. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29Multiboot support v5Alexander Graf1-8/+238
This patch implements support for Multiboot on x86 for -kernel. Multiboot is a "new" approach to get rid of different bootloaders, providing a unified interface for the kernel. It supports command line options and kernel modules. The two probably best known projects using multiboot are Xen and GNU Hurd. This implementation should be mostly feature-complete. It is missing VBE extensions, but as no system uses them currently it does not really hurt. To use multiboot, specify the kernel as -kernel option. Modules should be given as -initrd options, seperated by a comma (,). -append also works. Please bear in mind that grub also does gzip decompression, which qemu does not do yet. To run existing images, please ungzip them first. The guest multiboot loader code is implemented as option rom using int 19. Parts of the work are based on efforts by Rene Rebe, who originally ported my code to int 19. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29Expose fw_cfg v2Alexander Graf1-2/+6
Multiboot passes options to the option rom using the fw_cfg device. Right now, that device is local to the bochs_bios_init function. Let's change that and expose it, so everyone may put data in there. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29Change bochs bios init orderAlexander Graf1-6/+6
For multiboot support, we need bochs_bios_init to happen before load_linux, so we get the fw_cfg device. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29net: Provide VLAN client lookup helperJan Kiszka1-1/+1
Introduce qemu_find_vlan_client_by_name for VLANClientState lookup based on VLAN ID and client name. This is useful for monitor commands. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24Add serial number support for virtio_blkjohn cooper2-0/+62
[brought forward to current qemu-kvm.git] This patch implements the missing qemu logic to interpret a '-drive .. serial=XYZ ..' flag for a virtio_blk device. The serial number string is contained in a skeletal IDENTIFY DEVICE data structure and this structure is made available to the guest virtio_blk driver via pci i/o region 0. Signed-off-by: john cooper <john.cooper@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24qemu/net: flag to control the number of vectors a nic hasMichael S. Tsirkin1-1/+4
Add an option to specify the number of MSI-X vectors for PCI NIC cards. This can also be used to disable MSI-X, for compatibility with old qemu. This option currently only affects virtio cards. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24qemu/net: request 3 vectors in virtio-netMichael S. Tsirkin1-0/+1
Request up to 3 vectors in virtio-net. Actual bindings might supply less. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24qemu/pci: add pci_get/set_byteMichael S. Tsirkin1-0/+12
Add pci_get/set_byte to keep *_word and *_long access functions company. They are unused for now. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24qemu/virtio: virtio save/load bindingsMichael S. Tsirkin3-18/+65
Implement bindings for virtio save/load. Use them in virtio pci. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24qemu/virtio: MSI-X support in virtio PCIMichael S. Tsirkin1-40/+112
This enables actual support for MSI-X in virtio PCI. First user will be virtio-net. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24qemu/virtio: virtio support for many interrupt vectorsMichael S. Tsirkin4-25/+81
Extend virtio to support many interrupt vectors, and rearrange code in preparation for multi-vector support (mostly move reset out to bindings, because we will have to reset the vectors in transport-specific code). Actual bindings in pci, and use in net, to follow. Load and save are not connected to bindings yet, so they are left stubbed out for now. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24qemu/apic: minimal MSI/MSI-X implementation for PCMichael S. Tsirkin1-4/+39
Implement MSI support in APIC. Note that MSI and MMIO APIC registers are at the same memory location, but actually not on the global bus: MSI is on PCI bus, APIC is connected directly to the CPU. We map them on the global bus at the same address which happens to work because MSI registers are reserved in APIC MMIO and vice versa. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24qemu/pci: MSI-X support functionsMichael S. Tsirkin3-0/+435
Add functions implementing MSI-X support. First user will be virtio-pci. Note that platform must set a flag to declare MSI supported: this is a safety measure to avoid breaking platforms which should support MSI-X but currently lack this in the interrupt controller emulation. For PC this will be set by APIC. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24qemu/pci: check constant registers on loadMichael S. Tsirkin2-1/+30
Add "cmask" table of constant register masks: if a bit is not writeable and is set in cmask table, this bit is checked on load. An attempt to load an image that would change such a register causes load to fail. Use this table to make sure that load does not modify registers that guest can not change (directly or indirectly). Note: we can't just assume that read-only registers never change, because the guest could change a register indirectly. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24qemu/pci: add routines to manage PCI capabilitiesMichael S. Tsirkin2-2/+90
Add routines to manage PCI capability list. First user will be MSI-X. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24qemu/pci: helper routines for pci accessMichael S. Tsirkin1-3/+27
Add inline routines for convenient access to pci devices with correct (little) endianness. Will be used by MSI-X support. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24qemu/pci: make default_write_config use mask tableMichael S. Tsirkin2-117/+46
Change much of hw/pci to use symbolic constants and a table-driven design: add a mask table with writable bits set and readonly bits unset. Detect change by comparing original and new registers. This makes it easy to support capabilities where read-only/writeable bit layout differs between devices, depending on capabilities present. As a result, writing a single byte in BAR registers now works as it should. Writing to upper limit registers in the bridge also works as it should. Code is also shorter. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-23sparc64 follow pci_nic_init changeIgor V. Kovalenko1-1/+1
sun4u.c: correct pci_nic_init arguments following commit 5607c38820366954c38dd702e979499486057481 Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
2009-06-22virtio-net: implement async packet sendingMark McLoughlin1-2/+37
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22Don't register cpu reset handler for cpu with APIC.Gleb Natapov1-7/+3
APIC reset handler already resets cpu, no need to reset it twice. Also register cpu_reset handler directly to make it impossible to add additional code to main_cpu_reset() by mistake. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22Support addr=... in option argument of -drive if=virtioMarkus Armbruster4-3/+18
Make drive_init() accept addr=, put the value into struct DriveInfo. Use it in all the places that create virtio-blk-pci devices: pc_init1(), bamboo_init(), mpc8544ds_init(). Don't support addr= in third argument of monitor command pci_add and second argument of drive_add, because that clashes with their first arguments. Admittedly unelegant. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22Make first argument of monitor command pci_add workMarkus Armbruster3-44/+28
Simply pass the PCI address through qemu_pci_hot_add_nic() to pci_nic_init() and through qemu_pci_hot_add_storage() to pci_create(). Before, pci_device_hot_add() passed along the PCI bus to use, and ignored any user-specified slot. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22Support addr=... in option argument of -net nicMarkus Armbruster13-25/+66
Make net_client_init() accept addr=, put the value into struct NICinfo. Use it in pci_nic_init(), and remove arguments bus and devfn. Don't support addr= in third argument of monitor command pci_add, because that clashes with its first argument. Admittedly unelegant. Machines "malta" and "r2d" have a default NIC with a well-known PCI address. Deal with that the same way as the NIC model: make pci_nic_init() take an optional default to be used when the user doesn't specify one. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22Fix do_pci_register_device() to reject devfn already in useMarkus Armbruster1-0/+2
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22vmware_vga: clean upIsaku Yamahata1-1/+1
use NULL instead of 0 for pci_register_device() argument for consistency. Any other caller uses NULL. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22virtio-net: enable mergeable receive buffersMark McLoughlin1-0/+1
When virtio-net was merged in from qemu-kvm.git, the VNET_HDR related features were dropped from the code. However, VIRTIO_NET_F_MRG_RXBUF appears to have accidentally been dropped too. Re-instate that now. Reported-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22acpi.c: make qemu_system_device_hot_add piix independent.Isaku Yamahata3-5/+24
introruce piix4_device_hot_add() for piix4 specific code and make qemu_system_device_hot_add() generic. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22Handle init/sipi in a main cpu exec loop. (v2)Gleb Natapov1-11/+26
This should fix compilation problem in case of CONFIG_USER_ONLY. Currently INIT/SIPI is handled in the context of CPU that sends IPI. This patch changes this to handle them like all other events in a main cpu exec loop. When KVM will gain thread per vcpu capability it will be much more clear to handle those event by cpu thread itself and not modify one cpu's state from the context of the other. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22Add pci_bus_reset() function.Gleb Natapov1-0/+16
To reset internal irq handling data structures. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Yaniv Kamay <ykamay@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22virtio: add support for indirect ring entriesMark McLoughlin3-6/+53
Support a new feature flag for indirect ring entries. These are ring entries which point to a table of buffer descriptors. The idea here is to increase the ring capacity by allowing a larger effective ring size whereby the ring size dictates the number of requests that may be outstanding, rather than the size of those requests. This should be most effective in the case of block I/O where we can potentially benefit by concurrently dispatching a large number of large requests. Even in the simple case of single segment block requests, this results in a threefold increase in ring capacity. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22virtio: make vring_desc_*() take phys addrsMark McLoughlin1-26/+33
Change the vring descriptor helpers to take the physical address of the descriptor table rather than a virtqueue. This is needed in order to allow these helpers to be used with an indirect descriptor table. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22Make nic option rom loading less painful.Glauber Costa1-2/+17
The code how it is today, is totally painful to read and keep. To begin with, the code is duplicated with the option rom loading code that linux_boot and vga are already using. This patch introduces a "bootable" state in NICInfo structure, that we can use to keep track of whether or not a given nic should be bootable, avoiding the introduction of yet another global state. With that in hands, we move the code in vl.c to hw/pc.c, and use the already existing infra structure to load those option roms. Error checking code suggested by Mark McLoughlin Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-20Restore consistent formatting of audio devicesmalc5-31/+31
2009-06-18xilinx-eth: Remove debug print.Edgar E. Iglesias1-1/+0
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2009-06-17Don't set IRQs on device reset and loadvm/savevmBlue Swirl5-12/+0
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-17Call piix4_reset() on system reset.Blue Swirl1-1/+5
Also zero pci_irq_levels on reset to avoid stuck irq after reset. Based on 15a1956af94e36105494f782a752698103addf63 by Gleb Natapov. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>