brintos

brintos / linux-shallow public Read only

0
0
Text · 2.0 KiB · baeb3c8 Raw
65 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2/*3 * ARM Generic Interrupt Controller (GIC) specific defines4 */5 6#ifndef SELFTEST_KVM_GIC_H7#define SELFTEST_KVM_GIC_H8 9#include <asm/kvm.h>10 11enum 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 scales18 * with the number of vCPUs in the VM.19 */20#define GITS_BASE_GPA		0x8000000ULL21#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			030#define MIN_PPI			1631#define MIN_SPI			3232#define MAX_SPI			101933#define IAR_SPURIOUS		102334 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 39void gic_init(enum gic_type type, unsigned int nr_cpus);40void gic_irq_enable(unsigned int intid);41void gic_irq_disable(unsigned int intid);42unsigned int gic_get_and_ack_irq(void);43void gic_set_eoi(unsigned int intid);44void gic_set_dir(unsigned int intid);45 46/*47 * Sets the EOI mode. When split is false, EOI just drops the priority. When48 * split is true, EOI drops the priority and deactivates the interrupt.49 */50void gic_set_eoi_split(bool split);51void gic_set_priority_mask(uint64_t mask);52void gic_set_priority(uint32_t intid, uint32_t prio);53void gic_irq_set_active(unsigned int intid);54void gic_irq_clear_active(unsigned int intid);55bool gic_irq_get_active(unsigned int intid);56void gic_irq_set_pending(unsigned int intid);57void gic_irq_clear_pending(unsigned int intid);58bool gic_irq_get_pending(unsigned int intid);59void gic_irq_set_config(unsigned int intid, bool is_edge);60 61void 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