]>
git.proxmox.com Git - qemu.git/blob - hw/arm/pic_cpu.c
2 * Generic ARM Programmable Interrupt Controller support.
4 * Copyright (c) 2006 CodeSourcery.
5 * Written by Paul Brook
7 * This code is licensed under the LGPL
11 #include "hw/arm-misc.h"
12 #include "sysemu/kvm.h"
14 /* Input 0 is IRQ and input 1 is FIQ. */
15 static void arm_pic_cpu_handler(void *opaque
, int irq
, int level
)
18 CPUARMState
*env
= &cpu
->env
;
23 cpu_interrupt(env
, CPU_INTERRUPT_HARD
);
25 cpu_reset_interrupt(env
, CPU_INTERRUPT_HARD
);
29 cpu_interrupt(env
, CPU_INTERRUPT_FIQ
);
31 cpu_reset_interrupt(env
, CPU_INTERRUPT_FIQ
);
34 hw_error("arm_pic_cpu_handler: Bad interrupt line %d\n", irq
);
38 static void kvm_arm_pic_cpu_handler(void *opaque
, int irq
, int level
)
42 CPUState
*cs
= CPU(cpu
);
43 int kvm_irq
= KVM_ARM_IRQ_TYPE_CPU
<< KVM_ARM_IRQ_TYPE_SHIFT
;
47 kvm_irq
|= KVM_ARM_IRQ_CPU_IRQ
;
50 kvm_irq
|= KVM_ARM_IRQ_CPU_FIQ
;
53 hw_error("kvm_arm_pic_cpu_handler: Bad interrupt line %d\n", irq
);
55 kvm_irq
|= cs
->cpu_index
<< KVM_ARM_IRQ_VCPU_SHIFT
;
56 kvm_set_irq(kvm_state
, kvm_irq
, level
? 1 : 0);
60 qemu_irq
*arm_pic_init_cpu(ARMCPU
*cpu
)
63 return qemu_allocate_irqs(kvm_arm_pic_cpu_handler
, cpu
, 2);
65 return qemu_allocate_irqs(arm_pic_cpu_handler
, cpu
, 2);