summaryrefslogtreecommitdiff
path: root/hw
AgeCommit message (Collapse)AuthorFilesLines
2010-07-26ide: fix migration in the middle of a bmdma transferJuan Quintela1-0/+30
It reintroduces Revert "ide save/restore pio/atapi cmd transfer fields and io buffer" but using subsections. Added bonus is the addition of ide_dummy_transfer_stop to transfer_end_table, that was missing. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-26ide: fix migration in the middle of pio operationJuan Quintela2-1/+94
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-26vmstate: add subsections codeJuan Quintela1-0/+6
This commit adds subsections for each device section. Subsections is the way to handle information that don't need to be sent to de destination of a migration because its values are not needed. It is the way to handle optional information. Notice that only the source can decide if the information is optional or not. The destination needs to understand all subsections that it receives to have a sucessful load. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-26Revert "ide save/restore current transfer fields"Juan Quintela1-6/+2
This reverts commit 42ee76fe82093ba914f0dc83d2decbcf68866144. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-26Revert "ide save/restore pio/atapi cmd transfer fields and io buffer"Juan Quintela2-65/+2
This reverts commit ed487bb1d69040b9dac64a4fc076d8dd82b131d6. The conflicts are due to commit 4fc8d6711aff7a9c11e402c3d77b481609f9f486 that is a fix to the ide_drive_pre_save() function. It reverts both (and both are reinstantiated later in the series) Conflicts: hw/ide/core.c Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-26Merge remote branch 'mst/for_anthony' into stagingAnthony Liguori2-12/+21
2010-07-25etrax: Update ethernet mgm-ctrl reg on writesEdgar E. Iglesias1-0/+1
Some SW drivers dont keep track of what they've written and depend on the HW latching write contents for later read+modify+write sequences. Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-07-25mips: more fixes to the MIPS interrupt glue logicAurelien Jarno1-0/+9
Commit 36388314febad3d7675ab919287f03733a560ff6 moved most of the interrupt logic to cpu-exec.c. Remove the remaining useless code and fix software interrupts. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Acked-by: Edgar E. Iglesias <edgar@axis.com> Tested-by: Edgar E. Iglesias <edgar@axis.com>
2010-07-24mips: Correct MIPS interrupt glue logic for icountEdgar E. Iglesias1-17/+6
When hw interrupt pending bits in CP0_Cause are set, the CPU should see the hw interrupt line as active. The CPU may or may not take the interrupt based on internal state (global irq mask etc) but the glue logic shouldn't care. This fixes MIPS external hw interrupts in combination with -icount. Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-07-22scsi: Dequeue requests before invoking completion callbackJan Kiszka2-1/+12
The request completion callback of the LSI controller may start the next request that can use the same tag as the completed one. As the latter is still enqueued at that point, scsi_send_command will complain about the tag reuse and cancel the completed request. That will cause a double free later on when the completion path cleans up as well. Fix this by dequeuing the request before invoking the callback. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-22e1000: Fix wrong microwire EEPROM state initializationIzumi Tsutsui1-9/+8
This change fixes initialization of e1000's microwire EEPROM internal state values so that qemu's e1000 emulation works on NetBSD, which doesn't use Intel's em driver but has its own wm driver for the Intel i8254x Gigabit Ethernet. Previously set_eecd() function in e1000.c clears EEPROM internal state values on SK rising edge during CS==L, but according to FM93C06 EEPROM (which is MicroWire compatible) data sheet, EEPROM internal status should be cleared on CS rise edge regardless of SK input: "... a rising edge on this (CS) signal is required to reset the internal state-machine to accept a new cycle .." and nothing should be changed during CS (chip select) is inactive. Intel's em driver seems to explicitly raise SK output after CS is negated in em_standby_eeprom() so many other OSes that use Intel's driver don't have this problem even on the previous e1000.c implementation, but I can't find any articles that say the MICROWIRE or EEPROM spec requires such sequence, and actually hardware works fine without it (i.e. real i82540EM has been working on NetBSD). This fix also changes initialization to clear each state value in struct eecd_state individually rather than using memset() against the whole structre. The old_eecd member stores the last SK and CS signal levels and it should be preserved even after reset of internal EEPROM state to detect next signal edges for proper EEPROM emulation. Signed-off-by: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-22virtio-serial: Fix compat property nameAmit Shah2-4/+4
Starting with qemu -M pc-0.12 -device virtio-serial results in -device virtio-serial: Property 'virtio-serial-pci.max_nr_ports' not found The property name 'max_ports' is incorrectly named 'max_nr_ports'. Fix that. Also fix the ppc440 machine type bamboo-0.12 which has this typo. Reported-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-20Sparc32: reserve addresses for unimplemented devices on SS-20Bob Breuer1-2/+51
Use empty_slot to reserve addresses for several unimplemented devices so they won't fault. - BPP (parallel port), DBRI (audio), SX (pixel processor), and vsimms (framebuffer) OBP for SS-20 either assumes these devices exist or probes without expecting faults. Signed-off-by: Bob Breuer <breuerr@mc.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-19vhost: fix miration during device startMichael S. Tsirkin1-10/+11
We need to know ring layout to allocate log buffer. So init rings first. Also fixes a theoretical memory-leak-on-error. https://bugzilla.redhat.com/show_bug.cgi?id=615228 Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Gerd Hoffmann <kraxel@redhat.com>
2010-07-19e1000: secrc supportMichael S. Tsirkin1-1/+10
Add support for secrc field. Reportedly needed by old RHEL guests. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-07-19e1000: fix access 4 bytes beyond buffer endMichael S. Tsirkin1-2/+1
We do range check for size, and get size as buffer, but copy size + 4 bytes (4 is for FCS). Let's copy size bytes but put size + 4 in length. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-07-15Merge remote branch 'origin/master' into stagingAnthony Liguori1-1/+0
2010-07-15Merge remote branch 'kwolf/for-anthony' into stagingAnthony Liguori4-3/+21
2010-07-14hw/bonito: remove incorrect pci_mem_base settingHuacai Chen1-1/+0
This mistake makes PCI devices can't work correctly. Signed-off-by: Huacai Chen <zltjiangshi@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-13ide scsi virtio-blk: Reject empty drives unless media is removableMarkus Armbruster3-0/+13
Disks without media make no sense. For SCSI, a Linux guest kernel complains during boot. I didn't try other combinations. scsi-generic doesn't need the additional check, because it already requires bdrv_is_sg(), which fails without media. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-13virtio-blk: Fix virtio-blk-s390 to require driveMarkus Armbruster2-4/+6
Move the check from virtio_blk_init_pci(), where it protects only virtio-blk-pci, to virtio_blk_init(). Without that, virtio-blk-s390 initializes without a drive. I figure that can lead to null pointer dereferences. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-13virtio-pci: Check for virtio_blk_init() failureMarkus Armbruster1-0/+3
It can't actually fail now, but the next commit will change that. s390_virtio_blk_init() already checks for failure, but virtio_blk_init_pci() doesn't. Fix that. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-13virtio-serial: Assert for virtio queue ready before virtqueue operationsAmit Shah1-0/+1
In addition to the previous fix for calling do_flush_queued_data() only when the virtqueue is ready, ensure do_flush_queued_data() gets a vq that's suitably initialised. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-13virtio-serial: Check if virtio queue is ready before consuming dataAmit Shah1-0/+3
If a virtio-serial port is removed before the guest comes up and initialises the virtqueues, qemu exits with the message Guest moved used index from 0 to 61440 This happens because we try to clear any pending buffers from the virtqueue. Ensure the virtqueue is initialised before calling any virtqueue operations. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-13virtio-9p: Avoid SEGV when log file couldn't be openedSripathi Kodi1-0/+2
While running in debug mode if 9P server is unable to open the log file it results in a SEGV deep down in glibc: Program received signal SIGSEGV, Segmentation fault. 0x008fca8c in fwrite () from /lib/libc.so.6 (gdb) bt #0 0x008fca8c in fwrite () from /lib/libc.so.6 #1 0x081eb87e in pprint_pdu (pdu=0x89a52e1c) at /data/sripathi/code/qemu/new/qemu-next-upstream/hw/virtio-9p-debug.c:380 #2 0x0806dad8 in submit_pdu (s=0x897dc008, pdu=0x89a52e1c) at /data/sripathi/code/qemu/new/qemu-next-upstream/hw/virtio-9p.c:3092 #3 0x0806dc63 in handle_9p_output (vdev=0x897dc008, vq=0x86d8218) at /data/sripathi/code/qemu/new/qemu-next-upstream/hw/virtio-9p.c:3122 #4 0x081ac728 in virtio_queue_notify (vdev=0x897dc008, n=0) at /data/sripathi/code/qemu/new/qemu-next-upstream/hw/virtio.c:563 #5 0x08063876 in virtio_ioport_write (opaque=0x86d7b98, addr=16, val=0) at /data/sripathi/code/qemu/new/qemu-next-upstream/hw/virtio-pci.c:222 #6 0x08063e26 in virtio_pci_config_writew (opaque=0x86d7b98, addr=16, val=0) at /data/sripathi/code/qemu/new/qemu-next-upstream/hw/virtio-pci.c:357 #7 0x080c881a in ioport_write (index=1, address=49296, data=0) at ioport.c:80 #8 0x080c8d4c in cpu_outw (addr=49296, val=0) at ioport.c:204 #9 0x08073010 in kvm_handle_io (port=49296, data=0xab393000, direction=1, size=2, count=1) at /data/sripathi/code/qemu/new/qemu-next-upstream/kvm-all.c:735 ... ... This is ugly and misleading. The following patch adds a BUG_ON to catch this error. With this patch we get an abort message like the following, which makes it easier to analyze: f12-kvm login: qemu: /data/sripathi/code/qemu/new/qemu-next-upstream/hw/virtio-9p-debug.c:353: pprint_pdu: Assertion `!(!llogfile)' failed. Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-13pc: Avoid registering zero sized memoryAlex Williamson1-2/+4
No need to call cpu_register_physical_memory() for a zero sized area. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-13Merge remote branch 'mst/for_anthony' into stagingAnthony Liguori6-43/+56
2010-07-12pci/multi function bit: fix vt82c686.c.Isaku Yamahata2-5/+1
The file, vt82c686.c, was added after the change set of b80d4a9887fa4b6cc63f8c3a13ab2a45054d3e5c and fecb93c45c749a4c994d8d12bdee17ce2012de9e are created, but before the patch series was commit. So similar fix is needed to vt82c686.c. Cc: Huacai Chen <zltjiangshi@gmail.com> Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-11pci: fix bridge updateMichael S. Tsirkin1-1/+3
bridge config write should trigger updates on the secondary bus. never on the primary bus. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-07-11virtio-net: correct packet length mathMichael S. Tsirkin1-13/+28
We were requesting too much when checking buffer length: size already includes host header length. Further, we should not exit if we get a packet that is too long, since this might not be under control of the guest. Just drop the packet. Red Hat bz 591494 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-07-11pci hotplug: make pci hotplug return value to callerIsaku Yamahata1-4/+9
make pci hotplug callback return value to caller. And when returning error, allocated resources are freed. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-07-11vmware_vga: fix reset value for command registerMichael S. Tsirkin1-3/+0
Make init value for this register match the spec. BAR address is 0 at init, so enabling it only works by chance. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-07-11rtl8139: address TODOsMichael S. Tsirkin1-3/+0
Make rtl8139 spec compliant, fixing reset values for command register. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-07-11pci hotplug: make pci_device_hot_remove() staticIsaku Yamahata1-1/+1
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-07-11pcnet: address TODOsMichael S. Tsirkin1-14/+2
pcnet enables memory/io on init, which does not make sense as BAR values are wrong. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
2010-07-11pci: fix pci_device_resetIsaku Yamahata1-4/+13
Clear interrupt disable bit on reset, according to PCI spec. Fix pci_device_reset() with 64bit BAR. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-07-11AppleSMC device emulationAlexander Graf1-0/+241
Intel Macs have a chip called the "AppleSMC" which they use to control certain Apple specific parts of the hardware, like the keyboard background light. That chip is also used to store a key that Mac OS X uses to decrypt binaries. This patch adds emulation for that chip, so we're getting one step further to having Mac OS X run natively on Qemu. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-11pci: set PCI multi-function bit appropriately.Isaku Yamahata4-7/+52
Set PCI multi-function bit according to multifunction property. PCI address, devfn ,is exported to users as addr property, so users can populate pci function(PCIDevice in qemu) at arbitrary devfn. It means each function(PCIDevice) don't know whether pci device (PCIDevice[8]) is multi function or not. So this patch allows user to set multifunction bit via property and checks whether multifunction bit is set correctly. Cc: Juan Quintela <quintela@redhat.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-11pci_bridge: make pci bridge aware of pci multi function bit.Isaku Yamahata4-6/+8
make pci bridge aware of pci multi function property and let pci generic code to set the bit. Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-11pci: set multifunction property for normal device.Isaku Yamahata2-2/+2
use pci_create_simple_multifunction() for normal device which sets multifunction bit. At the moment, only pc_piix.c and mips_malta.c uses multifunction devices with piix3/4 pci-isa bridge. And other boards don't populate those devices. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-11pci: introduce multifunction property.Isaku Yamahata2-3/+28
introduce multifunction property. Also introduce new convenient device creation function which will be used later. For bisectability this patch doesn't do anything, but sets the property resulting in no functional changes. Actual changes will be introduced by later patch. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-11qdev: implement qdev_prop_set_bit().Isaku Yamahata2-0/+6
implement qdev_prop_set_bit(). Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-11pci: remove PCIDeviceInfo::header_typeIsaku Yamahata4-11/+16
replace PCIDeviceInfo::header_type with is_bridge as suggested by Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-11pci: don't overwrite multi functio bit in pci header type.Isaku Yamahata20-24/+0
Don't overwrite pci header type. Otherwise, multi function bit which pci_init_header_type() sets appropriately is lost. Anyway PCI_HEADER_TYPE_NORMAL is zero, so it is unnecessary to zero which is already zero cleared. how to test: run qemu and issue info pci to see whether a device in question is normal device, not pci-to-pci bridge. This is handy because guest os isn't required. tested changes: The following files are covered by using following commands. sparc64-softmmu apb_pci.c, vga-pci.c, cmd646.c, ne2k_pci.c, sun4u.c ppc-softmmu grackle_pci.c, cmd646.c, ne2k_pci.c, vga-pci.c, macio.c ppc-softmmu -M mac99 unin_pci.c(uni-north, uni-north-agp) ppc64-softmmu pci-ohci, ne2k_pci, vga-pci, unin_pci.c(u3-agp) x86_64-softmmu acpi_piix4.c, ide/piix.c, piix_pci.c -vga vmware vmware_vga.c -watchdog i6300esb wdt_i6300esb.c -usb usb-uhci.c -sound ac97 ac97.c -nic model=rtl8139 rtl8139.c -nic model=pcnet pcnet.c -balloon virtio virtio-pci.c: untested changes: The following changes aren't tested. prep_pci.c: ppc-softmmu -M prep should cover, but core dumped. unin_pci.c(uni-north-pci): the caller is commented out. openpic.c: the caller is commented out in ppc_prep.c Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-11pci: insert assert that auto-assigned-address function is single function ↵Isaku Yamahata2-1/+3
device. Auto-assigned-address pci function (passing devfn = -1) is always single function. This patch adds assert() to guarantee that auto-assigned-address function is always single function device at function = 0. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-11pci: use PCI_DEVFN() where appropriate.Isaku Yamahata4-9/+10
Use PCI_DEVFN() and PCI_FUNC_MAX where appropriate. This patch make it clear that func = 0. test: The following object files with/without this patch are stripped and compared. They remains same. arm-softmmu/versatile_pci.o libhw32/ppce500_pci.o libhw32/unin_pci.o libhw64/ppce500_pci.o libhw64/unin_pci.o mips-softmmu/gt64xxx.o mips64-softmmu/gt64xxx.o mips64el-softmmu/gt64xxx.o mipsel-softmmu/gt64xxx.o Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: Yu Liu <yu.liu@freescale.com> Cc: Paul Brook <paul@codesourcery.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-06Merge remote branch 'kwolf/for-anthony' into stagingAnthony Liguori12-43/+116
2010-07-06pci: Free the space allocated for the option rom on removalAlex Williamson1-0/+11
Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-06qemu_ram_alloc: Add DeviceState and name parametersAlex Williamson47-98/+131
These will be used to generate unique id strings for ramblocks. The name field is required, the device pointer is optional as most callers don't have a device. When there's no device or the device isn't a child of a bus implementing BusInfo.get_dev_path, the name should be unique for the platform. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-06virtio-net: Incorporate a DeviceState pointer and let savevm track instancesAlex Williamson1-3/+4
Stuff a pointer to the DeviceState into the VirtIONet structure so that we can easily remove the vmstate entry later. Also, let vmstate track the instance number (it should always be zero internally since the device path should now be unique). Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>