khypervisor
v1
|
00001 #ifndef __VGIC_H__ 00002 #define __VGIC_H__ 00003 #include "arch_types.h" 00004 #include "hvmm_types.h" 00005 00006 #define VGIC_NUM_MAX_SLOTS 64 00007 #define VGIC_SLOT_NOTFOUND (0xFFFFFFFF) 00008 00009 typedef enum { 00010 VIRQ_STATE_INACTIVE = 0x00, 00011 VIRQ_STATE_PENDING = 0x01, 00012 VIRQ_STATE_ACTIVE = 0x02, 00013 VIRQ_STATE_PENDING_ACTIVE = 0x03, 00014 } virq_state_t; 00015 00016 struct vgic_status { 00017 uint32_t saved_once; /* restore only if saved once to avoid dealing with corrupted data */ 00018 uint32_t lr[64]; 00019 uint32_t hcr; 00020 uint32_t apr; 00021 uint32_t vmcr; 00022 }; 00023 00024 hvmm_status_t vgic_enable(uint8_t enable); 00025 hvmm_status_t vgic_init(void); 00026 hvmm_status_t vgic_init_status( struct vgic_status *status, vmid_t vmid ); 00027 hvmm_status_t vgic_save_status( struct vgic_status *status, vmid_t vmid ); 00028 hvmm_status_t vgic_restore_status( struct vgic_status *status, vmid_t vmid ); 00029 hvmm_status_t vgic_flush_virqs(vmid_t vmid); 00030 /* returns slot index if successful, VGIC_SLOT_NOTFOUND otherwise */ 00031 uint32_t vgic_inject_virq_sw( uint32_t virq, virq_state_t state, uint32_t priority, 00032 uint32_t cpuid, uint8_t maintenance); 00033 /* returns slot index if successful, VGIC_SLOT_NOTFOUND otherwise */ 00034 uint32_t vgic_inject_virq_hw( uint32_t virq, virq_state_t state, uint32_t priority, uint32_t pirq); 00035 uint32_t vgic_inject_virq( uint32_t virq, uint32_t slot, virq_state_t state, uint32_t priority, 00036 uint8_t hw, uint32_t physrc, uint8_t maintenance ); 00037 hvmm_status_t vgic_setcallback_virq_flush(void (*callback)(vmid_t vmid)); 00038 #endif