| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2016,2017 ARM Limited, All Rights Reserved. |
|---|
| 3 | 4 | * 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 | 5 | */ |
|---|
| 17 | 6 | |
|---|
| 18 | 7 | #ifndef __LINUX_IRQCHIP_ARM_GIC_V4_H |
|---|
| .. | .. |
|---|
| 43 | 32 | struct its_vpe { |
|---|
| 44 | 33 | struct page *vpt_page; |
|---|
| 45 | 34 | struct its_vm *its_vm; |
|---|
| 35 | + /* per-vPE VLPI tracking */ |
|---|
| 36 | + atomic_t vlpi_count; |
|---|
| 46 | 37 | /* Doorbell interrupt */ |
|---|
| 47 | 38 | int irq; |
|---|
| 48 | 39 | irq_hw_number_t vpe_db_lpi; |
|---|
| 49 | | - /* VPE proxy mapping */ |
|---|
| 50 | | - int vpe_proxy_event; |
|---|
| 40 | + /* VPE resident */ |
|---|
| 41 | + bool resident; |
|---|
| 42 | + /* VPT parse complete */ |
|---|
| 43 | + bool ready; |
|---|
| 44 | + union { |
|---|
| 45 | + /* GICv4.0 implementations */ |
|---|
| 46 | + struct { |
|---|
| 47 | + /* VPE proxy mapping */ |
|---|
| 48 | + int vpe_proxy_event; |
|---|
| 49 | + /* Implementation Defined Area Invalid */ |
|---|
| 50 | + bool idai; |
|---|
| 51 | + }; |
|---|
| 52 | + /* GICv4.1 implementations */ |
|---|
| 53 | + struct { |
|---|
| 54 | + struct fwnode_handle *fwnode; |
|---|
| 55 | + struct irq_domain *sgi_domain; |
|---|
| 56 | + struct { |
|---|
| 57 | + u8 priority; |
|---|
| 58 | + bool enabled; |
|---|
| 59 | + bool group; |
|---|
| 60 | + } sgi_config[16]; |
|---|
| 61 | + atomic_t vmapp_count; |
|---|
| 62 | + }; |
|---|
| 63 | + }; |
|---|
| 64 | + |
|---|
| 65 | + /* |
|---|
| 66 | + * Ensures mutual exclusion between affinity setting of the |
|---|
| 67 | + * vPE and vLPI operations using vpe->col_idx. |
|---|
| 68 | + */ |
|---|
| 69 | + raw_spinlock_t vpe_lock; |
|---|
| 51 | 70 | /* |
|---|
| 52 | 71 | * This collection ID is used to indirect the target |
|---|
| 53 | 72 | * redistributor for this VPE. The ID itself isn't involved in |
|---|
| .. | .. |
|---|
| 56 | 75 | u16 col_idx; |
|---|
| 57 | 76 | /* Unique (system-wide) VPE identifier */ |
|---|
| 58 | 77 | u16 vpe_id; |
|---|
| 59 | | - /* Implementation Defined Area Invalid */ |
|---|
| 60 | | - bool idai; |
|---|
| 61 | 78 | /* Pending VLPIs on schedule out? */ |
|---|
| 62 | 79 | bool pending_last; |
|---|
| 63 | 80 | }; |
|---|
| .. | .. |
|---|
| 89 | 106 | PROP_UPDATE_AND_INV_VLPI, |
|---|
| 90 | 107 | SCHEDULE_VPE, |
|---|
| 91 | 108 | DESCHEDULE_VPE, |
|---|
| 109 | + COMMIT_VPE, |
|---|
| 92 | 110 | INVALL_VPE, |
|---|
| 111 | + PROP_UPDATE_VSGI, |
|---|
| 93 | 112 | }; |
|---|
| 94 | 113 | |
|---|
| 95 | 114 | struct its_cmd_info { |
|---|
| .. | .. |
|---|
| 97 | 116 | union { |
|---|
| 98 | 117 | struct its_vlpi_map *map; |
|---|
| 99 | 118 | u8 config; |
|---|
| 119 | + bool req_db; |
|---|
| 120 | + struct { |
|---|
| 121 | + bool g0en; |
|---|
| 122 | + bool g1en; |
|---|
| 123 | + }; |
|---|
| 124 | + struct { |
|---|
| 125 | + u8 priority; |
|---|
| 126 | + bool group; |
|---|
| 127 | + }; |
|---|
| 100 | 128 | }; |
|---|
| 101 | 129 | }; |
|---|
| 102 | 130 | |
|---|
| 103 | 131 | int its_alloc_vcpu_irqs(struct its_vm *vm); |
|---|
| 104 | 132 | void its_free_vcpu_irqs(struct its_vm *vm); |
|---|
| 105 | | -int its_schedule_vpe(struct its_vpe *vpe, bool on); |
|---|
| 133 | +int its_make_vpe_resident(struct its_vpe *vpe, bool g0en, bool g1en); |
|---|
| 134 | +int its_make_vpe_non_resident(struct its_vpe *vpe, bool db); |
|---|
| 135 | +int its_commit_vpe(struct its_vpe *vpe); |
|---|
| 106 | 136 | int its_invall_vpe(struct its_vpe *vpe); |
|---|
| 107 | 137 | int its_map_vlpi(int irq, struct its_vlpi_map *map); |
|---|
| 108 | 138 | int its_get_vlpi(int irq, struct its_vlpi_map *map); |
|---|
| 109 | 139 | int its_unmap_vlpi(int irq); |
|---|
| 110 | 140 | int its_prop_update_vlpi(int irq, u8 config, bool inv); |
|---|
| 141 | +int its_prop_update_vsgi(int irq, u8 priority, bool group); |
|---|
| 111 | 142 | |
|---|
| 112 | 143 | struct irq_domain_ops; |
|---|
| 113 | | -int its_init_v4(struct irq_domain *domain, const struct irq_domain_ops *ops); |
|---|
| 144 | +int its_init_v4(struct irq_domain *domain, |
|---|
| 145 | + const struct irq_domain_ops *vpe_ops, |
|---|
| 146 | + const struct irq_domain_ops *sgi_ops); |
|---|
| 114 | 147 | |
|---|
| 115 | 148 | #endif |
|---|