[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC][PATCH v2 1/4] kvm: Refactor KVMState::max_gsi to gsi_
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] [RFC][PATCH v2 1/4] kvm: Refactor KVMState::max_gsi to gsi_count |
Date: |
Tue, 3 Apr 2012 09:23:13 +0200 |
From: Jan Kiszka <address@hidden>
Instead of the bitmap size, store the maximum of GSIs the kernel
support. Move the GSI limit assertion to the API function
kvm_irqchip_add_route and make it stricter.
Signed-off-by: Jan Kiszka <address@hidden>
---
kvm-all.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index b8e9dc6..eb0b4c0 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -86,7 +86,7 @@ struct KVMState
struct kvm_irq_routing *irq_routes;
int nr_allocated_irq_routes;
uint32_t *used_gsi_bitmap;
- unsigned int max_gsi;
+ unsigned int gsi_count;
#endif
};
@@ -857,8 +857,6 @@ int kvm_irqchip_set_irq(KVMState *s, int irq, int level)
#ifdef KVM_CAP_IRQ_ROUTING
static void set_gsi(KVMState *s, unsigned int gsi)
{
- assert(gsi < s->max_gsi);
-
s->used_gsi_bitmap[gsi / 32] |= 1U << (gsi % 32);
}
@@ -873,7 +871,7 @@ static void kvm_init_irq_routing(KVMState *s)
/* Round up so we can search ints using ffs */
gsi_bits = ALIGN(gsi_count, 32);
s->used_gsi_bitmap = g_malloc0(gsi_bits / 8);
- s->max_gsi = gsi_bits;
+ s->gsi_count = gsi_count;
/* Mark any over-allocated bits as already in use */
for (i = gsi_count; i < gsi_bits; i++) {
@@ -918,6 +916,8 @@ void kvm_irqchip_add_route(KVMState *s, int irq, int
irqchip, int pin)
{
struct kvm_irq_routing_entry e;
+ assert(pin < s->gsi_count);
+
e.gsi = irq;
e.type = KVM_IRQ_ROUTING_IRQCHIP;
e.flags = 0;
--
1.7.3.4
- [Qemu-devel] [RFC][PATCH v2 0/4] uq/master: Basic MSI support for in-kernel irqchip mode, Jan Kiszka, 2012/04/03
- [Qemu-devel] [RFC][PATCH v2 1/4] kvm: Refactor KVMState::max_gsi to gsi_count,
Jan Kiszka <=
- [Qemu-devel] [RFC][PATCH v2 2/4] kvm: Introduce basic MSI support for in-kernel irqchips, Jan Kiszka, 2012/04/03
- [Qemu-devel] [RFC][PATCH v2 4/4] kvm: Add support for direct MSI injections, Jan Kiszka, 2012/04/03
- [Qemu-devel] [RFC][PATCH v2 3/4] KVM: x86: Wire up MSI support for in-kernel irqchip, Jan Kiszka, 2012/04/03
- Re: [Qemu-devel] [RFC][PATCH v2 0/4] uq/master: Basic MSI support for in-kernel irqchip mode, Michael S. Tsirkin, 2012/04/03
- Re: [Qemu-devel] [RFC][PATCH v2 0/4] uq/master: Basic MSI support for in-kernel irqchip mode, Jan Kiszka, 2012/04/03