summaryrefslogtreecommitdiff
path: root/hw
AgeCommit message (Collapse)AuthorFilesLines
2011-02-14correctly check ppr priority during interrupt injection]Gleb Natapov1-12/+30
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-07blockdev: add refcount to DriveInfoMarcelo Tosatti1-1/+1
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> (cherry picked from commit 84fb392526479d54602a3830326d50d44657f630)
2011-02-07ahci: make number of ports runtime determinedAlexander Graf3-16/+26
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> (cherry picked from commit 2c4b9d0ea42c27ec2112e437a0fa954afe73bd23)
2011-02-07ahci: Implement HBA resetAlexander Graf1-1/+4
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> (cherry picked from commit 760c3e44d3a1d8a7e9d22f0429b1805d1c688178)
2011-02-07ahci: send init d2h fis on fis enableAlexander Graf2-7/+32
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> (cherry picked from commit 87e62065bb5e0e544e45e6935e3ac2b053fe446e)
2011-02-07ahci: split ICH and AHCI even moreAlexander Graf2-112/+88
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> (cherry picked from commit 7fb6577b130c615e42e1ccf8dad69c27c3eef085)
2011-02-07ahci: add license header in ahci.hAlexander Graf1-0/+23
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> (cherry picked from commit f83a40dcd7c38aef8cb4aa93e1f6f0e21c750992)
2011-02-07ahci: split ICH9 from coreSebastian Herbszt3-301/+374
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> (cherry picked from commit 03c7a6a8e7122b9c12a532577046094a69593116)
2011-02-04ioapic: Style & magics cleanupJan Kiszka1-70/+107
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> (cherry picked from commit 1f5e71a8e6b24dce74b156472ff9253b9bd33a11)
2011-02-04ioapic: Add support for qemu-kvm's vmstate v2Jan Kiszka1-1/+2
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> (cherry picked from commit 5dce499948e4a4abe62f010baf4a7ed3d49e53cb)
2011-02-04ioapic: Save/restore irrJan Kiszka1-1/+14
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> (cherry picked from commit 35a74c5c5941b474d8b985237e1bde0b8cd2a20f)
2011-02-04ioapic: Implement EOI handling for level-triggered IRQsJan Kiszka3-5/+67
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> (cherry picked from commit 0280b571c1a153f8926612d8c8d7359242d596f5)
2011-02-04virtio-serial: Make sure virtqueue is ready before discarding dataAmit Shah1-0/+3
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> (cherry picked from commit 7185f9315bcf90e99b123370cf4d19b8c20afbd5)
2011-02-01vhost: force vhost off for non-MSI guestsmst@redhat.com7-10/+45
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-01Add bootindex handling into usb storage device.Gleb Natapov1-0/+2
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-01Merge remote branch 'spice/spice.v29.pull' into stagingAnthony Liguori2-73/+12
Conflicts: trace-events
2011-02-01Merge remote branch 'spice/usb.5' into stagingAnthony Liguori5-109/+280
2011-02-01Merge remote branch 'amit/for-anthony' into stagingAnthony Liguori3-46/+139
2011-02-01hw/slavio_intctl.c: fix gcc warning about array bounds overrunPeter Maydell1-1/+6
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-01SPARC: Fix Leon3 cache controlFabien Chouteau1-3/+2
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-01-31Merge remote branch 'mst/for_anthony' into stagingAnthony Liguori1-2/+2
2011-01-31blockdev: Fix drive_add for drives without mediaMarkus Armbruster2-4/+2
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-31blockdev: Make drive_add() take explicit type, index parametersMarkus Armbruster1-1/+1
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-31blockdev: Fix regression in -drive if=scsi,index=NMarkus Armbruster4-3/+4
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-31blockdev: New drive_get_next(), replacing qdev_init_bdrv()Markus Armbruster4-22/+8
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-31scsi hotplug: Set DriveInfo member bus correctlyMarkus Armbruster1-0/+1
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-31ahci: Fix cpu_physical_memory_unmap() argument orderingStefan Hajnoczi1-5/+5
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-31virtio-blk: tell the guest about size changesChristoph Hellwig1-0/+10
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-31block: tell drivers about an image resizeChristoph Hellwig2-2/+11
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-29prep: Disable second IDE channel, as long as ISA IDE emulation doesn't ↵Hervé Poussineau1-1/+1
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-29prep: Remove bogus BIOS size checkAndreas Färber1-3/+0
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-29mc146818rtc: update registers after a format changeAurelien Jarno1-1/+9
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-29mc146818rtc: constantifyAurelien Jarno1-2/+3
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-29virtio-blk: fix cross-endianness targetsAurelien Jarno1-15/+25
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-29virtio-net: fix cross-endianness supportAurelien Jarno1-6/+7
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-29escc: fix interrupt flagsAurelien Jarno1-2/+6
Recent PowerPC kernel end up in kernel panic during boot in -nographic mode. In this mode the second serial port is used as the udbg console, and thus a few characters are sent on this port. This activates the tx interrupt flag, and later choke the Linux kernel, as it was not expecting such a flag to be set. The problem here comes from the fact that contrary to most devices the interrupt flags are only set if the interrupt is enabled. Quoting the datasheet: "If the corresponding IE bit is not set, the IP for that source of interrupt will never be set." This patch fixes that by enabling the interrupt flag only when the corresponding interrupt is enabled. Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-29pxa2xx_gpio: switch to using qdevDmitry Eremin-Solenikov6-111/+103
As noted by Markus Armbruster pxa2xx_gpio vmstate version bumped because of a change in the or .ilevel / .olevel arrays are saved, for convenience. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-01-29spitz: make spitz-keyboard to use qdev infrastructureDmitry Eremin-Solenikov1-55/+72
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-01-29spitz: make sl-nand emulation use qdev infrastructureDmitry Eremin-Solenikov4-53/+75
Switch sl-nand emulation to use qdev and vmstate. Also drop ecc_get/_put functions as sl-nand was the only user of that code. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-01-29Use vmstate to save/load spitz-lcdtg and corgi-ssp stateDmitry Eremin-Solenikov1-46/+28
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-01-29SharpSL scoop device - convert to qdevDmitry Eremin-Solenikov4-89/+75
Convert SharpSL scoop device to qdev, remove lots of supporting code, as lot of init and gpio related things can now be done automagically. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-01-27pci: typo in pcibus_get_dev_path()Isaku Yamahata1-1/+1
This patch fixes typo in pcibus_get_dev_path(). Without this patch, the result of pcibus_get_dev_path() isn't unique. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-01-27pci: bridge control fixupMichael S. Tsirkin1-1/+0
PCI_BRIDGE_CTL_DISCARD_STATUS (bit 10 in bridge control register) is W1C so we should not make it writeable, otherwise the assert(!(wmask & w1cmask)) in pci_default_write_config() is hit Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reported-by: Isaku Yamahata <yamahata@valinux.co.jp> Tested-by: Isaku Yamahata <yamahata@valinux.co.jp>
2011-01-26sh4: implement missing mmaped TLB read functionsAurelien Jarno1-6/+9
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-26sh4: implement missing mmaped TLB write functionsAurelien Jarno1-3/+2
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-26etrax: Dont decrease the granularity of timersEdgar E. Iglesias1-4/+0
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-01-25mips_fulong: remove bogus HAS_AUDIOIsaku Yamahata1-4/+0
remove bogus HAS_AUDIO according to 738012bec4c67e697e766edadab3f522c552a04d. Cc: Blue Swirl <blauwirbel@gmail.com> Cc: Huacai Chen <zltjiangshi@gmail.com> Cc: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-25audio: consolidate audio_init()Isaku Yamahata5-64/+6
consolidate audio_init() and remove references to shoundhw. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-24Merge remote branch 'kwolf/for-anthony' into stagingAnthony Liguori8-95/+55
2011-01-24SPARC: Emulation of Leon3Fabien Chouteau1-0/+218
Leon3 is an open-source VHDL System-On-Chip, well known in space industry (more information on http://www.gaisler.com). Leon3 is made of multiple components available in the GrLib VHDL library. Three devices are implemented: uart, timers and IRQ manager. You can find code for these peripherals in the grlib_* files. Signed-off-by: Fabien Chouteau <chouteau@adacore.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>