1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * ARM Generic Interrupt Controller (GIC) specific defines 4 */ 5 6 #ifndef SELFTEST_KVM_GIC_H 7 #define SELFTEST_KVM_GIC_H 8 9 #include <asm/kvm.h> 10 11 enum gic_type { 12 GIC_V3, 13 GIC_TYPE_MAX, 14 }; 15 16 /* 17 * Note that the redistributor frames are at the end, as the range scales 18 * with the number of vCPUs in the VM. 19 */ 20 #define GITS_BASE_GPA 0x8000000ULL 21 #define GICD_BASE_GPA (GITS_BASE_GPA + KVM_VGIC_V3_ITS_SIZE) 22 #define GICR_BASE_GPA (GICD_BASE_GPA + KVM_VGIC_V3_DIST_SIZE) 23 24 /* The GIC is identity-mapped into the guest at the time of setup. */ 25 #define GITS_BASE_GVA ((volatile void *)GITS_BASE_GPA) 26 #define GICD_BASE_GVA ((volatile void *)GICD_BASE_GPA) 27 #define GICR_BASE_GVA ((volatile void *)GICR_BASE_GPA) 28 29 #define MIN_SGI 0 30 #define MIN_PPI 16 31 #define MIN_SPI 32 32 #define MAX_SPI 1019 33 #define IAR_SPURIOUS 1023 34 35 #define INTID_IS_SGI(intid) (0 <= (intid) && (intid) < MIN_PPI) 36 #define INTID_IS_PPI(intid) (MIN_PPI <= (intid) && (intid) < MIN_SPI) 37 #define INTID_IS_SPI(intid) (MIN_SPI <= (intid) && (intid) <= MAX_SPI) 38 39 void gic_init(enum gic_type type, unsigned int nr_cpus); 40 void gic_irq_enable(unsigned int intid); 41 void gic_irq_disable(unsigned int intid); 42 unsigned int gic_get_and_ack_irq(void); 43 void gic_set_eoi(unsigned int intid); 44 void gic_set_dir(unsigned int intid); 45 46 /* 47 * Sets the EOI mode. When split is false, EOI just drops the priority. When 48 * split is true, EOI drops the priority and deactivates the interrupt. 49 */ 50 void gic_set_eoi_split(bool split); 51 void gic_set_priority_mask(uint64_t mask); 52 void gic_set_priority(uint32_t intid, uint32_t prio); 53 void gic_irq_set_active(unsigned int intid); 54 void gic_irq_clear_active(unsigned int intid); 55 bool gic_irq_get_active(unsigned int intid); 56 void gic_irq_set_pending(unsigned int intid); 57 void gic_irq_clear_pending(unsigned int intid); 58 bool gic_irq_get_pending(unsigned int intid); 59 void gic_irq_set_config(unsigned int intid, bool is_edge); 60 61 void gic_rdist_enable_lpis(vm_paddr_t cfg_table, size_t cfg_table_size, 62 vm_paddr_t pend_table); 63 64 #endif /* SELFTEST_KVM_GIC_H */ 65
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.