| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2015, 2016 ARM Ltd. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 6 | | - * published by the Free Software Foundation. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 9 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 10 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 11 | | - * GNU General Public License for more details. |
|---|
| 12 | | - * |
|---|
| 13 | | - * You should have received a copy of the GNU General Public License |
|---|
| 14 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 15 | 4 | */ |
|---|
| 16 | 5 | #ifndef __KVM_ARM_VGIC_H |
|---|
| 17 | 6 | #define __KVM_ARM_VGIC_H |
|---|
| .. | .. |
|---|
| 81 | 70 | |
|---|
| 82 | 71 | /* Hardware has GICv4? */ |
|---|
| 83 | 72 | bool has_gicv4; |
|---|
| 73 | + bool has_gicv4_1; |
|---|
| 84 | 74 | |
|---|
| 85 | 75 | /* GIC system register CPU interface */ |
|---|
| 86 | 76 | struct static_key_false gicv3_cpuif; |
|---|
| .. | .. |
|---|
| 100 | 90 | }; |
|---|
| 101 | 91 | |
|---|
| 102 | 92 | struct vgic_irq { |
|---|
| 103 | | - spinlock_t irq_lock; /* Protects the content of the struct */ |
|---|
| 93 | + raw_spinlock_t irq_lock; /* Protects the content of the struct */ |
|---|
| 104 | 94 | struct list_head lpi_list; /* Used to link all LPIs together */ |
|---|
| 105 | 95 | struct list_head ap_list; |
|---|
| 106 | 96 | |
|---|
| .. | .. |
|---|
| 241 | 231 | /* distributor enabled */ |
|---|
| 242 | 232 | bool enabled; |
|---|
| 243 | 233 | |
|---|
| 234 | + /* Wants SGIs without active state */ |
|---|
| 235 | + bool nassgireq; |
|---|
| 236 | + |
|---|
| 244 | 237 | struct vgic_irq *spis; |
|---|
| 245 | 238 | |
|---|
| 246 | 239 | struct vgic_io_device dist_iodev; |
|---|
| .. | .. |
|---|
| 251 | 244 | * Contains the attributes and gpa of the LPI configuration table. |
|---|
| 252 | 245 | * Since we report GICR_TYPER.CommonLPIAff as 0b00, we can share |
|---|
| 253 | 246 | * one address across all redistributors. |
|---|
| 254 | | - * GICv3 spec: 6.1.2 "LPI Configuration tables" |
|---|
| 247 | + * GICv3 spec: IHI 0069E 6.1.1 "LPI Configuration tables" |
|---|
| 255 | 248 | */ |
|---|
| 256 | 249 | u64 propbaser; |
|---|
| 257 | 250 | |
|---|
| .. | .. |
|---|
| 259 | 252 | raw_spinlock_t lpi_list_lock; |
|---|
| 260 | 253 | struct list_head lpi_list_head; |
|---|
| 261 | 254 | int lpi_list_count; |
|---|
| 255 | + |
|---|
| 256 | + /* LPI translation cache */ |
|---|
| 257 | + struct list_head lpi_translation_cache; |
|---|
| 262 | 258 | |
|---|
| 263 | 259 | /* used by vgic-debug */ |
|---|
| 264 | 260 | struct vgic_state_iter *iter; |
|---|
| .. | .. |
|---|
| 278 | 274 | u32 vgic_vmcr; |
|---|
| 279 | 275 | u32 vgic_apr; |
|---|
| 280 | 276 | u32 vgic_lr[VGIC_V2_MAX_LRS]; |
|---|
| 277 | + |
|---|
| 278 | + unsigned int used_lrs; |
|---|
| 281 | 279 | }; |
|---|
| 282 | 280 | |
|---|
| 283 | 281 | struct vgic_v3_cpu_if { |
|---|
| .. | .. |
|---|
| 295 | 293 | * linking the Linux IRQ subsystem and the ITS together. |
|---|
| 296 | 294 | */ |
|---|
| 297 | 295 | struct its_vpe its_vpe; |
|---|
| 296 | + |
|---|
| 297 | + unsigned int used_lrs; |
|---|
| 298 | 298 | }; |
|---|
| 299 | 299 | |
|---|
| 300 | 300 | struct vgic_cpu { |
|---|
| .. | .. |
|---|
| 304 | 304 | struct vgic_v3_cpu_if vgic_v3; |
|---|
| 305 | 305 | }; |
|---|
| 306 | 306 | |
|---|
| 307 | | - unsigned int used_lrs; |
|---|
| 308 | 307 | struct vgic_irq private_irqs[VGIC_NR_PRIVATE_IRQS]; |
|---|
| 309 | 308 | |
|---|
| 310 | | - spinlock_t ap_list_lock; /* Protects the ap_list */ |
|---|
| 309 | + raw_spinlock_t ap_list_lock; /* Protects the ap_list */ |
|---|
| 311 | 310 | |
|---|
| 312 | 311 | /* |
|---|
| 313 | 312 | * List of IRQs that this VCPU should consider because they are either |
|---|
| .. | .. |
|---|
| 322 | 321 | * parts of the redistributor. |
|---|
| 323 | 322 | */ |
|---|
| 324 | 323 | struct vgic_io_device rd_iodev; |
|---|
| 325 | | - struct vgic_io_device sgi_iodev; |
|---|
| 326 | 324 | struct vgic_redist_region *rdreg; |
|---|
| 327 | 325 | |
|---|
| 328 | 326 | /* Contains the attributes and gpa of the LPI pending tables. */ |
|---|
| .. | .. |
|---|
| 387 | 385 | return kvm_vgic_global_state.max_gic_vcpus; |
|---|
| 388 | 386 | } |
|---|
| 389 | 387 | |
|---|
| 390 | | -int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi); |
|---|
| 391 | | - |
|---|
| 392 | 388 | /** |
|---|
| 393 | 389 | * kvm_vgic_setup_default_irq_routing: |
|---|
| 394 | 390 | * Setup a default flat gsi routing table mapping all SPIs |
|---|
| .. | .. |
|---|
| 405 | 401 | int kvm_vgic_v4_unset_forwarding(struct kvm *kvm, int irq, |
|---|
| 406 | 402 | struct kvm_kernel_irq_routing_entry *irq_entry); |
|---|
| 407 | 403 | |
|---|
| 408 | | -void kvm_vgic_v4_enable_doorbell(struct kvm_vcpu *vcpu); |
|---|
| 409 | | -void kvm_vgic_v4_disable_doorbell(struct kvm_vcpu *vcpu); |
|---|
| 404 | +int vgic_v4_load(struct kvm_vcpu *vcpu); |
|---|
| 405 | +void vgic_v4_commit(struct kvm_vcpu *vcpu); |
|---|
| 406 | +int vgic_v4_put(struct kvm_vcpu *vcpu, bool need_db); |
|---|
| 410 | 407 | |
|---|
| 411 | 408 | #endif /* __KVM_ARM_VGIC_H */ |
|---|