{"id":809744,"url":"http://patchwork.ozlabs.org/api/1.0/patches/809744/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20170904154316.4148-9-david@redhat.com>","date":"2017-09-04T15:43:05","name":"[v2,08/19] s390x: move sclp_service_call() to interrupt.c","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"01c9f3c8f43c5b3de60d06f4722e80f12e1f86a9","submitter":{"id":70402,"url":"http://patchwork.ozlabs.org/api/1.0/people/70402/?format=json","name":"David Hildenbrand","email":"david@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170904154316.4148-9-david@redhat.com/mbox/","series":[{"id":1412,"url":"http://patchwork.ozlabs.org/api/1.0/series/1412/?format=json","date":"2017-09-04T15:42:57","name":"s390x cleanups and CPU hotplug via device_add","version":2,"mbox":"http://patchwork.ozlabs.org/series/1412/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809744/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=david@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xmDsy4Vg1z9t2c\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 01:53:58 +1000 (AEST)","from localhost ([::1]:54537 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dothE-00043v-Nh\n\tfor incoming@patchwork.ozlabs.org; Mon, 04 Sep 2017 11:53:56 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:37643)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <david@redhat.com>) id 1dotXQ-0004WT-Tc\n\tfor qemu-devel@nongnu.org; Mon, 04 Sep 2017 11:43:53 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <david@redhat.com>) id 1dotXL-00011j-Ec\n\tfor qemu-devel@nongnu.org; Mon, 04 Sep 2017 11:43:48 -0400","from mx1.redhat.com ([209.132.183.28]:36410)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <david@redhat.com>) id 1dotXL-00011N-63\n\tfor qemu-devel@nongnu.org; Mon, 04 Sep 2017 11:43:43 -0400","from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 435C051455;\n\tMon,  4 Sep 2017 15:43:42 +0000 (UTC)","from t460s.redhat.com (ovpn-116-139.ams2.redhat.com\n\t[10.36.116.139])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 43D3611CC32;\n\tMon,  4 Sep 2017 15:43:40 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 435C051455","From":"David Hildenbrand <david@redhat.com>","To":"qemu-devel@nongnu.org","Date":"Mon,  4 Sep 2017 17:43:05 +0200","Message-Id":"<20170904154316.4148-9-david@redhat.com>","In-Reply-To":"<20170904154316.4148-1-david@redhat.com>","References":"<20170904154316.4148-1-david@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.13","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.39]);\n\tMon, 04 Sep 2017 15:43:42 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"[Qemu-devel] [PATCH v2 08/19] s390x: move sclp_service_call() to\n\tinterrupt.c","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"thuth@redhat.com, Eduardo Habkost <ehabkost@redhat.com>, david@redhat.com,\n\tcohuck@redhat.com, Richard Henderson <richard.henderson@linaro.org>, \n\tAlexander Graf <agraf@suse.de>, borntraeger@de.ibm.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"Fix up includes and rename it to s390x_*.\ncpu.h is now free of externally implemented functions.\n\nSigned-off-by: David Hildenbrand <david@redhat.com>\n---\n hw/s390x/sclp.c            | 51 +---------------------------------------------\n include/hw/s390x/sclp.h    |  1 +\n target/s390x/cpu.h         |  5 +----\n target/s390x/interrupt.c   | 49 ++++++++++++++++++++++++++++++++++++++++++++\n target/s390x/kvm.c         |  2 +-\n target/s390x/misc_helper.c |  2 +-\n 6 files changed, 54 insertions(+), 56 deletions(-)","diff":"diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c\nindex fd097262c7..9618dfac0a 100644\n--- a/hw/s390x/sclp.c\n+++ b/hw/s390x/sclp.c\n@@ -24,7 +24,7 @@\n #include \"hw/s390x/s390-pci-bus.h\"\n #include \"hw/s390x/ipl.h\"\n \n-static inline SCLPDevice *get_sclp_device(void)\n+SCLPDevice *get_sclp_device(void)\n {\n     static SCLPDevice *sclp;\n \n@@ -424,55 +424,6 @@ static void sclp_execute(SCLPDevice *sclp, SCCB *sccb, uint32_t code)\n     }\n }\n \n-int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code)\n-{\n-    SCLPDevice *sclp = get_sclp_device();\n-    SCLPDeviceClass *sclp_c = SCLP_GET_CLASS(sclp);\n-    int r = 0;\n-    SCCB work_sccb;\n-\n-    hwaddr sccb_len = sizeof(SCCB);\n-\n-    /* first some basic checks on program checks */\n-    if (env->psw.mask & PSW_MASK_PSTATE) {\n-        r = -PGM_PRIVILEGED;\n-        goto out;\n-    }\n-    if (cpu_physical_memory_is_io(sccb)) {\n-        r = -PGM_ADDRESSING;\n-        goto out;\n-    }\n-    if ((sccb & ~0x1fffUL) == 0 || (sccb & ~0x1fffUL) == env->psa\n-        || (sccb & ~0x7ffffff8UL) != 0) {\n-        r = -PGM_SPECIFICATION;\n-        goto out;\n-    }\n-\n-    /*\n-     * we want to work on a private copy of the sccb, to prevent guests\n-     * from playing dirty tricks by modifying the memory content after\n-     * the host has checked the values\n-     */\n-    cpu_physical_memory_read(sccb, &work_sccb, sccb_len);\n-\n-    /* Valid sccb sizes */\n-    if (be16_to_cpu(work_sccb.h.length) < sizeof(SCCBHeader) ||\n-        be16_to_cpu(work_sccb.h.length) > SCCB_SIZE) {\n-        r = -PGM_SPECIFICATION;\n-        goto out;\n-    }\n-\n-    sclp_c->execute(sclp, &work_sccb, code);\n-\n-    cpu_physical_memory_write(sccb, &work_sccb,\n-                              be16_to_cpu(work_sccb.h.length));\n-\n-    sclp_c->service_interrupt(sclp, sccb);\n-\n-out:\n-    return r;\n-}\n-\n static void service_interrupt(SCLPDevice *sclp, uint32_t sccb)\n {\n     SCLPEventFacility *ef = sclp->event_facility;\ndiff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h\nindex a72d096081..1cc233d01f 100644\n--- a/include/hw/s390x/sclp.h\n+++ b/include/hw/s390x/sclp.h\n@@ -237,6 +237,7 @@ static inline int sccb_data_len(SCCB *sccb)\n }\n \n \n+SCLPDevice *get_sclp_device(void);\n void s390_sclp_init(void);\n sclpMemoryHotplugDev *init_sclp_memory_hotplug_dev(void);\n sclpMemoryHotplugDev *get_sclp_memory_hotplug_dev(void);\ndiff --git a/target/s390x/cpu.h b/target/s390x/cpu.h\nindex 6c0abb9894..147aceba28 100644\n--- a/target/s390x/cpu.h\n+++ b/target/s390x/cpu.h\n@@ -698,6 +698,7 @@ int cpu_s390x_signal_handler(int host_signum, void *pinfo, void *puc);\n \n \n /* interrupt.c */\n+int s390x_sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code);\n void s390_crw_mchk(void);\n void s390_io_interrupt(uint16_t subchannel_id, uint16_t subchannel_nr,\n                        uint32_t io_int_parm, uint32_t io_int_word);\n@@ -718,8 +719,4 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uint8_t ar, void *hostbuf,\n #define s390_cpu_virt_mem_check_write(cpu, laddr, ar, len)   \\\n         s390_cpu_virt_mem_rw(cpu, laddr, ar, NULL, len, true)\n \n-\n-/* outside of target/s390x/ */\n-int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code);\n-\n #endif\ndiff --git a/target/s390x/interrupt.c b/target/s390x/interrupt.c\nindex 9aa6b89301..a3b627dd40 100644\n--- a/target/s390x/interrupt.c\n+++ b/target/s390x/interrupt.c\n@@ -17,6 +17,7 @@\n #include \"hw/s390x/ioinst.h\"\n #if !defined(CONFIG_USER_ONLY)\n #include \"hw/s390x/s390-virtio-ccw.h\"\n+#include \"hw/s390x/sclp.h\"\n #endif\n \n /* Ensure to exit the TB after this call! */\n@@ -161,4 +162,52 @@ void s390_crw_mchk(void)\n     }\n }\n \n+int s390x_sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code)\n+{\n+    SCLPDevice *sclp = get_sclp_device();\n+    SCLPDeviceClass *sclp_c = SCLP_GET_CLASS(sclp);\n+    int r = 0;\n+    SCCB work_sccb;\n+\n+    hwaddr sccb_len = sizeof(SCCB);\n+\n+    /* first some basic checks on program checks */\n+    if (env->psw.mask & PSW_MASK_PSTATE) {\n+        r = -PGM_PRIVILEGED;\n+        goto out;\n+    }\n+    if (cpu_physical_memory_is_io(sccb)) {\n+        r = -PGM_ADDRESSING;\n+        goto out;\n+    }\n+    if ((sccb & ~0x1fffUL) == 0 || (sccb & ~0x1fffUL) == env->psa\n+        || (sccb & ~0x7ffffff8UL) != 0) {\n+        r = -PGM_SPECIFICATION;\n+        goto out;\n+    }\n+\n+    /*\n+     * we want to work on a private copy of the sccb, to prevent guests\n+     * from playing dirty tricks by modifying the memory content after\n+     * the host has checked the values\n+     */\n+    cpu_physical_memory_read(sccb, &work_sccb, sccb_len);\n+\n+    /* Valid sccb sizes */\n+    if (be16_to_cpu(work_sccb.h.length) < sizeof(SCCBHeader) ||\n+        be16_to_cpu(work_sccb.h.length) > SCCB_SIZE) {\n+        r = -PGM_SPECIFICATION;\n+        goto out;\n+    }\n+\n+    sclp_c->execute(sclp, &work_sccb, code);\n+\n+    cpu_physical_memory_write(sccb, &work_sccb,\n+                              be16_to_cpu(work_sccb.h.length));\n+\n+    sclp_c->service_interrupt(sclp, sccb);\n+\n+out:\n+    return r;\n+}\n #endif\ndiff --git a/target/s390x/kvm.c b/target/s390x/kvm.c\nindex ed59896423..c36e4efdec 100644\n--- a/target/s390x/kvm.c\n+++ b/target/s390x/kvm.c\n@@ -1069,7 +1069,7 @@ static int kvm_sclp_service_call(S390CPU *cpu, struct kvm_run *run,\n     sccb = env->regs[ipbh0 & 0xf];\n     code = env->regs[(ipbh0 & 0xf0) >> 4];\n \n-    r = sclp_service_call(env, sccb, code);\n+    r = s390x_sclp_service_call(env, sccb, code);\n     if (r < 0) {\n         kvm_s390_program_interrupt(cpu, -r);\n     } else {\ndiff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c\nindex b142db71c6..57c02ddf1b 100644\n--- a/target/s390x/misc_helper.c\n+++ b/target/s390x/misc_helper.c\n@@ -76,7 +76,7 @@ void HELPER(exception)(CPUS390XState *env, uint32_t excp)\n uint32_t HELPER(servc)(CPUS390XState *env, uint64_t r1, uint64_t r2)\n {\n     qemu_mutex_lock_iothread();\n-    int r = sclp_service_call(env, r1, r2);\n+    int r = s390x_sclp_service_call(env, r1, r2);\n     if (r < 0) {\n         program_interrupt(env, -r, 4);\n         r = 0;\n","prefixes":["v2","08/19"]}