All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] floppy: build as modules.
@ 2021-08-04 14:27 Gerd Hoffmann
  2021-08-04 14:27 ` [PATCH 1/7] floppy: move isa_fdc_get_drive_type to separate source file Gerd Hoffmann
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2021-08-04 14:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Eduardo Habkost, qemu-block, Michael S. Tsirkin,
	Richard Henderson, Max Reitz, Gerd Hoffmann, Paolo Bonzini,
	John Snow

Some code shuffling needed beforehand due to floppy being part of
several platforms.  While being at it also make floppy optional
in pc machine type.

Gerd Hoffmann (7):
  floppy: move isa_fdc_get_drive_type to separate source file.
  floppy: move isa_fdc_init_drives + fdctrl_init_drives
  floppy: move fdctrl_init_sysbus
  floppy: move sun4m_fdctrl_init
  floppy: move cmos_get_fd_drive_type
  floppy: build as modules.
  pc: add floppy=OnOffAuto

 hw/block/fdc-internal.h |  31 ++++++++++
 include/hw/i386/pc.h    |   2 +
 hw/block/fdc-isa.c      |  54 +----------------
 hw/block/fdc-module.c   | 125 ++++++++++++++++++++++++++++++++++++++++
 hw/block/fdc-sysbus.c   |  54 ++---------------
 hw/block/fdc.c          |  19 +-----
 hw/i386/pc.c            |  23 ++++++++
 hw/i386/pc_piix.c       |   8 ++-
 hw/block/meson.build    |  18 +++++-
 9 files changed, 211 insertions(+), 123 deletions(-)
 create mode 100644 hw/block/fdc-module.c

-- 
2.31.1




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/7] floppy: move isa_fdc_get_drive_type to separate source file.
  2021-08-04 14:27 [PATCH 0/7] floppy: build as modules Gerd Hoffmann
@ 2021-08-04 14:27 ` Gerd Hoffmann
  2021-08-04 14:27 ` [PATCH 2/7] floppy: move isa_fdc_init_drives + fdctrl_init_drives Gerd Hoffmann
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2021-08-04 14:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Eduardo Habkost, qemu-block, Michael S. Tsirkin,
	Richard Henderson, Max Reitz, Gerd Hoffmann, Paolo Bonzini,
	John Snow

isa_fdc_get_drive_type() is needed by pc machine types
when setting up the cmos.

Move to separate source file so we can keep it in core qemu
when building floppy as module.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/block/fdc-internal.h | 16 ++++++++++++++++
 hw/block/fdc-isa.c      | 22 ----------------------
 hw/block/fdc-module.c   | 39 +++++++++++++++++++++++++++++++++++++++
 hw/block/meson.build    |  1 +
 4 files changed, 56 insertions(+), 22 deletions(-)
 create mode 100644 hw/block/fdc-module.c

diff --git a/hw/block/fdc-internal.h b/hw/block/fdc-internal.h
index 036392e9fc10..a74cd5e4b9f2 100644
--- a/hw/block/fdc-internal.h
+++ b/hw/block/fdc-internal.h
@@ -29,6 +29,7 @@
 #include "exec/ioport.h"
 #include "hw/block/block.h"
 #include "hw/block/fdc.h"
+#include "hw/isa/isa.h"
 #include "qapi/qapi-types-block.h"
 
 typedef struct FDCtrl FDCtrl;
@@ -143,6 +144,21 @@ struct FDCtrl {
     PortioList portio_list;
 };
 
+OBJECT_DECLARE_SIMPLE_TYPE(FDCtrlISABus, ISA_FDC)
+
+struct FDCtrlISABus {
+    /*< private >*/
+    ISADevice parent_obj;
+    /*< public >*/
+
+    uint32_t iobase;
+    uint32_t irq;
+    uint32_t dma;
+    struct FDCtrl state;
+    int32_t bootindexA;
+    int32_t bootindexB;
+};
+
 extern const FDFormat fd_formats[];
 extern const VMStateDescription vmstate_fdc;
 
diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c
index 3bf64e06657b..dd7e1669f862 100644
--- a/hw/block/fdc-isa.c
+++ b/hw/block/fdc-isa.c
@@ -49,21 +49,6 @@
 #include "qom/object.h"
 #include "fdc-internal.h"
 
-OBJECT_DECLARE_SIMPLE_TYPE(FDCtrlISABus, ISA_FDC)
-
-struct FDCtrlISABus {
-    /*< private >*/
-    ISADevice parent_obj;
-    /*< public >*/
-
-    uint32_t iobase;
-    uint32_t irq;
-    uint32_t dma;
-    struct FDCtrl state;
-    int32_t bootindexA;
-    int32_t bootindexB;
-};
-
 static void fdctrl_external_reset_isa(DeviceState *d)
 {
     FDCtrlISABus *isa = ISA_FDC(d);
@@ -117,13 +102,6 @@ static void isabus_fdc_realize(DeviceState *dev, Error **errp)
     }
 }
 
-FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i)
-{
-    FDCtrlISABus *isa = ISA_FDC(fdc);
-
-    return isa->state.drives[i].drive;
-}
-
 static void isa_fdc_get_drive_max_chs(FloppyDriveType type, uint8_t *maxc,
                                       uint8_t *maxh, uint8_t *maxs)
 {
diff --git a/hw/block/fdc-module.c b/hw/block/fdc-module.c
new file mode 100644
index 000000000000..93953bf0aa57
--- /dev/null
+++ b/hw/block/fdc-module.c
@@ -0,0 +1,39 @@
+/*
+ * QEMU Floppy disk emulator (Intel 82078)
+ *
+ * Some small helper functions which must be built into core qemu when
+ * building floppy as module.
+ *
+ * Copyright (c) 2003, 2007 Jocelyn Mayer
+ * Copyright (c) 2008 Hervé Poussineau
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/isa/isa.h"
+#include "hw/block/fdc.h"
+#include "fdc-internal.h"
+
+FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i)
+{
+    FDCtrlISABus *isa = ISA_FDC(fdc);
+
+    return isa->state.drives[i].drive;
+}
diff --git a/hw/block/meson.build b/hw/block/meson.build
index 2389326112ae..8460042fe320 100644
--- a/hw/block/meson.build
+++ b/hw/block/meson.build
@@ -4,6 +4,7 @@ softmmu_ss.add(files(
   'hd-geometry.c'
 ))
 softmmu_ss.add(when: 'CONFIG_ECC', if_true: files('ecc.c'))
+softmmu_ss.add(when: 'CONFIG_FDC', if_true: files('fdc-module.c'))
 softmmu_ss.add(when: 'CONFIG_FDC', if_true: files('fdc.c'))
 softmmu_ss.add(when: 'CONFIG_FDC_ISA', if_true: files('fdc-isa.c'))
 softmmu_ss.add(when: 'CONFIG_FDC_SYSBUS', if_true: files('fdc-sysbus.c'))
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/7] floppy: move isa_fdc_init_drives + fdctrl_init_drives
  2021-08-04 14:27 [PATCH 0/7] floppy: build as modules Gerd Hoffmann
  2021-08-04 14:27 ` [PATCH 1/7] floppy: move isa_fdc_get_drive_type to separate source file Gerd Hoffmann
@ 2021-08-04 14:27 ` Gerd Hoffmann
  2021-08-04 14:27 ` [PATCH 3/7] floppy: move fdctrl_init_sysbus Gerd Hoffmann
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2021-08-04 14:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Eduardo Habkost, qemu-block, Michael S. Tsirkin,
	Richard Henderson, Max Reitz, Gerd Hoffmann, Paolo Bonzini,
	John Snow

isa_fdc_init_drives() is called by pc machine setup,
and it depends on fdctrl_init_drives().

Move both functions to separate source file so we can
keep them in core qemu when building floppy as module.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/block/fdc-isa.c    |  5 -----
 hw/block/fdc-module.c | 24 ++++++++++++++++++++++++
 hw/block/fdc.c        | 17 -----------------
 3 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c
index dd7e1669f862..36c246efa822 100644
--- a/hw/block/fdc-isa.c
+++ b/hw/block/fdc-isa.c
@@ -57,11 +57,6 @@ static void fdctrl_external_reset_isa(DeviceState *d)
     fdctrl_reset(s, 0);
 }
 
-void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds)
-{
-    fdctrl_init_drives(&ISA_FDC(fdc)->state.bus, fds);
-}
-
 static const MemoryRegionPortio fdc_portio_list[] = {
     { 1, 5, 1, .read = fdctrl_read, .write = fdctrl_write },
     { 7, 1, 1, .read = fdctrl_read, .write = fdctrl_write },
diff --git a/hw/block/fdc-module.c b/hw/block/fdc-module.c
index 93953bf0aa57..8309e99361bc 100644
--- a/hw/block/fdc-module.c
+++ b/hw/block/fdc-module.c
@@ -29,8 +29,32 @@
 #include "qemu/osdep.h"
 #include "hw/isa/isa.h"
 #include "hw/block/fdc.h"
+#include "qapi/error.h"
+#include "sysemu/blockdev.h"
 #include "fdc-internal.h"
 
+void fdctrl_init_drives(FloppyBus *bus, DriveInfo **fds)
+{
+    DeviceState *dev;
+    int i;
+
+    for (i = 0; i < MAX_FD; i++) {
+        if (fds[i]) {
+            dev = qdev_new("floppy");
+            qdev_prop_set_uint32(dev, "unit", i);
+            qdev_prop_set_enum(dev, "drive-type", FLOPPY_DRIVE_TYPE_AUTO);
+            qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(fds[i]),
+                                    &error_fatal);
+            qdev_realize_and_unref(dev, &bus->bus, &error_fatal);
+        }
+    }
+}
+
+void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds)
+{
+    fdctrl_init_drives(&ISA_FDC(fdc)->state.bus, fds);
+}
+
 FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i)
 {
     FDCtrlISABus *isa = ISA_FDC(fdc);
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 9014cd30b3ab..ba42537e8d26 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -2297,23 +2297,6 @@ static void fdctrl_result_timer(void *opaque)
 
 /* Init functions */
 
-void fdctrl_init_drives(FloppyBus *bus, DriveInfo **fds)
-{
-    DeviceState *dev;
-    int i;
-
-    for (i = 0; i < MAX_FD; i++) {
-        if (fds[i]) {
-            dev = qdev_new("floppy");
-            qdev_prop_set_uint32(dev, "unit", i);
-            qdev_prop_set_enum(dev, "drive-type", FLOPPY_DRIVE_TYPE_AUTO);
-            qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(fds[i]),
-                                    &error_fatal);
-            qdev_realize_and_unref(dev, &bus->bus, &error_fatal);
-        }
-    }
-}
-
 void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl, Error **errp)
 {
     int i, j;
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/7] floppy: move fdctrl_init_sysbus
  2021-08-04 14:27 [PATCH 0/7] floppy: build as modules Gerd Hoffmann
  2021-08-04 14:27 ` [PATCH 1/7] floppy: move isa_fdc_get_drive_type to separate source file Gerd Hoffmann
  2021-08-04 14:27 ` [PATCH 2/7] floppy: move isa_fdc_init_drives + fdctrl_init_drives Gerd Hoffmann
@ 2021-08-04 14:27 ` Gerd Hoffmann
  2021-08-04 14:27 ` [PATCH 4/7] floppy: move sun4m_fdctrl_init Gerd Hoffmann
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2021-08-04 14:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Eduardo Habkost, qemu-block, Michael S. Tsirkin,
	Richard Henderson, Max Reitz, Gerd Hoffmann, Paolo Bonzini,
	John Snow

Needed by mips machine init.

Move to separate source file so we can keep it in core qemu
when building floppy as module.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/block/fdc-internal.h | 15 +++++++++++++++
 hw/block/fdc-module.c   | 21 +++++++++++++++++++++
 hw/block/fdc-sysbus.c   | 34 ----------------------------------
 3 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/hw/block/fdc-internal.h b/hw/block/fdc-internal.h
index a74cd5e4b9f2..f6c56f6e827f 100644
--- a/hw/block/fdc-internal.h
+++ b/hw/block/fdc-internal.h
@@ -30,6 +30,7 @@
 #include "hw/block/block.h"
 #include "hw/block/fdc.h"
 #include "hw/isa/isa.h"
+#include "hw/sysbus.h"
 #include "qapi/qapi-types-block.h"
 
 typedef struct FDCtrl FDCtrl;
@@ -159,6 +160,20 @@ struct FDCtrlISABus {
     int32_t bootindexB;
 };
 
+#define TYPE_SYSBUS_FDC "base-sysbus-fdc"
+typedef struct FDCtrlSysBusClass FDCtrlSysBusClass;
+typedef struct FDCtrlSysBus FDCtrlSysBus;
+DECLARE_OBJ_CHECKERS(FDCtrlSysBus, FDCtrlSysBusClass,
+                     SYSBUS_FDC, TYPE_SYSBUS_FDC)
+
+struct FDCtrlSysBus {
+    /*< private >*/
+    SysBusDevice parent_obj;
+    /*< public >*/
+
+    struct FDCtrl state;
+};
+
 extern const FDFormat fd_formats[];
 extern const VMStateDescription vmstate_fdc;
 
diff --git a/hw/block/fdc-module.c b/hw/block/fdc-module.c
index 8309e99361bc..11e6ae7c0cb9 100644
--- a/hw/block/fdc-module.c
+++ b/hw/block/fdc-module.c
@@ -29,10 +29,31 @@
 #include "qemu/osdep.h"
 #include "hw/isa/isa.h"
 #include "hw/block/fdc.h"
+#include "hw/sysbus.h"
 #include "qapi/error.h"
 #include "sysemu/blockdev.h"
 #include "fdc-internal.h"
 
+void fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
+                        hwaddr mmio_base, DriveInfo **fds)
+{
+    FDCtrl *fdctrl;
+    DeviceState *dev;
+    SysBusDevice *sbd;
+    FDCtrlSysBus *sys;
+
+    dev = qdev_new("sysbus-fdc");
+    sys = SYSBUS_FDC(dev);
+    fdctrl = &sys->state;
+    fdctrl->dma_chann = dma_chann; /* FIXME */
+    sbd = SYS_BUS_DEVICE(dev);
+    sysbus_realize_and_unref(sbd, &error_fatal);
+    sysbus_connect_irq(sbd, 0, irq);
+    sysbus_mmio_map(sbd, 0, mmio_base);
+
+    fdctrl_init_drives(&sys->state.bus, fds);
+}
+
 void fdctrl_init_drives(FloppyBus *bus, DriveInfo **fds)
 {
     DeviceState *dev;
diff --git a/hw/block/fdc-sysbus.c b/hw/block/fdc-sysbus.c
index 57fc8773f124..5a8d393d31c2 100644
--- a/hw/block/fdc-sysbus.c
+++ b/hw/block/fdc-sysbus.c
@@ -32,12 +32,6 @@
 #include "fdc-internal.h"
 #include "trace.h"
 
-#define TYPE_SYSBUS_FDC "base-sysbus-fdc"
-typedef struct FDCtrlSysBusClass FDCtrlSysBusClass;
-typedef struct FDCtrlSysBus FDCtrlSysBus;
-DECLARE_OBJ_CHECKERS(FDCtrlSysBus, FDCtrlSysBusClass,
-                     SYSBUS_FDC, TYPE_SYSBUS_FDC)
-
 struct FDCtrlSysBusClass {
     /*< private >*/
     SysBusDeviceClass parent_class;
@@ -46,14 +40,6 @@ struct FDCtrlSysBusClass {
     bool use_strict_io;
 };
 
-struct FDCtrlSysBus {
-    /*< private >*/
-    SysBusDevice parent_obj;
-    /*< public >*/
-
-    struct FDCtrl state;
-};
-
 static uint64_t fdctrl_read_mem(void *opaque, hwaddr reg, unsigned ize)
 {
     return fdctrl_read(opaque, (uint32_t)reg);
@@ -94,26 +80,6 @@ static void fdctrl_handle_tc(void *opaque, int irq, int level)
     trace_fdctrl_tc_pulse(level);
 }
 
-void fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
-                        hwaddr mmio_base, DriveInfo **fds)
-{
-    FDCtrl *fdctrl;
-    DeviceState *dev;
-    SysBusDevice *sbd;
-    FDCtrlSysBus *sys;
-
-    dev = qdev_new("sysbus-fdc");
-    sys = SYSBUS_FDC(dev);
-    fdctrl = &sys->state;
-    fdctrl->dma_chann = dma_chann; /* FIXME */
-    sbd = SYS_BUS_DEVICE(dev);
-    sysbus_realize_and_unref(sbd, &error_fatal);
-    sysbus_connect_irq(sbd, 0, irq);
-    sysbus_mmio_map(sbd, 0, mmio_base);
-
-    fdctrl_init_drives(&sys->state.bus, fds);
-}
-
 void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base,
                        DriveInfo **fds, qemu_irq *fdc_tc)
 {
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/7] floppy: move sun4m_fdctrl_init
  2021-08-04 14:27 [PATCH 0/7] floppy: build as modules Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2021-08-04 14:27 ` [PATCH 3/7] floppy: move fdctrl_init_sysbus Gerd Hoffmann
@ 2021-08-04 14:27 ` Gerd Hoffmann
  2021-08-04 14:27 ` [PATCH 5/7] floppy: move cmos_get_fd_drive_type Gerd Hoffmann
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2021-08-04 14:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Eduardo Habkost, qemu-block, Michael S. Tsirkin,
	Richard Henderson, Max Reitz, Gerd Hoffmann, Paolo Bonzini,
	John Snow

Needed by sparc machine init.

Move to separate source file so we can keep it in core qemu
when building floppy as module.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/block/fdc-module.c | 16 ++++++++++++++++
 hw/block/fdc-sysbus.c | 16 ----------------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/hw/block/fdc-module.c b/hw/block/fdc-module.c
index 11e6ae7c0cb9..3682b5c1ebd1 100644
--- a/hw/block/fdc-module.c
+++ b/hw/block/fdc-module.c
@@ -54,6 +54,22 @@ void fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
     fdctrl_init_drives(&sys->state.bus, fds);
 }
 
+void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base,
+                       DriveInfo **fds, qemu_irq *fdc_tc)
+{
+    DeviceState *dev;
+    FDCtrlSysBus *sys;
+
+    dev = qdev_new("sun-fdtwo");
+    sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
+    sys = SYSBUS_FDC(dev);
+    sysbus_connect_irq(SYS_BUS_DEVICE(sys), 0, irq);
+    sysbus_mmio_map(SYS_BUS_DEVICE(sys), 0, io_base);
+    *fdc_tc = qdev_get_gpio_in(dev, 0);
+
+    fdctrl_init_drives(&sys->state.bus, fds);
+}
+
 void fdctrl_init_drives(FloppyBus *bus, DriveInfo **fds)
 {
     DeviceState *dev;
diff --git a/hw/block/fdc-sysbus.c b/hw/block/fdc-sysbus.c
index 5a8d393d31c2..b358b6467ef5 100644
--- a/hw/block/fdc-sysbus.c
+++ b/hw/block/fdc-sysbus.c
@@ -80,22 +80,6 @@ static void fdctrl_handle_tc(void *opaque, int irq, int level)
     trace_fdctrl_tc_pulse(level);
 }
 
-void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base,
-                       DriveInfo **fds, qemu_irq *fdc_tc)
-{
-    DeviceState *dev;
-    FDCtrlSysBus *sys;
-
-    dev = qdev_new("sun-fdtwo");
-    sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
-    sys = SYSBUS_FDC(dev);
-    sysbus_connect_irq(SYS_BUS_DEVICE(sys), 0, irq);
-    sysbus_mmio_map(SYS_BUS_DEVICE(sys), 0, io_base);
-    *fdc_tc = qdev_get_gpio_in(dev, 0);
-
-    fdctrl_init_drives(&sys->state.bus, fds);
-}
-
 static void sysbus_fdc_common_instance_init(Object *obj)
 {
     DeviceState *dev = DEVICE(obj);
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/7] floppy: move cmos_get_fd_drive_type
  2021-08-04 14:27 [PATCH 0/7] floppy: build as modules Gerd Hoffmann
                   ` (3 preceding siblings ...)
  2021-08-04 14:27 ` [PATCH 4/7] floppy: move sun4m_fdctrl_init Gerd Hoffmann
@ 2021-08-04 14:27 ` Gerd Hoffmann
  2021-08-04 14:27 ` [PATCH 6/7] floppy: build as modules Gerd Hoffmann
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2021-08-04 14:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Eduardo Habkost, qemu-block, Michael S. Tsirkin,
	Richard Henderson, Max Reitz, Gerd Hoffmann, Paolo Bonzini,
	John Snow

Needed by pc machine init.

Move to separate source file so we can keep it in core qemu
when building floppy as module.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/block/fdc-isa.c    | 25 -------------------------
 hw/block/fdc-module.c | 25 +++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c
index 36c246efa822..a5a124fb9236 100644
--- a/hw/block/fdc-isa.c
+++ b/hw/block/fdc-isa.c
@@ -162,31 +162,6 @@ static Aml *build_fdinfo_aml(int idx, FloppyDriveType type)
     return dev;
 }
 
-int cmos_get_fd_drive_type(FloppyDriveType fd0)
-{
-    int val;
-
-    switch (fd0) {
-    case FLOPPY_DRIVE_TYPE_144:
-        /* 1.44 Mb 3"5 drive */
-        val = 4;
-        break;
-    case FLOPPY_DRIVE_TYPE_288:
-        /* 2.88 Mb 3"5 drive */
-        val = 5;
-        break;
-    case FLOPPY_DRIVE_TYPE_120:
-        /* 1.2 Mb 5"5 drive */
-        val = 2;
-        break;
-    case FLOPPY_DRIVE_TYPE_NONE:
-    default:
-        val = 0;
-        break;
-    }
-    return val;
-}
-
 static void fdc_isa_build_aml(ISADevice *isadev, Aml *scope)
 {
     Aml *dev;
diff --git a/hw/block/fdc-module.c b/hw/block/fdc-module.c
index 3682b5c1ebd1..7e2aaf86a0c0 100644
--- a/hw/block/fdc-module.c
+++ b/hw/block/fdc-module.c
@@ -98,3 +98,28 @@ FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i)
 
     return isa->state.drives[i].drive;
 }
+
+int cmos_get_fd_drive_type(FloppyDriveType fd0)
+{
+    int val;
+
+    switch (fd0) {
+    case FLOPPY_DRIVE_TYPE_144:
+        /* 1.44 Mb 3"5 drive */
+        val = 4;
+        break;
+    case FLOPPY_DRIVE_TYPE_288:
+        /* 2.88 Mb 3"5 drive */
+        val = 5;
+        break;
+    case FLOPPY_DRIVE_TYPE_120:
+        /* 1.2 Mb 5"5 drive */
+        val = 2;
+        break;
+    case FLOPPY_DRIVE_TYPE_NONE:
+    default:
+        val = 0;
+        break;
+    }
+    return val;
+}
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/7] floppy: build as modules.
  2021-08-04 14:27 [PATCH 0/7] floppy: build as modules Gerd Hoffmann
                   ` (4 preceding siblings ...)
  2021-08-04 14:27 ` [PATCH 5/7] floppy: move cmos_get_fd_drive_type Gerd Hoffmann
@ 2021-08-04 14:27 ` Gerd Hoffmann
  2021-08-04 14:27 ` [PATCH 7/7] pc: add floppy=OnOffAuto Gerd Hoffmann
  2021-08-04 15:19 ` [PATCH 0/7] floppy: build as modules Philippe Mathieu-Daudé
  7 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2021-08-04 14:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Eduardo Habkost, qemu-block, Michael S. Tsirkin,
	Richard Henderson, Max Reitz, Gerd Hoffmann, Paolo Bonzini,
	John Snow

Add module_obj() annotations, update meson build rules.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/block/fdc-isa.c    |  2 ++
 hw/block/fdc-sysbus.c |  4 ++++
 hw/block/fdc.c        |  2 ++
 hw/block/meson.build  | 17 ++++++++++++++---
 4 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c
index a5a124fb9236..fb2139760f8c 100644
--- a/hw/block/fdc-isa.c
+++ b/hw/block/fdc-isa.c
@@ -259,6 +259,7 @@ static const TypeInfo isa_fdc_info = {
     .class_init    = isabus_fdc_class_init,
     .instance_init = isabus_fdc_instance_init,
 };
+module_obj(TYPE_ISA_FDC);
 
 static void isa_fdc_register_types(void)
 {
@@ -266,3 +267,4 @@ static void isa_fdc_register_types(void)
 }
 
 type_init(isa_fdc_register_types)
+module_dep("hw-block-fdc");
diff --git a/hw/block/fdc-sysbus.c b/hw/block/fdc-sysbus.c
index b358b6467ef5..8cc65cd92642 100644
--- a/hw/block/fdc-sysbus.c
+++ b/hw/block/fdc-sysbus.c
@@ -137,6 +137,7 @@ static const TypeInfo sysbus_fdc_common_typeinfo = {
     .class_init    = sysbus_fdc_common_class_init,
     .class_size    = sizeof(FDCtrlSysBusClass),
 };
+module_obj(TYPE_SYSBUS_FDC);
 
 static Property sysbus_fdc_properties[] = {
     DEFINE_PROP_SIGNED("fdtypeA", FDCtrlSysBus, state.qdev_for_drives[0].type,
@@ -164,6 +165,7 @@ static const TypeInfo sysbus_fdc_typeinfo = {
     .parent        = TYPE_SYSBUS_FDC,
     .class_init    = sysbus_fdc_class_init,
 };
+module_obj("sysbus-fdc");
 
 static Property sun4m_fdc_properties[] = {
     DEFINE_PROP_SIGNED("fdtype", FDCtrlSysBus, state.qdev_for_drives[0].type,
@@ -190,6 +192,7 @@ static const TypeInfo sun4m_fdc_typeinfo = {
     .parent        = TYPE_SYSBUS_FDC,
     .class_init    = sun4m_fdc_class_init,
 };
+module_obj("sun-fdtwo");
 
 static void sysbus_fdc_register_types(void)
 {
@@ -199,3 +202,4 @@ static void sysbus_fdc_register_types(void)
 }
 
 type_init(sysbus_fdc_register_types)
+module_dep("hw-block-fdc");
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index ba42537e8d26..95a1467f3faf 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -74,6 +74,7 @@ static const TypeInfo floppy_bus_info = {
     .parent = TYPE_BUS,
     .instance_size = sizeof(FloppyBus),
 };
+module_obj(TYPE_FLOPPY_BUS);
 
 static void floppy_bus_create(FDCtrl *fdc, FloppyBus *bus, DeviceState *dev)
 {
@@ -564,6 +565,7 @@ static const TypeInfo floppy_drive_info = {
     .instance_size = sizeof(FloppyDrive),
     .class_init = floppy_drive_class_init,
 };
+module_obj(TYPE_FLOPPY_DRIVE);
 
 /********************************************************/
 /* Intel 82078 floppy disk controller emulation          */
diff --git a/hw/block/meson.build b/hw/block/meson.build
index 8460042fe320..b336773ac591 100644
--- a/hw/block/meson.build
+++ b/hw/block/meson.build
@@ -1,3 +1,5 @@
+hw_block_modules = {}
+
 softmmu_ss.add(files(
   'block.c',
   'cdrom.c',
@@ -5,9 +7,6 @@ softmmu_ss.add(files(
 ))
 softmmu_ss.add(when: 'CONFIG_ECC', if_true: files('ecc.c'))
 softmmu_ss.add(when: 'CONFIG_FDC', if_true: files('fdc-module.c'))
-softmmu_ss.add(when: 'CONFIG_FDC', if_true: files('fdc.c'))
-softmmu_ss.add(when: 'CONFIG_FDC_ISA', if_true: files('fdc-isa.c'))
-softmmu_ss.add(when: 'CONFIG_FDC_SYSBUS', if_true: files('fdc-sysbus.c'))
 softmmu_ss.add(when: 'CONFIG_NAND', if_true: files('nand.c'))
 softmmu_ss.add(when: 'CONFIG_ONENAND', if_true: files('onenand.c'))
 softmmu_ss.add(when: 'CONFIG_PFLASH_CFI01', if_true: files('pflash_cfi01.c'))
@@ -20,4 +19,16 @@ softmmu_ss.add(when: 'CONFIG_TC58128', if_true: files('tc58128.c'))
 specific_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio-blk.c'))
 specific_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('vhost-user-blk.c'))
 
+fdc_ss = ss.source_set()
+fdc_isa_ss = ss.source_set()
+fdc_sysbus_ss = ss.source_set()
+fdc_ss.add(when: 'CONFIG_FDC', if_true: files('fdc.c'))
+fdc_isa_ss.add(when: 'CONFIG_FDC_ISA', if_true: files('fdc-isa.c'))
+fdc_sysbus_ss.add(when: 'CONFIG_FDC_SYSBUS', if_true: files('fdc-sysbus.c'))
+hw_block_modules += {'fdc': fdc_ss,
+                     'fdc-isa' : fdc_isa_ss,
+                     'fdc-sysbus' : fdc_sysbus_ss }
+
 subdir('dataplane')
+
+modules += { 'hw-block': hw_block_modules }
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 7/7] pc: add floppy=OnOffAuto
  2021-08-04 14:27 [PATCH 0/7] floppy: build as modules Gerd Hoffmann
                   ` (5 preceding siblings ...)
  2021-08-04 14:27 ` [PATCH 6/7] floppy: build as modules Gerd Hoffmann
@ 2021-08-04 14:27 ` Gerd Hoffmann
  2021-08-04 15:19 ` [PATCH 0/7] floppy: build as modules Philippe Mathieu-Daudé
  7 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2021-08-04 14:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Eduardo Habkost, qemu-block, Michael S. Tsirkin,
	Richard Henderson, Max Reitz, Gerd Hoffmann, Paolo Bonzini,
	John Snow

Allows to enable/disable the floppy controller.  Default depends on
MachineClass->no_floppy.  It's ON for now, but we can flip the default
for 6.2+ machine types.

NOTE: This requires -nodefaults or no_floppy=1 to actually have an
effect.  Otherwise the default floppy drive created by qemu will
auto-enable the floppy controller.  Not sure how to deal with that best.
IMHO we should simply stop creating a default floppy, unfortunaly
that will break live migration.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/hw/i386/pc.h |  2 ++
 hw/i386/pc.c         | 23 +++++++++++++++++++++++
 hw/i386/pc_piix.c    |  8 +++++++-
 3 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 88dffe751724..b418ead6c260 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -38,6 +38,7 @@ typedef struct PCMachineState {
     /* Configuration options: */
     uint64_t max_ram_below_4g;
     OnOffAuto vmport;
+    OnOffAuto floppy;
 
     bool acpi_build_enabled;
     bool smbus_enabled;
@@ -59,6 +60,7 @@ typedef struct PCMachineState {
 #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
 #define PC_MACHINE_DEVMEM_REGION_SIZE "device-memory-region-size"
 #define PC_MACHINE_VMPORT           "vmport"
+#define PC_MACHINE_FLOPPY           "floppy"
 #define PC_MACHINE_SMBUS            "smbus"
 #define PC_MACHINE_SATA             "sata"
 #define PC_MACHINE_PIT              "pit"
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index c2b9d62a358f..832ea9cc8ef8 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1468,6 +1468,23 @@ static void pc_machine_set_vmport(Object *obj, Visitor *v, const char *name,
     visit_type_OnOffAuto(v, name, &pcms->vmport, errp);
 }
 
+static void pc_machine_get_floppy(Object *obj, Visitor *v, const char *name,
+                                  void *opaque, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+    OnOffAuto floppy = pcms->floppy;
+
+    visit_type_OnOffAuto(v, name, &floppy, errp);
+}
+
+static void pc_machine_set_floppy(Object *obj, Visitor *v, const char *name,
+                                  void *opaque, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    visit_type_OnOffAuto(v, name, &pcms->floppy, errp);
+}
+
 static bool pc_machine_get_smbus(Object *obj, Error **errp)
 {
     PCMachineState *pcms = PC_MACHINE(obj);
@@ -1751,6 +1768,12 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
     object_class_property_set_description(oc, PC_MACHINE_VMPORT,
         "Enable vmport (pc & q35)");
 
+    object_class_property_add(oc, PC_MACHINE_FLOPPY, "OnOffAuto",
+        pc_machine_get_floppy, pc_machine_set_floppy,
+        NULL, NULL);
+    object_class_property_set_description(oc, PC_MACHINE_FLOPPY,
+        "Enable floppy (pc only)");
+
     object_class_property_add_bool(oc, PC_MACHINE_SMBUS,
         pc_machine_get_smbus, pc_machine_set_smbus);
 
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 30b8bd6ea92d..7f81729e42cd 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -235,8 +235,14 @@ static void pc_init1(MachineState *machine,
         pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON;
     }
 
+    if (pcms->floppy == ON_OFF_AUTO_AUTO) {
+        pcms->floppy = MACHINE_CLASS(pcmc)->no_floppy
+            ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON;
+    }
+
     /* init basic PC hardware */
-    pc_basic_device_init(pcms, isa_bus, x86ms->gsi, &rtc_state, true,
+    pc_basic_device_init(pcms, isa_bus, x86ms->gsi, &rtc_state,
+                         pcms->floppy == ON_OFF_AUTO_ON,
                          0x4);
 
     pc_nic_init(pcmc, isa_bus, pci_bus);
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] floppy: build as modules.
  2021-08-04 14:27 [PATCH 0/7] floppy: build as modules Gerd Hoffmann
                   ` (6 preceding siblings ...)
  2021-08-04 14:27 ` [PATCH 7/7] pc: add floppy=OnOffAuto Gerd Hoffmann
@ 2021-08-04 15:19 ` Philippe Mathieu-Daudé
  2021-08-05  7:11   ` Gerd Hoffmann
  7 siblings, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-08-04 15:19 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel, Mark Cave-Ayland
  Cc: Kevin Wolf, Eduardo Habkost, qemu-block, Michael S. Tsirkin,
	Richard Henderson, Max Reitz, Paolo Bonzini, John Snow

+Mark

On 8/4/21 4:27 PM, Gerd Hoffmann wrote:
> Some code shuffling needed beforehand due to floppy being part of
> several platforms.  While being at it also make floppy optional
> in pc machine type.

>   floppy: move fdctrl_init_sysbus
>   floppy: move sun4m_fdctrl_init

https://www.mail-archive.com/qemu-block@nongnu.org/msg84008.html

Mark suggested:

  You may be able to simplify this further by removing the
  global legacy init functions fdctrl_init_sysbus() and
  sun4m_fdctrl_init(): from what I can see fdctrl_init_sysbus()
  is only used in hw/mips/jazz.c and sun4m_fdctrl_init() is only
  used in hw/sparc/sun4m.c so you might as well inline them or
  move the functions to the relevant files.

I did it and plan to send during 6.2. Sounds simpler than module.
You could easily rebase your series on top (or I can include your
patches while sending).


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] floppy: build as modules.
  2021-08-04 15:19 ` [PATCH 0/7] floppy: build as modules Philippe Mathieu-Daudé
@ 2021-08-05  7:11   ` Gerd Hoffmann
  2021-08-16 21:55     ` John Snow
  0 siblings, 1 reply; 13+ messages in thread
From: Gerd Hoffmann @ 2021-08-05  7:11 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Kevin Wolf, Eduardo Habkost, qemu-block, Michael S. Tsirkin,
	Richard Henderson, Mark Cave-Ayland, qemu-devel, Max Reitz,
	Paolo Bonzini, John Snow

On Wed, Aug 04, 2021 at 05:19:02PM +0200, Philippe Mathieu-Daudé wrote:
> +Mark
> 
> On 8/4/21 4:27 PM, Gerd Hoffmann wrote:
> > Some code shuffling needed beforehand due to floppy being part of
> > several platforms.  While being at it also make floppy optional
> > in pc machine type.
> 
> >   floppy: move fdctrl_init_sysbus
> >   floppy: move sun4m_fdctrl_init
> 
> https://www.mail-archive.com/qemu-block@nongnu.org/msg84008.html
> 
> Mark suggested:
> 
>   You may be able to simplify this further by removing the
>   global legacy init functions fdctrl_init_sysbus() and
>   sun4m_fdctrl_init(): from what I can see fdctrl_init_sysbus()
>   is only used in hw/mips/jazz.c and sun4m_fdctrl_init() is only
>   used in hw/sparc/sun4m.c so you might as well inline them or
>   move the functions to the relevant files.
> 
> I did it and plan to send during 6.2. Sounds simpler than module.
> You could easily rebase your series on top (or I can include your
> patches while sending).

Feel free to include them.  But I can also rebase when your patches
landed upstream.  Your choice ;)

take care,
  Gerd



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] floppy: build as modules.
  2021-08-05  7:11   ` Gerd Hoffmann
@ 2021-08-16 21:55     ` John Snow
  2021-08-17  9:09       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 13+ messages in thread
From: John Snow @ 2021-08-16 21:55 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Kevin Wolf, Eduardo Habkost, qemu-block, Michael S. Tsirkin,
	Richard Henderson, Mark Cave-Ayland, Philippe Mathieu-Daudé,
	qemu-devel, Paolo Bonzini, Max Reitz

[-- Attachment #1: Type: text/plain, Size: 1623 bytes --]

On Thu, Aug 5, 2021 at 3:12 AM Gerd Hoffmann <kraxel@redhat.com> wrote:

> On Wed, Aug 04, 2021 at 05:19:02PM +0200, Philippe Mathieu-Daudé wrote:
> > +Mark
> >
> > On 8/4/21 4:27 PM, Gerd Hoffmann wrote:
> > > Some code shuffling needed beforehand due to floppy being part of
> > > several platforms.  While being at it also make floppy optional
> > > in pc machine type.
> >
> > >   floppy: move fdctrl_init_sysbus
> > >   floppy: move sun4m_fdctrl_init
> >
> > https://www.mail-archive.com/qemu-block@nongnu.org/msg84008.html
> >
> > Mark suggested:
> >
> >   You may be able to simplify this further by removing the
> >   global legacy init functions fdctrl_init_sysbus() and
> >   sun4m_fdctrl_init(): from what I can see fdctrl_init_sysbus()
> >   is only used in hw/mips/jazz.c and sun4m_fdctrl_init() is only
> >   used in hw/sparc/sun4m.c so you might as well inline them or
> >   move the functions to the relevant files.
> >
> > I did it and plan to send during 6.2. Sounds simpler than module.
> > You could easily rebase your series on top (or I can include your
> > patches while sending).
>
> Feel free to include them.  But I can also rebase when your patches
> landed upstream.  Your choice ;)
>
> take care,
>   Gerd
>
>
What's the plan here, what are we trying to solve with this series
*exactly*?
If Phil sends his cleanups, do we still want/need the modularization here?

For now I'm gonna shuffle these off of my review queue and I assume I'll
see a respin/rebase from either you or phil during the 6.2 window, let me
know if this is wrong.

Thanks,
--js

[-- Attachment #2: Type: text/html, Size: 2330 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] floppy: build as modules.
  2021-08-16 21:55     ` John Snow
@ 2021-08-17  9:09       ` Philippe Mathieu-Daudé
  2021-08-17 13:19         ` John Snow
  0 siblings, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-08-17  9:09 UTC (permalink / raw)
  To: John Snow, Gerd Hoffmann
  Cc: Kevin Wolf, Eduardo Habkost, qemu-block, Michael S. Tsirkin,
	Richard Henderson, Mark Cave-Ayland, qemu-devel, Max Reitz,
	Paolo Bonzini

Hi John,

On 8/16/21 11:55 PM, John Snow wrote:
> On Thu, Aug 5, 2021 at 3:12 AM Gerd Hoffmann <kraxel@redhat.com
> <mailto:kraxel@redhat.com>> wrote:
> 
>     On Wed, Aug 04, 2021 at 05:19:02PM +0200, Philippe Mathieu-Daudé wrote:
>     > +Mark
>     >
>     > On 8/4/21 4:27 PM, Gerd Hoffmann wrote:
>     > > Some code shuffling needed beforehand due to floppy being part of
>     > > several platforms.  While being at it also make floppy optional
>     > > in pc machine type.
>     >
>     > >   floppy: move fdctrl_init_sysbus
>     > >   floppy: move sun4m_fdctrl_init
>     >
>     > https://www.mail-archive.com/qemu-block@nongnu.org/msg84008.html
>     <https://www.mail-archive.com/qemu-block@nongnu.org/msg84008.html>
>     >
>     > Mark suggested:
>     >
>     >   You may be able to simplify this further by removing the
>     >   global legacy init functions fdctrl_init_sysbus() and
>     >   sun4m_fdctrl_init(): from what I can see fdctrl_init_sysbus()
>     >   is only used in hw/mips/jazz.c and sun4m_fdctrl_init() is only
>     >   used in hw/sparc/sun4m.c so you might as well inline them or
>     >   move the functions to the relevant files.
>     >
>     > I did it and plan to send during 6.2. Sounds simpler than module.
>     > You could easily rebase your series on top (or I can include your
>     > patches while sending).
> 
>     Feel free to include them.  But I can also rebase when your patches
>     landed upstream.  Your choice ;)
> 
> What's the plan here, what are we trying to solve with this series
> *exactly*?
> If Phil sends his cleanups, do we still want/need the modularization here?

Both series are orthogonal, but if my cleanups get merged first, there
is less floppy code to modularize.

> For now I'm gonna shuffle these off of my review queue and I assume I'll
> see a respin/rebase from either you or phil during the 6.2 window, let
> me know if this is wrong.

This is OK. Probably easier for everybody if I can rebase/include Gerd's
patches along. I'm still not convinced FDC modularization is the right
way to go; but the PC machine is one of machines I know the less, and
has inherited a lot of odd things, so I need to carefully audit few more
things.

I'd rather have faithful chipsets modelled. Long term I don't think
FDC are going away from QEMU, as they are used by happy hobbyist running
old DOS programs from the 80's. But being able to build QEMU without
FDC would be nice indeed.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] floppy: build as modules.
  2021-08-17  9:09       ` Philippe Mathieu-Daudé
@ 2021-08-17 13:19         ` John Snow
  0 siblings, 0 replies; 13+ messages in thread
From: John Snow @ 2021-08-17 13:19 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Kevin Wolf, Eduardo Habkost, qemu-block, Michael S. Tsirkin,
	Mark Cave-Ayland, Richard Henderson, qemu-devel, Max Reitz,
	Gerd Hoffmann, Paolo Bonzini

[-- Attachment #1: Type: text/plain, Size: 3055 bytes --]

On Tue, Aug 17, 2021 at 5:09 AM Philippe Mathieu-Daudé <philmd@redhat.com>
wrote:

> Hi John,
>
> On 8/16/21 11:55 PM, John Snow wrote:
> > On Thu, Aug 5, 2021 at 3:12 AM Gerd Hoffmann <kraxel@redhat.com
> > <mailto:kraxel@redhat.com>> wrote:
> >
> >     On Wed, Aug 04, 2021 at 05:19:02PM +0200, Philippe Mathieu-Daudé
> wrote:
> >     > +Mark
> >     >
> >     > On 8/4/21 4:27 PM, Gerd Hoffmann wrote:
> >     > > Some code shuffling needed beforehand due to floppy being part of
> >     > > several platforms.  While being at it also make floppy optional
> >     > > in pc machine type.
> >     >
> >     > >   floppy: move fdctrl_init_sysbus
> >     > >   floppy: move sun4m_fdctrl_init
> >     >
> >     > https://www.mail-archive.com/qemu-block@nongnu.org/msg84008.html
> >     <https://www.mail-archive.com/qemu-block@nongnu.org/msg84008.html>
> >     >
> >     > Mark suggested:
> >     >
> >     >   You may be able to simplify this further by removing the
> >     >   global legacy init functions fdctrl_init_sysbus() and
> >     >   sun4m_fdctrl_init(): from what I can see fdctrl_init_sysbus()
> >     >   is only used in hw/mips/jazz.c and sun4m_fdctrl_init() is only
> >     >   used in hw/sparc/sun4m.c so you might as well inline them or
> >     >   move the functions to the relevant files.
> >     >
> >     > I did it and plan to send during 6.2. Sounds simpler than module.
> >     > You could easily rebase your series on top (or I can include your
> >     > patches while sending).
> >
> >     Feel free to include them.  But I can also rebase when your patches
> >     landed upstream.  Your choice ;)
> >
> > What's the plan here, what are we trying to solve with this series
> > *exactly*?
> > If Phil sends his cleanups, do we still want/need the modularization
> here?
>
> Both series are orthogonal, but if my cleanups get merged first, there
> is less floppy code to modularize.
>
> > For now I'm gonna shuffle these off of my review queue and I assume I'll
> > see a respin/rebase from either you or phil during the 6.2 window, let
> > me know if this is wrong.
>
> This is OK. Probably easier for everybody if I can rebase/include Gerd's
> patches along. I'm still not convinced FDC modularization is the right
> way to go; but the PC machine is one of machines I know the less, and
> has inherited a lot of odd things, so I need to carefully audit few more
> things.
>
> I'd rather have faithful chipsets modelled. Long term I don't think
> FDC are going away from QEMU, as they are used by happy hobbyist running
> old DOS programs from the 80's. But being able to build QEMU without
> FDC would be nice indeed.
>
>
OK, Understood -- And you're right, upstream the FDC needs a bit of work
and love, because they are used and important. I just ... as you can tell,
don't have much time to give them that love myself.

*cough* *cough* *nudge* *wink*

I'll be sending a patch when 6.2 opens indicating my desire to step down
from the device.

--js

[-- Attachment #2: Type: text/html, Size: 4277 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-08-17 13:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 14:27 [PATCH 0/7] floppy: build as modules Gerd Hoffmann
2021-08-04 14:27 ` [PATCH 1/7] floppy: move isa_fdc_get_drive_type to separate source file Gerd Hoffmann
2021-08-04 14:27 ` [PATCH 2/7] floppy: move isa_fdc_init_drives + fdctrl_init_drives Gerd Hoffmann
2021-08-04 14:27 ` [PATCH 3/7] floppy: move fdctrl_init_sysbus Gerd Hoffmann
2021-08-04 14:27 ` [PATCH 4/7] floppy: move sun4m_fdctrl_init Gerd Hoffmann
2021-08-04 14:27 ` [PATCH 5/7] floppy: move cmos_get_fd_drive_type Gerd Hoffmann
2021-08-04 14:27 ` [PATCH 6/7] floppy: build as modules Gerd Hoffmann
2021-08-04 14:27 ` [PATCH 7/7] pc: add floppy=OnOffAuto Gerd Hoffmann
2021-08-04 15:19 ` [PATCH 0/7] floppy: build as modules Philippe Mathieu-Daudé
2021-08-05  7:11   ` Gerd Hoffmann
2021-08-16 21:55     ` John Snow
2021-08-17  9:09       ` Philippe Mathieu-Daudé
2021-08-17 13:19         ` John Snow

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.