void kvm_init_irq_routing(KVMState *s)

{

    int gsi_count, i;



    gsi_count = kvm_check_extension(s, KVM_CAP_IRQ_ROUTING);

    if (gsi_count > 0) {

        unsigned int gsi_bits, i;



        /* 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->gsi_count = gsi_count;



        /* Mark any over-allocated bits as already in use */

        for (i = gsi_count; i < gsi_bits; i++) {

            set_gsi(s, i);

        }

    }



    s->irq_routes = g_malloc0(sizeof(*s->irq_routes));

    s->nr_allocated_irq_routes = 0;



    if (!s->direct_msi) {

        for (i = 0; i < KVM_MSI_HASHTAB_SIZE; i++) {

            QTAILQ_INIT(&s->msi_hashtab[i]);

        }

    }



    kvm_arch_init_irq_routing(s);

}

void kvm_init_irq_routing(KVMState *s)

{

    int gsi_count, i;



    gsi_count = kvm_check_extension(s, KVM_CAP_IRQ_ROUTING);

    if (gsi_count > 0) {

        unsigned int gsi_bits, i;



        

        gsi_bits = ALIGN(gsi_count, 32);

        s->used_gsi_bitmap = g_malloc0(gsi_bits / 8);

        s->gsi_count = gsi_count;



        

        for (i = gsi_count; i < gsi_bits; i++) {

            set_gsi(s, i);

        }

    }



    s->irq_routes = g_malloc0(sizeof(*s->irq_routes));

    s->nr_allocated_irq_routes = 0;



    if (!s->direct_msi) {

        for (i = 0; i < KVM_MSI_HASHTAB_SIZE; i++) {

            QTAILQ_INIT(&s->msi_hashtab[i]);

        }

    }



    kvm_arch_init_irq_routing(s);

}

void FUNC_0(KVMState *VAR_0)

{

    int VAR_1, VAR_4;



    VAR_1 = kvm_check_extension(VAR_0, KVM_CAP_IRQ_ROUTING);

    if (VAR_1 > 0) {

        unsigned int VAR_3, VAR_4;



        

        VAR_3 = ALIGN(VAR_1, 32);

        VAR_0->used_gsi_bitmap = g_malloc0(VAR_3 / 8);

        VAR_0->VAR_1 = VAR_1;



        

        for (VAR_4 = VAR_1; VAR_4 < VAR_3; VAR_4++) {

            set_gsi(VAR_0, VAR_4);

        }

    }



    VAR_0->irq_routes = g_malloc0(sizeof(*VAR_0->irq_routes));

    VAR_0->nr_allocated_irq_routes = 0;



    if (!VAR_0->direct_msi) {

        for (VAR_4 = 0; VAR_4 < KVM_MSI_HASHTAB_SIZE; VAR_4++) {

            QTAILQ_INIT(&VAR_0->msi_hashtab[VAR_4]);

        }

    }



    kvm_arch_init_irq_routing(VAR_0);

}

void FUNC_0(KVMState *VAR_0)
{ int VAR_1, VAR_4; VAR_1 = kvm_check_extension(VAR_0, KVM_CAP_IRQ_ROUTING); if (VAR_1 > 0) { unsigned int VAR_3, VAR_4; VAR_3 = ALIGN(VAR_1, 32); VAR_0->used_gsi_bitmap = g_malloc0(VAR_3 / 8); VAR_0->VAR_1 = VAR_1; for (VAR_4 = VAR_1; VAR_4 < VAR_3; VAR_4++) { set_gsi(VAR_0, VAR_4); } } VAR_0->irq_routes = g_malloc0(sizeof(*VAR_0->irq_routes)); VAR_0->nr_allocated_irq_routes = 0; if (!VAR_0->direct_msi) { for (VAR_4 = 0; VAR_4 < KVM_MSI_HASHTAB_SIZE; VAR_4++) { QTAILQ_INIT(&VAR_0->msi_hashtab[VAR_4]); } } kvm_arch_init_irq_routing(VAR_0); }