From patchwork Fri Nov 11 11:28:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Palatin X-Patchwork-Id: 693636 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tFd522Y10z9t1h for ; Fri, 11 Nov 2016 22:30:30 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="ZR8dcFSs"; dkim-atps=neutral Received: from localhost ([::1]:52114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5A2N-0001Lz-7X for incoming@patchwork.ozlabs.org; Fri, 11 Nov 2016 06:30:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43505) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5A0y-00005j-7e for qemu-devel@nongnu.org; Fri, 11 Nov 2016 06:29:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c5A0x-0001ix-2U for qemu-devel@nongnu.org; Fri, 11 Nov 2016 06:29:00 -0500 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:33357) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c5A0w-0001iT-Nr for qemu-devel@nongnu.org; Fri, 11 Nov 2016 06:28:58 -0500 Received: by mail-wm0-x233.google.com with SMTP id c184so59522174wmd.0 for ; Fri, 11 Nov 2016 03:28:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=eHWIioQPPolD8npJO6Pwa40q6fleiP+9ooYOeHq5aBU=; b=ZR8dcFSs91F+ExmkUn/s0Ob2W9+/r1zf98U4bDzFjod3lAa/TTHmqPZZprrEFviOot G1s/bJO3/JHOcHwJ3yu2zk+xsF72ji0INw5X71ynMdj732DlYdX7C31Yw+hk/jiSCMXz qTdHQA2kt93YAVvPuNIrxOagtAFymXb8ThFkKKqhr8uEankIhaKciekFoVfWNHSxiGMU aWGLIvS2xFORmVBA7VuuzKBWU7lXxluORmiXJk/ckW/smXeVEUm48HYUd+GND4bPbyyG 9jcNoLK2WOSacksUXjWx45WUyOv8nJATMesaSWBtpiEzj909deMsZZBntKQ8LjmEVb/G IioA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=eHWIioQPPolD8npJO6Pwa40q6fleiP+9ooYOeHq5aBU=; b=cP3/ep6G+n30PFKBVLIwnwF8rqke4pIW/hU7JSXwH537nduzzhRrMBam36qWMHV8C2 QjQXMe8GSztA81mMlLPSZNbLZrJenLv8j5rNlVvCbjMPiSyNqtJH983UX9nk0iP4q3Is XBgXRxW5ywMGSL3k7Vc+4GRf5aqdbobpgPkYDhdLq6BIW/gpqoKqrXY5hQUX00ro29Lq z5njxINf3jNXQD7UkGSHI3s/EGwQM7f/tBT1JO4dQ+psZRo9fTq2Kk4VR+yiLuxKGQs5 i4YfrL5lQsFoZzd3cHqcpwbRV7/JLCLFG2R8zqRBOGZ51fhy8STt2n6n/pB9j/muwrJX GDWA== X-Gm-Message-State: ABUngve6EAdw/QfDmwSNDM7lze4si4NaUbBDFjwRldEEnU6N53G8HGS2mshF+wCrvW0LffGP X-Received: by 10.28.175.204 with SMTP id y195mr11419623wme.106.1478863737156; Fri, 11 Nov 2016 03:28:57 -0800 (PST) Received: from vpalatin.zrh.corp.google.com ([172.16.114.40]) by smtp.gmail.com with ESMTPSA id i10sm10961389wjd.15.2016.11.11.03.28.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Nov 2016 03:28:56 -0800 (PST) From: Vincent Palatin To: qemu-devel Date: Fri, 11 Nov 2016 12:28:31 +0100 Message-Id: X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::233 Subject: [Qemu-devel] [PATCH v2 1/5] kvm: move cpu synchronization code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincent Palatin Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move the generic cpu_synchronize_ functions to the common hw_accel.h header, in order to prepare for the addition of a second hardware accelerator. Signed-off-by: Vincent Palatin --- cpus.c | 1 + gdbstub.c | 1 + hw/i386/kvm/apic.c | 1 + hw/i386/kvmvapic.c | 1 + hw/misc/vmport.c | 2 +- include/sysemu/hw_accel.h | 39 +++++++++++++++++++++++++++++++++++++++ include/sysemu/kvm.h | 23 ----------------------- monitor.c | 2 +- qom/cpu.c | 2 +- target-arm/cpu.c | 2 +- target-i386/helper.c | 1 + target-i386/kvm.c | 1 + 12 files changed, 49 insertions(+), 27 deletions(-) create mode 100644 include/sysemu/hw_accel.h diff --git a/cpus.c b/cpus.c index 5213351..fc78502 100644 --- a/cpus.c +++ b/cpus.c @@ -33,6 +33,7 @@ #include "sysemu/block-backend.h" #include "exec/gdbstub.h" #include "sysemu/dma.h" +#include "sysemu/hw_accel.h" #include "sysemu/kvm.h" #include "qmp-commands.h" #include "exec/exec-all.h" diff --git a/gdbstub.c b/gdbstub.c index de62d26..de9b62b 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -32,6 +32,7 @@ #define MAX_PACKET_LENGTH 4096 #include "qemu/sockets.h" +#include "sysemu/hw_accel.h" #include "sysemu/kvm.h" #include "exec/semihost.h" #include "exec/exec-all.h" diff --git a/hw/i386/kvm/apic.c b/hw/i386/kvm/apic.c index 01cbaa8..328f80c 100644 --- a/hw/i386/kvm/apic.c +++ b/hw/i386/kvm/apic.c @@ -14,6 +14,7 @@ #include "cpu.h" #include "hw/i386/apic_internal.h" #include "hw/pci/msi.h" +#include "sysemu/hw_accel.h" #include "sysemu/kvm.h" #include "target-i386/kvm_i386.h" diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c index b30d1b9..2f767b6 100644 --- a/hw/i386/kvmvapic.c +++ b/hw/i386/kvmvapic.c @@ -14,6 +14,7 @@ #include "exec/exec-all.h" #include "sysemu/sysemu.h" #include "sysemu/cpus.h" +#include "sysemu/hw_accel.h" #include "sysemu/kvm.h" #include "hw/i386/apic_internal.h" #include "hw/sysbus.h" diff --git a/hw/misc/vmport.c b/hw/misc/vmport.c index c763811..be40930 100644 --- a/hw/misc/vmport.c +++ b/hw/misc/vmport.c @@ -25,7 +25,7 @@ #include "hw/hw.h" #include "hw/isa/isa.h" #include "hw/i386/pc.h" -#include "sysemu/kvm.h" +#include "sysemu/hw_accel.h" #include "hw/qdev.h" //#define VMPORT_DEBUG diff --git a/include/sysemu/hw_accel.h b/include/sysemu/hw_accel.h new file mode 100644 index 0000000..03812cf --- /dev/null +++ b/include/sysemu/hw_accel.h @@ -0,0 +1,39 @@ +/* + * QEMU Hardware accelertors support + * + * Copyright 2016 Google, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#ifndef QEMU_HW_ACCEL_H +#define QEMU_HW_ACCEL_H + +#include "qom/cpu.h" +#include "sysemu/hax.h" +#include "sysemu/kvm.h" + +static inline void cpu_synchronize_state(CPUState *cpu) +{ + if (kvm_enabled()) { + kvm_cpu_synchronize_state(cpu); + } +} + +static inline void cpu_synchronize_post_reset(CPUState *cpu) +{ + if (kvm_enabled()) { + kvm_cpu_synchronize_post_reset(cpu); + } +} + +static inline void cpu_synchronize_post_init(CPUState *cpu) +{ + if (kvm_enabled()) { + kvm_cpu_synchronize_post_init(cpu); + } +} + +#endif /* QEMU_HW_ACCEL_H */ diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index df67cc0..3045ee7 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -461,29 +461,6 @@ void kvm_cpu_synchronize_state(CPUState *cpu); void kvm_cpu_synchronize_post_reset(CPUState *cpu); void kvm_cpu_synchronize_post_init(CPUState *cpu); -/* generic hooks - to be moved/refactored once there are more users */ - -static inline void cpu_synchronize_state(CPUState *cpu) -{ - if (kvm_enabled()) { - kvm_cpu_synchronize_state(cpu); - } -} - -static inline void cpu_synchronize_post_reset(CPUState *cpu) -{ - if (kvm_enabled()) { - kvm_cpu_synchronize_post_reset(cpu); - } -} - -static inline void cpu_synchronize_post_init(CPUState *cpu) -{ - if (kvm_enabled()) { - kvm_cpu_synchronize_post_init(cpu); - } -} - /** * kvm_irqchip_add_msi_route - Add MSI route for specific vector * @s: KVM state diff --git a/monitor.c b/monitor.c index 0841d43..d38956f 100644 --- a/monitor.c +++ b/monitor.c @@ -50,7 +50,7 @@ #include "sysemu/balloon.h" #include "qemu/timer.h" #include "migration/migration.h" -#include "sysemu/kvm.h" +#include "sysemu/hw_accel.h" #include "qemu/acl.h" #include "sysemu/tpm.h" #include "qapi/qmp/qerror.h" diff --git a/qom/cpu.c b/qom/cpu.c index 03d9190..2c5274f 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -22,7 +22,7 @@ #include "qapi/error.h" #include "qemu-common.h" #include "qom/cpu.h" -#include "sysemu/kvm.h" +#include "sysemu/hw_accel.h" #include "qemu/notify.h" #include "qemu/log.h" #include "exec/log.h" diff --git a/target-arm/cpu.c b/target-arm/cpu.c index 99f0dbe..744cc11 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -31,7 +31,7 @@ #endif #include "hw/arm/arm.h" #include "sysemu/sysemu.h" -#include "sysemu/kvm.h" +#include "sysemu/hw_accel.h" #include "kvm_arm.h" static void arm_cpu_set_pc(CPUState *cs, vaddr value) diff --git a/target-i386/helper.c b/target-i386/helper.c index 4ecc091..7530280 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -24,6 +24,7 @@ #include "kvm_i386.h" #ifndef CONFIG_USER_ONLY #include "sysemu/sysemu.h" +#include "sysemu/hw_accel.h" #include "monitor/monitor.h" #include "hw/i386/apic_internal.h" #endif diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 1c0864e..d9ad69e 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -23,6 +23,7 @@ #include "qemu-common.h" #include "cpu.h" #include "sysemu/sysemu.h" +#include "sysemu/hw_accel.h" #include "sysemu/kvm_int.h" #include "kvm_i386.h" #include "hyperv.h"