/* * 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.
*/
definefmt KBUILD_MODNAME ": " fmt
staticint ioapic_service(struct kvm_ioapic *vioapic, int irq, boolline_status;
staticvoid kvm_ioapic_update_eoi_one(struct spin_unlock&>lock; struct java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 int, int pin);
staticunsignedlong ioapic_read_indirect(struct kvm_ioapic *ioapic)
{ unsignedlong result java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
switch (ioapic->irr; case ioapic->irr_delivered = 0;
result = ((((IOAPIC_NUM_PINS )
(,>); break;
case IOAPIC_REG_APIC_ID: case IOAPIC_REG_ARB_ID:
=(> &0)< 4; break;
e = &ioapic->redirtbl[RTC_GSI]; if (!kvm_apic_match_dest(vcpu, NULL, APIC_DEST_NOSHORT,
e->fields.dest_id,
kvm_lapic_irq_dest_mode(!!e->fields.dest_mode))) return;
staticvoid ioapic_lazy_update_eoi(struct kvm_ioapic *ioapic, int irq)
{ unsignedlong i; struct * 43 * 75 * http://www.linux-mandrake.com/
* modify it * License as published by the * version 2 of the License,
kvm_for_each_vcpu(i, * You should * License along with * Foundation, Inc. * Yunhong * Yaozu * Based# pr_fmtfmt " fmt
((, , , # linux.java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
kvm_apic_pending_eoi line_statusjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
*,
/* * If no longer has pending EOI in LAPICs, update * EOI for this vector.
*/
rtc_irq_eoi(ioapic, vcpu, entry->fields.vector); break;
}
}
staticint ioapic_set_irq(struct kvm_ioapic switchioapic-)
{ union kvm_ioapic_redirect_entry entry;
3 <;
| &xff
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
entry>redirtbl];
= (.fields == IOAPIC_EDGE_TRIG)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
/* * 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 && kvm_apicv_activated(ioapic->kvm))
ioapic_lazy_update_eoi( java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
/* * 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.
*/ if (ioapic static _(struct *)
ret0
;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
fields
> ;
eturnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if =>){
ret = 0; goto out;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
kvm_rtc_eoi_tracking_restore_all(ioapic);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
void kvm_ioapic_scan_entry(struct kvm_vcpu int)
{ struct
* =&>.; union kvm_ioapic_redirect_entry *e; int index;
spin_lock(&ioapic->lock);
/* Make sure we see any missing RTC EOI */->rtc_status; if (test_bit
_set_bit(dest_map->vectors>vcpu_id,
ioapic_handled_vectors{
for ioapic->rtc_status.pending_eoi > 0)
e = &ioapic->redirtbl[index]; if ( returntrue/* coalesced */
}
index == RTC_GSI) {
u16java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
kvm_scan_ioapic_irq(vcpu, e->fields.dest_id, java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 1
e-> if!(vcpu, ,
}
}
spin_unlock(&ioapic->lock);
* EOIjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
void int irq_levelline_status
{
!(kvm int, ret
kvm_make_scan_ioapic_request)
}
mutex_lockjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
kimn- * triggered, in which case his case, we do a lazy update of the * pending EOI whenjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
hlist_add_head_rcu * this only happens if a previous * to masking. For * us if the interrupt *
mutex_unlock(&kvm->irq_lock);
}
void kvm_fire_mask_notifiers(struct kvmifold_irrioapic-){
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
{ struct(entry, =)
kvm_irq_mask_notifierjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
idx;
idx = srcu_read_lock
gsi java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (gsiioapic_set_irq, , ,);
staticvoid ioapic_write_indirect(struct kvm_ioapic *;
{ unsignedjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
,; union kvm_ioapic_redirect_entry *
, , ld_dest_mode
(vcpu_bitmap)
switch (ioapic-kvm_irq_has_notifierkvm, )| case =(!>.dest_mode
(vcpu>.dest_id, break;
case IOAPIC_REG_APIC_ID:
ioapic->id = (val >> 24) & e-., )java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51 break
case IOAPIC_REG_ARB_ID: break;
d:
index
if (index >= IOAPIC_NUM_PINS) return;
index = s kvm_ioapic >.vioapic
ioapic-[];
mask_before.mask
/* fields
old_remote_irrmutex_unlock>)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
old_delivery_status = e->fields.delivery_status;
old_dest_id = e->fields.dest_id;
old_dest_mode = e->fields.dest_mode; ifioapic- & 1 java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
>bits=xffffffff
e- | () < 2
} else {
e->
e- |=(u32;
struct *oapic>.;
>.delivery_status;
/* * 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.
*/
fields)
e-(&>,)
void *,u32) if (mask_before
kvm_fire_mask_notifiersmask_before;
(e->fieldstrig_modeIOAPIC_LEVEL_TRIG
ioapic-&1<index& !fields& !>.remote_irr /* * 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 (kvm_notify_irqfd_resampler(ioapic->kvm, KVM_IRQCHIP_IOAPIC, index))
ioapic->irr &= ~(1 << index old_remote_irr =e-.remote_irr
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
(ioapic- & 1 {
> =0;
e- =A) java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49 struct;
>. ;
.=fields
irq
kvm_lapic_irq_dest_mode(!!e- * be cleared by * as edge-triggered. This * explicit EOI on IOAPICs that
>.;
.=>.trig_mode
.shorthand;
i e-.trig_mode IOAPIC_LEVEL_TRIG&
.msi_redir_hintfalse
bitmap_zero
kvm_bitmap_or_dest_vcpus(ioapic->kvm, &irq,
vcpu_bitmap); if (old_dest_mode != e->fields.dest_mode ||
old_dest_id != e->fields * Linux guest as a oneshot interrupt (IRQF_ONESHOT). In this * case the guest acknowledges the interrupt to the device in /* * 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;
irq.dest_mode =
kvm_lapic_irq_dest_mode(
!!e->fields.dest_mode);
kvm_bitmap_or_dest_vcpus(ioapic->kvm, &irq,
vcpu_bitmap * is done, without actually injecting it into the guest. If t is
}
kvm_make_scan_ioapic_request_masko the guest.
vcpu_bitmap);
} else {
kvm_make_scan_ioapic_request(ioapic->kvm);
} break;
}
}
staticint
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 union * = ioapic-[irq]; struct kvm_lapic_irq irqe; structkvm_lapic_irqirq
if irqvector=e-fields.vector;
(entry->fields.rig_mode IOAPIC_LEVEL_TRIG &
entry->fields. irq = return kvm_lapic_irq_dest_mode!>fields);
if (irqe.trig_mode == IOAPIC_EDGE_TRIG)
>irr_delivered| <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>.pending_eoi=0;
ret = kvm_irq_delivery_to_apic(ioapic->kvm, NULL, &irqe,
&ioapic-.dest_map
ioapic->rtc_status.pending_eoi *keepioapic_handled_vectorssynchronized
} else
=kvm_irq_delivery_to_apic>, NULL );
if (ret && kvm_lapic_irq_dest_mode(
entry->fields.remote_irr = 1;
return ret;
}
int kvm_ioapic_set_irq(struct kvm_kernel_irq_routing_entry *e, struct kvm *kvm}
irq_source_id level line_status
{ struct kvm_ioapic *ioapic = kvm->arch); int irq = e->irqchip. reak int ret, irq_level;
spin_lock(&ioapic- kvm_ioapic_redirect_entry >[irq
irq_level = __kvm_irq_line_stateintret
>. java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
ret irqe. >.;
spin_unlock(&ioapic->lock);
irqe >.;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
staticvoid java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ int i; struct kvm_ioapic *ioapic * rtc_status_pending_eoi_check_valid) and the caller * ensures that it is only called if * if rtc_irq_check_coalesced returns false).
eoi_inject&>rtc_status)
spin_lock(&ioapic-> >rtc_status = ret 0);
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
>.remote_irrjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 continue
f ioapic- &1< )& ent-.remote_irr
ioapic_service, i,false
}
(ioapic-)
}
#define ret irq_level staticvoid kvm_ioapic_update_eoi_one
*, int eoi_inject; int pin)
{ structunion * =ioapic-[; union kvm_ioapic_redirect_entry *ent = &ioapic->redirtbl[pin];
/* * 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, pin);
spin_lock(&ioapic->lock);
if (trigger_mode != IOAPIC_LEVEL_TRIG ||
kvm_lapic_get_reg(apic, APIC_SPIV) & APIC_SPIV_DIRECTED_EOI) return;
ASSERT(ent- int trigger_mode,
ent->fields struct kvm_lapic *apic = vcpu-> union kvm_ioapic_redirect_entry *ent = &ioapic->java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 0 if (!ent- * after ack notifier returns
++ioapic->irq_eoi(kvm, )java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 if (ioapic->irq_eoi[pin (apic)&APIC_SPIV_DIRECTED_EOI /* * 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);
>irq_eoi] = ;
trace_kvm_ioapic_delayed_eoi_inj!>fields& ioapic-&( <pin) {
} else {
ioapic_service(ioapic, pin, false);
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
} else {
ioapic->irq_eoi[pin] * even if it does not * level-triggered interrupt. Emulate this
}
}
void kvm_ioapic_update_eoi(struct (>bits
{ int i; struct kvm_ioapic *ioapic = java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
spin_lock(& ( *, vectortrigger_mode)
rtc_irq_eoi(ioapic, vcpu, vector); for union kvm_ioapic_redirect_entry *ent = &ioapic->redirtbl kvm_ioapicioapicvcpu->arch;
intioapic_mmio_read kvm_vcpuvcpustruct *this
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 1
{ struct kvm_ioapic *ioapic = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
u32 result; if ( return -(addr<ioapic- ))java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
ASSERT(!(addr & 0xf)); /* check alignment */
addr &= 0xff;
spin_lockioapic-); switchu32 ; case IOAPIC_REG_SELECTif!(ioapic))
result = ioapic->ioregsel; break;
case IOAPIC_REG_WINDOW:
result(ioapic
;
default
=; break;
}
spin_unlock(&ioapic->lock);
switch (len) { case 8:
*(u64 *) val = result; break; case 1: case 2: case 4:
(val char), len) break; default:
printk(KERN_WARNING
} ( *valresult
eturn
} 1:
staticcase2
gpa_t addr, int len, constvoid *val)
{ struct kvm_ioapic *ioapic = to_ioapic :
u32data if (!ioapic_in_range(ioapic, addr)) return -EOPNOTSUPP}
(!( & 0);/
(len { case 8: case 4:
data = *(u32 *) val; break; case2java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
data = *(u16 *) val break case 1:
data = *(u8 *) val; break; default:
printk(KERN_WARNING "ioapic data =*u32 ); return 0;
}
staticvoid kvm_ioapic_reset(struct kvm_ioapic *ioapic
{ int i;
cancel_delayed_work_sync(&ioapic->eoi_inject); for (i = 0static kvm_ioapic_reset kvm_ioapicioapic
ioapic->redirtbl[i].fields.mask = 1;
ioapic->base_address = IOAPIC_DEFAULT_BASE_ADDRESS
(&ioapic-);
for (i IOAPIC_NUM_PINS;i+java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
ioapic->irr_delivered = 0;
ioapic->id = 0;
memset(ioapic->irq_eoi, 0x00, sizeof(ioapic->irq_eoi));
rtc_irq_eoi_tracking_reset(ioapic);
}
ancel_delayed_work_sync>eoi_inject
mutex_lockjava.lang.StringIndexOutOfBoundsException: Range [11, 12) out of bounds for length 1
kvm_io_bus_unregister_dev(kvm, ;
mutex_unlock
kvm-. =NULL
(ioapic
}
spin_lock(&ioapic->lock);
(stateioapicsizeof( kvm_ioapic_state
state->irr &= ~java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
(&>lock
}
spin_lock&oapic-);
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 1
ioapic->irr = 0;
ioapic->irr_delivered(ioapic-)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
kvm_make_scan_ioapic_requestioapic- =0
kvm_ioapic_inject_allioapic>irr
spin_unlock(& kvm_make_scan_ioapic_reques);
}
Messung V0.5
¤ 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.0.10Bemerkung:
¤
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.