public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: guangrong.xiao@gmail.com, pbonzini@redhat.com, mst@redhat.com,
	mtosatti@redhat.com
Cc: Xiao Guangrong <xiaoguangrong@tencent.com>,
	yunfangtai@tencent.com, qemu-devel@nongnu.org,
	kvm@vger.kernel.org
Subject: Re: [Qemu-devel] [PATCH v3 4/5] mc146818rtc: drop unnecessary '#ifdef TARGET_I386'
Date: Sat, 13 May 2017 19:12:26 -0300	[thread overview]
Message-ID: <fe0066de-bf05-15ed-cd56-e59cd036563f@amsat.org> (raw)
In-Reply-To: <20170510083259.3900-5-xiaoguangrong@tencent.com>

On 05/10/2017 05:32 AM, guangrong.xiao@gmail.com wrote:
> From: Xiao Guangrong <xiaoguangrong@tencent.com>
>
> 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 <xiaoguangrong@tencent.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  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 = {
>

  reply	other threads:[~2017-05-13 22:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10  8:32 [PATCH v3 0/5] mc146818rtc: fix Windows VM clock faster guangrong.xiao
2017-05-10  8:32 ` [PATCH v3 1/5] mc146818rtc: update periodic timer only if it is needed guangrong.xiao
2017-05-10  8:32 ` [PATCH v3 2/5] mc146818rtc: precisely count the clock for periodic timer guangrong.xiao
2017-05-10  8:32 ` [PATCH v3 3/5] mc146818rtc: ensure LOST_TICK_POLICY_SLEW is only enabled on TARGET_I386 guangrong.xiao
2017-05-13 22:13   ` [Qemu-devel] " Philippe Mathieu-Daudé
2017-05-10  8:32 ` [PATCH v3 4/5] mc146818rtc: drop unnecessary '#ifdef TARGET_I386' guangrong.xiao
2017-05-13 22:12   ` Philippe Mathieu-Daudé [this message]
2017-05-10  8:32 ` [PATCH v3 5/5] mc146818rtc: embrace all x86 specific code guangrong.xiao
2017-05-10  9:53 ` [PATCH v3 0/5] mc146818rtc: fix Windows VM clock faster Paolo Bonzini
2017-05-18  2:26   ` Xiao Guangrong
2017-05-18  7:52     ` [Qemu-devel] " Paolo Bonzini
2017-05-18 13:38       ` Xiao Guangrong
2017-05-18 13:51         ` Paolo Bonzini
2017-05-10 10:04 ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fe0066de-bf05-15ed-cd56-e59cd036563f@amsat.org \
    --to=f4bug@amsat.org \
    --cc=guangrong.xiao@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xiaoguangrong@tencent.com \
    --cc=yunfangtai@tencent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox