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: 9719445 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 EE36860236 for ; Wed, 10 May 2017 08:33:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E08D028552 for ; Wed, 10 May 2017 08:33:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D540828576; Wed, 10 May 2017 08:33:40 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A65228552 for ; Wed, 10 May 2017 08:33:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751877AbdEJIdh (ORCPT ); Wed, 10 May 2017 04:33:37 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36464 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751081AbdEJIda (ORCPT ); Wed, 10 May 2017 04:33:30 -0400 Received: by mail-pf0-f195.google.com with SMTP id v14so3012917pfd.3 for ; Wed, 10 May 2017 01:33:29 -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=lTBtfQIKvvCqdQutzU5gbn1R5KsjCvP79D9ufOoL8HyJ/sMTfGucqOf0e/6uS4H/OJ V9NdjKbSnrPMpx+AntsIK8lWjGcE57udOfGthdOIHu1ZL/z3QFwhbizFm+6NfQd+nQJm APEBBKCQ8iaaj51LEz/yxtiF/noDs6c8/MRA9i/KF5ZPp/XGsR1H+CZmftajyNVzBIWR +rZABT7yxJxanaKJjYheVAzONcm7jWs+5hdEwSFqIqTXG7mdANil3A0qdgwHNtzzze7D IoR0v2At13CxwKxaYJeOR+01IjrS7hzRe1keZjiHCHMPSP95yzimWhM24fzI/qF/v+eT Ym9w== X-Gm-Message-State: AODbwcAJf0CHvu5pyxMlgAWttWNRTXjTU/bXyMQVN6ZCITsk9znEmUij Chb6uNgxKA31l+5V 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 Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, yunfangtai@tencent.com, Xiao Guangrong Subject: [PATCH v3 4/5] mc146818rtc: drop unnecessary '#ifdef TARGET_I386' 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> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 = {