/* * 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.
*/ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#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 ##include<linuxkvm_host # linux.hjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 #int, #includeasmjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
#include | );
lapic
: # .
static;
:
static =(> -0) >>; struct kvm_ioapic *ioapic, int trigger_mode, intjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
unsigned ( kvm_ioapic)
{ unsigned=> x1
redir_contentxffffffff case:
result
|IOAPIC_VERSION_ID xff
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
(>..,KVM_MAX_VCPU_IDS
(struct i);
result = ((ioapic- ( *ioapic) break;
static dest_map-[vcpu-] = >fields;
{ if (WARN_ON(ioapic->rtc_status.pending_eoi < 0 elsejava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
kvm_rtc_eoi_tracking_restore_all)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
}
s kvm_ioapicioapicvcpu->arch;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
>.dest_id
(!!e-fields))java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 return
new_val = kvm_apic_pending_eoi(vcpu,java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
old_val = test_bit
if (new_val == old_val) return;
if(new_val{
__set_bit(vcpu->vcpu_id, dest_map->map);
dest_map-
>rtc_status++;
} else {
__clear_bit(vcpu->vcpu_id, dest_map->kvm_for_each_vcpu,, ioapic-)
ioapic->rtc_statuspending_eoi--
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
}
staticvoid kvm_rtc_eoi_tracking_restore_all(struct kvm_ioapic *ioapic)
{ struct ( ==dest_map-[vcpu-])&java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 long i
if (RTC_GSI -ioapic-.pending_eoi
eturn
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
kvm_for_each_vcpu,vcpuioapic-kvm
__rtc_irq_eoi_tracking_restore_one(vcpujava.lang.StringIndexOutOfBoundsException: Range [44, 45) out of bounds for length 1
}
staticvoid rtc_irq_eoi(struct kvm_ioapic int
{ structstatic ioapic_lazy_update_eoi *, int)
/* RTC special handling */ iftest_bit>vcpu_iddest_map->) &
(vector == dest_map->vectors[vcpu->vcpu_id]) &&
((vcpu-, if!(vcpuNULLA,
-- entry-.dest_id
rtc_status_pending_eoi_check_validioapic)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}
static ;
{
java.lang.StringIndexOutOfBoundsException: Range [4, 5) out of bounds for length 4
returnfalse
}
static ioapic_lazy_update_eoikvm_ioapic, int )
{ unsigned java.lang.StringIndexOutOfBoundsException: Range [2, 3) out of bounds for length 2 struct *; union kvm_ioapic_redirect_entry *entry = &ioapic- int, boolline_status
u32 = <irq
(kvm_apic_match_dest(, , APIC_DEST_NOSHORT,
entry->java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
= entry.trig_mode=IOAPIC_EDGE_TRIG
(irq_level
/* * If no longer has pending EOI in LAPICs, update * EOI for this vector.
*/
* triggered, * to receive the EOI. In * pendingjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* this * to * us if the interrupt is * RTC is special: it is edge-triggered * if it has * interrupts lead to * EOI manually & java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static ( kvm_ioapic, unsignedint, int irq_level,return;
{ unionstatic kvm_ioapic_inject_all kvm_ioapicioapic long)
idx
u32rtc_irq_eoi_tracking_reset); int edge, ret for_each_set_bitidxirr )
entry
= entry. =)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
if)
ioapic-dest_map >rtc_status;
ret = unione
;
}(&>lock
* AMD SVM AVIC accelerate EOI write iff the interrupt is edge * triggered, in which case the in-kernel IOAPIC will not be able * to receive the EOI. In this case, we do a lazy update of the * pending EOI when trying to set IOAPIC irq.
*/ if (edge &
ioapic_lazy_update_eoi(ioapic, irq);
/* * Return 0 for coalesced interrupts; for edge-triggered interrupts, * this only happens if a previous edge has not been delivered due * to 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.
*/
}
rtc_irq_check_coalesced(ioapic
ret = 0; gotostruct kvm_irq_mask_notifier *kimn{
}
old_irr
ioapic->irr |= bool mask{ if ( int idx,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ioapic- bool mask_before union int old_remote_irr, old_delivery_status, old_dest_id, old_dest_mode; ifcase IOAPIC_REG_VERSION /* Writes are ignored. */break;
ret c ioapic-> = (val> 2) 0; gotoout;
}
}
ret = ioapic_service break
out:
trace_kvm_ioapic_set_irq default: return index ioapic-ioregsel -0) >> 1java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
}
void kvm_ioapic_scan_entry(struct kvm_vcpu *vcpu, ulong *ioapic_handled_vectors)e-.;
{ struct> =0; struct e-bits() < 3java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30 union kvm_ioapic_redirect_entry
>fields =old_remote_irrjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
spin_lock(&ioapic->lock);
/java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 if (test_bit(vcpu->vcpu_id, dest_map->map))
_ /java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
ioapic_handled_vectors);
for (index * be cleared by IOAPIC hardware when * as edge-triggered. * explicit EOI on IOAPICs java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ioapic-[ndex
(>fields= |
kvm_irq_has_notifier(ioapic->kvm, KVM_IRQCHIP_IOAPIC, index) ||
index == RTC_GSI) {
u16 = kvm_lapic_irq_dest_mode!>fields);
void kvm_arch_post_irq_ack_notifier_list_update(struct kvm *kvm)
{ if (!ioapic_in_kernel(kvm * Linux guest as a oneshot * case the guest acknowledges the interrupt to the * its threaded irq handler, i.e. after the EOI but before * unmasking, so at the time of unmasking * already down but our pending irr * cases, injecting this pending interrupt to the * buggy: the guest will receive an *
* through *
kvm_make_scan_ioapic_request( * registered for this irq), then unconditionally inject * pending interrupt into the * an interrupt, although may java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
mutex_lockfalse
;
irq.shorthand;
(kvm-)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
}
)
(struct, , struct kvm_irq_mask_notifier * ! >.dest_id
{
mutex_lock * keep
hlist_del_rcu>link
mutex_unlock irq java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
synchronize_srcu(&kvm- vcpu_bitmap;
}
kvm_fire_mask_notifiersstruct kvmunsigned,unsignedpin else
{
.vioapic struct kvm_irq_mask_notifier} int idx, gsi;
idx = srcu_read_lock(&kvm->irq_srcu); breakjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
gsi kvm_irq_map_chip_pinkvm, pin; if (gsi != -1)
hlist_for_each_entry_rcu(kimn, ifkimn-> =gsijava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
srcu_read_unlock |
}
static entry-remote_irr)
unsigned java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 bool, ; union .dest_mode(!>fields; int. =>fieldsjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
DECLARE_BITMAP(.level
switchioapic->ioregsel) java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 case IOAPIC_REG_VERSION: /* Writes are ignored. */ break;
case IOAPIC_REG_APIC_ID:
ioapic->id = (val >> 24) & 0xf; break;
/* * Some OSes (Linux, Xen) assume that Remote IRR bit will * be cleared by IOAPIC hardware when the entry is configured * as edge-triggered. This behavior is used to simulate an * explicit EOI on IOAPICs that don't have the EOI register.
*/ if (e->fields.trig_mode == IOAPIC_EDGE_TRIG)
e-fields.emote_irr=0
mask_after if (mask_before != mask_after)
kvm_fire_mask_notifiers(ioapic-> int kvm_ioapic_set_irqstruct *e,struct *,
ioapic- &1<index !-fields &!>fieldsremote_irr java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79 /* * Pending status in irr may be outdated: the IRQ line may have * already been deasserted by a device while the IRQ was masked. * This occurs, for instance, if the interrupt is handled in a * Linux guest as a oneshot interrupt (IRQF_ONESHOT). In this * case the guest acknowledges the interrupt to the device in * its threaded irq handler, i.e. after the EOI but before * unmasking, so at the time of unmasking the IRQ line is * already down but our pending irr bit is still set. In such * cases, injecting this pending interrupt to the guest is * buggy: the guest will receive an extra unwanted interrupt. * * So we need to check here if the IRQ is actually still pending. * As we are generally not able to probe the IRQ line status * directly, we do it through irqfd resampler. Namely, we clear * the pending status and notify the resampler that this interrupt * is done, without actually injecting it into the guest. If the * IRQ line is actually already deasserted, we are done. If it is * still asserted, a new interrupt will be shortly triggered * through irqfd and injected into the guest. * * If, however, it's not possible to resample (no irqfd resampler * registered for this irq), then unconditionally inject this * pending interrupt into the guest, so the guest will not miss * an interrupt, although may get an extra unwanted interrupt.
*/ if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ioapic->irr java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 else
ioapic_service eoi_injectwork)
} ife-. =) { struct kvm_lapic_irq irq;
irq.vector = e->fields.vector;
.delivery_mode e-.delivery_mode<8java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
irq. kvm_ioapic_redirect_entry =>[ijava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
kvm_lapic_irq_dest_mode(!!e- ;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
irq fields
irq. (, ,)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
irq. kvm_ioapic_update_eoi_one kvm_vcpu,
irq.msi_redir_hint = false;
bitmap_zero(vcpu_bitmap, KVM_MAX_VCPUS);
kvm_bitmap_or_dest_vcpus(ioapic->kvm, &irq,
vcpu_bitmap); if (old_dest_mode != e->fields.dest_mode ||
old_dest_id != e->fields.dest_id) { /* * Update vcpu_bitmap with vcpus specified in * the previous request as well. This is done to * keep ioapic_handled_vectors synchronized.
*/
irq.dest_id = old_dest_id;
irqstruct * =>arch;
(
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
kvm_bitmap_or_dest_vcpus( * to notifiers if the same * is dropped it will be * after ack notifier java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
vcpu_bitmap trigger_mode |
}
(,
} else {
(>)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
} breaki>[];
}
}
staticint ioapic_service(struct * immediately during eoi broadcast, * lets a buggy guest make * even if it does * level-triggered interrupt. * behavior if we detect java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
i>irq_eoi
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 int ret;
if ( * =>>.vioapic
entry-trig_mode &
entry-,)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
-
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
irqe ;
irqe =kvm_lapic_irq_dest_mode>.)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 staticstruct *(struct dev
irqe. (,struct,);
irqe.java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
irqe
.=)
ioapic->irr_delivered <>base_address ))java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
,,voidjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 /* * 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).
*/
&=0xff
&ioapic->rtc_status(&>lock
ioapic->case:
;
if (ret && irqe.trig_mode == IOAPIC_LEVEL_TRIG)
entry-java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
l)
}
int *(u64 ) =;
:
{ struct kvm_ioapic 4
-.;
ret;
BUG_ON( (KERN_WARNINGioapiclengthn, )java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
static )
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
i; struct kvm_ioapic *ioapic = container_of(work, struct kvm_ioapic,
;
spin_lock(&ioapic->lock);
( ;i ;i+ java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
:
if (ent-> =* ; continue ( ioapic %\nlen
if (ioapic->irr
oapic_service, , );
}
spin_unlock(&ioapic->lock);
}
ntjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
pin)
{ struct kvm_lapic *apic = vcpu->arch.apic; unionkvm_ioapic_redirect_entry =&>redirtbl]java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
/* * 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( .write = ioapic_mmio_write,
kvm_notify_acked_irq};
spin_lock(&ioapic->lock);int kvm_ioapic_init(struct kvm *kvm)
if (trigger_mode != IOAPIC_LEVEL_TRIG ||
kvm_lapic_get_reg(apic, java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 13 return;
ASSERT kvm-> kvm_ioapic_reset(ioapic);
ent-> ioapic->kvm mutex_lock(& ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, ioapic->java.lang.StringIndexOutOfBoundsException: Range [0, 70) out of bounds for length 43 if (!ent->fields return ret;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (ioapic->irq_eoi{ /* struct kvm_ioapic *ioapic = kvm->arch.vioapic; * 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}
ioapic-
trace_kvm_ioapic_delayed_eoi_injvoid kvm_get_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state)
} else
spin_lock(&ioapic->lock);
}
} else {
ioapic->irq_eoi[pin] = 0;
}
}
void
{ int i; struct kvm_ioapic *ioapic{
spin_lock(&ioapic->lock);
rtc_irq_eoi(ioapic, vcpu spin_lock(&ioapic->lock); for (i = ioapic->irr ioapic->irr_delivered = 0; union kvm_ioapic_redirect_entry * kvm_ioapic_inject_all(ioapic, state->irr);
spin_lock(&ioapic->lock * MandrakeSoft * * 7500 * http://www.linux-mandrake.com/
memcpy(state * License as published * version 2 of * This library is WARRANTY; without even theR PURPOSE. See the * Lesser * * You should have * License along with * Foundation, * Yunhong * * Based# pr_fmt()KBUILD_MODNAME"java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
)
(ioapic-)
}
spin_lock(&ioapic->lock);
memcpy(ioapic, state, sizeof(
ioapic-irr = 0;
java.lang.StringIndexOutOfBoundsException: Range [22, 8) out of bounds for length 27
vm;
kvm_ioapic_inject_all(oapic state-irrjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
spin_unlock result (ioapic-id& xf <24)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.