gdbstub: Replace GET_REG*() macros with gdb_get_reg*() functions
This avoids polluting the global namespace with a non-prefixed macro andmakes it obvious in the call sites that we return.
Semi-automatic conversion using, e.g., sed i 's/GET_REGL(/return gdb_get_regl(mem_buf, /g' target*/gdbstub.c...
cpu: Introduce CPUClass::gdb_{read,write}_register()
Completes migration of target-specific code to new target-*/gdbstub.c.
Acked-by: Michael Walle <michael@walle.cc> (for lm32)Acked-by: Max Filippov <jcmvbkbc@gmail.com> (for xtensa)Signed-off-by: Andreas Färber <afaerber@suse.de>
target-s390x: Move cpu_gdb_{read,write}_register()
Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Introduce CPUState::gdb_num_regs and CPUClass::gdb_num_core_regs
CPUState::gdb_num_regs replaces num_g_regs.CPUClass::gdb_num_core_regs replaces NUM_CORE_REGS.
Allows building gdb_register_coprocessor() for xtensa, too.
As a side effect this should fix coprocessor register numbering for SMP....
target-s390x: Fix CPUState rework fallout
Commit f17ec444c3d39f76bcd8b71c2c05d5754bfe333eexec: Change cpu_memory_rw_debug() argument to CPUState
missed to update s390x KVM code, breaking the build.
Let's fix it up.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>...
cpu: Turn cpu_get_phys_page_debug() into a CPUClass hook
Change breakpoint_invalidate() argument to CPUState alongside.
Since all targets now assign a softmmu-only field, we can drop helperscpu_class_set_{do_unassigned_access,vmsd}() and device_class_set_vmsd()....
cpu: Introduce CPUClass::synchronize_from_tb() for cpu_pc_from_tb()
Where no extra implementation is needed, fall back to CPUClass::set_pc().
Acked-by: Michael Walle <michael@walle.cc> (for lm32)Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Move singlestep_enabled field from CPU_COMMON to CPUState
Prepares for changing cpu_single_step() argument to CPUState.
cpu: Introduce CPUClass::set_pc() for gdb_set_cpu_pc()
This moves setting the Program Counter from gdbstub into target code.Use vaddr type as upper-bound replacement for target_ulong.
log: Change log_cpu_state[_mask]() argument to CPUState
Since commit 878096eeb278a8ac1ccd6667af73e026f29b4cf5 (cpu: Turncpu_dump_{state,statistics}() into CPUState hooks) CPUArchState is nolonger needed.
Add documentation and make the functions available through qemu/log.h...
cpu: Move reset logging to CPUState
x86 was using additional CPU_DUMP_* flags, so make that configurable inCPUClass::reset_dump_flags.
This adds reset logging for alpha, unicore32 and xtensa.
Acked-by: Michael Walle <michael@walle.cc> (for lm32)Reviewed-by: Richard Henderson <rth@twiddle.net>...
target-s390x: Change gen_intermediate_code_internal() argument to S390CPU
Also use bool type while at it.
Prepares for moving singlestep_enabled field to CPUState.
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Andreas Färber <afaerber@suse.de>
target-s390x: Don't overuse ENV_GET_CPU()
Commit 3474b679486caa8f6448bae974e131370f360c13 (Utilize selectiveruntime reg sync for hot code paths) introduced two uses ofENV_GET_CPU() inside target-s390x/ KVM code. In one case we can use adirect CPU cast instead....
target-s390x: Change handle_{hypercall,diag}() argument to S390CPU
This allows to get rid of the last remaining ENV_GET_CPU() intarget-s390x/ by using CPU cast directly on the argument.
Cc: Jason J. Herne <jjherne@us.ibm.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
linux-user: Move cpu_clone_regs() and cpu_set_tls() into linux-user
The functions cpu_clone_regs() and cpu_set_tls() are not purely CPUrelated -- they are specific to the TLS ABI for a a particular OS.Move them into the linux-user/ tree where they belong....
cpu: Drop unnecessary dynamic casts in *_env_get_cpu()
A transition from CPUFooState to FooCPU can be considered safe,just like FooCPU::env access in the opposite direction.The only benefit of the FOO_CPU() casts would be protection againstbogus CPUFooState pointers, but then surrounding code would likely...
virtio-ccw: fix build breakage on windows
event_notifier_get_fd() is not available on windows hosts. Fix this bymoving the calls to event_notifier_get_fd() to the kvm code.
Reported-by: Stefan Weil <sw@weilnetz.de>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>...
cpu: Change qemu_init_vcpu() argument to CPUState
This allows to move the call into CPUState's realizefn.Therefore move the stub into libqemustub.a.
kvm: Change cpu_synchronize_state() argument to CPUState
Change Monitor::mon_cpu to CPUState as well.
Reviewed-by: liguang <lig.fnst@cn.fujitsu.com>Acked-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Turn cpu_dump_{state,statistics}() into CPUState hooks
Make cpustats monitor command available unconditionally.
Prepares for changing kvm_handle_internal_error() and kvm_cpu_exec()arguments to CPUState.
virtio-ccw: Wire up ioeventfd.
On hosts that support ioeventfd, make use of it for host-to-guestnotifications via diagnose 500.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Revert "s390x: reduce TARGET_PHYS_ADDR_SPACE_BITS to 62"
This reverts commit 311f83ca08c011b048c063c2fd3038a8957970bc.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
KVM: S390: Add dummy kvm_arch_init_irq_routing()
The common KVM code insists on calling kvm_arch_init_irq_routing()as soon as it sees kernel header support for it (regardless of whetherQEMU supports it). Provide a dummy function to satisfy this.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>...
Remove unnecessary break statements
Fix these warnings from cppcheck:
hw/display/cirrus_vga.c:2603:hw/sd/sd.c:348:hw/timer/exynos4210_mct.c:1033:target-arm/translate.c:9886:target-s390x/mem_helper.c:518:target-unicore32/translate.c:1936: style: Consecutive return, break, continue, goto or throw statements are unnecessary....
s390x: reduce TARGET_PHYS_ADDR_SPACE_BITS to 62
With the next patch, the memory API will complain if theTARGET_PHYS_ADDR_SPACE_BITS gets dangerously close to anoverflow. s390x can handle up to 64 bit of physical addressspace from its page tables, but we never use that much. Just...
osdep, kvm: rename low-level RAM allocation functions
This is preparatory to the introduction of a separate freeing API.
Reported-by: Amos Kong <akong@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Amos Kong <akong@redhat.com>...
Trivial grammar and spelling fixes
similiar -> similarrecieve -> receivetransfered -> transferredpreperation -> preparation
Most changes are in comments, one modifies a parameter name in a functionprototype.
The spelling fixes were made using codespell....
Wire up disabled wait a panicked event on s390
On s390 the disabled wait state indicates a state of attention.For example Linux uses that state after a panic. Letsput the system into panicked state.
An alternative implementation would be to statedisabled-wait <address> instead of pause in the action field....
Utilize selective runtime reg sync for hot code paths
Make use of new kvm_s390_get_registers_partial() for kvm_handle_css_inst() andhandle_hypercall() since they only need registers from the partial set and theyare called quite frequently.
Signed-off-by: Jason J. Herne <jjherne@us.ibm.com>...
Allow selective runtime register synchronization
We want to avoid expensive register synchronization IOCTL's on the hot path soa new kvm_s390_get_registers_partial() is introduced as a compliment tokvm_arch_get_registers(). The new function is called on the hot path, and...
s390x: use CONFIG_INT128 to detect __uint128_t
Target s390x uses ad-hoc macro magic to guess if the compilersupports the GCC extension __uint128_t. This patch uses thethe dedicated macro CONFIG_INT128 defined by configure instead.
This fixes compilation with the CIL source code analyzer, which...
Typo, spelling and grammatical fixes
Minor fixes to documentation and code comments.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
target-s390: Fix SRNMT
Fallthough into abort = oops.
Cc: qemu-trivial@nongnu.orgCc: Alexander Graf <agraf@suse.de>Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Fix typos and misspellings
Fix various typos and misspellings. The bulk of these were found withcodespell.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Reviewed-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
s390: Fix cpu refactoring fallout.
Commit 259186a7 "cpu: Move halted and interrupt_request fields to CPUState" seems to have missed one instance in target-s390x/kvm.c:
/home/cohuck/git/qemu/target-s390x/kvm.c: In function ‘kvm_arch_process_async_events’:...
cpu: Move halted and interrupt_request fields to CPUState
Both fields are used in VMState, thus need to be moved together.Explicitly zero them on reset since they were located beforebreakpoints.
Pass PowerPCCPU to kvmppc_handle_halt().
cpu: Pass CPUState to cpu_interrupt()
Move it to qom/cpu.h to avoid issues with include order.
Change pc_acpi_smi_interrupt() opaque to X86CPU.
cpu: Replace do_interrupt() by CPUClass::do_interrupt method
This removes a global per-target function and thus takes us one stepcloser to compiling multiple targets into one executable.
It will also allow to override the interrupt handling for certain CPU...
s390: simplify kvm cpu init
There is no special code right now and the reset ioctl is done lateron in the the reset handler anyway. Lets simplify the cpu init.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>Signed-off-by: Alexander Graf <agraf@suse.de>
s390/css: Fix subchannel detection
We have to consider the m bit to find the real channel subsystem whendetermining the last subchannel.
If we fail to take this into account, removal of a subchannel inthe middle of a big list of devices will stop device detection after...
gen-icount.h: Rename gen_icount_start/end to gen_tb_start/end
The gen_icount_start/end functions are now somewhat misnamed since theyare useful for generic "start/end of TB" code, used for more than justicount. Rename them to gen_tb_start/end.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
cpu: Introduce ENV_OFFSET macros
Introduce ENV_OFFSET macros which can be used in non-target-specificcode that needs to generate TCG instructions which reference CPUStatefields given the cpu_env register that TCG targets set up with apointer to the CPUArchState struct....
target-s390x: Use mulu2 for mlgr insn
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
cpu: Add CPUArchState pointer to CPUState
The target-specific ENV_GET_CPU() macros have allowed us to navigatefrom CPUArchState to CPUState. The reverse direction was not supported.Avoid introducing CPU_GET_ENV() macros by initializing an untypedpointer that is initialized in derived instance_init functions....
target-s390x: Drop unused cpu_s390x_close() prototype
It was never implemented.
target-s390x: Move TCG initialization to S390CPU initfn
Ensures that a QOM-created S390CPU is usable.
Acked-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Andreas Färber <afaerber@suse.de>
target-s390x: Introduce QOM realizefn for S390CPU
Introduce realizefn and set realized = true in cpu_s390x_init().
Defer CPU reset from initfn to realizefn.
Acked-by: Richard Henderson <rth@twiddle.net>[AF: Invoke parent's realizefn]Signed-off-by: Andreas Färber <afaerber@suse.de>
s390: Keep I/O interrupts enabled for all iscs.
do_io_interrupt() would stop scanning further iscs if it foundan I/O interrupt it could inject. This might cause the pendinginterrupt indication for I/O interrupts to be reset although theremight be queued I/O interrupts for subsequent iscs....
s390: Fix handling of iscs.
There are two ways to express an interruption subclass:- As a bitmask, as used in cr6.- As a number, as used in the I/O interruption word.
Unfortunately, we have treated to I/O interruption word as if itcontained the bitmask as well, which went unnoticed so far as...
s390x: silence warning from GCC on uninitialized values
As best I can tell, this is a false positive.
[aliguori@ccnode4 qemu-s390]$ make CC s390x-softmmu/target-s390x/helper.o /home/aliguori/git/qemu/target-s390x/helper.c: In function ‘do_interrupt’:...
target-s390x: Fix wrong comparison in interrupt handling
gcc with -Wextra complains about an ordered pointer comparison:
target-s390x/helper.c:660:27: warning: ordered comparison of pointer with integer zero [-Wextra]
Obviously the index was missing in the code....
Merge remote-tracking branch 'agraf/s390-for-upstream' into staging
target-s390x: Fix debug output (continued)
Since its introduction in d5a439645a5a70fed5431318c3bce9dc2caa950f(s390x: helper functions for system emulation) the variable name wasraddr. Fix this.
Signed-off-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Alexander Graf <agraf@suse.de>
target-s390x: Fix debug output
Commit 71e470886fb6092504503a5fe41092ace71c096c (target-s390x: fixstyle) renamed the cpu_s390x_handle_mmu_fault() argument from _vaddr toorig_vaddr. Update the debug output code.
Signed-off-by: Andreas Färber <afaerber@suse.de>...
target-s390x: Clean up cpu_inject_*() signatures
Despite cautioning that S390CPU is needed for upcoming CPUStaterefactorings, commit 5d69c547d947798cba92d836d06f6e017ba2b19d (s390:I/O interrupt and machine check injection.) added functionscpu_inject_io() and cpu_inject_crw_mchk() with CPUS390XState argument,...
target-s390x: Pass S390CPU to s390_{add, del}_running_cpu()
This prepares for moving the halted field to CPUState.Most call sites can already supply S390CPU, for some env becomes unused.
Signed-off-by: Andreas Färber <afaerber@suse.de>Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>...
target-s390x: Mark as unmigratable
CPU_SAVE_VERSION was undefined, so "cpu_common" VMState andcpu_{save,load}() were not registered. They were no-ops.Therefore there is no backwards compatibility to keep, so we can markS390CPU as unmigratable at device level....
s390: Use s390_cpu_physical_memory_map for tpi.
Map the I/O interruption code before calling into css.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>Signed-off-by: Alexander Graf <agraf@suse.de>
s390: Lowcore mapping helper.
Create a lowcore mapping helper that includes a check for sufficientlength.
s390: Add mapping helper functions.
Add s390_cpu_physical_memory_{map,unmap} with special handlingfor the lowcore.
s390: Channel I/O basic definitions.
Basic channel I/O structures and helper function.
s390: I/O interrupt and machine check injection.
I/O interrupts are queued per isc. Only crw pending machine checksare supported.
s390: Add channel I/O instructions.
Provide handlers for (most) channel I/O instructions.
s390: Virtual channel subsystem support.
Provide a mechanism for qemu to provide fully virtual subchannels tothe guest.
s390: Wire up channel I/O in kvm.
Trigger the code for our virtual css in case of instructionintercepts for I/O instructions.
Handle the tsch exit for the subchannel-related part of tsch.
kvm: Create kvm_arch_vcpu_id() function
This will allow each architecture to define how the VCPU ID is set onthe KVM_CREATE_VCPU ioctl call.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Acked-by: Gleb Natapov <gleb@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
s390: new contributions GPLv2 or later
IBMs s390 contributions were meant to to be gplv2 or later (sincewe were contributing to qemu). Several of the s390 specific fileslink to gpl code anyway, so lets clarify the licence statement fornew contributions for those files that we have touched multiple...
S390: Enable -cpu help and QMP query-cpu-definitions
This enables qemu -cpu help to return a list of supported CPU modelson s390 and also to query for cpu definitions in the monitor.Initially only cpu model = host is returned. This needs to be reworked...
s390x: Remove inline function ebcdic_put and related data from cpu.h
The function is only used in misc_helper.c, so move it to that file.
This reduces the size of debug executables (compiled without optimization)because they get unused code and data for each compilation which includes...
s390: Add CPU reset handler
Add a CPU reset handler to have all CPUs in a PoP compliantstate.
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>[agraf: move hw/hw.h into existing ifdef]Signed-off-by: Alexander Graf <agraf@suse.de>
s390x: fix indentation
In one of the last commits we accidently got 3-space indentation intothe tree. Fix it up so it's 4 spaces wide.
Reported-by: Andreas Faerber <afaerber@suse.de>Signed-off-by: Alexander Graf <agraf@suse.de>
target-s390x: Unregister reset callback on finalization
Since commit "s390: Add CPU reset handler" the CPU's instance_initregisters a reset callback. Unregister that on instance_finalize.
s390: Add a hypercall registration interface.
Allow virtio machines to register for different diag500 functioncodes and convert s390-virtio to use it.
cpu: Move cpu_index field to CPUState
Note that target-alpha accesses this field from TCG, now using anegative offset. Therefore the field is placed last in CPUState.
Pass PowerPCCPU to [kvm]ppc_fixup_cpu() to facilitate this change.
Move common parts of mips cpu_state_reset() to mips_cpu_reset()....
target-s390: Optimize ADDC/SUBB
Giving the proper mask to disas_jcc allows us to generate an inlinecomparison generating the carry/borrow with setcond.
In the very worst case, when we must use the external helper to computea value for CC, we generate (cc > 1) instead of (cc >> 1), which is only...
target-s390: Optimize get_address
Don't load the displacement into a register first, add it secondso that tcg_gen_addi_i64 can eliminate zeros. Don't mask thedisplacement first so that we don't turn small negative numbersinto large positive numbers....
target-s390: Perform COMPARE AND SWAP inline
Still no proper solution for CONFIG_USER_ONLY, but the systemversion is significantly better.
Signed-off-by: Richard Henderson <rth@twiddle.net>
target-s390: Use TCG_CALL_NO_WG for memory helpers
Those that do not read or write tcg registers, but canraise exceptions via memory faults.
target-s390: Use TCG_CALL_NO_WG for floating-point helpers
None of them read or write tcg registers, but most canraise fp exceptions.
target-s390: Use TCG_CALL_NO_WG for integer helpers
The division routines do not read or write tcg registers,but can raise fixed-point divide exceptions.
target-s390: Use TCG_CALL_NO_WG for misc helpers
target-s390: Use noreturn for exception and load_psw
Both always exit the cpu loop.
target-s390: Implement POPCNT
target-s390: Implement CPSDR
target-s390: Check insn operand specifications
Removes all the fixmes for even register numbers, etc.
target-s390: Implement LCDFR
target-s390: Use uint64_to_float128
target-s390: Implement SET ROUNDING MODE
target-s390: Implement LOAD/SET FP AND SIGNAL
target-s390: Fix cpu_clone_regs
R2 is the syscall return register, not R0.
target-s390: Optimize XC
Notice XC with same address and convert that to store of zero.
target-s390: Optmize emitting discards
While they aren't expensive, they aren't free to process. When weknow that the three cc helper variables are dead, don't kill them.
target-s390: Tidy comparisons
After full conversion, we can audit the uses of LTGT cc opsand see that none of the instructions can ever set CC=3.Thus we can extend the table to treat that bit as ignored.
This fixes a regression wrt the pre-conversion translation...
target-s390: Optimize ADDU/SUBU CC testing
We can easily generate some masks for logical add/subtract inline.
target-s390: Implement COMPARE RELATIVE LONG
target-s390: Implement COMPARE AND TRAP
target-s390: Implement LOAD ON CONDITION
target-s390: Implement STORE ON CONDITION
target-s390: Implement CONVERT TO LOGICAL
target-s390: Implement CONVERT FROM LOGICAL