Skip to contentSkip to conversation

pc: Implement -no-hpet as sugar for -machine allow-hpet=no

PATCH In review Eduardo Habkost 1 participant 2 messages Oct 21, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 pc: Implement -no-hpet as sugar for -machine allow-hpet=no

Get rid of yet another global variable.

---
Changes v2 -> v3:
* Revert v2 changes (use "hpet" property), plus:
* Default to hpet=off if CONFIG_HPET=n
* Error out if creation of HPET device fails and hpet=on

Changes v1 -> v2:
* Rename property to "allow-hpet" to make its semantic clearer, as it won't make sure HPET is created if CONFIG_HPET=n
* Use qdev_new(TYPE_HPET) at pc_basic_device_init()

---
 include/hw/i386/pc.h  |  1 +
 include/hw/i386/x86.h |  3 ---
 hw/i386/pc.c          | 61 +++++++++++++++++++++++++++++--------------
 hw/i386/pc_piix.c     |  2 +-
 softmmu/vl.c          |  4 +--
 5 files changed, 46 insertions(+), 25 deletions(-)
include/hw/i386/pc.h +1 -0
index 84639d0ebc..911e460097 100644
@@ -43,6 +43,7 @@ typedef struct PCMachineState {
     bool smbus_enabled;
     bool sata_enabled;
     bool pit_enabled;
+    bool hpet_enabled;
 
     /* NUMA information: */
     uint64_t numa_nodes;
include/hw/i386/x86.h +0 -3
index d5dcf7a07f..4e66a15ff5 100644
@@ -124,7 +124,4 @@ qemu_irq x86_allocate_cpu_irq(void);
 void gsi_handler(void *opaque, int n, int level);
 void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name);
 
-/* hpet.c */
-extern int no_hpet;
-
 #endif
hw/i386/pc.c +42 -19

88 lines not on this page · raw message

hw/i386/pc_piix.c +1 -1
index 0cf22a57ad..13d1628f13 100644
@@ -216,7 +216,7 @@ static void pc_init1(MachineState *machine,
         i440fx_state = NULL;
         isa_bus = isa_bus_new(NULL, get_system_memory(), system_io,
                               &error_abort);
-        no_hpet = 1;
+        pcms->hpet_enabled = false;
     }
     isa_bus_irqs(isa_bus, x86ms->gsi);
 
softmmu/vl.c +2 -2
index cb476aa70b..c2281f45a8 100644
@@ -146,7 +146,6 @@ static Chardev **serial_hds;
 Chardev *parallel_hds[MAX_PARALLEL_PORTS];
 int win2k_install_hack = 0;
 int singlestep = 0;
-int no_hpet = 0;
 int fd_bootchk = 1;
 static int no_reboot;
 int no_shutdown = 0;
@@ -3562,7 +3561,8 @@ void qemu_init(int argc, char **argv, char **envp)
                 qemu_opts_parse_noisily(olist, "acpi=off", false);
                 break;
             case QEMU_OPTION_no_hpet:
-                no_hpet = 1;
+                olist = qemu_find_opts("machine");
+                qemu_opts_parse_noisily(olist, "hpet=off", false);
                 break;
             case QEMU_OPTION_no_reboot:
                 no_reboot = 1;
Signature · 1 line
2.28.0