From patchwork Fri Sep 12 08:57:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gu Zheng X-Patchwork-Id: 388524 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C68BB140088 for ; Fri, 12 Sep 2014 19:19:45 +1000 (EST) Received: from localhost ([::1]:43591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSN15-0002cg-Le for incoming@patchwork.ozlabs.org; Fri, 12 Sep 2014 05:19:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSN0g-0001zs-Lf for qemu-devel@nongnu.org; Fri, 12 Sep 2014 05:19:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XSN0a-0005fE-TL for qemu-devel@nongnu.org; Fri, 12 Sep 2014 05:19:18 -0400 Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:35377) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSN0a-0005f5-Dt for qemu-devel@nongnu.org; Fri, 12 Sep 2014 05:19:12 -0400 Received: from kw-mxoi2.gw.nic.fujitsu.com (unknown [10.0.237.143]) by fgwmail6.fujitsu.co.jp (Postfix) with ESMTP id BB06F3EE0C7 for ; Fri, 12 Sep 2014 18:19:11 +0900 (JST) Received: from s2.gw.fujitsu.co.jp (s2.gw.fujitsu.co.jp [10.0.50.92]) by kw-mxoi2.gw.nic.fujitsu.com (Postfix) with ESMTP id D5C47AC0204 for ; Fri, 12 Sep 2014 18:19:10 +0900 (JST) Received: from s00.gw.fujitsu.co.jp (s00.gw.nic.fujitsu.com [133.161.11.15]) by s2.gw.fujitsu.co.jp (Postfix) with ESMTP id 6BAF51DB803C for ; Fri, 12 Sep 2014 18:19:10 +0900 (JST) Received: from s00.gw.fujitsu.co.jp (kw-mxio2.gw.nic.fujitsu.com [10.0.237.142]) by s00.gw.fujitsu.co.jp (Postfix) with ESMTP id 4884C4E31B; Fri, 12 Sep 2014 18:19:10 +0900 (JST) Received: from guz (unknown [10.167.226.100]) by s00.gw.fujitsu.co.jp (Postfix) with ESMTP id 1ACB88A002; Fri, 12 Sep 2014 18:19:10 +0900 (JST) Received: (from root@localhost) by guz (8.14.5/8.14.5/Submit) id s8C93XVr026359; Fri, 12 Sep 2014 17:03:33 +0800 From: Gu Zheng To: qemu-devel@nongnu.org Date: Fri, 12 Sep 2014 16:57:23 +0800 Message-Id: <1410512245-26141-6-git-send-email-guz.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1410512245-26141-1-git-send-email-guz.fnst@cn.fujitsu.com> References: <1410512245-26141-1-git-send-email-guz.fnst@cn.fujitsu.com> X-TM-AS-MML: disable X-TMASE-MatchedRID: SMp3wDMtamuKDa5m+5vWeEhEDfw/93BukKAa/khZ3iR11AHcrjhqEDBX Xb/qS263P5vI5ECwbmy+daZEFcM/u5Coy9iDotiwtYhj2cmvF4Zo3Yq5PCwLAkENV4Lwnu7BqjK 1cw/inhPxdxibPyoMwCpJxlCwtEWkt/K29VNwEQWJQ9k+Ypk5CfCrUlDnEXiSR2YNIFh+clHy9g ByORG5bwzue8drWRrunT0OWA7mPaeGeTbGWdRz1sqXjImgj58b1V5MFtNfsOibKItl61J/yZ+in TK0bC9eKrauXd3MZDV4aBaaKovc76BgW3HFaZyev7EqYbqVetwOVytetZfYkC12HCsm/KSM X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 192.51.44.36 Cc: tangchen@cn.fujitsu.com, Gu Zheng , isimatu.yasuaki@jp.fujitsu.com, chen.fan.fnst@cn.fujitsu.com, imammedo@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH V2 5/7] pc: Update rtc_cmos in pc_cpu_plug X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Update rtc_cmos in pc_cpu_plug directly instead of the notifier, with this change, there will no user of CPU hot-plug notifier any more, so remove it. Signed-off-by: Gu Zheng --- hw/i386/pc.c | 25 ++++++------------------- include/sysemu/sysemu.h | 3 --- qom/cpu.c | 10 ---------- 3 files changed, 6 insertions(+), 32 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 28fc66b..337d662 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -353,20 +353,7 @@ static void pc_cmos_init_late(void *opaque) qemu_unregister_reset(pc_cmos_init_late, opaque); } -typedef struct RTCCPUHotplugArg { - Notifier cpu_added_notifier; - ISADevice *rtc_state; -} RTCCPUHotplugArg; - -static void rtc_notify_cpu_added(Notifier *notifier, void *data) -{ - RTCCPUHotplugArg *arg = container_of(notifier, RTCCPUHotplugArg, - cpu_added_notifier); - ISADevice *s = arg->rtc_state; - - /* increment the number of CPUs */ - rtc_set_memory(s, 0x5f, rtc_get_memory(s, 0x5f) + 1); -} +static ISADevice *rtc_state; void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, const char *boot_device, @@ -376,7 +363,6 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, int val, nb, i; FDriveType fd_type[2] = { FDRIVE_DRV_NONE, FDRIVE_DRV_NONE }; static pc_cmos_init_late_arg arg; - static RTCCPUHotplugArg cpu_hotplug_cb; /* various important CMOS locations needed by PC/Bochs bios */ @@ -415,10 +401,8 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, /* set the number of CPU */ rtc_set_memory(s, 0x5f, smp_cpus - 1); - /* init CPU hotplug notifier */ - cpu_hotplug_cb.rtc_state = s; - cpu_hotplug_cb.cpu_added_notifier.notify = rtc_notify_cpu_added; - qemu_register_cpu_added_notifier(&cpu_hotplug_cb.cpu_added_notifier); + + rtc_state = s; if (set_boot_dev(s, boot_device)) { exit(1); @@ -1629,6 +1613,9 @@ static void pc_cpu_plug(HotplugHandler *hotplug_dev, hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); hhc->plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err); + + /* increment the number of CPUs */ + rtc_set_memory(rtc_state, 0x5f, rtc_get_memory(rtc_state, 0x5f) + 1); out: error_propagate(errp, local_err); } diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index d8539fd..acfe494 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -183,9 +183,6 @@ void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict); /* generic hotplug */ void drive_hot_add(Monitor *mon, const QDict *qdict); -/* CPU hotplug */ -void qemu_register_cpu_added_notifier(Notifier *notifier); - /* pcie aer error injection */ void pcie_aer_inject_error_print(Monitor *mon, const QObject *data); int do_pcie_aer_inject_error(Monitor *mon, diff --git a/qom/cpu.c b/qom/cpu.c index b32dd0a..19c5de5 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -107,15 +107,6 @@ static void cpu_common_get_memory_mapping(CPUState *cpu, error_setg(errp, "Obtaining memory mappings is unsupported on this CPU."); } -/* CPU hot-plug notifiers */ -static NotifierList cpu_added_notifiers = - NOTIFIER_LIST_INITIALIZER(cpu_add_notifiers); - -void qemu_register_cpu_added_notifier(Notifier *notifier) -{ - notifier_list_add(&cpu_added_notifiers, notifier); -} - void cpu_reset_interrupt(CPUState *cpu, int mask) { cpu->interrupt_request &= ~mask; @@ -303,7 +294,6 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp) if (dev->hotplugged) { cpu_synchronize_post_init(cpu); - notifier_list_notify(&cpu_added_notifiers, dev); cpu_resume(cpu); } }