Path: blob/master/tools/testing/selftests/kvm/include/arm64/gic.h
50868 views
/* SPDX-License-Identifier: GPL-2.0 */1/*2* ARM Generic Interrupt Controller (GIC) specific defines3*/45#ifndef SELFTEST_KVM_GIC_H6#define SELFTEST_KVM_GIC_H78#include <asm/kvm.h>910enum gic_type {11GIC_V3,12GIC_TYPE_MAX,13};1415/*16* Note that the redistributor frames are at the end, as the range scales17* with the number of vCPUs in the VM.18*/19#define GITS_BASE_GPA 0x8000000ULL20#define GICD_BASE_GPA (GITS_BASE_GPA + KVM_VGIC_V3_ITS_SIZE)21#define GICR_BASE_GPA (GICD_BASE_GPA + KVM_VGIC_V3_DIST_SIZE)2223/* The GIC is identity-mapped into the guest at the time of setup. */24#define GITS_BASE_GVA ((volatile void *)GITS_BASE_GPA)25#define GICD_BASE_GVA ((volatile void *)GICD_BASE_GPA)26#define GICR_BASE_GVA ((volatile void *)GICR_BASE_GPA)2728#define MIN_SGI 029#define MIN_PPI 1630#define MIN_SPI 3231#define MAX_SPI 101932#define IAR_SPURIOUS 10233334#define INTID_IS_SGI(intid) (0 <= (intid) && (intid) < MIN_PPI)35#define INTID_IS_PPI(intid) (MIN_PPI <= (intid) && (intid) < MIN_SPI)36#define INTID_IS_SPI(intid) (MIN_SPI <= (intid) && (intid) <= MAX_SPI)3738void gic_init(enum gic_type type, unsigned int nr_cpus);39void gic_irq_enable(unsigned int intid);40void gic_irq_disable(unsigned int intid);41unsigned int gic_get_and_ack_irq(void);42void gic_set_eoi(unsigned int intid);43void gic_set_dir(unsigned int intid);4445/*46* Sets the EOI mode. When split is false, EOI just drops the priority. When47* split is true, EOI drops the priority and deactivates the interrupt.48*/49void gic_set_eoi_split(bool split);50void gic_set_priority_mask(uint64_t mask);51void gic_set_priority(uint32_t intid, uint32_t prio);52void gic_irq_set_active(unsigned int intid);53void gic_irq_clear_active(unsigned int intid);54bool gic_irq_get_active(unsigned int intid);55void gic_irq_set_pending(unsigned int intid);56void gic_irq_clear_pending(unsigned int intid);57bool gic_irq_get_pending(unsigned int intid);58void gic_irq_set_config(unsigned int intid, bool is_edge);59void gic_irq_set_group(unsigned int intid, bool group);6061void gic_rdist_enable_lpis(vm_paddr_t cfg_table, size_t cfg_table_size,62vm_paddr_t pend_table);6364#endif /* SELFTEST_KVM_GIC_H */656667