From patchwork Thu May 4 11:59:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 9711747 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 333F960362 for ; Thu, 4 May 2017 12:00:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1766B27FBC for ; Thu, 4 May 2017 12:00:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BEFC2868C; Thu, 4 May 2017 12:00:26 +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 72D5127FBC for ; Thu, 4 May 2017 12:00:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753082AbdEDMAY (ORCPT ); Thu, 4 May 2017 08:00:24 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36105 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752834AbdEDMAU (ORCPT ); Thu, 4 May 2017 08:00:20 -0400 Received: by mail-pf0-f196.google.com with SMTP id v14so1831660pfd.3 for ; Thu, 04 May 2017 05:00:20 -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=XUTHKkVUnJx3fE1PDKqKKJpoJFnqLdQg0CvJjEJyCOU=; b=azwKbKOai0n2AIU/Tbb4r3saIpxArtlwRDd+n0HP8sFR6ws03EIvGHeU4aKpH+4qpe 4YCKeEUIjTKS71+jFfcNgAaCfqO4dPKdslDEz9YC0I4jsg5DY1mrCJYGCR0sBJq29AB5 Yk1cTXLXtmm2lEqBkdyoS0teW4ZFIyV6Rvbov0CN5zyUjc6t6QWoZSEaSoIGXjWI26p7 nijUrG6qCPUA6/SAFZznKeuPnU4bUWDzEvHyyKX6bcGL5nItca2Z1Td9sRLi3oy0tEUI IvX+t8Cl3dRaUMOkZG4ZdP2a2TGH+3la1z9lOsi2GV6r8Ai5WqAR0t44PI38Gnx19Q4p YxIg== 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=XUTHKkVUnJx3fE1PDKqKKJpoJFnqLdQg0CvJjEJyCOU=; b=Pw0CS1rm/18e5eLGof4i4pVJ3F39Q8ZGOZHpFdzvNmtazlQCyZBNG4LPy31RYjMu8C xTdbhpH78vKC1PqZpwL6HBBvTBI3TvEnaZHYI0VjewJ6yHsr+p2GgIJ4xH6hLhXqEJCh yVYeSgHKpu3Vv3hXAe0lBRbc0b3TPl7g/oCmIt6oYD/gU6zQo7cghnGUpSdIndOFFB3a ybzpeZGClPVKrzl7PRPcxAgsI8cyjIW8ocPLsLEsqHDfc8ZBCt7pM5zlqtWDi8qGqQGf lMEVKjTrzVcLJhs2LpOZE5UEHORE1MBrCB6PwIeN+I0dvt2H1yVMSKsBSzjmWclJLf81 ryUw== X-Gm-Message-State: AN3rC/5IOu2WgSpbWjZfIW0a+JFjX923aqY3hPvfBteRU6YcDfIEhzb4 x/mMNtAnWBYmrwUc X-Received: by 10.98.142.25 with SMTP id k25mr10340277pfe.238.1493899217776; Thu, 04 May 2017 05:00:17 -0700 (PDT) Received: from eric.tencent.com ([203.205.141.37]) by smtp.gmail.com with ESMTPSA id p7sm3698261pfb.125.2017.05.04.05.00.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 May 2017 05:00:17 -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 v2 4/5] mc146818rtc: drop unnecessary '#ifdef TARGET_I386' Date: Thu, 4 May 2017 19:59:47 +0800 Message-Id: <20170504115948.3048-5-xiaoguangrong@tencent.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170504115948.3048-1-xiaoguangrong@tencent.com> References: <20170504115948.3048-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 --- hw/timer/mc146818rtc.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 7f2e975..8fc9313 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; @@ -204,7 +204,6 @@ periodic_timer_update(RTCState *s, int64_t current_time, int old_period) lost_clock = cur_clock - last_periodic_clock; } -#ifdef TARGET_I386 /* * recalculate the coalesced irqs for two reasons: * a) the lost_clock is more that a period, i,e. the timer @@ -235,7 +234,7 @@ periodic_timer_update(RTCState *s, int64_t current_time, int old_period) rtc_coalesced_timer_update(s); } } -#endif + /* * no way to compensate the interrupt if LOST_TICK_POLICY_SLEW * is not used, we should make the time progress anyway. @@ -248,9 +247,7 @@ periodic_timer_update(RTCState *s, int64_t current_time, int 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); } } @@ -837,13 +834,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; } @@ -900,11 +895,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) @@ -925,12 +919,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 = {