From patchwork Mon May 16 15:35:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 9103951 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 878999F1C1 for ; Mon, 16 May 2016 15:42:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AE1A520279 for ; Mon, 16 May 2016 15:42:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E238720154 for ; Mon, 16 May 2016 15:41:59 +0000 (UTC) Received: from localhost ([::1]:44462 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2Ked-0001n2-4e for patchwork-qemu-devel@patchwork.kernel.org; Mon, 16 May 2016 11:41:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KZZ-0001aY-R1 for qemu-devel@nongnu.org; Mon, 16 May 2016 11:36:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2KZX-0006Z0-Gm for qemu-devel@nongnu.org; Mon, 16 May 2016 11:36:44 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:34337) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KZX-0006Yt-7L for qemu-devel@nongnu.org; Mon, 16 May 2016 11:36:43 -0400 Received: by mail-wm0-x243.google.com with SMTP id n129so18904863wmn.1 for ; Mon, 16 May 2016 08:36:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=qbSqbK8ePFOgsWdpKMPnvCVzJMCfQ54HKzCgIDnhix0=; b=Uuc0J+fD0K6poMg+stOW7bsIpkRRlPEXFc2yDt8eCZOC7xHnKABpLMBrB0iZE1ex/x 2a7GY1AC19FMzZKIGmtsTPR8YVlEhzcuDc8w5jDGvg7FKK4cLeGG7vzpy+0DGUsLlgPb 6s7D7X/c1g9Obq12rfJU5NZIWjq7XlUOm8yz+TJibrU9YTnhUK04uCRLFZRi1li5pztc RHyxlXUHcAI+Bp87NWMf7n7jsBqsrnSnwME/IPO4sacPNQ/jKS00YXFNepsWNVbgACnC IYy/BDYgdxP0dyplbH6idQ2e+tUJprPPWkFjNgPvmjGl5f83wcpY5LjKNEXqo37eVOoT QJWQ== 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:subject:date:message-id :in-reply-to:references; bh=qbSqbK8ePFOgsWdpKMPnvCVzJMCfQ54HKzCgIDnhix0=; b=YKCyTjB3Zt2nmY0Zdiq8kgxNtVR53o4vKIj3j4ouZMjlq53dlrLTmphVME1f4RlEtr 6WDHfordfw37xW9+jFHrmVtbh84yP62+ZmBbpzHcbg7oiW36fxQEUoKzotrnMdAEomIL XIUNAcV7jdzopr9Dy/1QA3QY6zU/AV9zUzxOWOj7iUSJ0QTgYNfNiGb92DM6FbQaI1Qs JkATyllruoEbzpCBqlzEmRreRHC0tTjHYSdYtvInPaN3Gi/hFIixAVTJPMtcBzAirpUl xmzLImDfP5j4T5XzJaZ/JrLJJYaxIk3ULq6ZlQCEdRDYHcDOChWR0N8uceWLiGBdQame pfig== X-Gm-Message-State: AOPr4FXqUfIOIIGqn/T4vzBDZxR0RCG9gppslap+5364MkIGIb2sN4SBLzen6RtaWdRN9w== X-Received: by 10.195.6.65 with SMTP id cs1mr28793855wjd.8.1463413002574; Mon, 16 May 2016 08:36:42 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-252-58.clienti.tiscali.it. [78.12.252.58]) by smtp.gmail.com with ESMTPSA id lf9sm34386875wjc.44.2016.05.16.08.36.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 May 2016 08:36:41 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 16 May 2016 17:35:47 +0200 Message-Id: <1463412982-6681-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1463412982-6681-1-git-send-email-pbonzini@redhat.com> References: <1463412982-6681-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PATCH 15/50] target-s390x: make cpu-qom.h not target specific 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 Make S390XCPU an opaque type within cpu-qom.h, and move all definitions of private methods, as well as all type definitions that require knowledge of the layout to cpu.h. This helps making files independent of NEED_CPU_H if they only need to pass around CPU pointers. Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth Acked-by: Cornelia Huck --- target-s390x/cpu-qom.h | 45 +-------------------------------------------- target-s390x/cpu.h | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 45 deletions(-) diff --git a/target-s390x/cpu-qom.h b/target-s390x/cpu-qom.h index 681e370..66b5d18 100644 --- a/target-s390x/cpu-qom.h +++ b/target-s390x/cpu-qom.h @@ -55,49 +55,6 @@ typedef struct S390CPUClass { void (*initial_cpu_reset)(CPUState *cpu); } S390CPUClass; -/** - * S390CPU: - * @env: #CPUS390XState. - * - * An S/390 CPU. - */ -typedef struct S390CPU { - /*< private >*/ - CPUState parent_obj; - /*< public >*/ - - CPUS390XState env; - int64_t id; - /* needed for live migration */ - void *irqstate; - uint32_t irqstate_saved_size; -} S390CPU; - -static inline S390CPU *s390_env_get_cpu(CPUS390XState *env) -{ - return container_of(env, S390CPU, env); -} - -#define ENV_GET_CPU(e) CPU(s390_env_get_cpu(e)) - -#define ENV_OFFSET offsetof(S390CPU, env) - -#ifndef CONFIG_USER_ONLY -extern const struct VMStateDescription vmstate_s390_cpu; -#endif - -void s390_cpu_do_interrupt(CPUState *cpu); -bool s390_cpu_exec_interrupt(CPUState *cpu, int int_req); -void s390_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, - int flags); -int s390_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs, - int cpuid, void *opaque); - -hwaddr s390_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); -hwaddr s390_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); -int s390_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); -int s390_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); -void s390_cpu_gdb_init(CPUState *cs); -void s390x_cpu_debug_excp_handler(CPUState *cs); +typedef struct S390CPU S390CPU; #endif diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index 6d97c08..760eadf 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -23,6 +23,7 @@ #define CPU_S390X_H #include "qemu-common.h" +#include "cpu-qom.h" #define TARGET_LONG_BITS 64 @@ -171,7 +172,51 @@ static inline CPU_DoubleU *get_freg(CPUS390XState *cs, int nr) return &cs->vregs[nr][0]; } -#include "cpu-qom.h" +/** + * S390CPU: + * @env: #CPUS390XState. + * + * An S/390 CPU. + */ +struct S390CPU { + /*< private >*/ + CPUState parent_obj; + /*< public >*/ + + CPUS390XState env; + int64_t id; + /* needed for live migration */ + void *irqstate; + uint32_t irqstate_saved_size; +}; + +static inline S390CPU *s390_env_get_cpu(CPUS390XState *env) +{ + return container_of(env, S390CPU, env); +} + +#define ENV_GET_CPU(e) CPU(s390_env_get_cpu(e)) + +#define ENV_OFFSET offsetof(S390CPU, env) + +#ifndef CONFIG_USER_ONLY +extern const struct VMStateDescription vmstate_s390_cpu; +#endif + +void s390_cpu_do_interrupt(CPUState *cpu); +bool s390_cpu_exec_interrupt(CPUState *cpu, int int_req); +void s390_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, + int flags); +int s390_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs, + int cpuid, void *opaque); + +hwaddr s390_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr s390_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); +int s390_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); +int s390_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); +void s390_cpu_gdb_init(CPUState *cs); +void s390x_cpu_debug_excp_handler(CPUState *cs); + #include /* distinguish between 24 bit and 31 bit addressing */