[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/22] rtc: update rtc_cmos on CPU hot-plug
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH 10/22] rtc: update rtc_cmos on CPU hot-plug |
Date: |
Fri, 5 Apr 2013 16:37:02 +0200 |
... so that on reboot BIOS could read current available CPU count
Signed-off-by: Igor Mammedov <address@hidden>
v2:
* s/qemu_register_cpu_add_notifier()/qemu_register_cpu_added_notifier()/
---
hw/mc146818rtc.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index a2119ad..c3a6a2d 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -82,6 +82,7 @@ typedef struct RTCState {
Notifier clock_reset_notifier;
LostTickPolicy lost_tick_policy;
Notifier suspend_notifier;
+ Notifier cpu_added_notifier;
} RTCState;
static void rtc_set_time(RTCState *s);
@@ -759,6 +760,14 @@ static void rtc_notify_suspend(Notifier *notifier, void
*data)
rtc_set_memory(&s->dev, 0xF, 0xFE);
}
+static void rtc_notify_cpu_added(Notifier *notifier, void *data)
+{
+ RTCState *s = container_of(notifier, RTCState, cpu_added_notifier);
+
+ /* increment the number of CPUs */
+ s->cmos_data[0x5f] += 1;
+}
+
static void rtc_reset(void *opaque)
{
RTCState *s = opaque;
@@ -852,6 +861,9 @@ static int rtc_initfn(ISADevice *dev)
s->suspend_notifier.notify = rtc_notify_suspend;
qemu_register_suspend_notifier(&s->suspend_notifier);
+ s->cpu_added_notifier.notify = rtc_notify_cpu_added;
+ qemu_register_cpu_added_notifier(&s->cpu_added_notifier);
+
memory_region_init_io(&s->io, &cmos_ops, s, "rtc", 2);
isa_register_ioport(dev, &s->io, base);
--
1.8.1.4
- Re: [Qemu-devel] [PATCH 08/22] target-i386: ioapic: replace FROM_SYSBUS() with QOM type cast, (continued)
- [Qemu-devel] [PATCH 06/22] cpu: introduce CPUClass.resume() method, Igor Mammedov, 2013/04/05
- [Qemu-devel] [PATCH 13/22] acpi_piix4: add infrastructure to send CPU hot-plug GPE to guest, Igor Mammedov, 2013/04/05
- [Qemu-devel] [PATCH 10/22] rtc: update rtc_cmos on CPU hot-plug,
Igor Mammedov <=
- [Qemu-devel] [PATCH 11/22] cpu: introduce get_firmware_id() method and override it for target-i386, Igor Mammedov, 2013/04/05
- [Qemu-devel] [PATCH 17/22] target-i386: replace MSI_SPACE_SIZE with APIC_SPACE_SIZE, Igor Mammedov, 2013/04/05
- [Qemu-devel] [PATCH 16/22] target-i386: cpu: attach ICC bus to CPU on its creation, Igor Mammedov, 2013/04/05
- [Qemu-devel] [PATCH 18/22] target-i386: move APIC to ICC bus, Igor Mammedov, 2013/04/05