i8254.c (27eb2c4b3d3e13f376a359e293c212a2e9407af5) | i8254.c (9ed96e87c5748de4c2807ef17e81287c7304186c) |
---|---|
1/* 2 * 8253/8254 interval timer emulation 3 * 4 * Copyright (c) 2003-2004 Fabrice Bellard 5 * Copyright (c) 2006 Intel Corporation 6 * Copyright (c) 2007 Keir Fraser, XenSource Inc 7 * Copyright (c) 2008 Intel Corporation 8 * Copyright 2009 Red Hat, Inc. and/or its affiliates. --- 23 unchanged lines hidden (view full) --- 32 33#define pr_fmt(fmt) "pit: " fmt 34 35#include <linux/kvm_host.h> 36#include <linux/slab.h> 37 38#include "irq.h" 39#include "i8254.h" | 1/* 2 * 8253/8254 interval timer emulation 3 * 4 * Copyright (c) 2003-2004 Fabrice Bellard 5 * Copyright (c) 2006 Intel Corporation 6 * Copyright (c) 2007 Keir Fraser, XenSource Inc 7 * Copyright (c) 2008 Intel Corporation 8 * Copyright 2009 Red Hat, Inc. and/or its affiliates. --- 23 unchanged lines hidden (view full) --- 32 33#define pr_fmt(fmt) "pit: " fmt 34 35#include <linux/kvm_host.h> 36#include <linux/slab.h> 37 38#include "irq.h" 39#include "i8254.h" |
40#include "x86.h" |
|
40 41#ifndef CONFIG_X86_64 42#define mod_64(x, y) ((x) - (y) * div64_u64(x, y)) 43#else 44#define mod_64(x, y) ((x) % (y)) 45#endif 46 47#define RW_STATE_LSB 1 --- 296 unchanged lines hidden (view full) --- 344 ps->is_periodic = is_period; 345 346 ps->timer.function = pit_timer_fn; 347 ps->kvm = ps->pit->kvm; 348 349 atomic_set(&ps->pending, 0); 350 ps->irq_ack = 1; 351 | 41 42#ifndef CONFIG_X86_64 43#define mod_64(x, y) ((x) - (y) * div64_u64(x, y)) 44#else 45#define mod_64(x, y) ((x) % (y)) 46#endif 47 48#define RW_STATE_LSB 1 --- 296 unchanged lines hidden (view full) --- 345 ps->is_periodic = is_period; 346 347 ps->timer.function = pit_timer_fn; 348 ps->kvm = ps->pit->kvm; 349 350 atomic_set(&ps->pending, 0); 351 ps->irq_ack = 1; 352 |
353 /* 354 * Do not allow the guest to program periodic timers with small 355 * interval, since the hrtimers are not throttled by the host 356 * scheduler. 357 */ 358 if (ps->is_periodic) { 359 s64 min_period = min_timer_period_us * 1000LL; 360 361 if (ps->period < min_period) { 362 pr_info_ratelimited( 363 "kvm: requested %lld ns " 364 "i8254 timer period limited to %lld ns\n", 365 ps->period, min_period); 366 ps->period = min_period; 367 } 368 } 369 |
|
352 hrtimer_start(&ps->timer, ktime_add_ns(ktime_get(), interval), 353 HRTIMER_MODE_ABS); 354} 355 356static void pit_load_count(struct kvm *kvm, int channel, u32 val) 357{ 358 struct kvm_kpit_state *ps = &kvm->arch.vpit->pit_state; 359 --- 398 unchanged lines hidden --- | 370 hrtimer_start(&ps->timer, ktime_add_ns(ktime_get(), interval), 371 HRTIMER_MODE_ABS); 372} 373 374static void pit_load_count(struct kvm *kvm, int channel, u32 val) 375{ 376 struct kvm_kpit_state *ps = &kvm->arch.vpit->pit_state; 377 --- 398 unchanged lines hidden --- |