From e6fa298ad00b96fd457c737ec9e100cd3be5f02e Mon Sep 17 00:00:00 2001
From: Dor Laor <[EMAIL PROTECTED]>
Date: Thu, 13 Dec 2007 15:09:54 +0200
Subject: [PATCH] Correct the highest priority order of irq injection
from userspace.
Actually this is not a must here since no more than a single
interrupt should be pending so no matter how we scan the vector should be
good, so it is more for being correct theoretically.
Signed-off-by: Dor Laor <[EMAIL PROTECTED]>
---
drivers/kvm/x86.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index c9e4b67..0fac2a1 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -2638,7 +2638,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu
*vcpu,
struct kvm_sregs *sregs)
{
int mmu_reset_needed = 0;
- int i, pending_vec, max_bits;
+ int i, pending_vec;
struct descriptor_table dt;
vcpu_load(vcpu);
@@ -2684,12 +2684,14 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct
kvm_vcpu *vcpu,
if (vcpu->irq_pending[i])
__set_bit(i, &vcpu->irq_summary);
} else {
- max_bits = (sizeof sregs->interrupt_bitmap) << 3;
- pending_vec = find_first_bit(
- (const unsigned long *)sregs->interrupt_bitmap,
- max_bits);
+ for (i = sizeof sregs->interrupt_bitmap/sizeof(long) - 1;i;i--) {
+ pending_vec = __fls(((unsigned long
*)sregs->interrupt_bitmap)[i]);
+ if (pending_vec) break;
+ }
+
/* Only pending external irq is handled here */
- if (pending_vec < max_bits) {
+ if (pending_vec) {
+ pending_vec += i * BITS_PER_LONG;
kvm_x86_ops->set_irq(vcpu, pending_vec);
pr_debug("Set back pending irq %d\n",
pending_vec);
--
1.5.3.3
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel