From patchwork Wed May 10 08:32:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 9719455 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8EA4060236 for ; Wed, 10 May 2017 08:34:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8304B284E4 for ; Wed, 10 May 2017 08:34:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7782728557; Wed, 10 May 2017 08:34:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0A069284E4 for ; Wed, 10 May 2017 08:34:52 +0000 (UTC) Received: from localhost ([::1]:41105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8N59-0000mn-9o for patchwork-qemu-devel@patchwork.kernel.org; Wed, 10 May 2017 04:34:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8N3r-0000j2-Dh for qemu-devel@nongnu.org; Wed, 10 May 2017 04:33:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8N3q-0003mD-H9 for qemu-devel@nongnu.org; Wed, 10 May 2017 04:33:31 -0400 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:33919) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d8N3q-0003lg-By for qemu-devel@nongnu.org; Wed, 10 May 2017 04:33:30 -0400 Received: by mail-pf0-x242.google.com with SMTP id w69so3029142pfk.1 for ; Wed, 10 May 2017 01:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=T6yko11oOkLhZNe8GsLr5Nexlt9wJmtNAhnlFH9KyQM=; b=Bgwq6sSglRhByeAVI2KlEc0/eo82hz/++kuygysnGF20bebHtiMOg0REQzKVgU3k1U A6Gr75HOrcnMsddxWDANH14cGF4lXKDAv1gCpoDlibiZggDhjG099wEaCAMabg/KChKo vUYoICispVksOknYlvxHFLBGr4tv8JVkUDf1Q9efpXWDEtyxcKf4eJjtNR7xZtvzGtxQ yHYqlU4ZDAeH4OvQJa3iiINnaxkjNm2jK+VOTbAT0eDx3XeAD0DCEUQVXXUQVmgoeqyO nvtqFvC4t228nxkhw2CRz/cBypbY0RUzOJFWKtexdSeUJB+KpEUhYmsN2VRWjDNSSEyl zkYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=T6yko11oOkLhZNe8GsLr5Nexlt9wJmtNAhnlFH9KyQM=; b=Hn5I/8hrSgVx7t/Xz6aufnFc3HQy0oc7Z2rJ2FODMBIQ4YmGJQK+fdU6JoTG1KhpYS 6knbzqBpn+GjrFT3418GyVbf7Ouhi9hB4Qhx1d6ejjOjY7V0+hiRQ40bJzapRC9ZaQHy jEjTZBo4QdlV8DhEWuCFcd7KCUo/Ixyb3gzsNB/tDvzrXhSrAAdgleZRzB/i3YMvzUmz vPEqfO4H/oF3r3IGe1d5bc29MepAmKQJvgnMcoellgIRpNzi5EH/Bn67ajm9QjtM7wGk kUJJ4lvoVzRZwLkd7wqE1TuVB9AvzVT+xXidpvQxpaXMK4r65PeDJTXuciIS2Gz34C+4 dguQ== X-Gm-Message-State: AODbwcC70QLQaNZPe6fSvw9qSL4GmvFagePD2+bpSm8hY4zf+lKrox/R ycVQYyD5jGQLKg== X-Received: by 10.98.68.197 with SMTP id m66mr4841474pfi.80.1494405209491; Wed, 10 May 2017 01:33:29 -0700 (PDT) Received: from eric.tencent.com ([203.205.141.37]) by smtp.gmail.com with ESMTPSA id z125sm3829043pfb.64.2017.05.10.01.33.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 May 2017 01:33:29 -0700 (PDT) From: guangrong.xiao@gmail.com X-Google-Original-From: xiaoguangrong@tencent.com To: pbonzini@redhat.com, mst@redhat.com, mtosatti@redhat.com Date: Wed, 10 May 2017 16:32:58 +0800 Message-Id: <20170510083259.3900-5-xiaoguangrong@tencent.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170510083259.3900-1-xiaoguangrong@tencent.com> References: <20170510083259.3900-1-xiaoguangrong@tencent.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::242 Subject: [Qemu-devel] [PATCH v3 4/5] mc146818rtc: drop unnecessary '#ifdef TARGET_I386' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Xiao Guangrong , yunfangtai@tencent.com, qemu-devel@nongnu.org, kvm@vger.kernel.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xiao Guangrong If the code purely depends on LOST_TICK_POLICY_SLEW, we can simply drop '#ifdef TARGET_I386' as only x86 can enable this tick policy Signed-off-by: Xiao Guangrong Reviewed-by: Philippe Mathieu-Daudé --- hw/timer/mc146818rtc.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 9810bd5..104a26d 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -112,7 +112,6 @@ static uint64_t get_guest_rtc_ns(RTCState *s) guest_clock - s->last_update + s->offset; } -#ifdef TARGET_I386 static void rtc_coalesced_timer_update(RTCState *s) { if (s->irq_coalesced == 0) { @@ -126,6 +125,7 @@ static void rtc_coalesced_timer_update(RTCState *s) } } +#ifdef TARGET_I386 static void rtc_coalesced_timer(void *opaque) { RTCState *s = opaque; @@ -198,7 +198,6 @@ periodic_timer_update(RTCState *s, int64_t current_time, uint32_t old_period) assert(lost_clock >= 0); } -#ifdef TARGET_I386 /* * recalculate the coalesced irqs for two reasons: * a) the lost_clock is more that a period, i,e. the timer @@ -233,9 +232,7 @@ periodic_timer_update(RTCState *s, int64_t current_time, uint32_t old_period) s->irq_coalesced, old_period, s->period); rtc_coalesced_timer_update(s); } - } else -#endif - { + } else { /* * no way to compensate the interrupt if LOST_TICK_POLICY_SLEW * is not used, we should make the time progress anyway. @@ -250,9 +247,7 @@ periodic_timer_update(RTCState *s, int64_t current_time, uint32_t old_period) RTC_CLOCK_RATE) + 1; timer_mod(s->periodic_timer, s->next_periodic_time); } else { -#ifdef TARGET_I386 s->irq_coalesced = 0; -#endif timer_del(s->periodic_timer); } } @@ -841,13 +836,11 @@ static int rtc_post_load(void *opaque, int version_id) } } -#ifdef TARGET_I386 if (version_id >= 2) { if (s->lost_tick_policy == LOST_TICK_POLICY_SLEW) { rtc_coalesced_timer_update(s); } } -#endif return 0; } @@ -904,11 +897,10 @@ static void rtc_notify_clock_reset(Notifier *notifier, void *data) rtc_set_date_from_host(ISA_DEVICE(s)); periodic_timer_update(s, now, 0); check_update_timer(s); -#ifdef TARGET_I386 + if (s->lost_tick_policy == LOST_TICK_POLICY_SLEW) { rtc_coalesced_timer_update(s); } -#endif } /* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE) @@ -929,12 +921,10 @@ static void rtc_reset(void *opaque) qemu_irq_lower(s->irq); -#ifdef TARGET_I386 if (s->lost_tick_policy == LOST_TICK_POLICY_SLEW) { s->irq_coalesced = 0; s->irq_reinject_on_ack_count = 0; } -#endif } static const MemoryRegionOps cmos_ops = {