From patchwork Fri Apr 8 20:28:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8785831 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 18CADC0553 for ; Fri, 8 Apr 2016 20:38:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5798E202EC for ; Fri, 8 Apr 2016 20:38:33 +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 8F42C202E9 for ; Fri, 8 Apr 2016 20:38:32 +0000 (UTC) Received: from localhost ([::1]:58123 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aodAl-0005PW-V2 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 08 Apr 2016 16:38:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aod22-0003oo-Q5 for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aod21-00023d-SU for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:30 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:36460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aod21-00023X-IC for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:29 -0400 Received: by mail-wm0-x244.google.com with SMTP id l6so6823839wml.3 for ; Fri, 08 Apr 2016 13:29:29 -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=QtoB56K3Pb98UnXkcdvQ1REfHWc2+Fz6t+06pywtyJT21jfuD83bZhab+gnrygg041 sg1X1WtDOQg1AowqmnhB58BgJPcfSlbrl7nQqf4rISWKImXDBYylpGWqsPIc+L70+nmQ qkXhd2HDmrAbsOdhar2DDMO0j1U1dcTcIrldIKpIy0or77NZXH/nvxW8iOpLG0PV7la0 ySdums7R5GXNqwPZwOYssF2HbHLm1s8UYTtuLt8we2hCutSusf2f/0ln2VvCcHNUtVyz eUaO1WRp5Q/T4zdrM0k3D3DlVj1ioOAOUZ/12+qyFZlgZu+Pcb8iztfpfZQnFOFAOIUd CBFA== 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=GhV8fLJMNDKaNpP9FvmpyCEEm766l9tlQCmwuagMAgR0NSV9K1+6pFQxFGy0BFT+jn fsLycS+aJzg0mnDu89jgiUs67DPzXMtOgeWsb587Q04LhVVhDRUt9zt0AElz3RI1vdDQ DFAchduyTK2nO3+SjcN3AftiBYfUhMJiYPJ0opu4sfi1tfQDpuDavWh2H0AwMFWLG6YY 2ONzQzDzDTA5ufbJB8jjiN66FXuHNtJjTuY1umXfZuwImTjCnrtQYkQKvLwmqp6JBh3b xgJQSWwImWvMeglKV+83apV0GqUsV/d9z9QF85neanuKdq6clHJbJ2lz7ZeAWDseMXEs Y/VQ== X-Gm-Message-State: AD7BkJJnviZMlVSloFBGFef/Y37w4+iyz0ArkX+ZlJCBSRbcmWs4K4JF+KJJTmahiE9e3Q== X-Received: by 10.194.66.34 with SMTP id c2mr11162827wjt.90.1460147369016; Fri, 08 Apr 2016 13:29:29 -0700 (PDT) Received: from 640k.lan (94-39-141-76.adsl-ull.clienti.tiscali.it. [94.39.141.76]) by smtp.gmail.com with ESMTPSA id w10sm3849168wjz.9.2016.04.08.13.29.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Apr 2016 13:29:28 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 8 Apr 2016 22:28:35 +0200 Message-Id: <1460147350-7601-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1460147350-7601-1-git-send-email-pbonzini@redhat.com> References: <1460147350-7601-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::244 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 --- 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 */