From patchwork Wed Aug 4 18:27:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hollis Blanchard X-Patchwork-Id: 60880 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8165FB70A4 for ; Thu, 5 Aug 2010 04:29:18 +1000 (EST) Received: from localhost ([127.0.0.1]:50531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OgiiJ-0002Zi-LE for incoming@patchwork.ozlabs.org; Wed, 04 Aug 2010 14:29:15 -0400 Received: from [140.186.70.92] (port=47677 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ogih3-0002XX-Vs for qemu-devel@nongnu.org; Wed, 04 Aug 2010 14:27:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ogih2-0004LX-Nw for qemu-devel@nongnu.org; Wed, 04 Aug 2010 14:27:57 -0400 Received: from mail-wy0-f173.google.com ([74.125.82.173]:38837) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ogih2-0004LL-Jq for qemu-devel@nongnu.org; Wed, 04 Aug 2010 14:27:56 -0400 Received: by wyi11 with SMTP id 11so54808wyi.4 for ; Wed, 04 Aug 2010 11:27:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=GihFhUQRzjg1f8k599Oq6yWmUMK0wRNWXracPSYhQWw=; b=rWA4aXUPfIZuLTugo/Gu+KwAznGXnAAwq/4NM+H9gjMl6S4cCmQTX8aoGyYml9lOAV rWqxQeb4ozmYhoacboA9kkJw64aukSCDkxXbhsJOZKF1CX/sSZr7rgP5MfRx/oFf14B/ mwwCIbyzfzZtuBkFnQh314h7utiKQEUvgCouU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=DhsTOn0agaVLnzfRDOPmHDYT067QvBOiD42nF7qD+WTM+GdAC5Ptd9IJIQ1zfBdcTe zy8SpvSStYKHOKbt+/0156G1TFKj75+fwr584jukFh1UeDzRb4qVrTrBn8XJbktb1oTY AiVyaalKgiNYOS3Tj3yeTG2Ij/nnJ9PV0kdss= MIME-Version: 1.0 Received: by 10.227.146.149 with SMTP id h21mr8019226wbv.153.1280946474687; Wed, 04 Aug 2010 11:27:54 -0700 (PDT) Received: by 10.227.134.211 with HTTP; Wed, 4 Aug 2010 11:27:54 -0700 (PDT) Date: Wed, 4 Aug 2010 11:27:54 -0700 X-Google-Sender-Auth: ntmIcQhiFLuVi-RsFIF_HoFgWH4 Message-ID: From: Hollis Blanchard To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] segfault due to missing qdev_create()? X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org I am able to run qemu with the following commandline: /usr/local/bin/qemu-system-ppcemb -enable-kvm -kernel uImage.bamboo -nographic -M bamboo ppc440-angstrom-linux.img However, when I try to use virtio instead, I get this segfault: /usr/local/bin/qemu-system-ppcemb -enable-kvm -kernel uImage.bamboo -drive file=ppc440-angstrom-linux.img,if=virtio -nographic -M bamboo #0 0x1009864c in qbus_find_recursive (bus=0x0, name=0x0, info=0x10287238) at /home/hollisb/work/qemu.git/hw/qdev.c:461 #1 0x10099cc4 in qdev_device_add (opts=0x108a07a0) at /home/hollisb/work/qemu.git/hw/qdev.c:229 #2 0x101a4220 in device_init_func (opts=, opaque=) at /home/hollisb/work/qemu.git/vl.c:1519 #3 0x1002baf8 in qemu_opts_foreach (list=, func=0x101a4204 , opaque=0x0, abort_on_failure=) at qemu-option.c:978 #4 0x101a68e0 in main (argc=, argv=, envp=) at /home/hollisb/work/qemu.git/vl.c:2890 This patch avoids the segfault, but just gives me this message: No 'PCI' bus found for device 'virtio-blk-pci' FWIW, hw/ppc4xx_pci.c is my PCI controller. Do I need to add some qdev magic to that file to make this work? -Hollis diff --git a/hw/qdev.c b/hw/qdev.c index e99c73f..8fe4f06 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -455,6 +455,9 @@ static BusState *qbus_find_recursive(BusState *bus, const ch BusState *child, *ret; int match = 1; + if (!bus) + return NULL; + if (name && (strcmp(bus->name, name) != 0)) { match = 0; }