virtio-blk: fix the list operation in virtio_blk_load().
Although it is really rare to get in to the while loop, the listoperation in the loop is obviously wrong.
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
scsi-bus: Add PERSISTENT_RESERVE_OUT SCSIRequest->cmd.mode setup
This patch updates hw/scsi-bus.c to add the PERSISTENT_RESERVE_OUT cdbcase in scsi_req_xfer_mode() to set SCSI_XFER_TO_DEV for outgoing WRITE data.
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>...
scsi-bus: Add MAINTENANCE_IN and MAINTENANCE_OUT SCSIRequest xfer and mode assignments
This patch updates hw/scsi-bus.c to add MAINTENANCE_IN and MAINTENANCE_OUT case inscsi_req_length() for TYPE_ROM with MMC commands. It also adds the MAINTENANCE_OUTcase in scsi_req_xfer_mode() to set SCSI_XFER_TO_DEV for outgoing write data....
apic: qdev conversion cleanup
Make APICState completely private to apic.c by using DeviceStatein external APIs.
Move apic_init() to pc.c.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
apic: convert to qdev
Convert to qdev.
Use an opaque CPUState pointer because of missing VMStateimplementation for CPUState.
apic: avoid using CPUState internals
Move the actual CPUState contents handling to cpu.h and cpuid.c.
Handle CPU reset and set env->halted in pc.c.
Add a function to get the local APIC state of the currentCPU for the MMIO.
apic: avoid passing CPUState from CPU code
Pass only APICState when accessing APIC from CPU code.
apic: avoid passing CPUState from devices
Pass only APICState from pc.c.
ioapic: convert to qdev
ioapic: unexport ioapic_set_irq
There's no need to use ioapic_set_irq() outside of ioapic.c, somake it static.
Fix comparison which always returned false
Comparing an 8 bit value with ~0 does not work as expected.Replace ~0 by UINT8_MAX in comparison and also in assignment(and fix coding style, too).
Cc: Gleb Natapov <gleb@redhat.com>Cc: Anthony Liguori <aliguori@us.ibm.com>...
xen: Fix build error due to missing include
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: Move error actions from DriveInfo to BlockDriverState
That's where they belong semantically (block device host part), eventhough the actions are actually executed by guest device code.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Correct definitions for FD_CMD_SAVE and FD_CMD_RESTORE
Correct definitions for FD_CMD_SAVE and FD_CMD_RESTORE in hw/fdc.c
Per https://bugs.launchpad.net/qemu/+bug/424453 the correct valuesfor FD_CMD_SAVE is 0x2e and FD_CMD_RESTORE is 0x4e. Verified against...
un-register kbd driver in case of USB kbd unplug.
If a USB keyboard is unplugged, the keyboard eventhandler is neverremoved, and events will continue to be passed through to the device,causing crashes or memory corruption.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>...
virtio-blk: stop tracking old_bs
There is a 1:1 relation between VirtIOBlock and BlockDriverState instances,no need to track it because it won't change.
Signed-off-by: Christoph Hellwig <hch@lst.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-blk: simplify multiwrite calling conventions
Pass the MultiReqBuffer structure down all the way to the I/O submissioninstead of takin it apart. Also mark num_writes unsigned as it can'tgo negative, and take the check for any pending I/O requests into the...
Clarify error message when a PCI slot is already in use (v2)
When mistakenly configuring two devices in the same PCI slot,QEMU gives a not entirely obvious message about a 'devfn' beingin use:
$ qemu -device rtl8139 -device virtio-balloon-pci,bus=pci.0,addr=0x3...
qdev: Revert the hack to let -net nic and pci_add set qdev ID
Setting the ID in pci_nic_init() is a blatant violation of theDeviceState abstraction. Which even carries a comment advisingagainst this:
/* This structure should not be accessed directly. We declare it here...
acpi_piix4: save gpe and pci hotplug slot status
PCI hotplug currently doesn't work after a migration becausewe don't migrate the enable bits of the GPE state. Pull hotplugstructs into vmstate.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>...
etrax-ser: Support the uart rx fifo.
Add support for the rx fifo to speed up bulk transfers.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@axis.com>
hpet: Init capability register only once
The capability register is read-only from guest POV, so we do not needto update it on reset.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pass info about hpets to seabios.]
Currently HPET ACPI table is created regardless of whether qemu actuallycreated hpet device. This may confuse some guests that don't check thathpet is functional before using it. Solve this by passing info abouthpets in qemu to seabios via fw config interface. Additional benefit is...
Remove unused DEBUG defines from hw/msix.c
Remove unused DEBUG defines from hw/msix.c to avoid having anythingdefine the word DEBUG without any additions such as MSIX_DEBUG.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Change #define DEBUG to #define E1000_DEBUG in hw/e1000.c
Change #define DEBUG to #define E1000_DEBUG in hw/e1000.c to makeit possible to build QEMU with -DDEBUG
Merge remote branch 'kwolf/for-anthony' into staging
Conflicts: hw/pc.c
OHCI address decoding fix
Ignore high address bits when PCI memory window is not mapped on a pageboundary.
Signed-off-by: Paul Brook <paul@codesourcery.com>
Move stdbool.h
Move inclusion of stdbool.h to common header files, instead of includingin an ad-hoc manner.
vmstate: Add VMSTATE_STRUCT_VARRAY_UINT8
Required for hpet.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
hpet: Make number of timers configurable
One HPET block supports up to 32 timers. Allow to instantiate more thanthe recommended and implemented minimum of 3. The number is configuredvia the qdev property "timers". It is also saved/restored so that itneed not match between migration peers....
hpet: Add MSI support
This implements the HPET capability of routing IRQs to the front-sidebus, aka MSI support. This feature can be enabled via the qdev property"msi" and is off by default.
Note that switching it on can cause guests (at least Linux) to use the...
hpet/rtc: Rework RTC IRQ replacement by HPET
Allow the intercept the RTC IRQ for the HPET legacy mode. Then pushrouting to IRQ8 completely into the HPET. This allows to turnhpet_in_legacy_mode() into a private function. Furthermore, this stopsthe RTC from clearing IRQ8 even if the HPET is in control....
hpet: Drop static state
Instead of keeping a static reference around, pass the state tohpet_enabled and hpet_get_ticks. All callers now have it at hand. Willonce allow to instantiate the HPET more than a single time.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
hpet: Add support for level-triggered interrupts
By implementing this feature we can also remove a nasty way to kill qemu(by trying to enable level-triggered hpet interrupts).
hpet: Silence warning on write to running main counter
Setting the main counter while the HPET is enabled may not be a goodidea of the guest, but it is supported and should, thus, not spam thehost console with warnings.
hpet: Move static timer field initialization
Properly initialize HPETTimer::tn and HPETTimer::state once duringhpet_init instead of (re-)writing them on every reset.
hpet: Convert to qdev
Register the HPET as a sysbus device and create it that way. As it canroute its IRQs to any ISA IRQ, we need to connect it to all 24 of them.Once converted to qdev, we can move reset handler and vmstateregistration into its hands as well....
hpet: Start/stop timer when HPET_TN_ENABLE is modified
We have to update the qemu timer when the per-timer enable bit istoggled, just like for HPET_CFG_ENABLE changes.
hpet: Catch out-of-bounds timer access
Also prevent out-of-bounds write access to the timers but don't spam thehost console if it triggers.
hpet: Coding style cleanups and some refactorings
This moves the private HPET structures into the C module, simplifiessome helper functions and fixes most coding style issues (biggest chunkwas improper switch-case indention). No functional changes.
esp: lower IRQ on soft reset
42f1ced228c9b616cfa2b69846025271618e4ef5 removed irq loweringduring reset. However, for chip reset command and DMA reset signal,its actually the correct thing to do.
Lower IRQ on soft reset only.
qbus: fix memory leak in qbus_free()
BusState::name is allocated in qbus_create_inplace().So it should be freed by qbus_free().
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
multiboot: compilation fix with DEBUG_MULTIBOOT enabled.
This patch fixes the following compilation errors in multiboot.cwhen DEBUG_MULTIBOOT is defined.Use TARGET_FMT_plx instead of %x for target_phys_addr_t.
CC i386-softmmu/multiboot.occ1: warnings being treated as errors...
vga-isa-mm: remove one #ifdef CONFIG_BOCHS_VBE.
remove one #ifdef CONFIG_BOCHS_VBE.Call vga_init_vbe() instead.
Merge remote branch 'mst/for_anthony' into staging
cris: Break out image loading to hw/cris-boot.c.
hw: honor low bit in mipssim machine
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
virtio-net: truncating packet
virtio net attempts to peek into virtio queue todetermine that we have enough space for the completepacket to fit. However, it fails to account for spaceconsumed by virtio net header when it does this,under stress this results in a failure...
petlogix-3adsp: Tweak displacement of cmdline and fdt blob.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
blockdev: Collect block device code in new blockdev.c
Anything that moves hundreds of lines out of vl.c can't be all bad.
scsi: Fix info qtree for scsi-disk.ver
Show the actual default value instead of <null> when the property hasnot been set.
blockdev: Hide QEMUMachine from drive_init()
To pave the way for moving it out of vl.c.
qdev: Move declaration of qdev_init_bdrv() into qdev.h
Cleanup: virtio-blk.c: Be more consistent using BDRV_SECTOR_SIZE instead
Clean up virtio-blk.c to be more consistent using BDRV_SECTOR_SIZEinstead of hard coded 512 values.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ide: Remove useless IDEDeviceInfo members unit, drive
ide: Remove redundant IDEState member conf
Commit 428c149b added IDEState member conf to let commit 0009baf1 findthe BlockConf from there. It exists only for qdev drives, created viaide_drive_initfn(), not for drives created via ide_init2().
But for a qdev drive, we can just as well reach its IDEDevice, which...
ide: Split ide_init1() off ide_init2()
ide: Change ide_init_drive() to require valid dinfo argument
IDEState members drive_serial_str and version are now left empty untilan actual drive is connected. Before, they got a default value thatwas overwritten when a drive got connected. Doesn't matter, because...
ide: Split non-qdev code off ide_init2()
qdev: New qdev_prop_set_string()
qdev: Don't leak string property value on hot unplug
parse_string() qemu_strdup()s the property value. It is never freed.It needs to be freed along with the device. Otherwise, the value ofscsi-disk property "ver" gets leaked when hot-unplugging the disk, for...
ide: Turn drive serial into a qdev property ide-drive.serial
It needs to be a qdev property, because it belongs to the drive'sguest part.
Bonus: info qtree now shows the serial number.
ide: Fix info qtree for ide-drive.ver
scsi: Turn drive serial into a qdev property scsi-disk.serial
virtio-net: stop vhost backend on vmstop
vhost net currently keeps running after vmstop,which causes trouble as qemy does not checkfor dirty pages anymore.The fix is to simply keep vm and vhost running/stoppedstatus in sync.
Tested-by: David L Stevens <dlstevens@us.ibm.com>...
Monitor: Drop QMP documentation from code
Previous commit added QMP documentation to the qemu-monitor.hxfile, it's is a copy of this information.
While it's good to keep it near code, maintaining two copies ofthe same information is too hard and has little benefit as we...
Merge remote branch 'mst/for_anthony' into HEAD
virtio-serial-bus: fix ports_map allocation on init
Fix for too small allocation to ports_map
Signed-off-by: Alon Levy <alevy@redhat.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ioapic: improve debugging
Add a DPRINTF macro, use it also to see irq deliveries.
arm: fix arm kernel boot for non zero start addr
Booting an arm kernel has been broken a while when booting from non zero startaddress. This is due to the order of events: board init loads the kernel andsets register 15 to the start address and then qemu_system_reset reset the cpu...
pci-hotplug: make them aware of pci domain.
add helper function which converts root bus to pci domain.make them aware of pci domain.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
pci: clean up of pci_set_default_subsystem_id().
Use pci accessor function.don't return value because it always return 0 andthe caller doesn't check the return value.
pci: add const to pci_is_express(), pci_config_size().
add const to pci_is_express(), pci_config_size().
pci.h: remove unused constants.
So remove unused constants,PCI_STATUS_RESERVED_MASK_LO, PCI_STATUS_RESERVED_MASK_HI,PCI_COMMAND_RESERVED, PCI_COMMAND_RESERVED_MASK_HI.They were used once, but they aren't used anymore.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>...
msix: remove duplicated defines.
remove defines which are already defined in pci_regs.h
mc146818rtc: improve debugging
Add a separate flag for debugging coalesced interrupts.
pc: improve debugging
Add a DPRINTF macro and use it for ISA and PIC interrupts.
apic: improve debugging
Add a DPRINTF macro. Use TARGET_FMT_plx for printing target_phys_addr_titems. Add a separate flag for debugging coalescing interrupts.
i8259: improve debugging
Add a DPRINTF macro.
Pad iommu with an empty slot (necessary for SunOS 4.1.4)
On the real hardware (SS-5, LX) the MMU is not padded, but aliased.Software shouldn't use aliased addresses, neither should it crashwhen it uses (on the real hardware it wouldn't). Using empty_slot...
Fix hw/gt64xxx.c compilation with DEBUG defined
Use TARGET_FMT_plx as format placeholder for target_phys_addr_t
Signed-off-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
musicpal: Drop redundant reset call
Reset is now triggered after init, no need for explicit calls anymore.
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Fix overflow in i440fx_init()
The ram_size parameter can be larger than an int, so it may be truncated.
Fix by using the correct type.
Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
vhost_net.c: v2 Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
The format statement expects unsigned long on x86_64, but receivesunsigned long long, so gcc exits with an error....
sparc64: clean up pci bridge map
- remove unused host state and store pci bus pointer only- do not map host state access into unused 1fe.10000000 range- reorder pci region registration- assign pci i/o region to isa_mem_base
Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>...
sparc64: rename sun4u cpu to Ultrasparc IIi
Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
use new cursor struct + functions for vmware vga and sdl.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Virtio-net: Replace the hardcode 6 with defined ETN_ALEN
hw/virtio-net.h: #define ETH_ALEN 6ETH_ALEN was defined by commit 7967406801aa897fae83caad3278ac85a342adaa
Signed-off-by: Amos Kong <akong@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Merge remote branch 'qmp/for-anthony' into staging
microblaze: Handle new elf mach nr for sysemu.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
lsi: Fix value overflow in request tag processing
This fixes a mismerge of 64d564094cac5f72eeaeb950c442b773a00d3586 (wrongpatch version): We need to mask the tag value properly to obtain itsdevice ID.
sparc32 protect read-only bits in DMA CSR registers
On a real hardware changing read-only bits has no effectUse a mask common for SCSI and Ethernet registers. The crucialbit is DMA_INTR, because setting or clearing it may producespurious interrupts.
This patch allows booting Solaris 2.3...
vmstate: fix breakage by 7e72abc382b700a72549e8147bdea413534eeedc
cirrus_post_load() will be executed twice when loading vm states and then thewrong physical memory will be registered. This issue may lead to crash qemu.
Signed-off-by: TeLeMan <geleman@gmail.com>...
Fix %lld or %llx printf format use
Compile dma only once
Use a qemu_irq to request CPU exit.
7 compilations less for the full build.
pckbd: improve debugging
Compile pckbd only once
Use a qemu_irq to indicate A20 line changes. Move I/O port 92to pckbd.c.
axisdev88: Fix passing of kernel cmdline.
Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
arm_timer: fix oneshot mode
In oneshot mode, the delta needs to come from the TimerLoad register,not the maximum limit.
Signed-off-by: Rabin Vincent <rabin@rab.in>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>