From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ysr4x-0002bZ-QP for qemu-devel@nongnu.org; Thu, 14 May 2015 07:13:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ysr4u-000807-GH for qemu-devel@nongnu.org; Thu, 14 May 2015 07:13:27 -0400 Received: from smtp.citrix.com ([66.165.176.89]:48460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ysr4u-0007xj-9P for qemu-devel@nongnu.org; Thu, 14 May 2015 07:13:24 -0400 Date: Thu, 14 May 2015 12:12:52 +0100 From: Stefano Stabellini In-Reply-To: <5553C651.4060000@redhat.com> Message-ID: References: <20150513174204.GS23627@redhat.com> <5553C651.4060000@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: John Snow 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, John Snow wrote: > On 05/13/2015 02:15 PM, Stefano Stabellini wrote: > > 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. > > > > We should just be a little careful in explaining the difference between > the controller, the drives, and what circumstances things show up and to > whom. > > Currently the FDC is always present and always has two drive objects > that are directly inlined to that device. > > Now, based on whether or not this line fires in vl.c: > default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS); > > controls whether or not we find that drive in pc_basic_device_init as > you've found, which controls (ultimately) whether or not > fdctrl->drives[0].blk or fdctrl->drives[1].blk gets set. > > If the blk pointer is set, even if you have no media inserted, > fd_revalidate (and pick_geometry) will *FORCIBLY PICK* a drive type for > this floppy, currently a 1.44MB type, (20 sect, 80 track, 1 head) with a > data rate of 500 Kbps. This is written to the rtc memory where seabios > later reads it to discover if you have a guest-visible floppy drive there. > > Both QEMU and SeaBIOS confuse the concept of "A drive is present" with > "A disk is present" which leads to these kinds of confusing scenarios. > > There's some work to do here, for sure. That was my impression too. On Thu, 14 May 2015, Stefan Weil wrote: > Am 13.05.2015 um 20:15 schrieb Stefano Stabellini: > > 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. > > A short test on some of my physical machines shows that most > of them don't have a floppy disk controller at all (dmesg | grep FDC). > > Only some older machines still have one. > > Therefore I think that QEMU must also be able to offer a virtual > machine without an FDC, maybe as the default for the next > version of QEMU. I think it would make sense to make it the default for -nodefaults machines. I would be OK with a new property too, as we could set it from libxl or libvirt. Anybody would be happy to pick this one up or should I do it? 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: Thu, 14 May 2015 12:12:52 +0100 Message-ID: References: <20150513174204.GS23627@redhat.com> <5553C651.4060000@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Return-path: In-Reply-To: <5553C651.4060000@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: John Snow 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, John Snow wrote: > On 05/13/2015 02:15 PM, Stefano Stabellini wrote: > > 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. > > > > We should just be a little careful in explaining the difference between > the controller, the drives, and what circumstances things show up and to > whom. > > Currently the FDC is always present and always has two drive objects > that are directly inlined to that device. > > Now, based on whether or not this line fires in vl.c: > default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS); > > controls whether or not we find that drive in pc_basic_device_init as > you've found, which controls (ultimately) whether or not > fdctrl->drives[0].blk or fdctrl->drives[1].blk gets set. > > If the blk pointer is set, even if you have no media inserted, > fd_revalidate (and pick_geometry) will *FORCIBLY PICK* a drive type for > this floppy, currently a 1.44MB type, (20 sect, 80 track, 1 head) with a > data rate of 500 Kbps. This is written to the rtc memory where seabios > later reads it to discover if you have a guest-visible floppy drive there. > > Both QEMU and SeaBIOS confuse the concept of "A drive is present" with > "A disk is present" which leads to these kinds of confusing scenarios. > > There's some work to do here, for sure. That was my impression too. On Thu, 14 May 2015, Stefan Weil wrote: > Am 13.05.2015 um 20:15 schrieb Stefano Stabellini: > > 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. > > A short test on some of my physical machines shows that most > of them don't have a floppy disk controller at all (dmesg | grep FDC). > > Only some older machines still have one. > > Therefore I think that QEMU must also be able to offer a virtual > machine without an FDC, maybe as the default for the next > version of QEMU. I think it would make sense to make it the default for -nodefaults machines. I would be OK with a new property too, as we could set it from libxl or libvirt. Anybody would be happy to pick this one up or should I do it?