Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
Define the architecture for compressed dump format
Signed-off-by: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>Reviewed-by: Laszlo Ersek <lersek@redhat.com>Reviewed-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
s390x/cpu: Use ioctl to reset state in the kernel
Some of the state in the kernel can not be reset from QEMU yet.For this we've got to use the KVM_S390_INITIAL_RESET ioctl to makesure that the state in the kernel is set to the right values duringinitial CPU reset, too....
s390x/kvm: Rework SIGP INITIAL CPU RESET handler
The s390_cpu_initial_reset() function had two deficiencies: First, itused an ioctl for the destination CPU, and this ioctl could blocknearly forever, as long as the destination CPU was running in the SIE...
s390x/kvm: Add missing SIGP CPU RESET order
The SIGP order CPU RESET was still missing in the list of oursupported handler. This patch now adds a simple implementation,by using the cpu_reset() function that is already available intarget-s390x/cpu.c.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>...
s390x/kvm: Rework priv instruction handlers
The current implementation uses the second byte of the instructionto identify the instruction handler. This is not sufficient tosupport instructions not starting with 0xb2. This patchadds separate handlers for 0xb2, 0xb9 and 0xeb to be able to...
s390x/async_pf: Check for apf extension and enable pfault
S390 can also use async page faults, to enhance guest scheduling.In case of live migration we want to disable the feature and letall pending request finish.
Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com>...
s390x/kvm: Fixed bad SIGP SET-ARCHITECTURE handler
The SET-ARCHITECTURE handler in QEMU caused a program interruption.This is wrong according to the "Principles of Operations" specification(since SIGP should never cause a program interrupt) and was likely only...
s390x/virtio-hcall: Specification exception for illegal subcodes
So far, the DIAG 500 hypervisor call was only setting -EINVAL inR2 when a guest tried to call this function with an illegal subcode.This patch now changes the behavior so that a specification exception...
s390x/sclp: Fixed the size of sccb and code parameter
The pointer to the SCCB should not be limited to 32 bits only.In contrast to this, the command word parameter is only 32 bits(the upper 32 bits should be ignored).
s390x/sclp: Add missing checks to SCLP handler
If the 51 most significant bits of the SCCB address are zero or equal tothe prefix, we should throw an specification exception, too.Also moved the check for privileged mode to sclp_service_call() to haveall program checks in one place now....
s390x/sclp: Fixed setting of condition code register
In the SCLP handler function, the condition code register mustonly be set if no exception occured.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>...
exec: Make stb_phys input an AddressSpace
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
exec: Make stw_*_phys input an AddressSpace
exec: Make stq_*_phys input an AddressSpace
exec: Make ldq/ldub_*_phys input an AddressSpace
exec: Make ldl_*_phys input an AddressSpace
s390x/kvm: cleanup partial register handling
The partial register handling (introduced with commits420840e58b85f7f4e5493dca3f273566f261090a and3474b679486caa8f6448bae974e131370f360c13 ) aimed to improve intercepthandling performance.
It made the code more complicated though. During development for life...
s390x/ioinst: CHSC has to set a condition code
I missed to set the CC in the CHSC instruction when I refactoredthe CC setting in the IO instructions with the following commit: 5d9bf1c07c1369ab3506fc82cc65a10f4415d867 s390/ioinst: Moved the CC setting to the IO instruction handlers...
s390x/kvm: Fix diagnose handling.
The instruction intercept handler for diagnose used only the displacementwhen trying to calculate the function code. This is only correct for base0, however; we need to perform a complete base/displacement addresscalculation and use bits 48-63 as the function code....
s390x/kvm: Removed duplicated SIGP defines
The SIGP order defines are also available in cpu.h,so there is no need to re-define them in kvm.c.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>...
s390x/kvm: Removed s390_store_status stub
The SIGP order STORE STATUS AT ADDRESS will be handled inkernel space, so we do not need the stub in QEMU anymore.
s390x/kvm: Fix coding style in handle_sigp()
To make scripts/checkpatch.pl happy for the following patches,the coding style in handle_sigp() has to be fixed first.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>...
s390x/kvm: Implemented SIGP START
This patch adds the missing START order to the SIGP instruction handler.
s390x/kvm: Simplified the calculation of the SIGP order code
We've already got a helper function for calculating thebase/displacement of RS formatted instructions, so we canget rid of the manual calculation of the SIGP order code.
s390x/kvm: Fixed condition code for unknown SIGP orders
If SIGP is called with an unknown order code, it has to return CC1instead of CC3 and set the "invalid order" bit in the return status.
exec: Fix prototype of phys_mem_set_alloc and related functions
phys_mem_alloc and its assigned values qemu_anon_ram_alloc andlegacy_s390_alloc must have identical argument lists.
legacy_s390_alloc uses the size parameter to call mmap, so size_t isgood enough for all of them....
Merge remote-tracking branch 'rth/tcg-pull' into staging
tcg: Move helper registration into tcg_context_init
No longer needs to be done on a per-target basis.
Signed-off-by: Richard Henderson <rth@twiddle.net>
cpu: Drop cpu_model_str from CPU_COMMON
Since this is only read in cpu_copy() and linux-user has a globalcpu_model, drop the field from generic code.
Signed-off-by: Andreas Färber <afaerber@suse.de>
s390/ebcdic: Move conversion tables to header file
Move conversion tables to header file. - In SCLP line mode processing EBCDIC/ASCII conversion is needed. - An additional EBCDIC to ASCII conversion function is added.
Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>...
s390/kexec: Implement diag308 subcode 0
This patch implements subcode 0 of diag 308. This is necessary for kexec(without kdump). The main difference to subcode 1 is that all CPUs geta full reset, instead of the architectured CPU reset (which leaves all...
s390/dump: zero out padding bytes in notes sections
The prstatus of an s390x dump contains several padding areas. Zero outthese bytes to make reading the notes section easier with a hexdump.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
s390/cpu: Make setcc() function available to other files
Moved the setcc() function to cpu.h so that it can be used by otherfiles, too. It now also does not modify the kvm state anymore sincethis gets updated during kvm_arch_put_registers() anyway.
s390/ioinst: Moved the CC setting to the IO instruction handlers
The IO instruction handlers now take care of setting the CC value ontheir own, so that the confusing return code magic in kvm_handle_css_inst()is not needed anymore.
s390/kvm: Add check for priviledged SCLP handler
The SCLP instruction is priviledged, so we should make sure thatwe generate an exception when it is called from the problem state.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
exec: Don't abort when we can't allocate guest memory
We abort() on memory allocation failure. abort() is appropriate forprogramming errors. Maybe most memory allocation failures areprogramming errors, maybe not. But guest memory allocation failureisn't, and aborting when the user asks for more memory than we can...
exec: Simplify the guest physical memory allocation hook
Make it a generic hook rather than a KVM hook. Less code andifdeffery.
Since the only user of the hook is old S390 KVM, there's hope we canget rid of it some day.
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>...
cpu: Use QTAILQ for CPU list
Introduce CPU_FOREACH(), CPU_FOREACH_SAFE() and CPU_NEXT() shorthandmacros.
tcg: Change tcg_gen_exit_tb argument to uintptr_t
And update all users.
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>Signed-off-by: Richard Henderson <rth@twiddle.net>
s390: Implement load normal reset
kdump on s390 uses a load normal reset to bring the system in a definedstate by doing a subsystem reset. The issuing CPUs will have an initialCPU reset, all other CPUs will have a CPU reset as defined in POP (noregister content will change)....
s390: wire up nmi command to raise a RESTART interrupt on S390
There is the 'nmi' command that is used to trigger a guest dump via kdump feature on x86.s390 uses RESTART interrupt to trigger kdump.So, this patch provides a mean to use 'nmi' command on s390 to raise RESTART interrupt....
s390/cpu: split CPU reset into architectured functions
s390 provides several CPU resets:- CPU reset, clears interrupts, stop processing, clears TLB, but does not touch registers- initial CPU reset, like CPU reset, but also clears PSW, prefix, FPC, timer and control registers. It does not touch gprs, fprs and acrs (!)...
s390: provide I/O subsystem reset
Provide a function that resets the I/O subsystem.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>Acked-by: Alexander Graf <agraf@suse.de>
s390: provide a cpu load normal function
Some code needs to perform an IPL-like bootup that mimics theESA (31bit) restart. Provide a cpu class method that does so.
s390/kvm: basic implementation of diagnose 308 subcode 6
Linux uses a check for subcode 6 to decide if other subcodes areavailable. Provide a minimal implementation for subcode 6, as wellas for subcode 5.
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>...
s390x/kvm: Fix switch/case indentation for handle_diag
This alignes case statements to switch statements in the handle_diagfunction as mandated by coding style.
aio / timers: Switch entire codebase to the new timer API
This is an autogenerated patch using scripts/switch-timer-api.
Switch the entire code base to using the new timer API.
Note this patch may introduce some line length issues.
Signed-off-by: Alex Bligh <alex@alex.org.uk>...
dump: rebase from host-private RAMBlock offsets to guest-physical addresses
RAMBlock.offset --> GuestPhysBlock.target_startRAMBlock.offset + RAMBlock.length --> GuestPhysBlock.target_endRAMBlock.length --> GuestPhysBlock.target_end -...
s390x/kvm: Remove redundant return code
Removed the redundant return code statement from handle_instruction() - italways returned 0 and never reports any errors to its caller, since errorsfrom the sub-functions are already reported via program exceptions instead....
s390: Implement dump-guest-memory support for target s390x
With this patch dump-guest-memory on s390 produces an ELF formatted,crash-readable dump.In order to implement this, the arch-specific part of dump-guest-memorywas added:target-s390x/arch_dump.c contains the whole set of function for writing...
s390x/kvm: Reworked/fixed handling of cc3 in kvm_handle_css_inst()
Consolidated the setting of the condition code in kvm_handle_css_inst().For the (unhandled) instructions EQBS and SQBS, we have to returnan operation exception instead of cc3. Also removed the is_ioinst()...
s390x/ioinst: Fixed alignment check in SCHM instruction
Register 2 only has to be aligned to a 32-byte boundary, not afull page boundary.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
s390x/ioinst: Fixed priority of operand exceptions
Operand exceptions have a lower priority than specification and addressexceptions. Thus the checks for operand exceptions must be done later.
s390x/ioinst: Add missing alignment checks for IO instructions
The IO instructions MSCH, SSCH, STSCH, TSCH, STCRW and TPI requirethat the second operand address must be aligned on a word boundary.
s390x/ioinst: Throw addressing exception when memory_map failed
So far, the IO instructions were throwing specification exceptions whenthere was a problem with accessing the memory. However, the better wayis to throw an addressing exception instead.
s390x: Rename 'dprintf' to 'DPRINTF'
'dprintf' is the name of a POSIX standard function so we should not bestealing it for our debug macro. Rename to 'DPRINTF' (in line witha number of other source files.)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
cpu: Partially revert "cpu: Change qemu_init_vcpu() argument to CPUState"
Commit c643bed99 moved qemu_init_vcpu() calls to common CPUState code.This causes x86 cpu-add to fail with "KVM: setting VAPIC address failed".
The reason for the failure is that CPUClass::kvm_fd is not yet...
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()
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.
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....