From patchwork Fri Dec 21 13:56:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason J. Herne" X-Patchwork-Id: 207817 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 56AE32C0094 for ; Sat, 22 Dec 2012 00:57:59 +1100 (EST) Received: from localhost ([::1]:47667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tm36r-00064k-Kk for incoming@patchwork.ozlabs.org; Fri, 21 Dec 2012 08:57:57 -0500 Received: from eggs.gnu.org ([208.118.235.92]:56586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tm35W-0002ND-Kd for qemu-devel@nongnu.org; Fri, 21 Dec 2012 08:56:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tm35L-0004po-9x for qemu-devel@nongnu.org; Fri, 21 Dec 2012 08:56:34 -0500 Received: from e7.ny.us.ibm.com ([32.97.182.137]:42997) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tm35L-0004pj-5d for qemu-devel@nongnu.org; Fri, 21 Dec 2012 08:56:23 -0500 Received: from /spool/local by e7.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 21 Dec 2012 08:56:22 -0500 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e7.ny.us.ibm.com (192.168.1.107) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 21 Dec 2012 08:56:20 -0500 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 722B6C9003E for ; Fri, 21 Dec 2012 08:56:19 -0500 (EST) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id qBLDuJqS313844 for ; Fri, 21 Dec 2012 08:56:19 -0500 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id qBLDuIt2005492 for ; Fri, 21 Dec 2012 08:56:19 -0500 Received: from w500-1204.ibm.com (sig-9-49-152-5.mts.ibm.com [9.49.152.5]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id qBLDuHjr005310; Fri, 21 Dec 2012 08:56:17 -0500 From: "Jason J. Herne" To: borntraeger@de.ibm.com, qemu-devel@nongnu.org, jan.kiszka@siemens.com, agraf@suse.de, jfrei@linux.vnet.ibm.com, graalfs@linux.vnet.ibm.com Date: Fri, 21 Dec 2012 08:56:16 -0500 Message-Id: <1356098176-4924-1-git-send-email-jjherne@us.ibm.com> X-Mailer: git-send-email 1.7.9.5 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12122113-5806-0000-0000-00001D4758CA X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 32.97.182.137 Cc: "Jason J. Herne" Subject: [Qemu-devel] [PATCH 5/7] KVM regsync: Add register level parameter to cpu_synchronize_state X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Jason J. Herne" cpu_synchronize_state is updated to take/propagate the register level parameter. All callers are modified to specify the runtime state. Signed-off-by: Jason J. Herne Reviewed-by: Christian Borntraeger --- cpus.c | 4 ++-- dump.c | 2 +- gdbstub.c | 8 ++++---- hw/kvmvapic.c | 4 ++-- hw/ppce500_spin.c | 2 +- hw/vmport.c | 2 +- include/sysemu/kvm.h | 4 ++-- monitor.c | 2 +- target-i386/helper.c | 4 ++-- target-i386/kvm.c | 2 +- target-ppc/mmu_helper.c | 2 +- target-ppc/translate.c | 2 +- target-s390x/kvm.c | 8 ++++---- 13 files changed, 23 insertions(+), 23 deletions(-) diff --git a/cpus.c b/cpus.c index 4a7782a..49e6536 100644 --- a/cpus.c +++ b/cpus.c @@ -408,7 +408,7 @@ void cpu_synchronize_all_states(void) CPUArchState *cpu; for (cpu = first_cpu; cpu; cpu = cpu->next_cpu) { - cpu_synchronize_state(cpu); + cpu_synchronize_state(cpu, KVM_REGSYNC_FULL_STATE); } } @@ -1209,7 +1209,7 @@ CpuInfoList *qmp_query_cpus(Error **errp) CPUState *cpu = ENV_GET_CPU(env); CpuInfoList *info; - cpu_synchronize_state(env); + cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); info = g_malloc0(sizeof(*info)); info->value = g_malloc0(sizeof(*info->value)); diff --git a/dump.c b/dump.c index a26b1a5..c945f89 100644 --- a/dump.c +++ b/dump.c @@ -728,7 +728,7 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, */ nr_cpus = 0; for (env = first_cpu; env != NULL; env = env->next_cpu) { - cpu_synchronize_state(env); + cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); nr_cpus++; } diff --git a/gdbstub.c b/gdbstub.c index a8dd437..fd9158d 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -2009,7 +2009,7 @@ static void gdb_breakpoint_remove_all(void) static void gdb_set_cpu_pc(GDBState *s, target_ulong pc) { - cpu_synchronize_state(s->c_cpu); + cpu_synchronize_state(s->c_cpu, KVM_REGSYNC_FULL_STATE); #if defined(TARGET_I386) s->c_cpu->eip = pc; #elif defined (TARGET_PPC) @@ -2206,7 +2206,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) } break; case 'g': - cpu_synchronize_state(s->g_cpu); + cpu_synchronize_state(s->g_cpu, KVM_REGSYNC_FULL_STATE); env = s->g_cpu; len = 0; for (addr = 0; addr < num_g_regs; addr++) { @@ -2217,7 +2217,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) put_packet(s, buf); break; case 'G': - cpu_synchronize_state(s->g_cpu); + cpu_synchronize_state(s->g_cpu, KVM_REGSYNC_FULL_STATE); env = s->g_cpu; registers = mem_buf; len = strlen(p) / 2; @@ -2383,7 +2383,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) thread = strtoull(p+16, (char **)&p, 16); env = find_cpu(thread); if (env != NULL) { - cpu_synchronize_state(env); + cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); len = snprintf((char *)mem_buf, sizeof(mem_buf), "CPU#%d [%s]", env->cpu_index, env->halted ? "halted " : "running"); diff --git a/hw/kvmvapic.c b/hw/kvmvapic.c index 81f4bcf..89a90c6 100644 --- a/hw/kvmvapic.c +++ b/hw/kvmvapic.c @@ -451,7 +451,7 @@ void vapic_report_tpr_access(DeviceState *dev, void *cpu, target_ulong ip, VAPICROMState *s = DO_UPCAST(VAPICROMState, busdev.qdev, dev); CPUX86State *env = cpu; - cpu_synchronize_state(env); + cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); if (evaluate_tpr_instruction(s, env, &ip, access) < 0) { if (s->state == VAPIC_ACTIVE) { @@ -622,7 +622,7 @@ static void vapic_write(void *opaque, hwaddr addr, uint64_t data, hwaddr rom_paddr; VAPICROMState *s = opaque; - cpu_synchronize_state(env); + cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); /* * The VAPIC supports two PIO-based hypercalls, both via port 0x7E. diff --git a/hw/ppce500_spin.c b/hw/ppce500_spin.c index 177aa2d..aa704ae 100644 --- a/hw/ppce500_spin.c +++ b/hw/ppce500_spin.c @@ -98,7 +98,7 @@ static void spin_kick(void *data) hwaddr map_size = 64 * 1024 * 1024; hwaddr map_start; - cpu_synchronize_state(env); + cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); stl_p(&curspin->pir, env->spr[SPR_PIR]); env->nip = ldq_p(&curspin->addr) & (map_size - 1); env->gpr[3] = ldq_p(&curspin->r3); diff --git a/hw/vmport.c b/hw/vmport.c index 7d42523..75daf6d 100644 --- a/hw/vmport.c +++ b/hw/vmport.c @@ -62,7 +62,7 @@ static uint64_t vmport_ioport_read(void *opaque, hwaddr addr, unsigned char command; uint32_t eax; - cpu_synchronize_state(env); + cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); eax = env->regs[R_EAX]; if (eax != VMPORT_MAGIC) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 2f3e485..7b32843 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -242,10 +242,10 @@ void kvm_cpu_synchronize_post_init(CPUArchState *env); /* generic hooks - to be moved/refactored once there are more users */ -static inline void cpu_synchronize_state(CPUArchState *env) +static inline void cpu_synchronize_state(CPUArchState *env, int register_level) { if (kvm_enabled()) { - kvm_cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); + kvm_cpu_synchronize_state(env, register_level); } } diff --git a/monitor.c b/monitor.c index 9cf419b..eaee6b9 100644 --- a/monitor.c +++ b/monitor.c @@ -886,7 +886,7 @@ static CPUArchState *mon_get_cpu(void) if (!cur_mon->mon_cpu) { monitor_set_cpu(0); } - cpu_synchronize_state(cur_mon->mon_cpu); + cpu_synchronize_state(cur_mon->mon_cpu, KVM_REGSYNC_FULL_STATE); return cur_mon->mon_cpu; } diff --git a/target-i386/helper.c b/target-i386/helper.c index dca1360..18ebb2a 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -175,7 +175,7 @@ void cpu_dump_state(CPUX86State *env, FILE *f, fprintf_function cpu_fprintf, char cc_op_name[32]; static const char *seg_name[6] = { "ES", "CS", "SS", "DS", "FS", "GS" }; - cpu_synchronize_state(env); + cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); eflags = env->eflags; #ifdef TARGET_X86_64 @@ -1074,7 +1074,7 @@ static void do_inject_x86_mce(void *data) CPUX86State *cenv = params->env; uint64_t *banks = cenv->mce_banks + 4 * params->bank; - cpu_synchronize_state(cenv); + cpu_synchronize_state(cenv, KVM_REGSYNC_FULL_STATE); /* * If there is an MCE exception being processed, ignore this SRAO MCE diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 1b6a604..f9908d8 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -1984,7 +1984,7 @@ static int kvm_handle_debug(CPUX86State *env, ret = EXCP_DEBUG; } if (ret == 0) { - cpu_synchronize_state(env); + cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); assert(env->exception_injected == -1); /* pass to guest */ diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c index 0aee7a9..814b79f 100644 --- a/target-ppc/mmu_helper.c +++ b/target-ppc/mmu_helper.c @@ -1604,7 +1604,7 @@ static void mmubooks_dump_mmu(FILE *f, fprintf_function cpu_fprintf, int i; uint64_t slbe, slbv; - cpu_synchronize_state(env); + cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); cpu_fprintf(f, "SLB\tESID\t\t\tVSID\n"); for (i = 0; i < env->slb_nr; i++) { diff --git a/target-ppc/translate.c b/target-ppc/translate.c index 798b7ac..186de01 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -9421,7 +9421,7 @@ void cpu_dump_state (CPUPPCState *env, FILE *f, fprintf_function cpu_fprintf, int i; - cpu_synchronize_state(env); + cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); cpu_fprintf(f, "NIP " TARGET_FMT_lx " LR " TARGET_FMT_lx " CTR " TARGET_FMT_lx " XER " TARGET_FMT_lx "\n", diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index be26686..ad978ba 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -337,7 +337,7 @@ static int kvm_sclp_service_call(CPUS390XState *env, struct kvm_run *run, uint64_t code; int r = 0; - cpu_synchronize_state(env); + cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); sccb = env->regs[ipbh0 & 0xf]; code = env->regs[(ipbh0 & 0xf0) >> 4]; @@ -371,7 +371,7 @@ static int handle_priv(CPUS390XState *env, struct kvm_run *run, uint8_t ipa1) static int handle_hypercall(CPUS390XState *env, struct kvm_run *run) { - cpu_synchronize_state(env); + cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); env->regs[2] = s390_virtio_hypercall(env, env->regs[2], env->regs[1]); return 0; @@ -425,7 +425,7 @@ static int s390_cpu_initial_reset(CPUS390XState *env) } /* Manually zero out all registers */ - cpu_synchronize_state(env); + cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); for (i = 0; i < 16; i++) { env->regs[i] = 0; } @@ -444,7 +444,7 @@ static int handle_sigp(CPUS390XState *env, struct kvm_run *run, uint8_t ipa1) S390CPU *target_cpu; CPUS390XState *target_env; - cpu_synchronize_state(env); + cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE); /* get order code */ order_code = run->s390_sieic.ipb >> 28;