[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/7 v2] KVM regsync: Add register bitmap paramet
From: |
Alexander Graf |
Subject: |
Re: [Qemu-devel] [PATCH 2/7 v2] KVM regsync: Add register bitmap parameter to kvm_arch_[get|put]_registers |
Date: |
Thu, 24 Jan 2013 13:03:31 +0100 |
On 10.01.2013, at 16:28, Jason J. Herne wrote:
> From: "Jason J. Herne" <address@hidden>
>
> 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 <address@hidden>
> Reviewed-by: Christian Borntraeger <address@hidden>
> ---
> 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
These should be defined as (1 << x). How about s/REGS/BIT/ here too, to
indicate what the defines are really about?
> +
> +/* 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)
Good :)
Since higher state is still a higher number than lower state, all checks in
arch-specific code keep working too. Nice :)
Alex