Check if GlobalProperty exists before registering
Quoted 21 lines · Crístian Viana
If a GlobalProperty has already been registered, it won't have its value overwritten.
Signed-off-by Crístian Viana <[email protected]>---
Changes since v4:
- Only register a GlobalProperty if it hasn't already been registered. That avoids the property values to be overwritten (fix previous known bug).hw/qdev-properties.c | 8 ++++++++ 1 file changed, 8 insertions(+)hw/qdev-properties.c +0
-0@@ -1105,6 +1105,14 @@ static QTAILQ_HEAD(, GlobalProperty) global_props = QTAILQ_HEAD_INITIALIZER(globstatic void qdev_prop_register_global (GlobalProperty *prop) {
hw/qdev-properties.c static QTAILQ_HEAD(, GlobalProperty) global_props = QTAILQ_HEAD_INITIALIZER(glob · line 1117
Quoted 10 lines
hw/qdev-properties.c +8
-0+GlobalProperty *p; + + QTAILQ_FOREACH(p, &global_props, next) { +if (strcmp (prop->driver, p->driver) ==0 ) { +return ; + } + } +QTAILQ_INSERT_TAIL (&global_props, prop, next); }
This is relying on a very subtle characteristic: that -global properties are registered before machine options. We probably need to be more explicit about who we want to win. In the very least, you should add a comment here that says this check is specifically to allow -global to "win" over machine options.
Regards,
Anthony Liguori
Quoted 3 lines
Signature · 2 lines
-- 1.7.9.5
Anthony Liguori
Reviewed-byRe: [Qemu-devel] [PATCH v5 2/3] Force driftfix=none on previous machines
In reply to a message not in the archiveQuoted 5 lines · Crístian Viana
The current value for the -rtc driftfix option is 'none'. This patch makes sure that the old machines configuration will work the same way even after that option changes its default value.
Signed-off-by Crístian Viana <[email protected]>
Regards,
Anthony Liguori
Quoted 21 lines
--- hw/pc_piix.c | 4 ++++ 1 file changed, 4 insertions(+)hw/pc_piix.c +4
-0@@ -379,6 +379,10 @@ static QEMUMachine pc_machine_v1_1 = { .driver = TYPE_USB_DEVICE,\ .property = "full-path",\ .value = "no",\ + },{\ + .driver = "mc146818rtc",\ + .property = "lost_tick_policy",\ + .value = "discard",\ }static QEMUMachine pc_machine_v1_0 = {Signature · 1 line
1.7.9.5
Anthony Liguori
Reviewed-byRe: [Qemu-devel] [PATCH v5 3/3] Change driftfix default value to slew
In reply to a message not in the archiveQuoted 5 lines · Crístian Viana
Windows 2008+ is very sensitive to missed ticks. The RTC is used by default as the time source. If driftfix is not enabled, Windows is prone to blue screening.
Signed-off-by Crístian Viana <[email protected]>
Regards,
Anthony Liguori
Quoted 42 lines
--- hw/mc146818rtc.c | 2 +- vl.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-)hw/mc146818rtc.c +1
-1@@ -686,7 +686,7 @@ ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)static Property mc146818rtc_properties[] = {DEFINE_PROP_INT32 ("base_year" , RTCState, base_year,1980 ),DEFINE_PROP_LOSTTICKPOLICY ("lost_tick_policy" , RTCState, - lost_tick_policy,LOST_TICK_DISCARD ), + lost_tick_policy,LOST_TICK_SLEW ),DEFINE_PROP_END_OF_LIST (), };vl.c +10
-1@@ -559,7 +559,16 @@ static void configure_rtc(QemuOpts *opts)qdev_prop_register_global_list (slew_lost_ticks); }else if (!strcmp (value,"none" )) { -/* discard is default */ +static GlobalProperty discard_lost_ticks[] = { + { + .driver ="mc146818rtc" , + .property ="lost_tick_policy" , + .value ="discard" , + }, + {/* end of list */ } + }; + +qdev_prop_register_global_list (discard_lost_ticks); }else {fprintf (stderr,"qemu: invalid option value '%s'\n" , value);exit (1 );Signature · 1 line
1.7.9.5