From patchwork Wed Aug 30 16:52:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 9930345 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D3A256022E for ; Wed, 30 Aug 2017 17:34:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF4CB28696 for ; Wed, 30 Aug 2017 17:34:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1640286C1; Wed, 30 Aug 2017 17:34:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id A7C8528696 for ; Wed, 30 Aug 2017 17:34:15 +0000 (UTC) Received: from localhost ([::1]:51809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6sY-0004ce-Ij for patchwork-qemu-devel@patchwork.kernel.org; Wed, 30 Aug 2017 13:34:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6HQ-00047w-9r for qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:55:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn6HM-00064G-Hc for qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:55:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40084) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn6HM-00063d-6i for qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:55:48 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0E3235F795; Wed, 30 Aug 2017 16:55:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0E3235F795 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=cohuck@redhat.com Received: from localhost (ovpn-116-210.ams2.redhat.com [10.36.116.210]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7724587CAA; Wed, 30 Aug 2017 16:55:44 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Wed, 30 Aug 2017 18:52:45 +0200 Message-Id: <20170830165252.13421-38-cohuck@redhat.com> In-Reply-To: <20170830165252.13421-1-cohuck@redhat.com> References: <20170830165252.13421-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 30 Aug 2017 16:55:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 37/44] target/s390x: move a couple of functions to cpu.c 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: thuth@redhat.com, david@redhat.com, Cornelia Huck , agraf@suse.de, qemu-devel@nongnu.org, borntraeger@de.ibm.com, rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: David Hildenbrand Prepare to move more stuff (especially KVM related) from cpu.h to internal.h. Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: David Hildenbrand Message-Id: <20170818114353.13455-16-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/cpu.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ target/s390x/cpu.h | 89 ++++++------------------------------------------------ 2 files changed, 89 insertions(+), 79 deletions(-) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index dadd383d90..90e2db7b1f 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -392,6 +392,85 @@ unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu) return s390_count_running_cpus(); } + +int s390_get_clock(uint8_t *tod_high, uint64_t *tod_low) +{ + if (kvm_enabled()) { + return kvm_s390_get_clock(tod_high, tod_low); + } + /* Fixme TCG */ + *tod_high = 0; + *tod_low = 0; + return 0; +} + +int s390_set_clock(uint8_t *tod_high, uint64_t *tod_low) +{ + if (kvm_enabled()) { + return kvm_s390_set_clock(tod_high, tod_low); + } + /* Fixme TCG */ + return 0; +} + +int s390_set_memory_limit(uint64_t new_limit, uint64_t *hw_limit) +{ + if (kvm_enabled()) { + return kvm_s390_set_mem_limit(new_limit, hw_limit); + } + return 0; +} + +void s390_cmma_reset(void) +{ + if (kvm_enabled()) { + kvm_s390_cmma_reset(); + } +} + +int s390_cpu_restart(S390CPU *cpu) +{ + if (kvm_enabled()) { + return kvm_s390_cpu_restart(cpu); + } + return -ENOSYS; +} + +int s390_get_memslot_count(void) +{ + if (kvm_enabled()) { + return kvm_s390_get_memslot_count(); + } else { + return MAX_AVAIL_SLOTS; + } +} + +int s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch_id, + int vq, bool assign) +{ + if (kvm_enabled()) { + return kvm_s390_assign_subch_ioeventfd(notifier, sch_id, vq, assign); + } else { + return 0; + } +} + +void s390_crypto_reset(void) +{ + if (kvm_enabled()) { + kvm_s390_crypto_reset(); + } +} + +bool s390_get_squash_mcss(void) +{ + if (object_property_get_bool(OBJECT(qdev_get_machine()), "s390-squash-mcss", + NULL)) { + return true; + } + + return false; +} #endif static gchar *s390_gdb_arch_name(CPUState *cs) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index af941f8e51..a2cefb7a0c 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -439,25 +439,8 @@ static inline void kvm_s390_access_exception(S390CPU *cpu, uint16_t code, } #endif -static inline int s390_get_clock(uint8_t *tod_high, uint64_t *tod_low) -{ - if (kvm_enabled()) { - return kvm_s390_get_clock(tod_high, tod_low); - } - /* Fixme TCG */ - *tod_high = 0; - *tod_low = 0; - return 0; -} - -static inline int s390_set_clock(uint8_t *tod_high, uint64_t *tod_low) -{ - if (kvm_enabled()) { - return kvm_s390_set_clock(tod_high, tod_low); - } - /* Fixme TCG */ - return 0; -} +int s390_get_clock(uint8_t *tod_high, uint64_t *tod_low); +int s390_set_clock(uint8_t *tod_high, uint64_t *tod_low); S390CPU *s390_cpu_addr2state(uint16_t cpu_addr); unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu); @@ -805,69 +788,17 @@ static inline void kvm_s390_crypto_reset(void) } #endif -static inline int s390_set_memory_limit(uint64_t new_limit, uint64_t *hw_limit) -{ - if (kvm_enabled()) { - return kvm_s390_set_mem_limit(new_limit, hw_limit); - } - return 0; -} - -static inline void s390_cmma_reset(void) -{ - if (kvm_enabled()) { - kvm_s390_cmma_reset(); - } -} - -static inline int s390_cpu_restart(S390CPU *cpu) -{ - if (kvm_enabled()) { - return kvm_s390_cpu_restart(cpu); - } - return -ENOSYS; -} - -static inline int s390_get_memslot_count(void) -{ - if (kvm_enabled()) { - return kvm_s390_get_memslot_count(); - } else { - return MAX_AVAIL_SLOTS; - } -} - +int s390_set_memory_limit(uint64_t new_limit, uint64_t *hw_limit); +void s390_cmma_reset(void); +int s390_cpu_restart(S390CPU *cpu); +int s390_get_memslot_count(void); void s390_io_interrupt(uint16_t subchannel_id, uint16_t subchannel_nr, uint32_t io_int_parm, uint32_t io_int_word); void s390_crw_mchk(void); - -static inline int s390_assign_subch_ioeventfd(EventNotifier *notifier, - uint32_t sch_id, int vq, - bool assign) -{ - if (kvm_enabled()) { - return kvm_s390_assign_subch_ioeventfd(notifier, sch_id, vq, assign); - } else { - return 0; - } -} - -static inline void s390_crypto_reset(void) -{ - if (kvm_enabled()) { - kvm_s390_crypto_reset(); - } -} - -static inline bool s390_get_squash_mcss(void) -{ - if (object_property_get_bool(OBJECT(qdev_get_machine()), "s390-squash-mcss", - NULL)) { - return true; - } - - return false; -} +int s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch_id, + int vq, bool assign); +void s390_crypto_reset(void); +bool s390_get_squash_mcss(void); /* machine check interruption code */