Misc patches for 2017-02-16
The following changes since commit 5dae13cd71f0755a1395b5a4cde635b8a6ee3f58:
Merge remote-tracking branch 'remotes/rth/tags/pull-or-20170214' into staging (2017-02-14 09:55:48 +0000)
are available in the git repository at:
git://github.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to 65c9d60a3ad3249784348824eca69acac455bc02:
target-i386: correctly propagate retaddr into SVM helpers (2017-02-16 18:37:01 +0100)
----------------------------------------------------------------
* GUEST_PANICKED improvements (Anton)
* vCont gdbstub rewrite (Claudio)
* Fix CPU creation with -device (Liyang)
* Logging fixes for pty chardevs (Ed)
* Makefile "move if changed" fix (Lin)
* First part of cpu_exec refactoring (me)
* SVM emulation fix (me)
* apic_delivered fix (Pavel)
* "info ioapic" fix (Peter)
* qemu-nbd socket activation (Richard)
* QOMification of mcf_uart (Thomas)
----------------------------------------------------------------
Alberto Garcia (1):
qemu-doc: Clarify that -vga std is now the default
Anton Nefedov (4):
qemu-char: socket backend: disconnect on write error i386/cpu: add crash-information QOM property report guest crash information in GUEST_PANICKED event
vl: log available guest crash information
Claudio Imbrenda (2):
move vm_start to cpus.c
gdbstub: Fix vCont behaviour
Dou Liyang (1):
vl: Move the cpu_synchronize_all_post_init() after generic devices initialization
Ed Swierk (1):
char: drop data written to a disconnected pty
Lin Ma (1):
Makefile: avoid leaving the temporary QEMU_PKGVERSION header file
Paolo Bonzini (7):
test-vmstate: remove yield_until_fd_readable
cpu-exec: fix icount out-of-bounds access
cpu-exec: tighten barrier on TCG_EXIT_REQUESTED
cpu-exec: avoid cpu_loop_exit in cpu_handle_interrupt
cpu-exec: avoid repeated sigsetjmp on interrupts
cpu-exec: remove outermost infinite loop
target-i386: correctly propagate retaddr into SVM helpers
Pavel Dovgalyuk (1):
apic: reset apic_delivered global variable on machine reset
Peter Xu (3):
kvm/ioapic: dump real object instead of a fake one
ioapic: fix error report value of def version kvm/ioapic: correct kvm ioapic version
Richard W.M. Jones (1):
qemu-nbd: Implement socket activation.
Thomas Huth (1):
hw/char/mcf_uart: QOMify the ColdFire UART
Makefile | 6 +- chardev/char-pty.c | 2 +- chardev/char-socket.c | 10 +++ cpu-exec.c | 86 ++++++++++--------- cpus.c | 42 ++++++++++ gdbstub.c | 209 +++++++++++++++++++++++++++++++++++----------- hw/char/mcf_uart.c | 102 ++++++++++++++++------ hw/i386/kvm/ioapic.c | 13 ++- hw/intc/apic_common.c | 2 + hw/intc/ioapic.c | 6 +- hw/m68k/mcf5208.c | 6 +- hw/misc/pvpanic.c | 2 +- hw/ppc/spapr_rtas.c | 3 +- include/exec/exec-all.h | 1 + include/hw/m68k/mcf.h | 6 +- include/qom/cpu.h | 10 +++ include/sysemu/sysemu.h | 4 +- kvm-all.c | 3 +- qapi-schema.json | 24 ++++++ qapi/event.json | 6 +- qemu-nbd.c | 172 ++++++++++++++++++++++++++++++++++++-- qemu-options.hx | 4 +- qom/cpu.c | 11 +++ target/i386/cpu.c | 51 +++++++++++ target/i386/cpu.h | 5 +- target/i386/excp_helper.c | 11 +-- target/i386/helper.h | 1 - target/i386/misc_helper.c | 24 +++--- target/i386/seg_helper.c | 6 +- target/i386/svm_helper.c | 65 +++++++------- target/s390x/kvm.c | 4 +- tests/test-vmstate.c | 11 --- vl.c | 56 +++++-------- 33 files changed, 711 insertions(+), 253 deletions(-)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 23/23] target-i386: correctly propagate retaddr into SVM helpers
Commit 2afbdf8 ("target-i386: exception handling for memory helpers", 2015-09-15) changed tlb_fill's cpu_restore_state+raise_exception_err to raise_exception_err_ra. After this change, the cpu_restore_state and raise_exception_err's cpu_loop_exit are merged into raise_exception_err_ra's cpu_loop_exit_restore.
This actually fixed some bugs, but when SVM is enabled there is a second path from raise_exception_err_ra to cpu_loop_exit. This is the VMEXIT path, and now cpu_vmexit is called without a cpu_restore_state before.
The fix is to pass the retaddr to cpu_vmexit (via cpu_svm_check_intercept_param). All helpers can now use GETPC() to pass the correct retaddr, too.
--- cpu-exec.c | 2 +- target/i386/cpu.h | 5 ++-- target/i386/excp_helper.c | 11 ++++---- target/i386/helper.h | 1 - target/i386/misc_helper.c | 24 ++++++++--------- target/i386/seg_helper.c | 6 ++--- target/i386/svm_helper.c | 65 ++++++++++++++++++++++------------------------- 7 files changed, 56 insertions(+), 58 deletions(-)
cpu-exec.c +1 -1
@@ -491,7 +491,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,X86CPU *x86_cpu =X86_CPU (cpu);CPUArchState *env = &x86_cpu->env;replay_interrupt (); -cpu_svm_check_intercept_param (env,SVM_EXIT_INIT ,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_INIT ,0 ,0 );do_cpu_init (x86_cpu); cpu->exception_index =EXCP_HALTED ;return true;
target/i386/cpu.h +3 -2
@@ -1621,8 +1621,9 @@ void helper_lock_init(void);/* svm_helper.c */ void cpu_svm_check_intercept_param (CPUX86State *env1,uint32_t type, -uint64_t param); -void cpu_vmexit (CPUX86State *nenv,uint32_t exit_code,uint64_t exit_info_1); +uint64_t param,uintptr_t retaddr); +void cpu_vmexit (CPUX86State *nenv,uint32_t exit_code,uint64_t exit_info_1, +uintptr_t retaddr);/* seg_helper.c */ void do_interrupt_x86_hardirq (CPUX86State *env,int intno,int is_hw);
target/i386/excp_helper.c +6 -5
@@ -39,7 +39,8 @@ void helper_raise_exception(CPUX86State *env, int exception_index)* needed. It should only be called, if this is not an interrupt. * Returns the new exception number. */ -static int check_exception (CPUX86State *env,int intno,int *error_code) +static int check_exception (CPUX86State *env,int intno,int *error_code, +uintptr_t retaddr) { int first_contributory = env->old_exception == 0 || (env->old_exception >= 10 &&
@@ -53,7 +54,7 @@ static int check_exception(CPUX86State *env, int intno, int *error_code)#if !defined(CONFIG_USER_ONLY )if (env->old_exception ==EXCP08_DBLE ) {if (env->hflags &HF_SVMI_MASK ) { -cpu_vmexit (env,SVM_EXIT_SHUTDOWN ,0 );/* does not return */ +cpu_vmexit (env,SVM_EXIT_SHUTDOWN ,0 , retaddr);/* does not return */ }qemu_log_mask (CPU_LOG_RESET ,"Triple fault\n" );
@@ -93,10 +94,10 @@ static void QEMU_NORETURN raise_interrupt2(CPUX86State *env, int intno,if (!is_int) {cpu_svm_check_intercept_param (env,SVM_EXIT_EXCP_BASE + intno, - error_code); - intno =check_exception (env, intno, &error_code); + error_code, retaddr); + intno =check_exception (env, intno, &error_code, retaddr); }else { -cpu_svm_check_intercept_param (env,SVM_EXIT_SWINT ,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_SWINT ,0 , retaddr); } cs->exception_index = intno;
target/i386/helper.h +0 -1
@@ -99,7 +99,6 @@ DEF_HELPER_2(inl, tl, env, i32) DEF_HELPER_FLAGS_4(bpt_io, TCG_CALL_NO_WG, void, env, i32, i32, tl) DEF_HELPER_3(svm_check_intercept_param, void, env, i32, i64) -DEF_HELPER_3(vmexit, void, env, i32, i64) DEF_HELPER_4(svm_check_io, void, env, i32, i32, i32) DEF_HELPER_3(vmrun, void, env, int, int)DEF_HELPER_1 (vmmcall, void, env)
target/i386/misc_helper.c +12 -12
@@ -101,7 +101,7 @@ void helper_cpuid(CPUX86State *env) {uint32_t eax, ebx, ecx, edx; -cpu_svm_check_intercept_param (env,SVM_EXIT_CPUID ,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_CPUID ,0 ,GETPC ());cpu_x86_cpuid (env, (uint32_t )env->regs[R_EAX ], (uint32_t )env->regs[R_ECX ], &eax, &ebx, &ecx, &edx);
@@ -125,7 +125,7 @@ target_ulong helper_read_crN(CPUX86State *env, int reg) {target_ulong val; -cpu_svm_check_intercept_param (env,SVM_EXIT_READ_CR0 + reg,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_READ_CR0 + reg,0 ,GETPC ());switch (reg) {default : val = env->cr[reg];
@@ -143,7 +143,7 @@ target_ulong helper_read_crN(CPUX86State *env, int reg)void helper_write_crN (CPUX86State *env,int reg,target_ulong t0) { -cpu_svm_check_intercept_param (env,SVM_EXIT_WRITE_CR0 + reg,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_WRITE_CR0 + reg,0 ,GETPC ());switch (reg) {case 0 :cpu_x86_update_cr0 (env, t0);
@@ -179,7 +179,7 @@ void helper_invlpg(CPUX86State *env, target_ulong addr) {X86CPU *cpu =x86_env_get_cpu (env); -cpu_svm_check_intercept_param (env,SVM_EXIT_INVLPG ,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_INVLPG ,0 ,GETPC ());tlb_flush_page (CPU (cpu), addr); }
@@ -190,7 +190,7 @@ void helper_rdtsc(CPUX86State *env)if ((env->cr[4 ] &CR4_TSD_MASK ) && ((env->hflags &HF_CPL_MASK ) !=0 )) {raise_exception_ra (env,EXCP0D_GPF ,GETPC ()); } -cpu_svm_check_intercept_param (env,SVM_EXIT_RDTSC ,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_RDTSC ,0 ,GETPC ()); val =cpu_get_tsc (env) + env->tsc_offset; env->regs[R_EAX ] = (uint32_t )(val);
@@ -208,7 +208,7 @@ void helper_rdpmc(CPUX86State *env)if ((env->cr[4 ] &CR4_PCE_MASK ) && ((env->hflags &HF_CPL_MASK ) !=0 )) {raise_exception_ra (env,EXCP0D_GPF ,GETPC ()); } -cpu_svm_check_intercept_param (env,SVM_EXIT_RDPMC ,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_RDPMC ,0 ,GETPC ());/* currently unimplemented */ qemu_log_mask (LOG_UNIMP ,"x86: unimplemented rdpmc\n" );
@@ -228,7 +228,7 @@ void helper_wrmsr(CPUX86State *env) {uint64_t val; -cpu_svm_check_intercept_param (env,SVM_EXIT_MSR ,1 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_MSR ,1 ,GETPC ()); val = ((uint32_t )env->regs[R_EAX ]) | ((uint64_t )((uint32_t )env->regs[R_EDX ]) <<32 );
@@ -388,7 +388,7 @@ void helper_rdmsr(CPUX86State *env) {uint64_t val; -cpu_svm_check_intercept_param (env,SVM_EXIT_MSR ,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_MSR ,0 ,GETPC ());switch ((uint32_t )env->regs[R_ECX ]) {case MSR_IA32_SYSENTER_CS :
@@ -557,7 +557,7 @@ void helper_hlt(CPUX86State *env, int next_eip_addend) {X86CPU *cpu =x86_env_get_cpu (env); -cpu_svm_check_intercept_param (env,SVM_EXIT_HLT ,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_HLT ,0 ,GETPC ()); env->eip += next_eip_addend;do_hlt (cpu);
@@ -569,7 +569,7 @@ void helper_monitor(CPUX86State *env, target_ulong ptr)raise_exception_ra (env,EXCP0D_GPF ,GETPC ()); }/* XXX: store address? */ -cpu_svm_check_intercept_param (env,SVM_EXIT_MONITOR ,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_MONITOR ,0 ,GETPC ()); }void helper_mwait (CPUX86State *env,int next_eip_addend)
@@ -580,7 +580,7 @@ void helper_mwait(CPUX86State *env, int next_eip_addend)if ((uint32_t )env->regs[R_ECX ] !=0 ) {raise_exception_ra (env,EXCP0D_GPF ,GETPC ()); } -cpu_svm_check_intercept_param (env,SVM_EXIT_MWAIT ,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_MWAIT ,0 ,GETPC ()); env->eip += next_eip_addend; cpu =x86_env_get_cpu (env);
@@ -597,7 +597,7 @@ void helper_pause(CPUX86State *env, int next_eip_addend) {X86CPU *cpu =x86_env_get_cpu (env); -cpu_svm_check_intercept_param (env,SVM_EXIT_PAUSE ,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_PAUSE ,0 ,GETPC ()); env->eip += next_eip_addend;do_pause (cpu);
target/i386/seg_helper.c +3 -3
@@ -1335,7 +1335,7 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) }else if (env->hflags2 &HF2_GIF_MASK ) {if ((interrupt_request &CPU_INTERRUPT_SMI ) && !(env->hflags &HF_SMM_MASK )) { -cpu_svm_check_intercept_param (env,SVM_EXIT_SMI ,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_SMI ,0 ,0 ); cs->interrupt_request &= ~CPU_INTERRUPT_SMI ;do_smm_enter (cpu); ret = true;
@@ -1356,7 +1356,7 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) (env->eflags & IF_MASK && !(env->hflags & HF_INHIBIT_IRQ_MASK))))) {int intno; -cpu_svm_check_intercept_param (env,SVM_EXIT_INTR ,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_INTR ,0 ,0 ); cs->interrupt_request &= ~(CPU_INTERRUPT_HARD |CPU_INTERRUPT_VIRQ ); intno =cpu_get_pic_interrupt (env);
@@ -1372,7 +1372,7 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) !(env->hflags & HF_INHIBIT_IRQ_MASK)) {int intno;/* FIXME: this should respect TPR */ -cpu_svm_check_intercept_param (env,SVM_EXIT_VINTR ,0 ); +cpu_svm_check_intercept_param (env,SVM_EXIT_VINTR ,0 ,0 ); intno =x86_ldl_phys (cs, env->vm_vmcb + offsetof(struct vmcb, control.int_vector)); qemu_log_mask(CPU_LOG_TB_IN_ASM,
target/i386/svm_helper.c +31 -34
192 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Peter Maydell
AppliedQuoted 13 lines · Paolo Bonzini
The following changes since commit
5dae13cd71f0755a1395b5a4cde635b8a6ee3f58:Merge remote-tracking branch 'remotes/rth/tags/pull-or-20170214' into staging (2017-02-14 09:55:48 +0000)
are available in the git repository at:
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
65c9d60a3ad3249784348824eca69acac455bc02:target-i386: correctly propagate retaddr into SVM helpers (2017-02-16 18:37:01 +0100)
Quoted 13 lines
----------------------------------------------------------------
*GUEST_PANICKEDimprovements (Anton)
* vCont gdbstub rewrite (Claudio)
* Fix CPU creation with -device (Liyang)
* Logging fixes for pty chardevs (Ed)
*Makefile"move if changed" fix (Lin)
* First part ofcpu_execrefactoring (me)
* SVM emulation fix (me)
*apic_deliveredfix (Pavel)
* "info ioapic" fix (Peter)
* qemu-nbd socket activation (Richard)
* QOMification ofmcf_uart(Thomas)
Applied, thanks.
-- PMM