cregit-Linux how code gets into the kernel

Release 4.14 arch/x86/kvm/ioapic.c

Directory: arch/x86/kvm
/*
 *  Copyright (C) 2001  MandrakeSoft S.A.
 *  Copyright 2010 Red Hat, Inc. and/or its affiliates.
 *
 *    MandrakeSoft S.A.
 *    43, rue d'Aboukir
 *    75002 Paris - France
 *    http://www.linux-mandrake.com/
 *    http://www.mandrakesoft.com/
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 *  Yunhong Jiang <yunhong.jiang@intel.com>
 *  Yaozu (Eddie) Dong <eddie.dong@intel.com>
 *  Based on Xen 3.1 code.
 */

#include <linux/kvm_host.h>
#include <linux/kvm.h>
#include <linux/mm.h>
#include <linux/highmem.h>
#include <linux/smp.h>
#include <linux/hrtimer.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/export.h>
#include <asm/processor.h>
#include <asm/page.h>
#include <asm/current.h>
#include <trace/events/kvm.h>

#include "ioapic.h"
#include "lapic.h"
#include "irq.h"

#if 0
#define ioapic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg)
#else

#define ioapic_debug(fmt, arg...)
#endif
static int ioapic_service(struct kvm_ioapic *vioapic, int irq,
		bool line_status);


static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic, unsigned long addr, unsigned long length) { unsigned long result = 0; switch (ioapic->ioregsel) { case IOAPIC_REG_VERSION: result = ((((IOAPIC_NUM_PINS - 1) & 0xff) << 16) | (IOAPIC_VERSION_ID & 0xff)); break; case IOAPIC_REG_APIC_ID: case IOAPIC_REG_ARB_ID: result = ((ioapic->id & 0xf) << 24); break; default: { u32 redir_index = (ioapic->ioregsel - 0x10) >> 1; u64 redir_content; if (redir_index < IOAPIC_NUM_PINS) redir_content = ioapic->redirtbl[redir_index].bits; else redir_content = ~0ULL; result = (ioapic->ioregsel & 0x1) ? (redir_content >> 32) & 0xffffffff : redir_content & 0xffffffff; break; } } return result; }

Contributors

PersonTokensPropCommitsCommitProp
Eddie Dong14294.04%150.00%
Andrew Honig95.96%150.00%
Total151100.00%2100.00%


static void rtc_irq_eoi_tracking_reset(struct kvm_ioapic *ioapic) { ioapic->rtc_status.pending_eoi = 0; bitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPU_ID); }

Contributors

PersonTokensPropCommitsCommitProp
Yang Zhang2990.62%133.33%
Joerg Roedel26.25%133.33%
Radim Krčmář13.12%133.33%
Total32100.00%3100.00%

static void kvm_rtc_eoi_tracking_restore_all(struct kvm_ioapic *ioapic);
static void rtc_status_pending_eoi_check_valid(struct kvm_ioapic *ioapic) { if (WARN_ON(ioapic->rtc_status.pending_eoi < 0)) kvm_rtc_eoi_tracking_restore_all(ioapic); }

Contributors

PersonTokensPropCommitsCommitProp
Paolo Bonzini29100.00%1100.00%
Total29100.00%1100.00%


static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) { bool new_val, old_val; struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic; struct dest_map *dest_map = &ioapic->rtc_status.dest_map; union kvm_ioapic_redirect_entry *e; e = &ioapic->redirtbl[RTC_GSI]; if (!kvm_apic_match_dest(vcpu, NULL, 0, e->fields.dest_id, e->fields.dest_mode)) return; new_val = kvm_apic_pending_eoi(vcpu, e->fields.vector); old_val = test_bit(vcpu->vcpu_id, dest_map->map); if (new_val == old_val) return; if (new_val) { __set_bit(vcpu->vcpu_id, dest_map->map); dest_map->vectors[vcpu->vcpu_id] = e->fields.vector; ioapic->rtc_status.pending_eoi++; } else { __clear_bit(vcpu->vcpu_id, dest_map->map); ioapic->rtc_status.pending_eoi--; rtc_status_pending_eoi_check_valid(ioapic); } }

Contributors

PersonTokensPropCommitsCommitProp
Yang Zhang14480.45%125.00%
Paolo Bonzini3217.88%250.00%
Joerg Roedel31.68%125.00%
Total179100.00%4100.00%


void kvm_rtc_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) { struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic; spin_lock(&ioapic->lock); __rtc_irq_eoi_tracking_restore_one(vcpu); spin_unlock(&ioapic->lock); }

Contributors

PersonTokensPropCommitsCommitProp
Yang Zhang44100.00%1100.00%
Total44100.00%1100.00%


static void kvm_rtc_eoi_tracking_restore_all(struct kvm_ioapic *ioapic) { struct kvm_vcpu *vcpu; int i; if (RTC_GSI >= IOAPIC_NUM_PINS) return; rtc_irq_eoi_tracking_reset(ioapic); kvm_for_each_vcpu(i, vcpu, ioapic->kvm) __rtc_irq_eoi_tracking_restore_one(vcpu); }

Contributors

PersonTokensPropCommitsCommitProp
Yang Zhang44100.00%1100.00%
Total44100.00%1100.00%


static void rtc_irq_eoi(struct kvm_ioapic *ioapic, struct kvm_vcpu *vcpu) { if (test_and_clear_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map)) { --ioapic->rtc_status.pending_eoi; rtc_status_pending_eoi_check_valid(ioapic); } }

Contributors

PersonTokensPropCommitsCommitProp
Yang Zhang4289.36%133.33%
Paolo Bonzini36.38%133.33%
Joerg Roedel24.26%133.33%
Total47100.00%3100.00%


static bool rtc_irq_check_coalesced(struct kvm_ioapic *ioapic) { if (ioapic->rtc_status.pending_eoi > 0) return true; /* coalesced */ return false; }

Contributors

PersonTokensPropCommitsCommitProp
Yang Zhang28100.00%1100.00%
Total28100.00%1100.00%


static int ioapic_set_irq(struct kvm_ioapic *ioapic, unsigned int irq, int irq_level, bool line_status) { union kvm_ioapic_redirect_entry entry; u32 mask = 1 << irq; u32 old_irr; int edge, ret; entry = ioapic->redirtbl[irq]; edge = (entry.fields.trig_mode == IOAPIC_EDGE_TRIG); if (!irq_level) { ioapic->irr &= ~mask; ret = 1; goto out; } /* * Return 0 for coalesced interrupts; for edge-triggered interrupts, * this only happens if a previous edge has not been delivered due * do masking. For level interrupts, the remote_irr field tells * us if the interrupt is waiting for an EOI. * * RTC is special: it is edge-triggered, but userspace likes to know * if it has been already ack-ed via EOI because coalesced RTC * interrupts lead to time drift in Windows guests. So we track * EOI manually for the RTC interrupt. */ if (irq == RTC_GSI && line_status && rtc_irq_check_coalesced(ioapic)) { ret = 0; goto out; } old_irr = ioapic->irr; ioapic->irr |= mask; if (edge) ioapic->irr_delivered &= ~mask; if ((edge && old_irr == ioapic->irr) || (!edge && entry.fields.remote_irr)) { ret = 0; goto out; } ret = ioapic_service(ioapic, irq, line_status); out: trace_kvm_ioapic_set_irq(entry.bits, irq, ret == 0); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Paolo Bonzini17894.18%150.00%
Wincy Van115.82%150.00%
Total189100.00%2100.00%


static void kvm_ioapic_inject_all(struct kvm_ioapic *ioapic, unsigned long irr) { u32 idx; rtc_irq_eoi_tracking_reset(ioapic); for_each_set_bit(idx, &irr, IOAPIC_NUM_PINS) ioapic_set_irq(ioapic, idx, 1, true); kvm_rtc_eoi_tracking_restore_all(ioapic); }

Contributors

PersonTokensPropCommitsCommitProp
Paolo Bonzini47100.00%1100.00%
Total47100.00%1100.00%


void kvm_ioapic_scan_entry(struct kvm_vcpu *vcpu, ulong *ioapic_handled_vectors) { struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic; struct dest_map *dest_map = &ioapic->rtc_status.dest_map; union kvm_ioapic_redirect_entry *e; int index; spin_lock(&ioapic->lock); /* Make sure we see any missing RTC EOI */ if (test_bit(vcpu->vcpu_id, dest_map->map)) __set_bit(dest_map->vectors[vcpu->vcpu_id], ioapic_handled_vectors); for (index = 0; index < IOAPIC_NUM_PINS; index++) { e = &ioapic->redirtbl[index]; if (e->fields.trig_mode == IOAPIC_LEVEL_TRIG || kvm_irq_has_notifier(ioapic->kvm, KVM_IRQCHIP_IOAPIC, index) || index == RTC_GSI) { if (kvm_apic_match_dest(vcpu, NULL, 0, e->fields.dest_id, e->fields.dest_mode) || (e->fields.trig_mode == IOAPIC_EDGE_TRIG && kvm_apic_pending_eoi(vcpu, e->fields.vector))) __set_bit(e->fields.vector, ioapic_handled_vectors); } } spin_unlock(&ioapic->lock); }

Contributors

PersonTokensPropCommitsCommitProp
Yang Zhang13467.68%457.14%
Joerg Roedel4020.20%114.29%
Radim Krčmář2110.61%114.29%
Andrey Smetanin31.52%114.29%
Total198100.00%7100.00%


void kvm_arch_post_irq_ack_notifier_list_update(struct kvm *kvm) { if (!ioapic_in_kernel(kvm)) return; kvm_make_scan_ioapic_request(kvm); }

Contributors

PersonTokensPropCommitsCommitProp
Yang Zhang1979.17%250.00%
David Hildenbrand520.83%250.00%
Total24100.00%4100.00%


static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) { unsigned index; bool mask_before, mask_after; union kvm_ioapic_redirect_entry *e; switch (ioapic->ioregsel) { case IOAPIC_REG_VERSION: /* Writes are ignored. */ break; case IOAPIC_REG_APIC_ID: ioapic->id = (val >> 24) & 0xf; break; case IOAPIC_REG_ARB_ID: break; default: index = (ioapic->ioregsel - 0x10) >> 1; ioapic_debug("change redir index %x val %x\n", index, val); if (index >= IOAPIC_NUM_PINS) return; e = &ioapic->redirtbl[index]; mask_before = e->fields.mask; if (ioapic->ioregsel & 1) { e->bits &= 0xffffffff; e->bits |= (u64) val << 32; } else { e->bits &= ~0xffffffffULL; e->bits |= (u32) val; e->fields.remote_irr = 0; } mask_after = e->fields.mask; if (mask_before != mask_after) kvm_fire_mask_notifiers(ioapic->kvm, KVM_IRQCHIP_IOAPIC, index, mask_after); if (e->fields.trig_mode == IOAPIC_LEVEL_TRIG && ioapic->irr & (1 << index)) ioapic_service(ioapic, index, false); kvm_make_scan_ioapic_request(ioapic->kvm); break; } }

Contributors

PersonTokensPropCommitsCommitProp
Eddie Dong14664.89%111.11%
Avi Kivity4017.78%111.11%
Gleb Natapov2912.89%333.33%
Yang Zhang83.56%222.22%
Laurent Vivier10.44%111.11%
David Hildenbrand10.44%111.11%
Total225100.00%9100.00%


static int ioapic_service(struct kvm_ioapic *ioapic, int irq, bool line_status) { union kvm_ioapic_redirect_entry *entry = &ioapic->redirtbl[irq]; struct kvm_lapic_irq irqe; int ret; if (entry->fields.mask) return -1; ioapic_debug("dest=%x dest_mode=%x delivery_mode=%x " "vector=%x trig_mode=%x\n", entry->fields.dest_id, entry->fields.dest_mode, entry->fields.delivery_mode, entry->fields.vector, entry->fields.trig_mode); irqe.dest_id = entry->fields.dest_id; irqe.vector = entry->fields.vector; irqe.dest_mode = entry->fields.dest_mode; irqe.trig_mode = entry->fields.trig_mode; irqe.delivery_mode = entry->fields.delivery_mode << 8; irqe.level = 1; irqe.shorthand = 0; irqe.msi_redir_hint = false; if (irqe.trig_mode == IOAPIC_EDGE_TRIG) ioapic->irr_delivered |= 1 << irq; if (irq == RTC_GSI && line_status) { /* * pending_eoi cannot ever become negative (see * rtc_status_pending_eoi_check_valid) and the caller * ensures that it is only called if it is >= zero, namely * if rtc_irq_check_coalesced returns false). */ BUG_ON(ioapic->rtc_status.pending_eoi != 0); ret = kvm_irq_delivery_to_apic(ioapic->kvm, NULL, &irqe, &ioapic->rtc_status.dest_map); ioapic->rtc_status.pending_eoi = (ret < 0 ? 0 : ret); } else ret = kvm_irq_delivery_to_apic(ioapic->kvm, NULL, &irqe, NULL); if (ret && irqe.trig_mode == IOAPIC_LEVEL_TRIG) entry->fields.remote_irr = 1; return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Gleb Natapov10940.67%317.65%
Yang Zhang6323.51%317.65%
Paolo Bonzini5420.15%423.53%
Sheng Yang165.97%15.88%
Eddie Dong134.85%15.88%
James Sullivan62.24%15.88%
Marcelo Tosatti31.12%15.88%
Wincy Van20.75%15.88%
Liu Yuan10.37%15.88%
Joerg Roedel10.37%15.88%
Total268100.00%17100.00%


int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int irq_source_id, int level, bool line_status) { int ret, irq_level; BUG_ON(irq < 0 || irq >= IOAPIC_NUM_PINS); spin_lock(&ioapic->lock); irq_level = __kvm_irq_line_state(&ioapic->irq_states[irq], irq_source_id, level); ret = ioapic_set_irq(ioapic, irq, irq_level, line_status); spin_unlock(&ioapic->lock); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Michael S. Tsirkin3540.23%222.22%
Gleb Natapov2427.59%333.33%
Eddie Dong1921.84%111.11%
Yang Zhang44.60%111.11%
Paolo Bonzini33.45%111.11%
Marcelo Tosatti22.30%111.11%
Total87100.00%9100.00%


void kvm_ioapic_clear_all(struct kvm_ioapic *ioapic, int irq_source_id) { int i; spin_lock(&ioapic->lock); for (i = 0; i < KVM_IOAPIC_NUM_PINS; i++) __clear_bit(irq_source_id, &ioapic->irq_states[i]); spin_unlock(&ioapic->lock); }

Contributors

PersonTokensPropCommitsCommitProp
Michael S. Tsirkin58100.00%1100.00%
Total58100.00%1100.00%


static void kvm_ioapic_eoi_inject_work(struct work_struct *work) { int i; struct kvm_ioapic *ioapic = container_of(work, struct kvm_ioapic, eoi_inject.work); spin_lock(&ioapic->lock); for (i = 0; i < IOAPIC_NUM_PINS; i++) { union kvm_ioapic_redirect_entry *ent = &ioapic->redirtbl[i]; if (ent->fields.trig_mode != IOAPIC_LEVEL_TRIG) continue; if (ioapic->irr & (1 << i) && !ent->fields.remote_irr) ioapic_service(ioapic, i, false); } spin_unlock(&ioapic->lock); }

Contributors

PersonTokensPropCommitsCommitProp
Zhang Haoyu114100.00%1100.00%
Total114100.00%1100.00%

#define IOAPIC_SUCCESSIVE_IRQ_MAX_COUNT 10000
static void __kvm_ioapic_update_eoi(struct kvm_vcpu *vcpu, struct kvm_ioapic *ioapic, int vector, int trigger_mode) { struct dest_map *dest_map = &ioapic->rtc_status.dest_map; struct kvm_lapic *apic = vcpu->arch.apic; int i; /* RTC special handling */ if (test_bit(vcpu->vcpu_id, dest_map->map) && vector == dest_map->vectors[vcpu->vcpu_id]) rtc_irq_eoi(ioapic, vcpu); for (i = 0; i < IOAPIC_NUM_PINS; i++) { union kvm_ioapic_redirect_entry *ent = &ioapic->redirtbl[i]; if (ent->fields.vector != vector) continue; /* * We are dropping lock while calling ack notifiers because ack * notifier callbacks for assigned devices call into IOAPIC * recursively. Since remote_irr is cleared only after call * to notifiers if the same vector will be delivered while lock * is dropped it will be put into irr and will be delivered * after ack notifier returns. */ spin_unlock(&ioapic->lock); kvm_notify_acked_irq(ioapic->kvm, KVM_IRQCHIP_IOAPIC, i); spin_lock(&ioapic->lock); if (trigger_mode != IOAPIC_LEVEL_TRIG || kvm_lapic_get_reg(apic, APIC_SPIV) & APIC_SPIV_DIRECTED_EOI) continue; ASSERT(ent->fields.trig_mode == IOAPIC_LEVEL_TRIG); ent->fields.remote_irr = 0; if (!ent->fields.mask && (ioapic->irr & (1 << i))) { ++ioapic->irq_eoi[i]; if (ioapic->irq_eoi[i] == IOAPIC_SUCCESSIVE_IRQ_MAX_COUNT) { /* * Real hardware does not deliver the interrupt * immediately during eoi broadcast, and this * lets a buggy guest make slow progress * even if it does not correctly handle a * level-triggered interrupt. Emulate this * behavior if we detect an interrupt storm. */ schedule_delayed_work(&ioapic->eoi_inject, HZ / 100); ioapic->irq_eoi[i] = 0; trace_kvm_ioapic_delayed_eoi_inj(ent->bits); } else { ioapic_service(ioapic, i, false); } } else { ioapic->irq_eoi[i] = 0; } } }

Contributors

PersonTokensPropCommitsCommitProp
Zhang Haoyu7627.24%17.14%
Eddie Dong5620.07%17.14%
Gleb Natapov4917.56%17.14%
Joerg Roedel4616.49%17.14%
Marcelo Tosatti217.53%321.43%
Radim Krčmář196.81%17.14%
Yang Zhang72.51%214.29%
Avi Kivity20.72%17.14%
Mark McLoughlin10.36%17.14%
Suravee Suthikulpanit10.36%17.14%
Sheng Yang10.36%17.14%
Total279100.00%14100.00%


void kvm_ioapic_update_eoi(struct kvm_vcpu *vcpu, int vector, int trigger_mode) { struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic; spin_lock(&ioapic->lock); __kvm_ioapic_update_eoi(vcpu, ioapic, vector, trigger_mode); spin_unlock(&ioapic->lock); }

Contributors

PersonTokensPropCommitsCommitProp
Michael S. Tsirkin2442.86%116.67%
Gleb Natapov1323.21%116.67%
Avi Kivity916.07%116.67%
Yang Zhang610.71%116.67%
Marcelo Tosatti47.14%233.33%
Total56100.00%6100.00%


static inline struct kvm_ioapic *to_ioapic(struct kvm_io_device *dev) { return container_of(dev, struct kvm_ioapic, dev); }

Contributors

PersonTokensPropCommitsCommitProp
Gregory Haskins25100.00%1100.00%
Total25100.00%1100.00%


static inline int ioapic_in_range(struct kvm_ioapic *ioapic, gpa_t addr) { return ((addr >= ioapic->base_address && (addr < ioapic->base_address + IOAPIC_MEM_LENGTH))); }

Contributors

PersonTokensPropCommitsCommitProp
Eddie Dong3391.67%150.00%
Michael S. Tsirkin38.33%150.00%
Total36100.00%2100.00%


static int ioapic_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *this, gpa_t addr, int len, void *val) { struct kvm_ioapic *ioapic = to_ioapic(this); u32 result; if (!ioapic_in_range(ioapic, addr)) return -EOPNOTSUPP; ioapic_debug("addr %lx\n", (unsigned long)addr); ASSERT(!(addr & 0xf)); /* check alignment */ addr &= 0xff; spin_lock(&ioapic->lock); switch (addr) { case IOAPIC_REG_SELECT: result = ioapic->ioregsel; break; case IOAPIC_REG_WINDOW: result = ioapic_read_indirect(ioapic, addr, len); break; default: result = 0; break; } spin_unlock(&ioapic->lock); switch (len) { case 8: *(u64 *) val = result; break; case 1: case 2: case 4: memcpy(val, (char *)&result, len); break; default: printk(KERN_WARNING "ioapic: wrong length %d\n", len); } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Eddie Dong14074.87%112.50%
Michael S. Tsirkin189.63%112.50%
Gleb Natapov126.42%112.50%
Marcelo Tosatti84.28%225.00%
Nikolay Nikolaev52.67%112.50%
Gregory Haskins31.60%112.50%
Laurent Vivier10.53%112.50%
Total187100.00%8100.00%


static int ioapic_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this, gpa_t addr, int len, const void *val) { struct kvm_ioapic *ioapic = to_ioapic(this); u32 data; if (!ioapic_in_range(ioapic, addr)) return -EOPNOTSUPP; ioapic_debug("ioapic_mmio_write addr=%p len=%d val=%p\n", (void*)addr, len, val); ASSERT(!(addr & 0xf)); /* check alignment */ switch (len) { case 8: case 4: data = *(u32 *) val; break; case 2: data = *(u16 *) val; break; case 1: data = *(u8 *) val; break; default: printk(KERN_WARNING "ioapic: Unsupported size %d\n", len); return 0; } addr &= 0xff; spin_lock(&ioapic->lock); switch (addr) { case IOAPIC_REG_SELECT: ioapic->ioregsel = data & 0xFF; /* 8-bit register */ break; case IOAPIC_REG_WINDOW: ioapic_write_indirect(ioapic, data); break; default: break; } spin_unlock(&ioapic->lock); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Eddie Dong10654.36%111.11%
Julian Stecklina3920.00%111.11%
Michael S. Tsirkin189.23%111.11%
Gleb Natapov115.64%111.11%
Marcelo Tosatti84.10%222.22%
Laurent Vivier52.56%111.11%
Nikolay Nikolaev52.56%111.11%
Gregory Haskins31.54%111.11%
Total195100.00%9100.00%


static void kvm_ioapic_reset(struct kvm_ioapic *ioapic) { int i; cancel_delayed_work_sync(&ioapic->eoi_inject); for (i = 0; i < IOAPIC_NUM_PINS; i++) ioapic->redirtbl[i].fields.mask = 1; ioapic->base_address = IOAPIC_DEFAULT_BASE_ADDRESS; ioapic->ioregsel = 0; ioapic->irr = 0; ioapic->irr_delivered = 0; ioapic->id = 0; memset(ioapic->irq_eoi, 0x00, sizeof(ioapic->irq_eoi)); rtc_irq_eoi_tracking_reset(ioapic); }

Contributors

PersonTokensPropCommitsCommitProp
Eddie Dong6363.64%116.67%
Zhang Haoyu1818.18%116.67%
Jiri Slaby66.06%116.67%
Wincy Van66.06%116.67%
Yang Zhang55.05%116.67%
Stephen Hemminger11.01%116.67%
Total99100.00%6100.00%

static const struct kvm_io_device_ops ioapic_mmio_ops = { .read = ioapic_mmio_read, .write = ioapic_mmio_write, };
int kvm_ioapic_init(struct kvm *kvm) { struct kvm_ioapic *ioapic; int ret; ioapic = kzalloc(sizeof(struct kvm_ioapic), GFP_KERNEL); if (!ioapic) return -ENOMEM; spin_lock_init(&ioapic->lock); INIT_DELAYED_WORK(&ioapic->eoi_inject, kvm_ioapic_eoi_inject_work); kvm->arch.vioapic = ioapic; kvm_ioapic_reset(ioapic); kvm_iodevice_init(&ioapic->dev, &ioapic_mmio_ops); ioapic->kvm = kvm; mutex_lock(&kvm->slots_lock); ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, ioapic->base_address, IOAPIC_MEM_LENGTH, &ioapic->dev); mutex_unlock(&kvm->slots_lock); if (ret < 0) { kvm->arch.vioapic = NULL; kfree(ioapic); } return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Eddie Dong6946.62%215.38%
Gregory Haskins2416.22%215.38%
Marcelo Tosatti1812.16%323.08%
Wei Yongjun106.76%17.69%
Zhang Haoyu106.76%17.69%
Gleb Natapov74.73%17.69%
Sasha Levin64.05%17.69%
Michael S. Tsirkin21.35%17.69%
Xiantao Zhang21.35%17.69%
Total148100.00%13100.00%


void kvm_ioapic_destroy(struct kvm *kvm) { struct kvm_ioapic *ioapic = kvm->arch.vioapic; if (!ioapic) return; cancel_delayed_work_sync(&ioapic->eoi_inject); mutex_lock(&kvm->slots_lock); kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS, &ioapic->dev); mutex_unlock(&kvm->slots_lock); kvm->arch.vioapic = NULL; kfree(ioapic); }

Contributors

PersonTokensPropCommitsCommitProp
Wei Yongjun4660.53%125.00%
David Hildenbrand1621.05%125.00%
Zhang Haoyu810.53%125.00%
Peter Xu67.89%125.00%
Total76100.00%4100.00%


void kvm_get_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state) { struct kvm_ioapic *ioapic = kvm->arch.vioapic; spin_lock(&ioapic->lock); memcpy(state, ioapic, sizeof(struct kvm_ioapic_state)); state->irr &= ~ioapic->irr_delivered; spin_unlock(&ioapic->lock); }

Contributors

PersonTokensPropCommitsCommitProp
Gleb Natapov4875.00%120.00%
Wincy Van914.06%120.00%
David Hildenbrand57.81%240.00%
Marcelo Tosatti23.12%120.00%
Total64100.00%5100.00%


void kvm_set_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state) { struct kvm_ioapic *ioapic = kvm->arch.vioapic; spin_lock(&ioapic->lock); memcpy(ioapic, state, sizeof(struct kvm_ioapic_state)); ioapic->irr = 0; ioapic->irr_delivered = 0; kvm_make_scan_ioapic_request(kvm); kvm_ioapic_inject_all(ioapic, state->irr); spin_unlock(&ioapic->lock); }

Contributors

PersonTokensPropCommitsCommitProp
Gleb Natapov4859.26%111.11%
Paolo Bonzini1113.58%111.11%
Yang Zhang89.88%222.22%
David Hildenbrand67.41%333.33%
Wincy Van67.41%111.11%
Marcelo Tosatti22.47%111.11%
Total81100.00%9100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Eddie Dong83626.68%22.53%
Yang Zhang59118.86%911.39%
Paolo Bonzini36811.75%78.86%
Gleb Natapov35311.27%911.39%
Zhang Haoyu2307.34%11.27%
Michael S. Tsirkin1585.04%56.33%
Joerg Roedel943.00%22.53%
Gregory Haskins732.33%22.53%
Marcelo Tosatti722.30%78.86%
Wei Yongjun561.79%22.53%
Avi Kivity531.69%45.06%
Radim Krčmář411.31%33.80%
Julian Stecklina391.24%11.27%
Wincy Van341.09%11.27%
David Hildenbrand331.05%67.59%
Laurent Vivier240.77%11.27%
Sheng Yang170.54%22.53%
Nikolay Nikolaev100.32%11.27%
Andrew Honig90.29%11.27%
Xiantao Zhang80.26%33.80%
Peter Xu60.19%11.27%
Sasha Levin60.19%11.27%
James Sullivan60.19%11.27%
Jiri Slaby60.19%11.27%
Tejun Heo30.10%11.27%
Andrey Smetanin30.10%11.27%
Liu Yuan10.03%11.27%
Stephen Hemminger10.03%11.27%
Suravee Suthikulpanit10.03%11.27%
Mark McLoughlin10.03%11.27%
Total3133100.00%79100.00%
Directory: arch/x86/kvm
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.