hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/include/kvm/arm_vgic.h
....@@ -1,17 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * 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/>.
154 */
165 #ifndef __KVM_ARM_VGIC_H
176 #define __KVM_ARM_VGIC_H
....@@ -81,6 +70,7 @@
8170
8271 /* Hardware has GICv4? */
8372 bool has_gicv4;
73
+ bool has_gicv4_1;
8474
8575 /* GIC system register CPU interface */
8676 struct static_key_false gicv3_cpuif;
....@@ -100,7 +90,7 @@
10090 };
10191
10292 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 */
10494 struct list_head lpi_list; /* Used to link all LPIs together */
10595 struct list_head ap_list;
10696
....@@ -241,6 +231,9 @@
241231 /* distributor enabled */
242232 bool enabled;
243233
234
+ /* Wants SGIs without active state */
235
+ bool nassgireq;
236
+
244237 struct vgic_irq *spis;
245238
246239 struct vgic_io_device dist_iodev;
....@@ -251,7 +244,7 @@
251244 * Contains the attributes and gpa of the LPI configuration table.
252245 * Since we report GICR_TYPER.CommonLPIAff as 0b00, we can share
253246 * 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"
255248 */
256249 u64 propbaser;
257250
....@@ -259,6 +252,9 @@
259252 raw_spinlock_t lpi_list_lock;
260253 struct list_head lpi_list_head;
261254 int lpi_list_count;
255
+
256
+ /* LPI translation cache */
257
+ struct list_head lpi_translation_cache;
262258
263259 /* used by vgic-debug */
264260 struct vgic_state_iter *iter;
....@@ -278,6 +274,8 @@
278274 u32 vgic_vmcr;
279275 u32 vgic_apr;
280276 u32 vgic_lr[VGIC_V2_MAX_LRS];
277
+
278
+ unsigned int used_lrs;
281279 };
282280
283281 struct vgic_v3_cpu_if {
....@@ -295,6 +293,8 @@
295293 * linking the Linux IRQ subsystem and the ITS together.
296294 */
297295 struct its_vpe its_vpe;
296
+
297
+ unsigned int used_lrs;
298298 };
299299
300300 struct vgic_cpu {
....@@ -304,10 +304,9 @@
304304 struct vgic_v3_cpu_if vgic_v3;
305305 };
306306
307
- unsigned int used_lrs;
308307 struct vgic_irq private_irqs[VGIC_NR_PRIVATE_IRQS];
309308
310
- spinlock_t ap_list_lock; /* Protects the ap_list */
309
+ raw_spinlock_t ap_list_lock; /* Protects the ap_list */
311310
312311 /*
313312 * List of IRQs that this VCPU should consider because they are either
....@@ -322,7 +321,6 @@
322321 * parts of the redistributor.
323322 */
324323 struct vgic_io_device rd_iodev;
325
- struct vgic_io_device sgi_iodev;
326324 struct vgic_redist_region *rdreg;
327325
328326 /* Contains the attributes and gpa of the LPI pending tables. */
....@@ -387,8 +385,6 @@
387385 return kvm_vgic_global_state.max_gic_vcpus;
388386 }
389387
390
-int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi);
391
-
392388 /**
393389 * kvm_vgic_setup_default_irq_routing:
394390 * Setup a default flat gsi routing table mapping all SPIs
....@@ -405,7 +401,8 @@
405401 int kvm_vgic_v4_unset_forwarding(struct kvm *kvm, int irq,
406402 struct kvm_kernel_irq_routing_entry *irq_entry);
407403
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);
410407
411408 #endif /* __KVM_ARM_VGIC_H */