All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: "John Snow" <jsnow@redhat.com>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>
Subject: [Qemu-devel] [PULL 08/11] hw: Drop superfluous special checks for orphaned -drive
Date: Tue, 21 Feb 2017 13:34:36 +0100	[thread overview]
Message-ID: <1487680479-15132-9-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1487680479-15132-1-git-send-email-armbru@redhat.com>

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 <jsnow@redhat.com>
Cc: "Hervé Poussineau" <hpoussin@reactos.org>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1487153147-11530-9-git-send-email-armbru@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
---
 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 * <num_real_buses>,
-     * 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);
-- 
2.7.4

  parent reply	other threads:[~2017-02-21 12:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 12:34 [Qemu-devel] [PULL 00/11] Changes to -drive without if= and with if=scsi Markus Armbruster
2017-02-21 12:34 ` [Qemu-devel] [PULL 01/11] hw: Default -drive to if=ide explicitly where it works Markus Armbruster
2017-02-21 12:34 ` [Qemu-devel] [PULL 02/11] hw/arm/cubieboard hw/arm/xlnx-ep108: Fix units_per_default_bus Markus Armbruster
2017-02-21 12:34 ` [Qemu-devel] [PULL 03/11] hw: Default -drive to if=none instead of ide when ide cannot work Markus Armbruster
2017-02-21 12:34   ` Markus Armbruster
2017-02-21 12:34 ` [Qemu-devel] [PULL 04/11] hw: Default -drive to if=none instead of scsi when scsi " Markus Armbruster
2017-02-21 12:34 ` [Qemu-devel] [PULL 05/11] hw/arm/highbank: Default -drive to if=ide instead of if=scsi Markus Armbruster
2017-02-21 12:34 ` [Qemu-devel] [PULL 06/11] blockdev: Improve message for orphaned -drive Markus Armbruster
2017-02-21 12:34 ` [Qemu-devel] [PULL 07/11] blockdev: Make orphaned -drive fatal Markus Armbruster
2017-02-21 12:34 ` Markus Armbruster [this message]
2017-02-21 12:34 ` [Qemu-devel] [PULL 09/11] hw/scsi: Concentrate -drive if=scsi auto-create in one place Markus Armbruster
2017-02-21 12:34 ` [Qemu-devel] [PULL 10/11] hw: Deprecate -drive if=scsi with non-onboard HBAs Markus Armbruster
2017-02-21 12:34 ` [Qemu-devel] [PULL 11/11] hw/i386: Deprecate -drive if=scsi with PC machine types Markus Armbruster
2017-02-21 13:37 ` [Qemu-devel] [PULL 00/11] Changes to -drive without if= and with if=scsi no-reply
2017-02-21 15:05 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1487680479-15132-9-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=hpoussin@reactos.org \
    --cc=jsnow@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.