lapic.c (4a4541a40e1fe145c72c4b959fac524a5600d9fb) | lapic.c (e9d90d472da97e1b1560bffb89578ba082c88a69) |
---|---|
1 2/* 3 * Local APIC virtualization 4 * 5 * Copyright (C) 2006 Qumranet, Inc. 6 * Copyright (C) 2007 Novell 7 * Copyright (C) 2007 Intel 8 * Copyright 2009 Red Hat, Inc. and/or its affiliates. --- 1248 unchanged lines hidden (view full) --- 1257 .is_periodic = lapic_is_periodic, 1258}; 1259 1260static const struct kvm_io_device_ops apic_mmio_ops = { 1261 .read = apic_mmio_read, 1262 .write = apic_mmio_write, 1263}; 1264 | 1 2/* 3 * Local APIC virtualization 4 * 5 * Copyright (C) 2006 Qumranet, Inc. 6 * Copyright (C) 2007 Novell 7 * Copyright (C) 2007 Intel 8 * Copyright 2009 Red Hat, Inc. and/or its affiliates. --- 1248 unchanged lines hidden (view full) --- 1257 .is_periodic = lapic_is_periodic, 1258}; 1259 1260static const struct kvm_io_device_ops apic_mmio_ops = { 1261 .read = apic_mmio_read, 1262 .write = apic_mmio_write, 1263}; 1264 |
1265static enum hrtimer_restart apic_timer_fn(struct hrtimer *data) 1266{ 1267 struct kvm_timer *ktimer = container_of(data, struct kvm_timer, timer); 1268 struct kvm_vcpu *vcpu = ktimer->vcpu; 1269 wait_queue_head_t *q = &vcpu->wq; 1270 1271 /* 1272 * There is a race window between reading and incrementing, but we do 1273 * not care about potentially losing timer events in the !reinject 1274 * case anyway. Note: KVM_REQ_PENDING_TIMER is implicitly checked 1275 * in vcpu_enter_guest. 1276 */ 1277 if (ktimer->reinject || !atomic_read(&ktimer->pending)) { 1278 atomic_inc(&ktimer->pending); 1279 /* FIXME: this code should not know anything about vcpus */ 1280 kvm_make_request(KVM_REQ_PENDING_TIMER, vcpu); 1281 } 1282 1283 if (waitqueue_active(q)) 1284 wake_up_interruptible(q); 1285 1286 if (ktimer->t_ops->is_periodic(ktimer)) { 1287 hrtimer_add_expires_ns(&ktimer->timer, ktimer->period); 1288 return HRTIMER_RESTART; 1289 } else 1290 return HRTIMER_NORESTART; 1291} 1292 |
|
1265int kvm_create_lapic(struct kvm_vcpu *vcpu) 1266{ 1267 struct kvm_lapic *apic; 1268 1269 ASSERT(vcpu != NULL); 1270 apic_debug("apic_init %d\n", vcpu->vcpu_id); 1271 1272 apic = kzalloc(sizeof(*apic), GFP_KERNEL); --- 7 unchanged lines hidden (view full) --- 1280 printk(KERN_ERR "malloc apic regs error for vcpu %x\n", 1281 vcpu->vcpu_id); 1282 goto nomem_free_apic; 1283 } 1284 apic->vcpu = vcpu; 1285 1286 hrtimer_init(&apic->lapic_timer.timer, CLOCK_MONOTONIC, 1287 HRTIMER_MODE_ABS); | 1293int kvm_create_lapic(struct kvm_vcpu *vcpu) 1294{ 1295 struct kvm_lapic *apic; 1296 1297 ASSERT(vcpu != NULL); 1298 apic_debug("apic_init %d\n", vcpu->vcpu_id); 1299 1300 apic = kzalloc(sizeof(*apic), GFP_KERNEL); --- 7 unchanged lines hidden (view full) --- 1308 printk(KERN_ERR "malloc apic regs error for vcpu %x\n", 1309 vcpu->vcpu_id); 1310 goto nomem_free_apic; 1311 } 1312 apic->vcpu = vcpu; 1313 1314 hrtimer_init(&apic->lapic_timer.timer, CLOCK_MONOTONIC, 1315 HRTIMER_MODE_ABS); |
1288 apic->lapic_timer.timer.function = kvm_timer_fn; | 1316 apic->lapic_timer.timer.function = apic_timer_fn; |
1289 apic->lapic_timer.t_ops = &lapic_timer_ops; 1290 apic->lapic_timer.kvm = vcpu->kvm; 1291 apic->lapic_timer.vcpu = vcpu; 1292 1293 apic->base_address = APIC_DEFAULT_PHYS_BASE; 1294 vcpu->arch.apic_base = APIC_DEFAULT_PHYS_BASE; 1295 1296 kvm_lapic_reset(vcpu); --- 284 unchanged lines hidden --- | 1317 apic->lapic_timer.t_ops = &lapic_timer_ops; 1318 apic->lapic_timer.kvm = vcpu->kvm; 1319 apic->lapic_timer.vcpu = vcpu; 1320 1321 apic->base_address = APIC_DEFAULT_PHYS_BASE; 1322 vcpu->arch.apic_base = APIC_DEFAULT_PHYS_BASE; 1323 1324 kvm_lapic_reset(vcpu); --- 284 unchanged lines hidden --- |