From patchwork Thu Jan 10 15:28:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason J. Herne" X-Patchwork-Id: 211069 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 ADE022C0346 for ; Fri, 11 Jan 2013 02:29:15 +1100 (EST) Received: from localhost ([::1]:40797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtK49-0005P1-Ii for incoming@patchwork.ozlabs.org; Thu, 10 Jan 2013 10:29:13 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtK3u-0005Bs-Gh for qemu-devel@nongnu.org; Thu, 10 Jan 2013 10:29:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtK3p-0007rX-SM for qemu-devel@nongnu.org; Thu, 10 Jan 2013 10:28:58 -0500 Received: from e7.ny.us.ibm.com ([32.97.182.137]:46881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtK3p-0007rH-Nl for qemu-devel@nongnu.org; Thu, 10 Jan 2013 10:28:53 -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 ; Thu, 10 Jan 2013 10:28:51 -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; Thu, 10 Jan 2013 10:28:47 -0500 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id E49D3C90045 for ; Thu, 10 Jan 2013 10:28:46 -0500 (EST) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r0AFSkV4296398 for ; Thu, 10 Jan 2013 10:28:46 -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 r0AFSjrp011545 for ; Thu, 10 Jan 2013 10:28:46 -0500 Received: from w500-1204.endicott.ibm.com (w500-1204.endicott.ibm.com [9.60.75.168] (may be forged)) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r0AFSh5H011457; Thu, 10 Jan 2013 10:28:43 -0500 From: "Jason J. Herne" To: agraf@suse.de, borntraeger@de.ibm.com, aliguori@us.ibm.com, mtosatti@redhat.com, qemu-devel@nongnu.org, R65777@freescale.com, jan.kiszka@siemens.com Date: Thu, 10 Jan 2013 10:28:43 -0500 Message-Id: <1357831723-3884-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: 13011015-5806-0000-0000-00001E0EFABA 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 2/7 v2] KVM regsync: Add register bitmap parameter to kvm_arch_[get|put]_registers 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" Modify kvm_arch_get_registers anf kvm_arch_put_registers interfaces such that they accept a register bitmap parameter. Also modify the only caller of kvm_arch_get_registers such that it passes an appropriate bitmap. The idea here is that, for all currently existing calls we want to do nothing different. Signed-off-by: Jason J. Herne Reviewed-by: Christian Borntraeger --- include/sysemu/kvm.h | 11 ++--------- kvm-all.c | 2 +- target-i386/cpu.h | 15 +++++++++++++++ target-ppc/cpu.h | 15 +++++++++++++++ target-s390x/cpu.h | 15 +++++++++++++++ target-s390x/kvm.c | 2 +- 6 files changed, 49 insertions(+), 11 deletions(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 6756e16..e0738ba 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -165,16 +165,9 @@ int kvm_arch_handle_exit(CPUState *cpu, struct kvm_run *run); int kvm_arch_process_async_events(CPUState *cpu); -int kvm_arch_get_registers(CPUState *cpu); +int kvm_arch_get_registers(CPUState *cpu, int regmap); -/* state subset only touched by the VCPU itself during runtime */ -#define KVM_REGSYNC_RUNTIME_STATE 1 -/* state subset modified during VCPU reset */ -#define KVM_REGSYNC_RESET_STATE 2 -/* full state set, modified during initialization or on vmload */ -#define KVM_REGSYNC_FULL_STATE 3 - -int kvm_arch_put_registers(CPUState *cpu, int level); +int kvm_arch_put_registers(CPUState *cpu, int regmap); int kvm_arch_init(KVMState *s); diff --git a/kvm-all.c b/kvm-all.c index aa58b74..1aa61bb 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1494,7 +1494,7 @@ static void do_kvm_cpu_synchronize_state(void *arg) CPUState *cpu = arg; if (!cpu->kvm_vcpu_dirty) { - kvm_arch_get_registers(cpu); + kvm_arch_get_registers(cpu, KVM_REGSYNC_FULL_STATE); cpu->kvm_vcpu_dirty = true; } } diff --git a/target-i386/cpu.h b/target-i386/cpu.h index e56921b..64d9f05 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -1223,4 +1223,19 @@ void enable_kvm_pv_eoi(void); /* Return name of 32-bit register, from a R_* constant */ const char *get_register_name_32(unsigned int reg); +/* Architecture specific register synchronization constants */ +#define KVM_REGSYNC_I386_RUNTIME_REGS 0x01 +#define KVM_REGSYNC_I386_RESET_REGS 0x02 +#define KVM_REGSYNC_I386_FULL_REGS 0x04 + +/* General register sets made up of architeture specific registers*/ +/* state subset only touched by the VCPU itself during runtime */ +#define KVM_REGSYNC_RUNTIME_STATE KVM_REGSYNC_I386_RUNTIME_REGS +/* state subset modified during VCPU reset */ +#define KVM_REGSYNC_RESET_STATE (KVM_REGSYNC_RUNTIME_STATE| \ + KVM_REGSYNC_I386_RESET_REGS) +/* full state set, modified during initialization or on vmload */ +#define KVM_REGSYNC_FULL_STATE (KVM_REGSYNC_RESET_STATE| \ + KVM_REGSYNC_I386_FULL_REGS) + #endif /* CPU_I386_H */ diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h index e88ebe0..f890ebd 100644 --- a/target-ppc/cpu.h +++ b/target-ppc/cpu.h @@ -2233,4 +2233,19 @@ static inline void cpu_pc_from_tb(CPUPPCState *env, TranslationBlock *tb) void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUPPCState *env); +/* Architecture specific register synchronization constants */ +#define KVM_REGSYNC_PPC_RUNTIME_REGS 0x01 +#define KVM_REGSYNC_PPC_RESET_REGS 0x02 +#define KVM_REGSYNC_PPC_FULL_REGS 0x04 + +/* General register sets made up of architeture specific registers*/ +/* state subset only touched by the VCPU itself during runtime */ +#define KVM_REGSYNC_RUNTIME_STATE KVM_REGSYNC_PPC_RUNTIME_REGS +/* state subset modified during VCPU reset */ +#define KVM_REGSYNC_RESET_STATE (KVM_REGSYNC_RUNTIME_STATE| \ + KVM_REGSYNC_PPC_RESET_REGS) +/* full state set, modified during initialization or on vmload */ +#define KVM_REGSYNC_FULL_STATE (KVM_REGSYNC_RESET_STATE| \ + KVM_REGSYNC_PPC_FULL_REGS) + #endif /* !defined (__CPU_PPC_H__) */ diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index cd565c9..55ea4ee 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -999,4 +999,19 @@ uint32_t set_cc_nz_f64(float64 v); /* misc_helper.c */ void program_interrupt(CPUS390XState *env, uint32_t code, int ilc); +/* Architecture specific register synchronization constants */ +#define KVM_REGSYNC_S390_RUNTIME_REGS 0x01 +#define KVM_REGSYNC_S390_RESET_REGS 0x02 +#define KVM_REGSYNC_S390_FULL_REGS 0x04 + +/* General register sets made up of architeture specific registers*/ +/* state subset only touched by the VCPU itself during runtime */ +#define KVM_REGSYNC_RUNTIME_STATE KVM_REGSYNC_S390_RUNTIME_REGS +/* state subset modified during VCPU reset */ +#define KVM_REGSYNC_RESET_STATE (KVM_REGSYNC_RUNTIME_STATE| \ + KVM_REGSYNC_S390_RESET_REGS) +/* full state set, modified during initialization or on vmload */ +#define KVM_REGSYNC_FULL_STATE (KVM_REGSYNC_RESET_STATE| \ + KVM_REGSYNC_S390_FULL_REGS) + #endif diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index e7b5ad9..4b87f1c 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -151,7 +151,7 @@ int kvm_arch_put_registers(CPUState *cs, int level) return 0; } -int kvm_arch_get_registers(CPUState *cs) +int kvm_arch_get_registers(CPUState *cs, int regmap) { S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env;