|
| 1 | +/* |
| 2 | + * Copyright (C) 2016,2017 ARM Limited, All Rights Reserved. |
| 3 | + * Author: Marc Zyngier <marc.zyngier@arm.com> |
| 4 | + * |
| 5 | + * This program is free software; you can redistribute it and/or modify |
| 6 | + * it under the terms of the GNU General Public License version 2 as |
| 7 | + * published by the Free Software Foundation. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | + |
| 18 | +#ifndef __LINUX_IRQCHIP_ARM_GIC_V4_H |
| 19 | +#define __LINUX_IRQCHIP_ARM_GIC_V4_H |
| 20 | + |
| 21 | +struct its_vpe; |
| 22 | + |
| 23 | +/* Embedded in kvm.arch */ |
| 24 | +struct its_vm { |
| 25 | + struct fwnode_handle *fwnode; |
| 26 | + struct irq_domain *domain; |
| 27 | + struct page *vprop_page; |
| 28 | + struct its_vpe **vpes; |
| 29 | + int nr_vpes; |
| 30 | + irq_hw_number_t db_lpi_base; |
| 31 | + unsigned long *db_bitmap; |
| 32 | + int nr_db_lpis; |
| 33 | +}; |
| 34 | + |
| 35 | +/* Embedded in kvm_vcpu.arch */ |
| 36 | +struct its_vpe { |
| 37 | + struct page *vpt_page; |
| 38 | + struct its_vm *its_vm; |
| 39 | + /* Doorbell interrupt */ |
| 40 | + int irq; |
| 41 | + irq_hw_number_t vpe_db_lpi; |
| 42 | + /* |
| 43 | + * This collection ID is used to indirect the target |
| 44 | + * redistributor for this VPE. The ID itself isn't involved in |
| 45 | + * programming of the ITS. |
| 46 | + */ |
| 47 | + u16 col_idx; |
| 48 | + /* Unique (system-wide) VPE identifier */ |
| 49 | + u16 vpe_id; |
| 50 | + /* Implementation Defined Area Invalid */ |
| 51 | + bool idai; |
| 52 | + /* Pending VLPIs on schedule out? */ |
| 53 | + bool pending_last; |
| 54 | +}; |
| 55 | + |
| 56 | +/* |
| 57 | + * struct its_vlpi_map: structure describing the mapping of a |
| 58 | + * VLPI. Only to be interpreted in the context of a physical interrupt |
| 59 | + * it complements. To be used as the vcpu_info passed to |
| 60 | + * irq_set_vcpu_affinity(). |
| 61 | + * |
| 62 | + * @vm: Pointer to the GICv4 notion of a VM |
| 63 | + * @vpe: Pointer to the GICv4 notion of a virtual CPU (VPE) |
| 64 | + * @vintid: Virtual LPI number |
| 65 | + * @db_enabled: Is the VPE doorbell to be generated? |
| 66 | + */ |
| 67 | +struct its_vlpi_map { |
| 68 | + struct its_vm *vm; |
| 69 | + struct its_vpe *vpe; |
| 70 | + u32 vintid; |
| 71 | + bool db_enabled; |
| 72 | +}; |
| 73 | + |
| 74 | +enum its_vcpu_info_cmd_type { |
| 75 | + MAP_VLPI, |
| 76 | + GET_VLPI, |
| 77 | + PROP_UPDATE_VLPI, |
| 78 | + PROP_UPDATE_AND_INV_VLPI, |
| 79 | + SCHEDULE_VPE, |
| 80 | + DESCHEDULE_VPE, |
| 81 | + INVALL_VPE, |
| 82 | +}; |
| 83 | + |
| 84 | +struct its_cmd_info { |
| 85 | + enum its_vcpu_info_cmd_type cmd_type; |
| 86 | + union { |
| 87 | + struct its_vlpi_map *map; |
| 88 | + u8 config; |
| 89 | + }; |
| 90 | +}; |
| 91 | + |
| 92 | +#endif |
0 commit comments