Replace the VMSTOP macros with a proper state type
Today, when notifying a VM state change with vm_state_notify(),we pass a VMSTOP macro as the 'reason' argument. This is not idealbecause the VMSTOP macros tell why qemu stopped and not exactlywhat the current VM state is....
RunState: Add additional states
Currently, only vm_start() and vm_stop() change the VM state.That's, the state is only changed when starting or stopping the VM.
This commit adds the runstate_set() function, which makes it possibleto also do state transitions when the VM is stopped or running....
runstate_set(): Check for valid transitions
This commit could have been folded with the previous one, howeverdoing it separately will allow for easy bisect and revert if needed.
Checking and testing all valid transitions wasn't trivial, chancesare this will need broader testing to become more stable....
Drop the incoming_expected global variable
Test against RSTATE_IN_MIGRATE instead.
Please, note that the RSTATE_IN_MIGRATE state is only set when all theinitial VM setup is done, while 'incoming_expected' was set right inthe beginning when parsing command-line options. Shouldn't be a problem...
Drop the vm_running global variable
Use runstate_is_running() instead, which is introduced by this commit.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Monitor/QMP: Don't allow cont on bad VM state
We have two states where issuing cont before system_reset cancause problems: RSTATE_SHUTDOWN (when -no-shutdown is used) andRSTATE_PANICKED (which only happens with kvm).
This commit fixes that by doing the following when state is...
QMP: query-status: Introduce 'status' key
This new key reports the current VM status to clients. Please, checkthe documentation being added in this commit for more details.
Move vm_state_notify() prototype from cpus.h to sysemu.h
It's where all the state handling functions prototypes are located.
Merge remote-tracking branch 'qemu-kvm-tmp/memory/core' into staging
Merge remote-tracking branch 'aneesh/for-upstream-4' into staging
Fix subtle integer overflow bug in memory API
It is quite common to have a MemoryRegion with size of INT64_MAX.When processing alias regions in render_memory_region() it's quiteeasy to find a case where it will construct a temporary AddrRange witha non-zero start, and size still of INT64_MAX. When means attempting...
block: New bdrv_set_buffer_alignment()
Device models should be able to set it without an unclean include ofblock_int.h.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: Reset buffer alignment on detach
BlockDriverState member buffer_alignment is initially 512. The devicemodel may set them, with bdrv_set_buffer_alignment(). If the devicemodel gets detached (hot unplug), the device's alignment is leftbehind. Only okay because device hot unplug automatically destroys...
nbd: Clean up use of block_int.h
block: New change_media_cb() parameter load
To let device models distinguish between eject and load.
ide/atapi scsi-disk: Make monitor eject -f, then change work
change fails while the tray is locked by the guest. eject -f forcesit open and removes any media. Unfortunately, the tray closes againinstantly. Since the lock remains as it is, there is no way to insert...
qcow2: initialize metadata before inserting in cluster_allocs
QCow2Meta structure was inserted into list before many fields areinitialized. Currently is not a problem cause all occur in a lockbut if qcow2_alloc_clusters would in a future unlock this lock...
ahci: Remove unused struct member
Member variable is_read is written, but never read(contrary to its name). Remove it.
Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qcow2: align cluster_data to block to improve performance using O_DIRECT
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qcow2: fix range check
QCowL2Meta::offset is not cluster aligned but only sector alignedhowever nb_clusters count cluster from cluster start.This fix range check. Note that old code have no corruption issuesrelated to this check cause it only cause intersection to occur...
rbd: clean up, fix style
No assignment in condition. Remove duplicate ret > 0 check.
Signed-off-by: Sage Weil <sage@newdream.net>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
rbd: fix leak in qemu_rbd_open failure paths
Fix leak of s->snap in failure path. Simplify error paths for the wholefunction.
Reported-by: Stefan Hajnoczi <stefanha@gmail.com>Signed-off-by: Sage Weil <sage@newdream.net>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>...
ide/atapi: Don't fail eject when tray is already open
MMC-5 6.40.2.6 specifies that START STOP UNIT succeeds when the drivealready has the requested state. cmd_start_stop_unit() fails whenasked to eject while the tray is open and locked. Fix that.
Signed-off-by: Markus Armbruster <armbru@redhat.com>...
scsi-disk: Fix START_STOP to fail when it can't eject
Don't fail when tray is already open.
ide/atapi: Preserve tray state on migration
Use a subsection, so that migration to older version still works,provided the tray is closed and unlocked.
block: Clean up remaining users of "removable"
BlockDriverState member removable is a confused mess. It is true whenan ide-cd, scsi-cd or floppy qdev is attached, or when theBlockDriverState was created with -drive if={floppy,sd} or -driveif={ide,scsi,xen,none},media=cdrom ("created removable"), except when...
block: Drop BlockDriverState member removable
It's a confused mess (see previous commit). No users remain.
block: Show whether the virtual tray is open in info block
Need to ask the device, so this requires new BlockDevOps memberis_tray_open().
block: Move BlockConf & friends from block_int.h to block.h
It's convenience stuff for block device models, so block.h isn't theideal home either, but better than block_int.h.
Permits moving some #include "block_int.h" from device model .h into.c.
hw: Trim superfluous #include "block_int.h"
Including it in device models is unclean, including it without areason adds insult to injury.
ide/atapi: Track tray open/close state
We already track it in BlockDriverState since commit 4be9762a. Asdiscussed in that commit's message, we should track it in the devicedevice models instead, because it's device state.
scsi-disk: Factor out scsi_disk_emulate_start_stop()
scsi-disk: Track tray open/close state
block: Revert entanglement of bdrv_is_inserted() with tray status
Commit 4be9762a changed bdrv_is_inserted() to fail when the tray isopen. Unfortunately, there are two different kinds of users, withconflicting needs.
1. Device models using bdrv_eject(), currently ide-cd and scsi-cd....
block: Drop tray status tracking, no longer used
Commit 4be9762a is now completely redone.
ide/atapi: Track tray locked state
We already track it in BlockDriverState. Just like tray open/closestate, we should track it in the device models instead, because it'sdevice state.
scsi-disk: Track tray locked state
block: Leave enforcing tray lock to device models
The device model knows best when to accept the guest's eject command.No need to detour through the block layer.
bdrv_eject() can't fail anymore. Make it void.
block: Drop medium lock tracking, ask device models instead
Requires new BlockDevOps member is_medium_locked(). Implement for IDEand SCSI CD-ROMs.
block: Rename bdrv_set_locked() to bdrv_lock_medium()
While there, make the locked parameter bool.
rbd: allow client id to be specified in config string
Allow the client id to be specified in the config string via 'id=' so thatusers can control who they authenticate as. Currently they are stuck withthe default ('admin'). This is necessary for anyone using authentication...
ide: Use a table to declare which drive kinds accept each command
No functional change.
It would be nice to have handler functions in the table, like commite1a064f9 did for ATAPI. Left for another day.
ide: Reject ATA commands specific to drive kinds
ACS-2 Table B.2 explicitly prohibits ATAPI devices from implementingWIN_RECAL, WIN_READ_EXT, WIN_READDMA_EXT, WIN_READ_NATIVE_MAX,WIN_MULTREAD_EXT, WIN_WRITE, WIN_WRITE_ONCE, WIN_WRITE_EXT,WIN_WRITEDMA_EXT, WIN_MULTWRITE_EXT, WIN_WRITE_VERIFY, WIN_VERIFY,...
ide/atapi: Clean up misleading name in cmd_start_stop_unit()
"eject" is misleading; it means "eject" when start is clear, but"load" when start is set. Rename to loej, because that's how MMC-5calls it, in section 6.40.
ide: Fix ATA command READ to set ATAPI signature for CD-ROM
Must set the ATAPI device signature, see ATA4 8.27.5.2 Outputs forPACKET Command feature set devices, and ACS-2 7.36.6 Outputs forPACKET feature set devices.
qcow2: removed unused depends_on field
Gdbstub: Fix back-trace on SPARC32
Gdb expects all registers windows to be flushed in ram, which is not the casein Qemu. Therefore the back-trace generation doesn't work. This patch adds afunction to handle reads (and only read) in stack frames as if windows were...
target-xtensa: implement relocatable vectors
See ISA, 4.4.3 for details.
Vector addresses recorded in core configuration are absolute values thatcorrespond to default VECBASE value.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
target-xtensa: add gdb support
Specific xtensa processor overlay for GDB contains register map inthe gdb/xtensa-config.c. This description is used by the GDB to e.g.parse 'g' response packets and it may be reused in the qemu's gdbstub(only XTREG definitions for non-pseudoregisters are needed)....
target-xtensa: implement memory protection options
- TLB opcode group;- region protection option (ISA, 4.6.3);- region translation option (ISA, 4.6.4);- MMU option (ISA, 4.6.5).
Cache control attribute bits are not used by this implementation.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>...
target-xtensa: implement boolean option
See ISA, 4.3.9
target-xtensa: add dc232b core and board
This is Diamond 232L Standard Core Rev.B (LE).
MAINTAINERS: add xtensa maintainer
Add myself as target-xtensa and DC232B maintainer.
target-xtensa: add regression testsuite
target-xtensa: implement windowed registers
See ISA, 4.7.1 for details.
Physical registers and currently visible window are separate fields inCPUEnv. Only current window is accessible to TCG. On operations thatchange window base helpers copy current window to and from physical...
target-xtensa: implement loop option
See ISA, 4.3.2 for details.
Operations that change LEND SR value invalidate TBs at the old and atthe new LEND. LEND value at TB compilation time is considered constantand loop instruction is generated based on this value....
target-xtensa: implement extended L32R
See ISA, 4.3.3 for details.
TB flag XTENSA_TBFLAG_LITBASE is used to track enable bit of LITBASE SR.
target-xtensa: implement unaligned exception option
See ISA, 4.4.4 for details.
Correct (aligned as per ISA) address for unaligned access is generatedin case this option is not enabled.
target-xtensa: implement SIMCALL
Tensilica iss provides support for applications running in freestandingenvironment through SIMCALL command. It is used by Tensilica libc toaccess argc/argv, for file I/O, etc.
Note that simcalls that accept buffer addresses expect virtual addresses....
target-xtensa: implement interrupt option
See ISA, 4.4.6 (interrupt option), 4.4.7 (high priority interruptoption) and 4.4.8 (timer interrupt option) for details.
target-xtensa: implement accurate window check
See ISA, 4.7.1.3 for details.
Window check is inserted before commands that push "used registerwatermark" beyond its current level. Used register watermark is reset oninstructions that change WINDOW_BASE/WINDOW_START SRs....
target-xtensa: implement CPENABLE and PRID SRs
target-xtensa: implement RST3 group
- access to Special Registers (wsr, rsr);- access to User Registers (wur, rur);- misc. operations option (value clamp, sign extension, min, max);- conditional moves.
target-xtensa: implement shifts (ST1 and RST1 groups)
- ST1: SAR (shift amount special register) manipulation, NSA;- RST1: shifts, 16-bit multiplication.
target-xtensa: implement LSAI group
- base + offset load/store operations for 1/2/4 byte values;- cache operations (not implemented);- multiprocessor synchronization operations.
target-xtensa: mark reserved and TBD opcodes
Reserved opcodes must generate illegal instruction exception. Usuallythey signal emulation quality problems.Not implemented opcodes are good to see.
target-xtensa: implement SYNC group
All operations in this group are no-ops, because there are no delayedside effects.
target-xtensa: implement CACHE group
All operations in this group are no-ops, because cache ought to betransparent to applications. However cache may be abused, then we'llneed to actually implement these opcodes.
target-xtensa: add PS register and access control
target-xtensa: implement exceptions
- mark privileged opcodes with ring check;- make debug exception on exception handler entry.
target-xtensa: implement RST2 group (32 bit mul/div/rem)
target-xtensa: implement conditional jumps
- BZ (comparison to zero);- BI0 (comparison to signed immediate);- BI1 (comparison to unsigned immediate);- B (two registers comparison, bit sets comparison);- BEQZ.N/BNEZ.N (narrow comparison to zero).
target-xtensa: implement JX/RET0/CALLX
Group SNM0 (indirect jumps and calls).
target-xtensa: add special and user registers
Special Registers hold the majority of the state added to the processorby the options. See ISA, 5.3 for details.
User Registers hold state added in support of designer's TIE and in somecases of options that Tensilica provides. See ISA, 5.4 for details....
target-xtensa: add target stubs
target-xtensa: add target to the configure script
target-xtensa: implement disas_xtensa_insn
Set up disas_xtensa_insn switch structure, mark required options on highlevel groups. Implement arithmetic/bit logic/jump/call0.
Implement code generation loop with single step/breakpoint checking.
target-xtensa: implement narrow instructions
Instructions with op0 >= 8 are 2 bytes long, others are 3 bytes long.
target-xtensa: implement RT0 group
NEG and ABS are the only members of RT0 group.
target-xtensa: add sample board
Sample board and sample CPU core are used for debug and may be used fordevelopment of custom SoC emulators.
This board has two fixed size memory regions for DTCM and ITCM andvariable length SRAM region.
mipsnet: convert to qdev
Move mipsnet_init() function to mipssim machine
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
mipsnet: use trace framework
PCI: delete unused mem_base and pci_to_cpu_addr
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Sparc64: remove useless variable
Remove a useless variable, spotted by clang analyzer:/src/qemu/target-sparc/op_helper.c:3904:18: warning: unused variable 'tmp' [-Wunused-variable] target_ulong tmp = val;The error message is actually incorrect since the variable is used....
lsi53c895a: avoid a warning from clang analyzer
Avoid this warning from clang analyzer by deleting the variable:/src/qemu/hw/lsi53c895a.c:895:5: warning: Value stored to 'id' is never read id = (current_tag >> 8) & 0xf;
cpu-exec: remove unnecessary assignment
Avoid this warning from clang analyzer:/src/qemu/cpu-exec.c:97:5: warning: Value stored to 'phys_page2' is never read phys_page2 = -1;
Adjust the scope of the variable while at it.
kvm: remove unnecessary assignments
Avoid these warnings from clang analyzer:/src/qemu/target-i386/kvm.c:772:5: warning: Value stored to 'cwd' is never read cwd = swd = twd = 0;/src/qemu/target-i386/kvm.c:772:11: warning: Although the value stored to 'swd' is used in the enclosing expression, the value is never actually read from 'swd'...
hid: fix misassignment
The code does not have any effect as is, fix it.
Spotted by clang analyzer:/src/qemu/hw/hid.c:99:13: warning: Value stored to 'x1' is never read x1 = 1;
scsi-bus: remove duplicate table entries
Remove duplicate entries from SCSI command table, spotted byclang analyzer:/src/qemu/hw/scsi-bus.c:979:40: warning: initializer overrides prior initialization of this subobject [ ERASE_16 ] = "ERASE_16",...
qemu-io: remove unnecessary assignment
Remove an unnecessary assignment, spotted by clang analyzer:/src/qemu/qemu-io.c:995:9: warning: Value stored to 'offset' is never read offset += reqs[i].qiov->size;
Acked-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
win32: improve version.o dependency
Actually, version.rc doesn't need config-host.mak but config-host.h, fix it.
g364fb: compile in hwlib
Compile g364fb in hwlib. Two compilations less for the full build.
Acked-by: Hervé Poussineau <hpoussin@reactos.org>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Merge remote-tracking branch 'sstabellini/xen-next' into staging
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
vns/tls: don't use depricated gnutls functions
Avoid using deprecated gnutls functions with recent gnutls versions.Fixes build failure on Fedora 16. Keep the old way for compatibilitywith old installations such as RHEL-5 (gnutls 1.4.x).
Based on a patch from Raghavendra D Prabhu <raghu.prabhu13@gmail.com>...
build: fix missing trace dep on GENERATED_HEADERS
fc764105 added an include for qemu-common.h to trace/control.h, whichmade all users of this header file dependent on GENERATED_HEADERS. Sinceit's used by pretty much all the trace backends now, make trace-obj-y...
curses: fix garbling when chtype != long
Qemu currently assumes that chtype is typedef'd to unsigned long, butthis is not necessarily the case (ncurses, for instance, can configurethis at build-time). This patch uses the predefined chtype if qemu isconfigured for curses support and falls back to unsigned long otherwise....
qemu_vmalloc: align properly for transparent hugepages and KVM
To make good use of transparent hugepages, KVM requires that guest-physicaland host-virtual addresses share the low 21 bits (as opposed to just the low12 bits normally required).
Adjust qemu_vmalloc() to honor that requirement. Ignore it for small regions...
Don't use g_thread_get_initialized.
Initialize glib threads unconditionally in main() insteadof using g_thread_get_initialized in the 9p code.
Fixes a build failure on RHEL-5, which ships glib 2.12.g_thread_get_initialized was added in 2.20.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>...
Use hex instead of binary.
Older gcc versions don't understand 0b<bits>,use hex representation instead.
Fixes build failure on RHEL-5.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>