{"id":808249,"url":"http://patchwork.ozlabs.org/api/patches/808249/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1504185578-80843-1-git-send-email-imammedo@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/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":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1504185578-80843-1-git-send-email-imammedo@redhat.com>","list_archive_url":null,"date":"2017-08-31T13:19:38","name":"[for-2.11,v4,08/25] s390x: replace cpu_s390x_init() with cpu_generic_init()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"df199e97878a3a721d424b99b456dc6bacc3adff","submitter":{"id":11305,"url":"http://patchwork.ozlabs.org/api/people/11305/?format=json","name":"Igor Mammedov","email":"imammedo@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1504185578-80843-1-git-send-email-imammedo@redhat.com/mbox/","series":[{"id":827,"url":"http://patchwork.ozlabs.org/api/series/827/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=827","date":"2017-08-31T13:19:38","name":null,"version":4,"mbox":"http://patchwork.ozlabs.org/series/827/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/808249/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808249/checks/","tags":{},"related":[],"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-mx02.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=imammedo@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 3xjjfd3D28z9sMN\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 23:20:25 +1000 (AEST)","from localhost ([::1]:55791 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 1dnPOR-0003pB-Ik\n\tfor incoming@patchwork.ozlabs.org; Thu, 31 Aug 2017 09:20:23 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:55329)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <imammedo@redhat.com>) id 1dnPNr-0003iH-W2\n\tfor qemu-devel@nongnu.org; Thu, 31 Aug 2017 09:19:53 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <imammedo@redhat.com>) id 1dnPNp-0001wa-Bh\n\tfor qemu-devel@nongnu.org; Thu, 31 Aug 2017 09:19:47 -0400","from mx1.redhat.com ([209.132.183.28]:57248)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <imammedo@redhat.com>) id 1dnPNp-0001vv-2U\n\tfor qemu-devel@nongnu.org; Thu, 31 Aug 2017 09:19:45 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\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 605B6806AF\n\tfor <qemu-devel@nongnu.org>; Thu, 31 Aug 2017 13:19:43 +0000 (UTC)","from dell-r430-03.lab.eng.brq.redhat.com\n\t(dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 19E789D5FF;\n\tThu, 31 Aug 2017 13:19:39 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 605B6806AF","From":"Igor Mammedov <imammedo@redhat.com>","To":"qemu-devel@nongnu.org","Date":"Thu, 31 Aug 2017 15:19:38 +0200","Message-Id":"<1504185578-80843-1-git-send-email-imammedo@redhat.com>","In-Reply-To":"<1503592308-93913-9-git-send-email-imammedo@redhat.com>","References":"<1503592308-93913-9-git-send-email-imammedo@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.26]);\n\tThu, 31 Aug 2017 13:19:43 +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 for-2.11 v4 08/25] s390x: replace\n\tcpu_s390x_init() with cpu_generic_init()","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":"Cornelia Huck <cohuck@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>,\n\tdavid@redhat.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":"cpu_s390x_init() is used only *-user targets indirectly\nvia cpu_init() macro and has a hack to assign ids to created\ncpus (I'm not sure if 'id' really matters to *-user emulation).\n\nSo to on safe side, instead of having custom wrapper to do numbering\nreplace it with cpu_generic_init() and use S390CPUClass::next_cpu_id\nwhich could serve the same purpose as static variable and move cpu->id\ninitialization to s390_cpu_initfn for CONFIG_USER_ONLY use-case.\n\nPS:\nifdef is ugly but it allows us to hide s390x detail that isn't\nset by *-user targets and reuse generic cpu creation utility\nfor btoh machine and user emulation.\n\nSigned-off-by: Igor Mammedov <imammedo@redhat.com>\nAcked-by: Cornelia Huck <cohuck@redhat.com>\n---\nv2:\n  - fix merge conflict in target/s390x/cpu.h caused by moving\n    cpu_init/cpu_s390x_init with the file in commit\n    (c862bddbc target/s390x: cleanup cpu.h)\n\nCC: Cornelia Huck <cohuck@redhat.com>\nCC: david@redhat.com\nCC: Eduardo Habkost <ehabkost@redhat.com>\n\nperhaps cpu->id isn't need by CONFIG_USER_ONLY but I'd leave to it\ns390x maintainers to deal with it.\n---\n target/s390x/cpu.h    |  3 +--\n target/s390x/cpu.c    |  7 +++++++\n target/s390x/helper.c | 14 --------------\n 3 files changed, 8 insertions(+), 16 deletions(-)","diff":"diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h\nindex 4ec3380..0bd97a5 100644\n--- a/target/s390x/cpu.h\n+++ b/target/s390x/cpu.h\n@@ -688,8 +688,7 @@ const char *s390_default_cpu_model_name(void);\n \n \n /* helper.c */\n-S390CPU *cpu_s390x_init(const char *cpu_model);\n-#define cpu_init(model) CPU(cpu_s390x_init(model))\n+#define cpu_init(cpu_model) cpu_generic_init(TYPE_S390_CPU, cpu_model)\n S390CPU *s390x_new_cpu(const char *cpu_model, int64_t id, Error **errp);\n /* you can call this signal handler from your SIGBUS and SIGSEGV\n    signal handlers to inform the virtual CPU of exceptions. non zero\ndiff --git a/target/s390x/cpu.c b/target/s390x/cpu.c\nindex 7267b60..74b3e4f 100644\n--- a/target/s390x/cpu.c\n+++ b/target/s390x/cpu.c\n@@ -306,6 +306,13 @@ static void s390_cpu_initfn(Object *obj)\n         inited = true;\n         s390x_translate_init();\n     }\n+\n+#if defined(CONFIG_USER_ONLY)\n+    {\n+        S390CPUClass *scc = S390_CPU_GET_CLASS(obj);\n+        cpu->id = scc->next_cpu_id;\n+    }\n+#endif\n }\n \n static void s390_cpu_finalize(Object *obj)\ndiff --git a/target/s390x/helper.c b/target/s390x/helper.c\nindex 3adb9de..ba29504 100644\n--- a/target/s390x/helper.c\n+++ b/target/s390x/helper.c\n@@ -129,20 +129,6 @@ out:\n     return cpu;\n }\n \n-S390CPU *cpu_s390x_init(const char *cpu_model)\n-{\n-    Error *err = NULL;\n-    S390CPU *cpu;\n-    /* Use to track CPU ID for linux-user only */\n-    static int64_t next_cpu_id;\n-\n-    cpu = s390x_new_cpu(cpu_model, next_cpu_id++, &err);\n-    if (err) {\n-        error_report_err(err);\n-    }\n-    return cpu;\n-}\n-\n #ifndef CONFIG_USER_ONLY\n \n hwaddr s390_cpu_get_phys_page_debug(CPUState *cs, vaddr vaddr)\n","prefixes":["for-2.11","v4","08/25"]}