{"id":811510,"url":"http://patchwork.ozlabs.org/api/patches/811510/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170908103558.31632-29-david@gibson.dropbear.id.au/","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":"<20170908103558.31632-29-david@gibson.dropbear.id.au>","list_archive_url":null,"date":"2017-09-08T10:35:46","name":"[PULL,28/40] hw/ppc/spapr_cpu_core: Add a proper check for spapr machine","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"18f0229d2038315d2e3406da06cceb9ed04ab1ee","submitter":{"id":47,"url":"http://patchwork.ozlabs.org/api/people/47/?format=json","name":"David Gibson","email":"david@gibson.dropbear.id.au"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170908103558.31632-29-david@gibson.dropbear.id.au/mbox/","series":[{"id":2179,"url":"http://patchwork.ozlabs.org/api/series/2179/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2179","date":"2017-09-08T10:35:20","name":"[PULL,01/40] hw/ppc/spapr_drc.c: change spapr_drc_needed to use drc->dev","version":1,"mbox":"http://patchwork.ozlabs.org/series/2179/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/811510/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/811510/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>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=gibson.dropbear.id.au\n\theader.i=@gibson.dropbear.id.au header.b=\"P+JuYLu8\"; \n\tdkim-atps=neutral"],"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 3xpYw64Xmfz9s3w\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Sep 2017 20:48:54 +1000 (AEST)","from localhost ([::1]:44503 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 1dqGqC-0004vl-MG\n\tfor incoming@patchwork.ozlabs.org; Fri, 08 Sep 2017 06:48:52 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:58775)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <dgibson@ozlabs.org>) id 1dqGe9-0002Cj-Eo\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 06:36:35 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <dgibson@ozlabs.org>) id 1dqGe2-0003Hh-W2\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 06:36:25 -0400","from ozlabs.org ([2401:3900:2:1::2]:52373)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <dgibson@ozlabs.org>)\n\tid 1dqGe2-0003FJ-Li; Fri, 08 Sep 2017 06:36:18 -0400","by ozlabs.org (Postfix, from userid 1007)\n\tid 3xpYdP02wlz9t5Q; Fri,  8 Sep 2017 20:36:07 +1000 (AEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n\td=gibson.dropbear.id.au; s=201602; t=1504866969;\n\tbh=SuJe/RiY3eIS3InJzfDxBncB7dnqxfKnAMpwy7DOwU4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=P+JuYLu8LehkEKywtBC5N+jvuG01rDFLfG3TFtSYVyp7wILqf+//jrLwpsMwUp7DX\n\tZ7G3vM4CfL0eu0C/QTLqk4E9W8YrIwiVSisDy2VyHlabDzy4E+1l3FJEFYqROk2f05\n\tBlyzRuU3AmlA43k5l2M7vbqELUKgO4U0rwsKn+Vc=","From":"David Gibson <david@gibson.dropbear.id.au>","To":"peter.maydell@linaro.org","Date":"Fri,  8 Sep 2017 20:35:46 +1000","Message-Id":"<20170908103558.31632-29-david@gibson.dropbear.id.au>","X-Mailer":"git-send-email 2.13.5","In-Reply-To":"<20170908103558.31632-1-david@gibson.dropbear.id.au>","References":"<20170908103558.31632-1-david@gibson.dropbear.id.au>","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2401:3900:2:1::2","Subject":"[Qemu-devel] [PULL 28/40] hw/ppc/spapr_cpu_core: Add a proper check\n\tfor spapr machine","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":"qemu-devel@nongnu.org, aik@ozlabs.ru, agraf@suse.de,\n\tmdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org,\n\tThomas Huth <thuth@redhat.com>, imammedo@redhat.com,\n\tsam.bobroff@au1.ibm.com, David Gibson <david@gibson.dropbear.id.au>","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":"From: Thomas Huth <thuth@redhat.com>\n\nQEMU currently crashes when the user tries to add a spapr-cpu-core\non a non-pseries machine:\n\n$ qemu-system-ppc64 -S -machine ppce500,accel=tcg \\\n                    -device POWER5+_v2.1-spapr-cpu-core\nhw/ppc/spapr_cpu_core.c:178:spapr_cpu_core_realize_child:\nObject 0x55cee1f55160 is not an instance of type spapr-machine\nAborted (core dumped)\n\nSo let's add a proper check for the correct machine time with\na more friendly error message here.\n\nReported-by: Eduardo Habkost <ehabkost@redhat.com>\nSigned-off-by: Thomas Huth <thuth@redhat.com>\nSigned-off-by: David Gibson <david@gibson.dropbear.id.au>\n---\n hw/ppc/spapr_cpu_core.c   | 5 +++++\n scripts/device-crash-test | 3 +++\n 2 files changed, 8 insertions(+)","diff":"diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c\nindex ea278ce2a7..dd9232620d 100644\n--- a/hw/ppc/spapr_cpu_core.c\n+++ b/hw/ppc/spapr_cpu_core.c\n@@ -220,6 +220,11 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)\n     void *obj;\n     int i, j;\n \n+    if (!object_dynamic_cast(qdev_get_machine(), TYPE_SPAPR_MACHINE)) {\n+        error_setg(errp, \"spapr-cpu-core needs a pseries machine\");\n+        return;\n+    }\n+\n     sc->threads = g_malloc0(size * cc->nr_threads);\n     for (i = 0; i < cc->nr_threads; i++) {\n         char id[32];\ndiff --git a/scripts/device-crash-test b/scripts/device-crash-test\nindex 81d65b9617..043b24a4aa 100755\n--- a/scripts/device-crash-test\n+++ b/scripts/device-crash-test\n@@ -160,6 +160,9 @@ ERROR_WHITELIST = [\n     {'machine':'q35|pc.*', 'device':'kvm-ioapic', 'expected':True}, # Only 1 ioapics allowed\n     {'machine':'q35|pc.*', 'device':'ioapic', 'expected':True},     # Only 1 ioapics allowed\n \n+    # \"spapr-cpu-core needs a pseries machine\"\n+    {'machine':'(?!pseries).*', 'device':'.*-spapr-cpu-core', 'expected':True},\n+\n     # KVM-specific devices shouldn't be tried without accel=kvm:\n     {'accel':'(?!kvm).*', 'device':'kvmclock', 'expected':True},\n     {'accel':'(?!kvm).*', 'device':'kvm-pci-assign', 'expected':True},\n","prefixes":["PULL","28/40"]}