From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45011) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDp13-00029I-Fe for qemu-devel@nongnu.org; Fri, 17 Jun 2016 04:20:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDp12-0007DA-Gc for qemu-devel@nongnu.org; Fri, 17 Jun 2016 04:20:37 -0400 Received: from mga02.intel.com ([134.134.136.20]:55279) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDp12-0007Ag-9y for qemu-devel@nongnu.org; Fri, 17 Jun 2016 04:20:36 -0400 From: Chao Peng Date: Fri, 17 Jun 2016 04:14:15 -0400 Message-Id: <1466151257-96318-8-git-send-email-chao.p.peng@linux.intel.com> In-Reply-To: <1466151257-96318-1-git-send-email-chao.p.peng@linux.intel.com> References: <1466151257-96318-1-git-send-email-chao.p.peng@linux.intel.com> Subject: [Qemu-devel] [RFC 7/9] pc: skip setting CMOS data when RTC device is unavailable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , gor Mammedov , Xiao Guangrong , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Haozhong Zhang ... to make sure hotplug for new platform that without RTC support can still work. Signed-off-by: Chao Peng --- hw/i386/pc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 7198ed5..46ca0e3 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1695,8 +1695,10 @@ static void pc_cpu_plug(HotplugHandler *hotplug_dev, goto out; } - /* increment the number of CPUs */ - rtc_set_memory(pcms->rtc, 0x5f, rtc_get_memory(pcms->rtc, 0x5f) + 1); + if (pcms->rtc) { + /* increment the number of CPUs */ + rtc_set_memory(pcms->rtc, 0x5f, rtc_get_memory(pcms->rtc, 0x5f) + 1); + } apic_id.arch_id = cc->get_arch_id(CPU(dev)); found_cpu = bsearch(&apic_id, pcms->possible_cpus->cpus, -- 1.8.3.1