From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsbCm-0005Ev-0A for qemu-devel@nongnu.org; Wed, 13 May 2015 14:16:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YsbCi-0000jz-Pz for qemu-devel@nongnu.org; Wed, 13 May 2015 14:16:27 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:61848) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsbCi-0000jZ-Ku for qemu-devel@nongnu.org; Wed, 13 May 2015 14:16:24 -0400 Date: Wed, 13 May 2015 19:15:54 +0100 From: Stefano Stabellini In-Reply-To: <20150513174204.GS23627@redhat.com> Message-ID: References: <20150513174204.GS23627@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Subject: Re: [Qemu-devel] [PATCH] Do not emulate a floppy drive when -nodefaults List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: xen-devel@lists.xensource.com, mst@redhat.com, Stefano Stabellini , qemu-devel@nongnu.org, pbonzini@redhat.com, rth@twiddle.net On Wed, 13 May 2015, Daniel P. Berrange wrote: > On Wed, May 13, 2015 at 06:29:46PM +0100, Stefano Stabellini wrote: > > 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. > > Technically that doc is just refering to the disablement of the > primary floppy drive, as opposed to the floppy controller. The > floppy controller itself is really a built-in device that is > defined as part of the machine type, along with the various other > platform devices hanging off the PIIX and ISA brige. I think you are right, this patch is a bit too harsh in fixing the problem: I just wanted to properly disable drive emulation, because from my tests the guest thinks that one drive is present even when is not. > > 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); > > } > > This results in a guest ABI change when updating QEMU, because the floppy > controller will disappear for existing guests. This is liable to break > guests upon migration. > > If we want to be able to disable the floppy controller itself, in addition > to the floppy drives, then we'd likely need to define a property against > the machine type to allow its existence to be toggled on/off. We'd then > need to at least make sure the existing machine types defaulted to on, > if we decided that new machine types should default to off. > > Libvirt would also need to gain the ability to represent the existance > of the floppy controller and allow it to be turned on / off explicitly. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: Re: [PATCH] Do not emulate a floppy drive when -nodefaults Date: Wed, 13 May 2015 19:15:54 +0100 Message-ID: References: <20150513174204.GS23627@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Return-path: In-Reply-To: <20150513174204.GS23627@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org To: "Daniel P. Berrange" Cc: xen-devel@lists.xensource.com, mst@redhat.com, Stefano Stabellini , qemu-devel@nongnu.org, pbonzini@redhat.com, rth@twiddle.net List-Id: xen-devel@lists.xenproject.org On Wed, 13 May 2015, Daniel P. Berrange wrote: > On Wed, May 13, 2015 at 06:29:46PM +0100, Stefano Stabellini wrote: > > 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. > > Technically that doc is just refering to the disablement of the > primary floppy drive, as opposed to the floppy controller. The > floppy controller itself is really a built-in device that is > defined as part of the machine type, along with the various other > platform devices hanging off the PIIX and ISA brige. I think you are right, this patch is a bit too harsh in fixing the problem: I just wanted to properly disable drive emulation, because from my tests the guest thinks that one drive is present even when is not. > > 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); > > } > > This results in a guest ABI change when updating QEMU, because the floppy > controller will disappear for existing guests. This is liable to break > guests upon migration. > > If we want to be able to disable the floppy controller itself, in addition > to the floppy drives, then we'd likely need to define a property against > the machine type to allow its existence to be toggled on/off. We'd then > need to at least make sure the existing machine types defaulted to on, > if we decided that new machine types should default to off. > > Libvirt would also need to gain the ability to represent the existance > of the floppy controller and allow it to be turned on / off explicitly.