From patchwork Fri Jun 28 15:55:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 2799811 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BAB23BF4A1 for ; Fri, 28 Jun 2013 15:56:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CA7A4201FC for ; Fri, 28 Jun 2013 15:56:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B1F4201F7 for ; Fri, 28 Jun 2013 15:56:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755384Ab3F1P4B (ORCPT ); Fri, 28 Jun 2013 11:56:01 -0400 Received: from cantor2.suse.de ([195.135.220.15]:44130 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751361Ab3F1Pz7 (ORCPT ); Fri, 28 Jun 2013 11:55:59 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id EF9F4A52C6; Fri, 28 Jun 2013 17:55:58 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , David Gibson , Alexander Graf , Gleb Natapov , Marcelo Tosatti , qemu-ppc@nongnu.org (open list:sPAPR), kvm@vger.kernel.org (open list:Overall) Subject: [PULL 08/24] kvm: Change kvm_cpu_synchronize_state() argument to CPUState Date: Fri, 28 Jun 2013 17:55:30 +0200 Message-Id: <1372434946-18489-9-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1372434946-18489-1-git-send-email-afaerber@suse.de> References: <1372434946-18489-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It no longer relies on CPUArchState since 20d695a. Reviewed-by: liguang Acked-by: Paolo Bonzini Reviewed-by: Richard Henderson Signed-off-by: Andreas Färber --- hw/ppc/spapr_rtas.c | 2 +- include/sysemu/kvm.h | 4 ++-- kvm-all.c | 4 +--- kvm-stub.c | 2 +- target-i386/kvm.c | 10 +++++----- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index f4bd3c9..42ed7dc 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -184,7 +184,7 @@ static void rtas_start_cpu(sPAPREnvironment *spapr, /* This will make sure qemu state is up to date with kvm, and * mark it dirty so our changes get flushed back before the * new cpu enters */ - kvm_cpu_synchronize_state(env); + kvm_cpu_synchronize_state(cs); env->msr = (1ULL << MSR_SF) | (1ULL << MSR_ME); env->nip = start; diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 8b19322..3e1db28 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -259,14 +259,14 @@ int kvm_check_extension(KVMState *s, unsigned int extension); uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function, uint32_t index, int reg); -void kvm_cpu_synchronize_state(CPUArchState *env); +void kvm_cpu_synchronize_state(CPUState *cpu); /* generic hooks - to be moved/refactored once there are more users */ static inline void cpu_synchronize_state(CPUArchState *env) { if (kvm_enabled()) { - kvm_cpu_synchronize_state(env); + kvm_cpu_synchronize_state(ENV_GET_CPU(env)); } } diff --git a/kvm-all.c b/kvm-all.c index e6b262f..eee294b 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1590,10 +1590,8 @@ static void do_kvm_cpu_synchronize_state(void *arg) } } -void kvm_cpu_synchronize_state(CPUArchState *env) +void kvm_cpu_synchronize_state(CPUState *cpu) { - CPUState *cpu = ENV_GET_CPU(env); - if (!cpu->kvm_vcpu_dirty) { run_on_cpu(cpu, do_kvm_cpu_synchronize_state, cpu); } diff --git a/kvm-stub.c b/kvm-stub.c index 22eaff0..128faf7 100644 --- a/kvm-stub.c +++ b/kvm-stub.c @@ -42,7 +42,7 @@ void kvm_flush_coalesced_mmio_buffer(void) { } -void kvm_cpu_synchronize_state(CPUArchState *env) +void kvm_cpu_synchronize_state(CPUState *cpu) { } diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 9ffb6ca..0b0adfd 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -1857,7 +1857,7 @@ int kvm_arch_process_async_events(CPUState *cs) cs->interrupt_request &= ~CPU_INTERRUPT_MCE; - kvm_cpu_synchronize_state(env); + kvm_cpu_synchronize_state(cs); if (env->exception_injected == EXCP08_DBLE) { /* this means triple fault */ @@ -1888,16 +1888,16 @@ int kvm_arch_process_async_events(CPUState *cs) cs->halted = 0; } if (cs->interrupt_request & CPU_INTERRUPT_INIT) { - kvm_cpu_synchronize_state(env); + kvm_cpu_synchronize_state(cs); do_cpu_init(cpu); } if (cs->interrupt_request & CPU_INTERRUPT_SIPI) { - kvm_cpu_synchronize_state(env); + kvm_cpu_synchronize_state(cs); do_cpu_sipi(cpu); } if (cs->interrupt_request & CPU_INTERRUPT_TPR) { cs->interrupt_request &= ~CPU_INTERRUPT_TPR; - kvm_cpu_synchronize_state(env); + kvm_cpu_synchronize_state(cs); apic_handle_tpr_access_report(env->apic_state, env->eip, env->tpr_access_type); } @@ -2184,7 +2184,7 @@ bool kvm_arch_stop_on_emulation_error(CPUState *cs) X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; - kvm_cpu_synchronize_state(env); + kvm_cpu_synchronize_state(cs); return !(env->cr[0] & CR0_PE_MASK) || ((env->segs[R_CS].selector & 3) != 3); }