Commit Graph

4518 Commits (f2574737f6a1218b4f4809ad6c8aba935126d90f)

Author SHA1 Message Date
Andrzej Zaborowski 0c69aa703c pxa2xx_pic: Set base address for sysbus device.
Thid device's registration was broken since
e1f8c729fa, this should fix it.
2011-03-03 03:43:40 +01:00
Dmitry Eremin-Solenikov 13801f32f6 vmstate: add VMSTATE_STRUCT_ARRAY_TEST
This is a _TEST variant of VMSTATE_STRUCT_ARRAY, necessary e.g.
for future patch changing pxa2xx_timer to use vmstate.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-03-03 03:34:01 +01:00
Dmitry Eremin-Solenikov e1f8c729fa pxa2xx_pic: update to use qdev
Use qdev/sysbus framework to handle pxa2xx-pic. Instead of exposing IRQs
via array, reference them via qdev_get_gpio_in().

Patch has been modified by the committer.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-25 12:13:38 +01:00
Dmitry Eremin-Solenikov 3e1dbc3bd4 mst_fpga: correct irq level settings
Final corrections for IRQ levels that are set by mst_fpga:

* Don't retranslate IRQ if previously IRQ was masked.
* After setting or clearing IRQs through register, apply mask
  before setting parent IRQ level.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-25 09:06:16 +01:00
Gerd Hoffmann a43f9c90c9 virtio-serial: kill VirtIOSerialDevice
VirtIOSerialDevice is like VirtIOSerialPort with just the first two
fields, which makes it pretty pointless.  Using VirtIOSerialPort
directly works equally well and is less confusing.

[Amit: - rebase
       - rename 'dev' to 'port' in function params in virtio-serial.h ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-24 11:25:38 -06:00
Peter Maydell fb1ba03ab0 hw/sd.c: Add missing state change for SD_STATUS, SEND_NUM_WR_BLOCKS
The SD_STATUS and SEND_NUM_WR_BLOCKS commands are supposed to cause
the card to send data back to the host. However sd.c was missing the
state change to sd_sendingdata_state for these commands, with the effect
that the Linux driver would either hang indefinitely waiting for
nonexistent data (pl181) or read zeroes and provoke a qemu warning
message (omap).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-24 08:53:36 +01:00
Edgar E. Iglesias 082e5be809 pls3adsp1800: Base load_elf endianness on target endianness
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
2011-02-23 12:31:53 +01:00
Peter Maydell 9a31334f41 hw/irq.h: Remove unused SetIRQFunc typedef
Remove the typedef SetIRQFunc, as it is not used by anything.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-21 16:02:38 +01:00
Aurelien Jarno 81aa06471a Revert "prep: Disable second IDE channel, as long as ISA IDE emulation doesn't support same irq for both channels"
This reverts commit 491e2a338f.
2011-02-21 15:53:05 +01:00
Jan Kiszka ee951a37d8 isa-bus: Remove bogus IRQ sharing check
Nothing prevented IRQ sharing on the ISA bus in principle. Not all
boards supported this, neither each and every card nor driver and OS.
Still, there existed valid IRQ sharing scenarios, (at least) two of them
can also be found in QEMU: >2 PC UARTs and the PREP IDE buses.

So remove this artificial restriction from our ISA model.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-21 15:46:53 +01:00
Roy Tam 7096a96db2 PS/2 keyboard Scancode Set 3 support
The following patch adds PS/2 keyboard Scancode Set 3 support.

Signed-off-by: Roy Tam <roytam@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-21 15:41:12 +01:00
Vasily Khoruzhick 9dda246547 Fix obvious mistake in pxa2xx i2s driver
RST bit is (1 << 4) bit, not (1 << 3), fix condition
that enables i2s if ENB is set and RST is not set.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-20 20:28:45 +01:00
Vasily Khoruzhick 582798b5c6 pxa2xx_keypad: Handle 0xe0xx keycodes
Add handling of 0xe0xx keycodes to pxa2xx_driver.
Extended keycodes in keymap should be marked with most significant
bit set (i.e. 0x80). Without this patch it's not possible to handle
i.e. cursor keys.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-20 19:53:23 +01:00
Vasily Khoruzhick b976b4c0e7 pxa2xx_keypad: enhance emulation of KPAS, KPASMKP regs
Add emulation of KPAS register and proper emulation of
KPASMKP regs, so now driver supports multipresses and properly
works with Linux driver.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-20 19:53:22 +01:00
David 'Digit' Turner 5a5e3d55ff qdev: Fix printout of bit device properties with bit index >= 8
Signed-off-by: David 'Digit' Turner <digit@google.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-20 18:51:59 +01:00
Stefan Weil 9f953ca0b8 s390: Fix memory leak
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-20 18:23:07 +01:00
Stefan Weil e98ccb3fbb ppc405: Fix memory leak
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Acked-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-20 18:23:07 +01:00
Stefan Weil 386bbf4572 pci: Fix memory leak
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-20 18:23:00 +01:00
Michael S. Tsirkin 3299369856 vhost: disable on tap link down
qemu makes it possible to disable link at tap which is not communicated
to the guest but causes all packets to be dropped.

When vhost-net is enabled, vhost needs to be aware of both the virtio
link_down and the peer link_down. we switch to userspace emulation when
either is down.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: pradeep <psuriset@linux.vnet.ibm.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-20 18:06:21 +01:00
Michael S. Tsirkin 322fd48afb e1000: verify we have buffers, upfront
The spec says: Any descriptor with a non-zero status byte has been
processed by the hardware, and is ready to be handled by the software.

Thus, once we change a descriptor status to non-zero we should
never move the head backwards and try to reuse this
descriptor from hardware.

This actually happened with a multibuffer packet
that arrives when we don't have enough buffers.

Fix by checking that we have enough buffers upfront
so we never need to discard the packet midway through.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-20 15:18:26 +01:00
Michael S. Tsirkin ee912ccfa0 e1000: clear EOP for multi-buffer descriptors
The e1000 spec says: if software statically allocates
buffers, and uses memory read to check for completed descriptors, it
simply has to zero the status byte in the descriptor to make it ready
for reuse by hardware. This is not a hardware requirement (moving the
hardware tail pointer is), but is necessary for performing an in–memory
scan.

Thus the guest does not have to clear the status byte.  In case it
doesn't we need to clear EOP for all descriptors
except the last.  While I don't know of any such guests,
it's probably a good idea to stick to the spec.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: Juan Quintela <quintela@redhat.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-20 15:18:20 +01:00
Michael S. Tsirkin b19487e27e e1000: multi-buffer packet support
e1000 supports multi-buffer packets larger than rxbuf_size.

This fixes the following (on linux):
- in guest: ifconfig eth1 mtu 16110
- in host: ifconfig tap0 mtu 16110
           ping -s 16082 <guest-ip>

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-20 15:18:10 +01:00
Aurelien Jarno 1c69371006 pc: remove test on TARGET_PHYS_ADDR_BITS == 32
Both i386 and x86_64 targets are now using target_phys_bits=64. Remove
useless code.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-20 15:13:59 +01:00
Blue Swirl 64d7e9a421 i8254: convert to qdev
Convert to qdev. Don't expose PITState.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20 09:35:06 +00:00
Blue Swirl c74b88dffc vga-isa: make optional
Ignore failure with vga-isa device creation, but print a warning
message.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20 09:34:44 +00:00
Blue Swirl 7435b791ca vga-isa: convert to qdev
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20 09:34:31 +00:00
Blue Swirl 17801c78fe fdc: make optional
Ignore failure with fdc device creation.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20 09:34:06 +00:00
Blue Swirl 63ffb564dc fdc: refactor device creation
Turn fdc_init_isa into an inline function.

Get floppy geometry directly from the drives.

Don't expose FDCtrl.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20 09:33:46 +00:00
Blue Swirl d288c7ba7b fdc: use FDriveType for floppy drive type
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20 09:33:26 +00:00
Blue Swirl 5bbdbb4676 fdc: move floppy geometry guessing to block.c
Other geometry guessing functions already reside in block.c.

Remove some unused or debugging only fields.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20 09:33:17 +00:00
Blue Swirl 9b13ef9f4c serial: make optional
Ignore failure with serial device creation.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20 09:33:03 +00:00
Blue Swirl e22cf21efd serial: refactor device creation
Turn serial_init into an inline function.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20 09:32:50 +00:00
Blue Swirl cd1b8a8b0d ne2000_isa: make optional
Ignore failure with ne2000_isa device creation.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20 09:32:35 +00:00
Blue Swirl 60a14ad31e ne2000_isa: refactor device creation
Turn isa_ne2000_init into an inline function.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20 09:32:26 +00:00
Blue Swirl 7353153891 parallel: make optional
Ignore failure with parallel device creation.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20 09:31:57 +00:00
Blue Swirl defdb20e1a parallel: refactor device creation
Turn parallel_init into an inline function.

Don't expose ParallelState.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20 09:31:21 +00:00
Marcelo Tosatti e14da0af64 Fix vmport segfault (v2)
Fix regression caused by qdev conversion.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-17 19:34:52 +00:00
Anthony Liguori c5d69e6bbf Merge remote branch 'qemu-kvm/uq/master' into staging 2011-02-16 08:47:07 -06:00
Dmitry Eremin-Solenikov 459505a264 Merge mainstone.h header into mainstone.c
Now the only user of mainstone.h is mainstone.c file. Merge header
into board file.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-16 02:04:51 +01:00
Dmitry Eremin-Solenikov cb380f615c mainstone: convert FPGA emulation code to use QDev/SysBus
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-16 02:04:03 +01:00
Dmitry Eremin-Solenikov 43d91709c1 mainstone: correct and simplify irq handling
Simplify IRQ handling to stop setting an input irq pin. As a win, also get
correct IRQ status after save/load cycle.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-16 02:00:27 +01:00
Gleb Natapov 0fbfbb59a9 correctly check ppr priority during interrupt injection]
TPR blocks all interrupts in a priority class, so simple "less or
equal" check is not enough.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-14 08:43:30 -06:00
Jan Kiszka 0ec329dab9 kvm: x86: Introduce kvmclock device to save/restore its state
If kvmclock is used, which implies the kernel supports it, register a
kvmclock device with the sysbus. Its main purpose is to save and restore
the kernel state on migration, but this will also allow to visualize it
one day.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Glauber Costa <glommer@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:43:09 -02:00
Jan Kiszka 638a84af9f cirrus: Remove obsolete kvm.h include
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:47 -02:00
Anthony PERARD e5896b12e2 Introduce log_start/log_stop in CPUPhysMemoryClient
In order to use log_start/log_stop with Xen as well in the vga code,
this two operations have been put in CPUPhysMemoryClient.

The two new functions cpu_physical_log_start,cpu_physical_log_stop are
used in hw/vga.c and replace the kvm_log_start/stop. With this, vga does
no longer depends on kvm header.

[ Jan: rebasing and style fixlets ]

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:47 -02:00
Jan Kiszka e07bbac542 Improve vm_stop reason declarations
Define and use dedicated constants for vm_stop reasons, they actually
have nothing to do with the EXCP_* defines used so far. At this chance,
specify more detailed reasons so that VM state change handlers can
evaluate them.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:46 -02:00
Blue Swirl 8668f61d20 vmmouse: fix queue_size field initialization
Initialize the field queue_size, dropped by
91c9e09147.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 17:44:11 +00:00
Blue Swirl dd703b991c hpet: make optional
Ignore failure with hpet device creation.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 09:45:06 +00:00
Blue Swirl 4912371fc3 sysbus: add creation function that may fail
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 09:45:03 +00:00
Blue Swirl 86d864140b x86: make vmmouse optional
Compile vmmouse in hwlib. Ignore failure if vmmouse device can't be
created.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 09:43:44 +00:00
Blue Swirl 86f4a9a5c7 isa: add creation function that may fail
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 09:43:41 +00:00
Blue Swirl 91c9e09147 vmmouse: convert to qdev
Convert to qdev, also add a proper reset function.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 09:34:56 +00:00
Blue Swirl 6872ef610b vmport: convert to qdev
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 08:28:24 +00:00
Blue Swirl 7ba7e49e6a x86,MIPS: make vmware_vga optional
Allow failure with vmware_vga device creation and use standard
VGA instead.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 08:28:22 +00:00
Blue Swirl 7cc050b165 pci: add creation functions that may fail
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 08:27:58 +00:00
Blue Swirl 0bcdeda7e4 qdev: add creation function that may fail
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 08:27:55 +00:00
Blue Swirl 5c81e4ca9e vmware_vga: refactor device creation
Turn vmsvga_init into an inline function.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 08:27:53 +00:00
Andrzej Zaborowski 55619bb667 mst_fpga: Drop one more pxa.h inclusion.
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 23:35:20 +01:00
Dmitry Eremin-Solenikov c8ba63f829 pxa2xx: convert i2c master to use qdev/vmsd
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 23:31:17 +01:00
Dmitry Eremin-Solenikov 987e8b3b03 max7310: finish qdev'ication
1) Move GPIO-related functionality to qdev. Now one can use directly
qdev_get_gpio_in()/qdev_connect_gpio_out() on max7310 devices.

2) Make reset to be called through qdev.reset callback.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 23:31:17 +01:00
Dmitry Eremin-Solenikov 2e4b4e79c6 tosa: we aren't connected to VBus, pass this info to Linux kernel
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 23:31:16 +01:00
Dmitry Eremin-Solenikov bb70651e45 mainstone: pass one irq to the mst_fpga instead of the whole PIC
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 23:31:16 +01:00
Dmitry Eremin-Solenikov 21c75ddbf9 Drop unnecessary inclusions of pxa.h header
Seceral files contained onnecessary dependencies on hw/pxa.h header.
Drop unused references.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 23:31:16 +01:00
Dmitry Eremin-Solenikov 7fe63a170a Add scoop post_load callback that sets IRQs to loaded levels
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 23:31:16 +01:00
Dmitry Eremin-Solenikov f23c1b2a38 tc6393xb: correct NAND isr assertion
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 01:52:04 +01:00
Dmitry Eremin-Solenikov 0fba9fd6c3 sysbus: print number of irqs in dev_print
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 01:13:52 +01:00
Marcelo Tosatti 84fb392526 blockdev: add refcount to DriveInfo
The host part of a block device can be deleted with in progress
block migration.

To fix this, add a reference count to DriveInfo, freeing resources
on last reference.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-02-07 12:51:19 +01:00
Alexander Graf 2c4b9d0ea4 ahci: make number of ports runtime determined
Different AHCI controllers have a different number of ports, so the core
shouldn't care about the amount of ports available.

This patch makes the number of ports available to the AHCI core runtime
configurable, allowing us to have multiple different AHCI implementations
with different amounts of ports.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-02-07 11:40:31 +01:00
Alexander Graf 760c3e44d3 ahci: Implement HBA reset
The ahci code was missing its soft reset functionality. This wasn't really an
issue for Linux guests, but Windows gets confused when the controller doesn't
reset when it tells it so.

Using this patch I can now successfully boot Windows 7 from AHCI using AHCI
enabled SeaBIOS.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-02-07 11:38:57 +01:00
Alexander Graf 87e62065bb ahci: send init d2h fis on fis enable
The drive sends a d2h init fis on initialization. Usually, the guest doesn't
receive fises yet at that point though, so the delivery is deferred.

Let's reflect that by sending the init fis on fis receive enablement.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-02-07 11:38:35 +01:00
Alexander Graf 7fb6577b13 ahci: split ICH and AHCI even more
Sebastian's patch already did a pretty good job at splitting up ICH-9
AHCI code and the AHCI core. We need some more though. Copyright was missing,
the lspci dump belongs to ICH-9, we don't need the AHCI core to have its
own qdev device duplicate.

So let's split them a bit more in this patch, making things easier to
read an understand.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-02-07 11:37:17 +01:00
Alexander Graf f83a40dcd7 ahci: add license header in ahci.h
Due to popular request, this patch adds a license header to ahci.h

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-02-07 11:35:03 +01:00
Sebastian Herbszt 03c7a6a8e7 ahci: split ICH9 from core
There are multiple ahci devices out there. The currently implemented ich-9
is only one of the many. So let's split that one out into a separate file
to stress the difference.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-02-07 11:14:01 +01:00
Jan Kiszka 1f5e71a8e6 ioapic: Style & magics cleanup
Fix a few style issues and convert magic numbers into prober symbolic
constants, also fixing the wrong but unused IOAPIC_DM_SIPI value.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-04 06:33:26 -06:00
Jan Kiszka 5dce499948 ioapic: Add support for qemu-kvm's vmstate v2
qemu-kvm carries the IOAPIC base address in its v2 vmstate. We only
support the default base address so far, and saving even that in the
device state was rejected.

Add a padding field to be able to read qemu-kvm's old state, but
increase our version to 3, indicating that we are not saving a valid
address. This also gives downstream the chance to change to stop
evaluating the base_address and move to v3 as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-04 06:33:26 -06:00
Jan Kiszka 35a74c5c59 ioapic: Save/restore irr
This is a guest modifiable state that must be saved/restored properly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-04 06:33:26 -06:00
Jan Kiszka 0280b571c1 ioapic: Implement EOI handling for level-triggered IRQs
Add the missing EOI broadcast from local APIC to the IOAPICs on
completion of level-triggered IRQs. This ensures that a still asserted
IRQ source properly re-triggers an APIC IRQ.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-04 06:33:26 -06:00
Amit Shah 7185f9315b virtio-serial: Make sure virtqueue is ready before discarding data
This can happen if a port gets unplugged before guest has chance to
initialise vqs.

Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-04 06:33:26 -06:00
mst@redhat.com 5430a28fe4 vhost: force vhost off for non-MSI guests
When MSI is off, each interrupt needs to be bounced through the io
thread when it's set/cleared, so vhost-net causes more context switches and
higher CPU utilization than userspace virtio which handles networking in
the same thread.

We'll need to fix this by adding level irq support in kvm irqfd,
for now disable vhost-net in these configurations.

Added a vhostforce flag to force vhost-net back on.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-01 16:50:44 -06:00
Gleb Natapov cf8ce30d03 Add bootindex handling into usb storage device.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-01 16:50:44 -06:00
Anthony Liguori 9363ee31ab Merge remote branch 'spice/spice.v29.pull' into staging
Conflicts:
	trace-events
2011-02-01 15:22:48 -06:00
Anthony Liguori cfb41c82ab Merge remote branch 'spice/usb.5' into staging 2011-02-01 15:21:23 -06:00
Anthony Liguori e54b7f5256 Merge remote branch 'amit/for-anthony' into staging 2011-02-01 15:20:56 -06:00
Peter Maydell c84a88d8cb hw/slavio_intctl.c: fix gcc warning about array bounds overrun
The Ubuntu 10.10 gcc for ARM complains that we might be overrunning
the cpu_irqs[][] array: silence this by correcting the bounds on the
loop. (In fact we would not have overrun the array because bit
MAX_PILS in pil_pending and irl_out will always be 0.)

Also add a comment about why the loop's lower bound is OK.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-01 17:02:15 +00:00
Fabien Chouteau 60f356e86d SPARC: Fix Leon3 cache control
The "leon3_cache_control_int" (op_helper.c) function is called within leon3.c
which leads to segfault error with the global "env".

Now cache control is a CPU feature and everything is handled in op_helper.c.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-01 17:01:41 +00:00
Anthony Liguori 2685d2961b Merge remote branch 'mst/for_anthony' into staging 2011-01-31 12:07:17 -06:00
Markus Armbruster 319ae529b8 blockdev: Fix drive_add for drives without media
Watch this:

    (qemu) drive_add 0 if=none
    (qemu) info block
    none0: type=hd removable=0 [not inserted]
    (qemu) drive_del none0
    Segmentation fault (core dumped)

add_init_drive() is confused about drive_init()'s failure modes, and
cleans up when it shouldn't.  This leaves the DriveInfo with member
opts dangling.  drive_del attempts to free it, and dies.

drive_init() behaves as follows:

* If it created a drive with media, it returns its DriveInfo.

* If it created a drive without media, it clears *fatal_error and
  returns NULL.

* If it couldn't create a drive, it sets *fatal_error and returns
  NULL.

Of its three callers:

* drive_init_func() is correct.

* usb_msd_init() assumes drive_init() failed when it returns NULL.
  This is correct only because it always passes option "file", and
  "drive without media" can't happen then.

* add_init_drive() assumes drive_init() failed when it returns NULL.
  This is incorrect.

Clean up drive_init() to return NULL on failure and only on failure.
Drop its parameter fatal_error.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-01-31 11:59:24 +01:00
Markus Armbruster 2292ddaeab blockdev: Make drive_add() take explicit type, index parameters
Before, type & index were hidden in printf-like fmt, ... parameters,
which get expanded into an option string.  Rather inconvenient for
uses later in this series.

New IF_DEFAULT to ask for the machine's default interface.  Before,
that was done by having no option "if" in the option string.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-01-31 10:59:09 +01:00
Markus Armbruster 27d6bf40ed blockdev: Fix regression in -drive if=scsi,index=N
Before commit 622b520f, index=12 meant bus=1,unit=5.

Since the commit, it means bus=0,unit=12.  The drive is created, but
not the guest device.  That's because the controllers we use with
if=scsi drives (lsi53c895a and esp) support only 7 units, and
scsi_bus_legacy_handle_cmdline() ignores drives with unit numbers
exceeding that limit.

Changing the mapping of index to bus, unit is a regression.  Breaking
-drive invocations that used to work just makes it worse.

Revert the part of commit 622b520f that causes this, and clean up
some.

Note that the fix only affects if=scsi.  You can still put more than 7
units on a SCSI bus with -device & friends.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-01-31 10:42:42 +01:00
Markus Armbruster 13839974d1 blockdev: New drive_get_next(), replacing qdev_init_bdrv()
qdev_init_bdrv() doesn't belong into qdev.c; it's about drives, not
qdevs.  Rename to drive_get_next, move to blockdev.c, drop the bogus
DeviceState argument, and return DriveInfo instead of
BlockDriverState.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-01-31 10:24:11 +01:00
Markus Armbruster 31e1ea3ee7 scsi hotplug: Set DriveInfo member bus correctly
drive_init() picks the first free bus and unit number, unless the user
specifies them.

This isn't a good fit for the drive_add monitor command, because there
we specify the controller by PCI address instead of using bus number
set by drive_init().

scsi_hot_add() takes care to replace the unit number set by
drive_init() by the real one, but it neglects to replace the bus
number.  Thus, bus/unit in DriveInfo may be bogus.  Affects
drive_get() and drive_get_max_bus().  I'm not aware of anything bad
happening because of that; looks like by the time we're hot-plugging,
the two functions aren't used anymore.  Fix it anyway.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-01-31 10:03:00 +01:00
Stefan Hajnoczi fe6ceac860 ahci: Fix cpu_physical_memory_unmap() argument ordering
The len and is_write arguments to cpu_physical_memory_unmap() were
swapped.  This patch changes calls to use the correct argument ordering.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-01-31 10:03:00 +01:00
Christoph Hellwig e5051fc708 virtio-blk: tell the guest about size changes
Raise a config change interrupt when the size changed.  This allows
virtio-blk guest drivers to read-read the information from the
config space once it got the config chaged interrupt.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-01-31 10:03:00 +01:00
Christoph Hellwig db97ee6a97 block: tell drivers about an image resize
Extend the change_cb callback with a reason argument, and use it
to tell drivers about size changes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-01-31 10:03:00 +01:00
Hervé Poussineau 491e2a338f prep: Disable second IDE channel, as long as ISA IDE emulation doesn't support same irq for both channels
Cc: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-29 16:02:39 +01:00
Andreas Färber 74145374bf prep: Remove bogus BIOS size check
r3480 added this check to account for the entry vector 0xfff00100 to be
available for CPUs that need it. Today however, the NIP is not yet
initialized at this point (zero), so the check always triggers.

Moreover, BIOS size check is already done previously, so this part can
be removed too.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-29 16:02:38 +01:00
Aurelien Jarno 51e08f3e4b mc146818rtc: update registers after a format change
For some unknown reason, the MIPS kernel briefly changes the RTC to
binary mode during boot, switch back to BCD mode and read the time. As
the registers are updated only every second, they may still be in the
old format when they are read.

This patch forces a register update immediately after a format change
(BCD/binary or 12/24H). This avoid long fsck during boot due to time
wrap.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-29 15:19:22 +01:00
Aurelien Jarno c29cd656a8 mc146818rtc: constantify
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-29 15:19:18 +01:00
Aurelien Jarno 92e3c2a39e virtio-blk: fix cross-endianness targets
virtio-blk doesn't work on cross-endian configuration, as endianness is
not handled correctly.

This patch adds missing endianness conversions to make virtio-blk
working. Tested on the following configurations:
- i386 guest on x86_64 host
- ppc guest on x86_64 host
- i386 guest on mips host
- ppc guest on mips host

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-29 15:08:14 +01:00
Aurelien Jarno 44b15bc5c6 virtio-net: fix cross-endianness support
virtio-net used to work on cross-endianness configurations, but doesn't
anymore with recent guest kernels, as the new features don't handle
endianness correctly.

This patch fixes wrong conversion, and add missing ones to make
virtio-net working. Tested on the following configurations:
- i386 guest on x86_64 host
- ppc guest on x86_64 host
- i386 guest on mips host
- ppc guest on mips host

Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-29 15:07:56 +01:00