From patchwork Thu Apr 2 13:35:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 457647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CE5614007F for ; Fri, 3 Apr 2015 00:36:08 +1100 (AEDT) Received: from localhost ([::1]:58392 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdfHy-0002gw-0O for incoming@patchwork.ozlabs.org; Thu, 02 Apr 2015 09:36:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdfHJ-0001vJ-Gu for qemu-devel@nongnu.org; Thu, 02 Apr 2015 09:35:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YdfHF-0002H9-4t for qemu-devel@nongnu.org; Thu, 02 Apr 2015 09:35:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36628) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdfHE-0002H4-Vt for qemu-devel@nongnu.org; Thu, 02 Apr 2015 09:35:21 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 72C61AC7BA; Thu, 2 Apr 2015 13:35:20 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-38.ams2.redhat.com [10.36.116.38]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t32DZIaJ002948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 2 Apr 2015 09:35:19 -0400 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 186583046041; Thu, 2 Apr 2015 15:35:18 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Thu, 2 Apr 2015 15:35:16 +0200 Message-Id: <1427981717-7682-5-git-send-email-armbru@redhat.com> In-Reply-To: <1427981717-7682-1-git-send-email-armbru@redhat.com> References: <1427981717-7682-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: pbonzini@redhat.com, peter.maydell@linaro.org Subject: [Qemu-devel] [PULL v2 4/5] sdhci: Make device "sdhci-pci" unavailable with -device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Device models aren't supposed to go on fishing expeditions for backends. They should expose suitable properties for the user to set. For onboard devices, board code sets them. "sdhci-pci" picks up its block backend in its realize() method with drive_get_next() instead. Already marked FIXME. See the commit that added the FIXME for a more detailed explanation of what's wrong. We can't fix this in time for the release, but since the device is new in 2.3, we can set cannot_instantiate_with_device_add_yet to disable it before this mistake becomes ABI, and we have to support command lines like $ qemu -drive if=sd -drive if=sd,file=sd.img -device sdhci-pci -device sdhci-pci forever. Signed-off-by: Markus Armbruster --- hw/sd/sdhci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index f056c52..ab13505 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -1254,6 +1254,8 @@ static void sdhci_pci_class_init(ObjectClass *klass, void *data) set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); dc->vmsd = &sdhci_vmstate; dc->props = sdhci_properties; + /* Reason: realize() method uses drive_get_next() */ + dc->cannot_instantiate_with_device_add_yet = true; } static const TypeInfo sdhci_pci_info = {