From patchwork Tue Feb 21 12:34:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 9584563 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D606E600CA for ; Tue, 21 Feb 2017 13:09:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFB90285AE for ; Tue, 21 Feb 2017 13:09:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A49372867D; Tue, 21 Feb 2017 13:09:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9D416285AE for ; Tue, 21 Feb 2017 13:09:54 +0000 (UTC) Received: from localhost ([::1]:44436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgACX-0006Dv-IZ for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Feb 2017 08:09:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cg9eZ-0007fA-N0 for qemu-devel@nongnu.org; Tue, 21 Feb 2017 07:34:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cg9eX-00084S-7J for qemu-devel@nongnu.org; Tue, 21 Feb 2017 07:34:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53454) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cg9eW-00083r-Vp for qemu-devel@nongnu.org; Tue, 21 Feb 2017 07:34:45 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A13B83D963; Tue, 21 Feb 2017 12:34:44 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LCYgkN029941 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Feb 2017 07:34:43 -0500 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id E26C411385E1; Tue, 21 Feb 2017 13:34:39 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 21 Feb 2017 13:34:36 +0100 Message-Id: <1487680479-15132-9-git-send-email-armbru@redhat.com> In-Reply-To: <1487680479-15132-1-git-send-email-armbru@redhat.com> References: <1487680479-15132-1-git-send-email-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 21 Feb 2017 12:34:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 08/11] hw: Drop superfluous special checks for orphaned -drive X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Mark Cave-Ayland , John Snow Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP We've traditionally rejected orphans here and there, but not systematically. For instance, the sun4m machines have an onboard SCSI HBA (bus=0), and have always rejected bus>0. Other machines with an onboard SCSI HBA don't. Commit a66c9dc made all orphans trigger a warning, and the previous commit turned this into an error. The checks "here and there" are now redundant. Drop them. Note that the one in mips_jazz.c was wrong: it rejected bus > MAX_FD, but MAX_FD is the number of floppy drives per bus. Error messages change from $ qemu-system-x86_64 -drive if=ide,bus=2 qemu-system-x86_64: Too many IDE buses defined (3 > 2) $ qemu-system-mips64 -M magnum,accel=qtest -drive if=floppy,bus=2,id=fd1 qemu: too many floppy drives $ qemu-system-sparc -M LX -drive if=scsi,bus=1 qemu: too many SCSI bus to $ qemu-system-x86_64 -drive if=ide,bus=2 qemu-system-x86_64: -drive if=ide,bus=2: machine type does not support if=ide,bus=2,unit=0 $ qemu-system-mips64 -M magnum,accel=qtest -drive if=floppy,bus=2,id=fd1 qemu-system-mips64: -drive if=floppy,bus=2,id=fd1: machine type does not support if=floppy,bus=2,unit=0 $ qemu-system-sparc -M LX -drive if=scsi,bus=1 qemu-system-sparc: -drive if=scsi,bus=1: machine type does not support if=scsi,bus=1,unit=0 Cc: John Snow Cc: "Hervé Poussineau" Cc: Mark Cave-Ayland Signed-off-by: Markus Armbruster Message-Id: <1487153147-11530-9-git-send-email-armbru@redhat.com> Reviewed-by: John Snow --- hw/ide/core.c | 17 ----------------- hw/mips/mips_jazz.c | 4 ---- hw/sparc/sun4m.c | 5 ----- 3 files changed, 26 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index 43709e5..cfa5de6 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -2840,23 +2840,6 @@ const VMStateDescription vmstate_ide_bus = { void ide_drive_get(DriveInfo **hd, int n) { int i; - int highest_bus = drive_get_max_bus(IF_IDE) + 1; - int max_devs = drive_get_max_devs(IF_IDE); - int n_buses = max_devs ? (n / max_devs) : n; - - /* - * Note: The number of actual buses available is not known. - * We compute this based on the size of the DriveInfo* array, n. - * If it is less than max_devs * , - * We will stop looking for drives prematurely instead of overfilling - * the array. - */ - - if (highest_bus > n_buses) { - error_report("Too many IDE buses defined (%d > %d)", - highest_bus, n_buses); - exit(1); - } for (i = 0; i < n; i++) { hd[i] = drive_get_by_index(IF_IDE, i); diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 73f6c9f..1cef581 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -291,10 +291,6 @@ static void mips_jazz_init(MachineState *machine, qdev_get_gpio_in(rc4030, 5), &esp_reset, &dma_enable); /* Floppy */ - if (drive_get_max_bus(IF_FLOPPY) >= MAX_FD) { - fprintf(stderr, "qemu: too many floppy drives\n"); - exit(1); - } for (n = 0; n < MAX_FD; n++) { fds[n] = drive_get(IF_FLOPPY, 0, n); } diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index f5b6efd..61416a6 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -989,11 +989,6 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, slavio_misc_init(hwdef->slavio_base, hwdef->aux1_base, hwdef->aux2_base, slavio_irq[30], fdc_tc); - if (drive_get_max_bus(IF_SCSI) > 0) { - fprintf(stderr, "qemu: too many SCSI bus\n"); - exit(1); - } - esp_init(hwdef->esp_base, 2, espdma_memory_read, espdma_memory_write, espdma, espdma_irq, &esp_reset, &dma_enable);