All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Add a property to disable the floppy controller
@ 2015-05-14 14:41 ` Stefano Stabellini
  0 siblings, 0 replies; 6+ messages in thread
From: Stefano Stabellini @ 2015-05-14 14:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, xen-devel, mst, stefano.stabellini

Do not change default settings for any machines at the moment: this
patch does not introduce any changes in behavior unless the user asks
for no-fdc=on.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/i386/pc.c         |   27 ++++++++++++++++++++++++---
 include/hw/i386/pc.h |    2 ++
 vl.c                 |    4 ++++
 3 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index f31d55e..501609b 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1450,10 +1450,14 @@ 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);
 
-    for(i = 0; i < MAX_FD; i++) {
-        fd[i] = drive_get(IF_FLOPPY, 0, i);
+    *floppy = NULL;
+    if (!object_property_get_bool(qdev_get_machine(),
+                PC_MACHINE_NO_FDC, &error_abort)) {
+        for (i = 0; i < MAX_FD; i++) {
+            fd[i] = drive_get(IF_FLOPPY, 0, i);
+        }
+        *floppy = fdctrl_init_isa(isa_bus, fd);
     }
-    *floppy = fdctrl_init_isa(isa_bus, fd);
 }
 
 void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus)
@@ -1797,6 +1801,20 @@ static bool pc_machine_get_aligned_dimm(Object *obj, Error **errp)
     return pcms->enforce_aligned_dimm;
 }
 
+static bool pc_machine_get_no_fdc(Object *obj, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    return pcms->no_fdc;
+}
+
+static void pc_machine_set_no_fdc(Object *obj, bool value, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    pcms->no_fdc = value;
+}
+
 static void pc_machine_initfn(Object *obj)
 {
     PCMachineState *pcms = PC_MACHINE(obj);
@@ -1820,6 +1838,9 @@ static void pc_machine_initfn(Object *obj)
     object_property_add_bool(obj, PC_MACHINE_ENFORCE_ALIGNED_DIMM,
                              pc_machine_get_aligned_dimm,
                              NULL, NULL);
+    object_property_add_bool(obj, PC_MACHINE_NO_FDC,
+                             pc_machine_get_no_fdc, pc_machine_set_no_fdc,
+                             NULL);
 }
 
 static void pc_machine_class_init(ObjectClass *oc, void *data)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 69d9cf8..93b2442 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -41,6 +41,7 @@ struct PCMachineState {
     uint64_t max_ram_below_4g;
     OnOffAuto vmport;
     bool enforce_aligned_dimm;
+    bool no_fdc;
 };
 
 #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
@@ -48,6 +49,7 @@ struct PCMachineState {
 #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
 #define PC_MACHINE_VMPORT           "vmport"
 #define PC_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm"
+#define PC_MACHINE_NO_FDC "no-fdc"
 
 /**
  * PCMachineClass:
diff --git a/vl.c b/vl.c
index 91411c1..81d80ae 100644
--- a/vl.c
+++ b/vl.c
@@ -387,6 +387,10 @@ static QemuOptsList qemu_machine_opts = {
             .name = "iommu",
             .type = QEMU_OPT_BOOL,
             .help = "Set on/off to enable/disable Intel IOMMU (VT-d)",
+        },{
+            .name = PC_MACHINE_NO_FDC,
+            .type = QEMU_OPT_BOOL,
+            .help = "do not emulate a floppy controller",
         },
         { /* End of list */ }
     },
-- 
1.7.10.4

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

* [PATCH] Add a property to disable the floppy controller
@ 2015-05-14 14:41 ` Stefano Stabellini
  0 siblings, 0 replies; 6+ messages in thread
From: Stefano Stabellini @ 2015-05-14 14:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, xen-devel, mst, stefano.stabellini

Do not change default settings for any machines at the moment: this
patch does not introduce any changes in behavior unless the user asks
for no-fdc=on.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/i386/pc.c         |   27 ++++++++++++++++++++++++---
 include/hw/i386/pc.h |    2 ++
 vl.c                 |    4 ++++
 3 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index f31d55e..501609b 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1450,10 +1450,14 @@ 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);
 
-    for(i = 0; i < MAX_FD; i++) {
-        fd[i] = drive_get(IF_FLOPPY, 0, i);
+    *floppy = NULL;
+    if (!object_property_get_bool(qdev_get_machine(),
+                PC_MACHINE_NO_FDC, &error_abort)) {
+        for (i = 0; i < MAX_FD; i++) {
+            fd[i] = drive_get(IF_FLOPPY, 0, i);
+        }
+        *floppy = fdctrl_init_isa(isa_bus, fd);
     }
-    *floppy = fdctrl_init_isa(isa_bus, fd);
 }
 
 void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus)
@@ -1797,6 +1801,20 @@ static bool pc_machine_get_aligned_dimm(Object *obj, Error **errp)
     return pcms->enforce_aligned_dimm;
 }
 
+static bool pc_machine_get_no_fdc(Object *obj, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    return pcms->no_fdc;
+}
+
+static void pc_machine_set_no_fdc(Object *obj, bool value, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    pcms->no_fdc = value;
+}
+
 static void pc_machine_initfn(Object *obj)
 {
     PCMachineState *pcms = PC_MACHINE(obj);
@@ -1820,6 +1838,9 @@ static void pc_machine_initfn(Object *obj)
     object_property_add_bool(obj, PC_MACHINE_ENFORCE_ALIGNED_DIMM,
                              pc_machine_get_aligned_dimm,
                              NULL, NULL);
+    object_property_add_bool(obj, PC_MACHINE_NO_FDC,
+                             pc_machine_get_no_fdc, pc_machine_set_no_fdc,
+                             NULL);
 }
 
 static void pc_machine_class_init(ObjectClass *oc, void *data)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 69d9cf8..93b2442 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -41,6 +41,7 @@ struct PCMachineState {
     uint64_t max_ram_below_4g;
     OnOffAuto vmport;
     bool enforce_aligned_dimm;
+    bool no_fdc;
 };
 
 #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
@@ -48,6 +49,7 @@ struct PCMachineState {
 #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
 #define PC_MACHINE_VMPORT           "vmport"
 #define PC_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm"
+#define PC_MACHINE_NO_FDC "no-fdc"
 
 /**
  * PCMachineClass:
diff --git a/vl.c b/vl.c
index 91411c1..81d80ae 100644
--- a/vl.c
+++ b/vl.c
@@ -387,6 +387,10 @@ static QemuOptsList qemu_machine_opts = {
             .name = "iommu",
             .type = QEMU_OPT_BOOL,
             .help = "Set on/off to enable/disable Intel IOMMU (VT-d)",
+        },{
+            .name = PC_MACHINE_NO_FDC,
+            .type = QEMU_OPT_BOOL,
+            .help = "do not emulate a floppy controller",
         },
         { /* End of list */ }
     },
-- 
1.7.10.4

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

* Re: [Qemu-devel] [PATCH] Add a property to disable the floppy controller
  2015-05-14 14:41 ` Stefano Stabellini
@ 2015-05-14 14:45   ` Paolo Bonzini
  -1 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2015-05-14 14:45 UTC (permalink / raw)
  To: Stefano Stabellini, qemu-devel; +Cc: xen-devel, mst



On 14/05/2015 16:41, Stefano Stabellini wrote:
> Do not change default settings for any machines at the moment: this
> patch does not introduce any changes in behavior unless the user asks
> for no-fdc=on.

Can we avoid the double negative?

Paolo

> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
>  hw/i386/pc.c         |   27 ++++++++++++++++++++++++---
>  include/hw/i386/pc.h |    2 ++
>  vl.c                 |    4 ++++
>  3 files changed, 30 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index f31d55e..501609b 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1450,10 +1450,14 @@ 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);
>  
> -    for(i = 0; i < MAX_FD; i++) {
> -        fd[i] = drive_get(IF_FLOPPY, 0, i);
> +    *floppy = NULL;
> +    if (!object_property_get_bool(qdev_get_machine(),
> +                PC_MACHINE_NO_FDC, &error_abort)) {
> +        for (i = 0; i < MAX_FD; i++) {
> +            fd[i] = drive_get(IF_FLOPPY, 0, i);
> +        }
> +        *floppy = fdctrl_init_isa(isa_bus, fd);
>      }
> -    *floppy = fdctrl_init_isa(isa_bus, fd);
>  }
>  
>  void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus)
> @@ -1797,6 +1801,20 @@ static bool pc_machine_get_aligned_dimm(Object *obj, Error **errp)
>      return pcms->enforce_aligned_dimm;
>  }
>  
> +static bool pc_machine_get_no_fdc(Object *obj, Error **errp)
> +{
> +    PCMachineState *pcms = PC_MACHINE(obj);
> +
> +    return pcms->no_fdc;
> +}
> +
> +static void pc_machine_set_no_fdc(Object *obj, bool value, Error **errp)
> +{
> +    PCMachineState *pcms = PC_MACHINE(obj);
> +
> +    pcms->no_fdc = value;
> +}
> +
>  static void pc_machine_initfn(Object *obj)
>  {
>      PCMachineState *pcms = PC_MACHINE(obj);
> @@ -1820,6 +1838,9 @@ static void pc_machine_initfn(Object *obj)
>      object_property_add_bool(obj, PC_MACHINE_ENFORCE_ALIGNED_DIMM,
>                               pc_machine_get_aligned_dimm,
>                               NULL, NULL);
> +    object_property_add_bool(obj, PC_MACHINE_NO_FDC,
> +                             pc_machine_get_no_fdc, pc_machine_set_no_fdc,
> +                             NULL);
>  }
>  
>  static void pc_machine_class_init(ObjectClass *oc, void *data)
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 69d9cf8..93b2442 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -41,6 +41,7 @@ struct PCMachineState {
>      uint64_t max_ram_below_4g;
>      OnOffAuto vmport;
>      bool enforce_aligned_dimm;
> +    bool no_fdc;
>  };
>  
>  #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
> @@ -48,6 +49,7 @@ struct PCMachineState {
>  #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
>  #define PC_MACHINE_VMPORT           "vmport"
>  #define PC_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm"
> +#define PC_MACHINE_NO_FDC "no-fdc"
>  
>  /**
>   * PCMachineClass:
> diff --git a/vl.c b/vl.c
> index 91411c1..81d80ae 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -387,6 +387,10 @@ static QemuOptsList qemu_machine_opts = {
>              .name = "iommu",
>              .type = QEMU_OPT_BOOL,
>              .help = "Set on/off to enable/disable Intel IOMMU (VT-d)",
> +        },{
> +            .name = PC_MACHINE_NO_FDC,
> +            .type = QEMU_OPT_BOOL,
> +            .help = "do not emulate a floppy controller",
>          },
>          { /* End of list */ }
>      },
> 

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

* Re: [PATCH] Add a property to disable the floppy controller
@ 2015-05-14 14:45   ` Paolo Bonzini
  0 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2015-05-14 14:45 UTC (permalink / raw)
  To: Stefano Stabellini, qemu-devel; +Cc: xen-devel, mst



On 14/05/2015 16:41, Stefano Stabellini wrote:
> Do not change default settings for any machines at the moment: this
> patch does not introduce any changes in behavior unless the user asks
> for no-fdc=on.

Can we avoid the double negative?

Paolo

> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
>  hw/i386/pc.c         |   27 ++++++++++++++++++++++++---
>  include/hw/i386/pc.h |    2 ++
>  vl.c                 |    4 ++++
>  3 files changed, 30 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index f31d55e..501609b 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1450,10 +1450,14 @@ 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);
>  
> -    for(i = 0; i < MAX_FD; i++) {
> -        fd[i] = drive_get(IF_FLOPPY, 0, i);
> +    *floppy = NULL;
> +    if (!object_property_get_bool(qdev_get_machine(),
> +                PC_MACHINE_NO_FDC, &error_abort)) {
> +        for (i = 0; i < MAX_FD; i++) {
> +            fd[i] = drive_get(IF_FLOPPY, 0, i);
> +        }
> +        *floppy = fdctrl_init_isa(isa_bus, fd);
>      }
> -    *floppy = fdctrl_init_isa(isa_bus, fd);
>  }
>  
>  void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus)
> @@ -1797,6 +1801,20 @@ static bool pc_machine_get_aligned_dimm(Object *obj, Error **errp)
>      return pcms->enforce_aligned_dimm;
>  }
>  
> +static bool pc_machine_get_no_fdc(Object *obj, Error **errp)
> +{
> +    PCMachineState *pcms = PC_MACHINE(obj);
> +
> +    return pcms->no_fdc;
> +}
> +
> +static void pc_machine_set_no_fdc(Object *obj, bool value, Error **errp)
> +{
> +    PCMachineState *pcms = PC_MACHINE(obj);
> +
> +    pcms->no_fdc = value;
> +}
> +
>  static void pc_machine_initfn(Object *obj)
>  {
>      PCMachineState *pcms = PC_MACHINE(obj);
> @@ -1820,6 +1838,9 @@ static void pc_machine_initfn(Object *obj)
>      object_property_add_bool(obj, PC_MACHINE_ENFORCE_ALIGNED_DIMM,
>                               pc_machine_get_aligned_dimm,
>                               NULL, NULL);
> +    object_property_add_bool(obj, PC_MACHINE_NO_FDC,
> +                             pc_machine_get_no_fdc, pc_machine_set_no_fdc,
> +                             NULL);
>  }
>  
>  static void pc_machine_class_init(ObjectClass *oc, void *data)
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 69d9cf8..93b2442 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -41,6 +41,7 @@ struct PCMachineState {
>      uint64_t max_ram_below_4g;
>      OnOffAuto vmport;
>      bool enforce_aligned_dimm;
> +    bool no_fdc;
>  };
>  
>  #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
> @@ -48,6 +49,7 @@ struct PCMachineState {
>  #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
>  #define PC_MACHINE_VMPORT           "vmport"
>  #define PC_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm"
> +#define PC_MACHINE_NO_FDC "no-fdc"
>  
>  /**
>   * PCMachineClass:
> diff --git a/vl.c b/vl.c
> index 91411c1..81d80ae 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -387,6 +387,10 @@ static QemuOptsList qemu_machine_opts = {
>              .name = "iommu",
>              .type = QEMU_OPT_BOOL,
>              .help = "Set on/off to enable/disable Intel IOMMU (VT-d)",
> +        },{
> +            .name = PC_MACHINE_NO_FDC,
> +            .type = QEMU_OPT_BOOL,
> +            .help = "do not emulate a floppy controller",
>          },
>          { /* End of list */ }
>      },
> 

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

* Re: [Qemu-devel] [PATCH] Add a property to disable the floppy controller
  2015-05-14 14:41 ` Stefano Stabellini
@ 2015-05-14 15:18   ` Marcel Apfelbaum
  -1 siblings, 0 replies; 6+ messages in thread
From: Marcel Apfelbaum @ 2015-05-14 15:18 UTC (permalink / raw)
  To: Stefano Stabellini, qemu-devel; +Cc: pbonzini, xen-devel, mst

On 05/14/2015 05:41 PM, Stefano Stabellini wrote:
> Do not change default settings for any machines at the moment: this
> patch does not introduce any changes in behavior unless the user asks
> for no-fdc=on.
Hi,

Agreeing with Paolo on this, maybe we can have an 'fdc' property (enabled by default)
and set fdc=off when we don't want it?

>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
>   hw/i386/pc.c         |   27 ++++++++++++++++++++++++---
>   include/hw/i386/pc.h |    2 ++
>   vl.c                 |    4 ++++
>   3 files changed, 30 insertions(+), 3 deletions(-)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index f31d55e..501609b 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1450,10 +1450,14 @@ 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);
>
> -    for(i = 0; i < MAX_FD; i++) {
> -        fd[i] = drive_get(IF_FLOPPY, 0, i);
> +    *floppy = NULL;
> +    if (!object_property_get_bool(qdev_get_machine(),
> +                PC_MACHINE_NO_FDC, &error_abort)) {
> +        for (i = 0; i < MAX_FD; i++) {
> +            fd[i] = drive_get(IF_FLOPPY, 0, i);
> +        }
> +        *floppy = fdctrl_init_isa(isa_bus, fd);
>       }
> -    *floppy = fdctrl_init_isa(isa_bus, fd);
>   }
>
>   void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus)
> @@ -1797,6 +1801,20 @@ static bool pc_machine_get_aligned_dimm(Object *obj, Error **errp)
>       return pcms->enforce_aligned_dimm;
>   }
>
> +static bool pc_machine_get_no_fdc(Object *obj, Error **errp)
> +{
> +    PCMachineState *pcms = PC_MACHINE(obj);
> +
> +    return pcms->no_fdc;
> +}
> +
> +static void pc_machine_set_no_fdc(Object *obj, bool value, Error **errp)
> +{
> +    PCMachineState *pcms = PC_MACHINE(obj);
> +
> +    pcms->no_fdc = value;
> +}
> +
>   static void pc_machine_initfn(Object *obj)
>   {
>       PCMachineState *pcms = PC_MACHINE(obj);
> @@ -1820,6 +1838,9 @@ static void pc_machine_initfn(Object *obj)
>       object_property_add_bool(obj, PC_MACHINE_ENFORCE_ALIGNED_DIMM,
>                                pc_machine_get_aligned_dimm,
>                                NULL, NULL);
> +    object_property_add_bool(obj, PC_MACHINE_NO_FDC,
> +                             pc_machine_get_no_fdc, pc_machine_set_no_fdc,
> +                             NULL);
>   }
>
>   static void pc_machine_class_init(ObjectClass *oc, void *data)
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 69d9cf8..93b2442 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -41,6 +41,7 @@ struct PCMachineState {
>       uint64_t max_ram_below_4g;
>       OnOffAuto vmport;
>       bool enforce_aligned_dimm;
> +    bool no_fdc;
>   };
>
>   #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
> @@ -48,6 +49,7 @@ struct PCMachineState {
>   #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
>   #define PC_MACHINE_VMPORT           "vmport"
>   #define PC_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm"
> +#define PC_MACHINE_NO_FDC "no-fdc"
>
>   /**
>    * PCMachineClass:
> diff --git a/vl.c b/vl.c
> index 91411c1..81d80ae 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -387,6 +387,10 @@ static QemuOptsList qemu_machine_opts = {
>               .name = "iommu",
>               .type = QEMU_OPT_BOOL,
>               .help = "Set on/off to enable/disable Intel IOMMU (VT-d)",
> +        },{
> +            .name = PC_MACHINE_NO_FDC,
> +            .type = QEMU_OPT_BOOL,
> +            .help = "do not emulate a floppy controller",
The machine properties are "dynamic" now, this list
should be empty, including the "iommu" above. Am I missing something ?

By the way, there is a problem with this, we have to add the
new properties to util/qemu-config.c.

Thanks,
Marcel

>           },
>           { /* End of list */ }
>       },
>

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

* Re: [PATCH] Add a property to disable the floppy controller
@ 2015-05-14 15:18   ` Marcel Apfelbaum
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Apfelbaum @ 2015-05-14 15:18 UTC (permalink / raw)
  To: Stefano Stabellini, qemu-devel; +Cc: pbonzini, xen-devel, mst

On 05/14/2015 05:41 PM, Stefano Stabellini wrote:
> Do not change default settings for any machines at the moment: this
> patch does not introduce any changes in behavior unless the user asks
> for no-fdc=on.
Hi,

Agreeing with Paolo on this, maybe we can have an 'fdc' property (enabled by default)
and set fdc=off when we don't want it?

>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
>   hw/i386/pc.c         |   27 ++++++++++++++++++++++++---
>   include/hw/i386/pc.h |    2 ++
>   vl.c                 |    4 ++++
>   3 files changed, 30 insertions(+), 3 deletions(-)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index f31d55e..501609b 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1450,10 +1450,14 @@ 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);
>
> -    for(i = 0; i < MAX_FD; i++) {
> -        fd[i] = drive_get(IF_FLOPPY, 0, i);
> +    *floppy = NULL;
> +    if (!object_property_get_bool(qdev_get_machine(),
> +                PC_MACHINE_NO_FDC, &error_abort)) {
> +        for (i = 0; i < MAX_FD; i++) {
> +            fd[i] = drive_get(IF_FLOPPY, 0, i);
> +        }
> +        *floppy = fdctrl_init_isa(isa_bus, fd);
>       }
> -    *floppy = fdctrl_init_isa(isa_bus, fd);
>   }
>
>   void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus)
> @@ -1797,6 +1801,20 @@ static bool pc_machine_get_aligned_dimm(Object *obj, Error **errp)
>       return pcms->enforce_aligned_dimm;
>   }
>
> +static bool pc_machine_get_no_fdc(Object *obj, Error **errp)
> +{
> +    PCMachineState *pcms = PC_MACHINE(obj);
> +
> +    return pcms->no_fdc;
> +}
> +
> +static void pc_machine_set_no_fdc(Object *obj, bool value, Error **errp)
> +{
> +    PCMachineState *pcms = PC_MACHINE(obj);
> +
> +    pcms->no_fdc = value;
> +}
> +
>   static void pc_machine_initfn(Object *obj)
>   {
>       PCMachineState *pcms = PC_MACHINE(obj);
> @@ -1820,6 +1838,9 @@ static void pc_machine_initfn(Object *obj)
>       object_property_add_bool(obj, PC_MACHINE_ENFORCE_ALIGNED_DIMM,
>                                pc_machine_get_aligned_dimm,
>                                NULL, NULL);
> +    object_property_add_bool(obj, PC_MACHINE_NO_FDC,
> +                             pc_machine_get_no_fdc, pc_machine_set_no_fdc,
> +                             NULL);
>   }
>
>   static void pc_machine_class_init(ObjectClass *oc, void *data)
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 69d9cf8..93b2442 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -41,6 +41,7 @@ struct PCMachineState {
>       uint64_t max_ram_below_4g;
>       OnOffAuto vmport;
>       bool enforce_aligned_dimm;
> +    bool no_fdc;
>   };
>
>   #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
> @@ -48,6 +49,7 @@ struct PCMachineState {
>   #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
>   #define PC_MACHINE_VMPORT           "vmport"
>   #define PC_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm"
> +#define PC_MACHINE_NO_FDC "no-fdc"
>
>   /**
>    * PCMachineClass:
> diff --git a/vl.c b/vl.c
> index 91411c1..81d80ae 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -387,6 +387,10 @@ static QemuOptsList qemu_machine_opts = {
>               .name = "iommu",
>               .type = QEMU_OPT_BOOL,
>               .help = "Set on/off to enable/disable Intel IOMMU (VT-d)",
> +        },{
> +            .name = PC_MACHINE_NO_FDC,
> +            .type = QEMU_OPT_BOOL,
> +            .help = "do not emulate a floppy controller",
The machine properties are "dynamic" now, this list
should be empty, including the "iommu" above. Am I missing something ?

By the way, there is a problem with this, we have to add the
new properties to util/qemu-config.c.

Thanks,
Marcel

>           },
>           { /* End of list */ }
>       },
>

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

end of thread, other threads:[~2015-05-14 15:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-14 14:41 [Qemu-devel] [PATCH] Add a property to disable the floppy controller Stefano Stabellini
2015-05-14 14:41 ` Stefano Stabellini
2015-05-14 14:45 ` [Qemu-devel] " Paolo Bonzini
2015-05-14 14:45   ` Paolo Bonzini
2015-05-14 15:18 ` [Qemu-devel] " Marcel Apfelbaum
2015-05-14 15:18   ` Marcel Apfelbaum

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.