Skip to contentSkip to conversation

hw/core/null-machine: Do not initialize unused chardev backends

PATCH Applied Philippe Mathieu-Daudé 5 participants 6 messages Jun 24, 2020 – Jul 7, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/core/null-machine: Do not initialize unused chardev backends

The MachineClass uses an inverted logic (inherited from the PC machines [*]) to create the chardev backends for the default devices (see commits 998bbd74b9d..aa40fc9c964 and ac33f8fad14).

As the none-machine doesn't have any hardware device, it is pointless to initialize chardev backends. Fix by setting the 'no_defaults' bits in its MachineClass.

---
 hw/core/null-machine.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/core/null-machine.c +5 -0
index cb47d9d4f8..7e693523d7 100644
@@ -50,6 +50,11 @@ static void machine_none_machine_init(MachineClass *mc)
     mc->max_cpus = 1;
     mc->default_ram_size = 0;
     mc->default_ram_id = "ram";
+    mc->no_serial = 1;
+    mc->no_parallel = 1;
+    mc->no_floppy = 1;
+    mc->no_cdrom = 1;
+    mc->no_sdcard = 1;
 }
 
 DEFINE_MACHINE("none", machine_none_machine_init)
Signature · 1 line
2.21.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines · Philippe Mathieu-Daudé

The MachineClass uses an inverted logic (inherited from the PC machines [*]) to create the chardev backends for the default devices (see commits 998bbd74b9d..aa40fc9c964 and ac33f8fad14).

As the none-machine doesn't have any hardware device, it is pointless to initialize chardev backends. Fix by setting the 'no_defaults' bits in its MachineClass.

---
  hw/core/null-machine.c | 5 +++++
  1 file changed, 5 insertions(+)
hw/core/null-machine.c +0 -0
index cb47d9d4f8..7e693523d7 100644
@@ -50,6 +50,11 @@ static void machine_none_machine_init(MachineClass *mc)
      mc->max_cpus = 1;

hw/core/null-machine.c static void machine_none_machine_init(MachineClass *mc) · line 60

Quoted 10 lines
hw/core/null-machine.c +5 -0
      mc->default_ram_size = 0;
      mc->default_ram_id = "ram";
+    mc->no_serial = 1;
+    mc->no_parallel = 1;
+    mc->no_floppy = 1;
+    mc->no_cdrom = 1;
+    mc->no_sdcard = 1;
  }
 
  DEFINE_MACHINE("none", machine_none_machine_init)
#2 lore raw

Le 24/06/2020 à 13:01, Thomas Huth a écrit :

Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 25 lines

The MachineClass uses an inverted logic (inherited from the PC machines [*]) to create the chardev backends for the default devices (see commits 998bbd74b9d..aa40fc9c964 and ac33f8fad14).

As the none-machine doesn't have any hardware device, it is pointless to initialize chardev backends. Fix by setting the 'no_defaults' bits in its MachineClass.

---
  hw/core/null-machine.c | 5 +++++

  1 file changed, 5 insertions(+)
hw/core/null-machine.c +2 -0
index cb47d9d4f8..7e693523d7 100644
@@ -50,6 +50,11 @@ static void machine_none_machine_init(MachineClass
 *mc)
       mc->max_cpus = 1;
       mc->default_ram_size = 0;
       mc->default_ram_id = "ram";
+    mc->no_serial = 1;
+    mc->no_parallel = 1;
Quoted 10 lines

hw/core/null-machine.c static void machine_none_machine_init(MachineClass *mc) · line 60

Quoted 6 lines
hw/core/null-machine.c +3 -0
+    mc->no_floppy = 1;
+    mc->no_cdrom = 1;
+    mc->no_sdcard = 1;
   }
     DEFINE_MACHINE("none", machine_none_machine_init)

Applied to my trivial-patches-for-5.1 branch.

Thanks,
Laurent

#3 lore raw

Le 06/07/2020 à 18:24, Laurent Vivier a écrit :

Quoted 38 lines

Le 24/06/2020 à 13:01, Thomas Huth a écrit :

Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 25 lines

The MachineClass uses an inverted logic (inherited from the PC machines [*]) to create the chardev backends for the default devices (see commits 998bbd74b9d..aa40fc9c964 and ac33f8fad14).

As the none-machine doesn't have any hardware device, it is pointless to initialize chardev backends. Fix by setting the 'no_defaults' bits in its MachineClass.

---
  hw/core/null-machine.c | 5 +++++

  1 file changed, 5 insertions(+)
hw/core/null-machine.c +2 -0
index cb47d9d4f8..7e693523d7 100644
@@ -50,6 +50,11 @@ static void machine_none_machine_init(MachineClass
 *mc)
       mc->max_cpus = 1;
       mc->default_ram_size = 0;
       mc->default_ram_id = "ram";
+    mc->no_serial = 1;
+    mc->no_parallel = 1;
Quoted 10 lines

hw/core/null-machine.c static void machine_none_machine_init(MachineClass *mc) · line 60

Quoted 6 lines
hw/core/null-machine.c +3 -0
+    mc->no_floppy = 1;
+    mc->no_cdrom = 1;
+    mc->no_sdcard = 1;
   }
     DEFINE_MACHINE("none", machine_none_machine_init)
Quoted 1 line

Applied to my trivial-patches-for-5.1 branch.

Removed as it is in Paolo's PR.

Thanks,
Laurent

Reviewed-by on v1 1/1
#4 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 8 lines · Philippe Mathieu-Daudé

The MachineClass uses an inverted logic (inherited from the PC machines [*]) to create the chardev backends for the default devices (see commits 998bbd74b9d..aa40fc9c964 and ac33f8fad14).

As the none-machine doesn't have any hardware device, it is pointless to initialize chardev backends. Fix by setting the 'no_defaults' bits in its MachineClass.

Quoted 5 lines
---
 hw/core/null-machine.c | 5 +++++
 1 file changed, 5 insertions(+)

r~

#5 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 21 lines · Philippe Mathieu-Daudé

The MachineClass uses an inverted logic (inherited from the PC machines [*]) to create the chardev backends for the default devices (see commits 998bbd74b9d..aa40fc9c964 and ac33f8fad14).

As the none-machine doesn't have any hardware device, it is pointless to initialize chardev backends. Fix by setting the 'no_defaults' bits in its MachineClass.

---
 hw/core/null-machine.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/core/null-machine.c +0 -0
index cb47d9d4f8..7e693523d7 100644
@@ -50,6 +50,11 @@ static void machine_none_machine_init(MachineClass *mc)
     mc->max_cpus = 1;

hw/core/null-machine.c static void machine_none_machine_init(MachineClass *mc) · line 60

Quoted 10 lines
hw/core/null-machine.c +5 -0
     mc->default_ram_size = 0;
     mc->default_ram_id = "ram";
+    mc->no_serial = 1;
+    mc->no_parallel = 1;
+    mc->no_floppy = 1;
+    mc->no_cdrom = 1;
+    mc->no_sdcard = 1;
 }
 
 DEFINE_MACHINE("none", machine_none_machine_init)

Queued, thanks.

Paolo