All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, rth@twiddle.net,
	xen-devel@lists.xensource.com, mst@redhat.com,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: [Qemu-devel] [PATCH] Do not emulate a floppy drive when -nodefaults
Date: Wed, 13 May 2015 18:29:46 +0100	[thread overview]
Message-ID: <alpine.DEB.2.02.1505131826580.20496@kaball.uk.xensource.com> (raw)

Do not emulate a floppy drive if no drives are supposed to be present.

This fixes the behavior of -nodefaults, that should remove the floppy
drive (see docs/qdev-device-use.txt:Default Devices), but actually
doesn't.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index a8e6be1..c9f50b3 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1410,6 +1410,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
     qemu_irq *cpu_exit_irq;
     MemoryRegion *ioport80_io = g_new(MemoryRegion, 1);
     MemoryRegion *ioportF0_io = g_new(MemoryRegion, 1);
+    bool floppy_exist;
 
     memory_region_init_io(ioport80_io, NULL, &ioport80_io_ops, NULL, "ioport80", 1);
     memory_region_add_subregion(isa_bus->address_space_io, 0x80, ioport80_io);
@@ -1487,10 +1488,17 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
     cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);
     DMA_init(0, cpu_exit_irq);
 
+    *floppy = NULL;
+    floppy_exist = false;
     for(i = 0; i < MAX_FD; i++) {
         fd[i] = drive_get(IF_FLOPPY, 0, i);
+        if (fd[i] != NULL) {
+            floppy_exist = true;
+        }
+    }
+    if (floppy_exist) {
+        *floppy = fdctrl_init_isa(isa_bus, fd);
     }
-    *floppy = fdctrl_init_isa(isa_bus, fd);
 }
 
 void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus)

WARNING: multiple messages have this Message-ID (diff)
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, rth@twiddle.net,
	xen-devel@lists.xensource.com, mst@redhat.com,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: [PATCH] Do not emulate a floppy drive when -nodefaults
Date: Wed, 13 May 2015 18:29:46 +0100	[thread overview]
Message-ID: <alpine.DEB.2.02.1505131826580.20496@kaball.uk.xensource.com> (raw)

Do not emulate a floppy drive if no drives are supposed to be present.

This fixes the behavior of -nodefaults, that should remove the floppy
drive (see docs/qdev-device-use.txt:Default Devices), but actually
doesn't.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index a8e6be1..c9f50b3 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1410,6 +1410,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
     qemu_irq *cpu_exit_irq;
     MemoryRegion *ioport80_io = g_new(MemoryRegion, 1);
     MemoryRegion *ioportF0_io = g_new(MemoryRegion, 1);
+    bool floppy_exist;
 
     memory_region_init_io(ioport80_io, NULL, &ioport80_io_ops, NULL, "ioport80", 1);
     memory_region_add_subregion(isa_bus->address_space_io, 0x80, ioport80_io);
@@ -1487,10 +1488,17 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
     cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);
     DMA_init(0, cpu_exit_irq);
 
+    *floppy = NULL;
+    floppy_exist = false;
     for(i = 0; i < MAX_FD; i++) {
         fd[i] = drive_get(IF_FLOPPY, 0, i);
+        if (fd[i] != NULL) {
+            floppy_exist = true;
+        }
+    }
+    if (floppy_exist) {
+        *floppy = fdctrl_init_isa(isa_bus, fd);
     }
-    *floppy = fdctrl_init_isa(isa_bus, fd);
 }
 
 void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus)

             reply	other threads:[~2015-05-13 17:30 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 17:29 Stefano Stabellini [this message]
2015-05-13 17:29 ` [PATCH] Do not emulate a floppy drive when -nodefaults Stefano Stabellini
2015-05-13 17:42 ` [Qemu-devel] " Daniel P. Berrange
2015-05-13 17:42   ` Daniel P. Berrange
2015-05-13 18:15   ` [Qemu-devel] " Stefano Stabellini
2015-05-13 18:15     ` Stefano Stabellini
2015-05-13 21:46     ` [Qemu-devel] " John Snow
2015-05-13 21:46       ` John Snow
2015-05-14 11:12       ` [Qemu-devel] " Stefano Stabellini
2015-05-14 11:12         ` Stefano Stabellini
2015-05-14 11:18         ` [Qemu-devel] " Daniel P. Berrange
2015-05-14 11:18           ` Daniel P. Berrange
2015-05-14 11:46           ` [Qemu-devel] " Michael S. Tsirkin
2015-05-14 11:46             ` Michael S. Tsirkin
2015-05-14 12:02           ` [Qemu-devel] " Markus Armbruster
2015-05-14 12:02             ` Markus Armbruster
2015-05-14 12:11             ` [Qemu-devel] " Paolo Bonzini
2015-05-14 12:11               ` Paolo Bonzini
2015-05-14 12:45               ` [Qemu-devel] " Markus Armbruster
2015-05-14 12:45                 ` Markus Armbruster
2015-05-14 12:48                 ` [Qemu-devel] " Daniel P. Berrange
2015-05-14 12:48                   ` Daniel P. Berrange
2015-05-14 12:53                 ` [Qemu-devel] " Paolo Bonzini
2015-05-14 12:53                   ` Paolo Bonzini
2015-05-14 13:25                   ` [Qemu-devel] [Xen-devel] " Sander Eikelenboom
2015-05-14 13:25                     ` Sander Eikelenboom
2015-05-14 13:41                     ` [Qemu-devel] " Daniel P. Berrange
2015-05-14 13:41                       ` Daniel P. Berrange
2015-05-14 13:55                     ` [Qemu-devel] " Paolo Bonzini
2015-05-14 13:55                       ` Paolo Bonzini
2015-05-14 14:39                       ` [Qemu-devel] " Stefano Stabellini
2015-05-14 14:39                         ` Stefano Stabellini
2015-05-14 14:44                         ` [Qemu-devel] " Paolo Bonzini
2015-05-14 14:44                           ` Paolo Bonzini
2015-05-14 14:52                           ` [Qemu-devel] " Stefano Stabellini
2015-05-14 14:52                             ` Stefano Stabellini
2015-05-14 13:57                     ` [Qemu-devel] " Michael S. Tsirkin
2015-05-14 13:57                       ` Michael S. Tsirkin
2015-05-14 14:07             ` [Qemu-devel] " Michael S. Tsirkin
2015-05-14 14:07               ` Michael S. Tsirkin
2015-05-14 17:54               ` [Qemu-devel] " John Snow
2015-05-14 17:54                 ` John Snow
2015-05-15  7:50                 ` [Qemu-devel] " Markus Armbruster
2015-05-15  7:50                   ` Markus Armbruster
2015-05-15  8:19                   ` [Qemu-devel] " Paolo Bonzini
2015-05-15  8:19                     ` Paolo Bonzini
2015-05-15 10:20                     ` [Qemu-devel] " Stefano Stabellini
2015-05-15 10:20                       ` Stefano Stabellini
2015-05-18  9:19                 ` [Qemu-devel] " Kevin Wolf
2015-05-18  9:19                   ` Kevin Wolf
2015-05-14 11:47         ` [Qemu-devel] " Michael S. Tsirkin
2015-05-14 11:47           ` Michael S. Tsirkin
2015-05-14 11:54           ` [Qemu-devel] " Paolo Bonzini
2015-05-14 11:54             ` Paolo Bonzini
2015-05-14 11:56             ` [Qemu-devel] " Michael S. Tsirkin
2015-05-14 11:56               ` Michael S. Tsirkin
2015-05-14 12:47             ` [Qemu-devel] " Markus Armbruster
2015-05-14 12:47               ` Markus Armbruster
2015-05-14  4:38     ` [Qemu-devel] " Stefan Weil
2015-05-14  4:38       ` Stefan Weil
2015-05-14  5:45       ` [Qemu-devel] " Michael S. Tsirkin
2015-05-14  5:45         ` Michael S. Tsirkin
2015-05-13 21:44 ` [Qemu-devel] " Michael S. Tsirkin
2015-05-13 21:44   ` Michael S. Tsirkin

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=alpine.DEB.2.02.1505131826580.20496@kaball.uk.xensource.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=xen-devel@lists.xensource.com \
    /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.