xref: /linux/arch/arm64/kvm/vgic/vgic-init.c (revision 6e7fd890f1d6ac83805409e9c346240de2705584)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (C) 2015, 2016 ARM Ltd.
4  */
5 
6 #include <linux/uaccess.h>
7 #include <linux/interrupt.h>
8 #include <linux/cpu.h>
9 #include <linux/kvm_host.h>
10 #include <kvm/arm_vgic.h>
11 #include <asm/kvm_emulate.h>
12 #include <asm/kvm_mmu.h>
13 #include "vgic.h"
14 
15 /*
16  * Initialization rules: there are multiple stages to the vgic
17  * initialization, both for the distributor and the CPU interfaces.  The basic
18  * idea is that even though the VGIC is not functional or not requested from
19  * user space, the critical path of the run loop can still call VGIC functions
20  * that just won't do anything, without them having to check additional
21  * initialization flags to ensure they don't look at uninitialized data
22  * structures.
23  *
24  * Distributor:
25  *
26  * - kvm_vgic_early_init(): initialization of static data that doesn't
27  *   depend on any sizing information or emulation type. No allocation
28  *   is allowed there.
29  *
30  * - vgic_init(): allocation and initialization of the generic data
31  *   structures that depend on sizing information (number of CPUs,
32  *   number of interrupts). Also initializes the vcpu specific data
33  *   structures. Can be executed lazily for GICv2.
34  *
35  * CPU Interface:
36  *
37  * - kvm_vgic_vcpu_init(): initialization of static data that
38  *   doesn't depend on any sizing information or emulation type. No
39  *   allocation is allowed there.
40  */
41 
42 /* EARLY INIT */
43 
44 /**
45  * kvm_vgic_early_init() - Initialize static VGIC VCPU data structures
46  * @kvm: The VM whose VGIC districutor should be initialized
47  *
48  * Only do initialization of static structures that don't require any
49  * allocation or sizing information from userspace.  vgic_init() called
50  * kvm_vgic_dist_init() which takes care of the rest.
51  */
52 void kvm_vgic_early_init(struct kvm *kvm)
53 {
54 	struct vgic_dist *dist = &kvm->arch.vgic;
55 
56 	xa_init_flags(&dist->lpi_xa, XA_FLAGS_LOCK_IRQ);
57 }
58 
59 /* CREATION */
60 
61 /**
62  * kvm_vgic_create: triggered by the instantiation of the VGIC device by
63  * user space, either through the legacy KVM_CREATE_IRQCHIP ioctl (v2 only)
64  * or through the generic KVM_CREATE_DEVICE API ioctl.
65  * irqchip_in_kernel() tells you if this function succeeded or not.
66  * @kvm: kvm struct pointer
67  * @type: KVM_DEV_TYPE_ARM_VGIC_V[23]
68  */
69 int kvm_vgic_create(struct kvm *kvm, u32 type)
70 {
71 	struct kvm_vcpu *vcpu;
72 	unsigned long i;
73 	int ret;
74 
75 	/*
76 	 * This function is also called by the KVM_CREATE_IRQCHIP handler,
77 	 * which had no chance yet to check the availability of the GICv2
78 	 * emulation. So check this here again. KVM_CREATE_DEVICE does
79 	 * the proper checks already.
80 	 */
81 	if (type == KVM_DEV_TYPE_ARM_VGIC_V2 &&
82 		!kvm_vgic_global_state.can_emulate_gicv2)
83 		return -ENODEV;
84 
85 	/* Must be held to avoid race with vCPU creation */
86 	lockdep_assert_held(&kvm->lock);
87 
88 	ret = -EBUSY;
89 	if (!lock_all_vcpus(kvm))
90 		return ret;
91 
92 	mutex_lock(&kvm->arch.config_lock);
93 
94 	if (irqchip_in_kernel(kvm)) {
95 		ret = -EEXIST;
96 		goto out_unlock;
97 	}
98 
99 	kvm_for_each_vcpu(i, vcpu, kvm) {
100 		if (vcpu_has_run_once(vcpu))
101 			goto out_unlock;
102 	}
103 	ret = 0;
104 
105 	if (type == KVM_DEV_TYPE_ARM_VGIC_V2)
106 		kvm->max_vcpus = VGIC_V2_MAX_CPUS;
107 	else
108 		kvm->max_vcpus = VGIC_V3_MAX_CPUS;
109 
110 	if (atomic_read(&kvm->online_vcpus) > kvm->max_vcpus) {
111 		ret = -E2BIG;
112 		goto out_unlock;
113 	}
114 
115 	kvm->arch.vgic.in_kernel = true;
116 	kvm->arch.vgic.vgic_model = type;
117 
118 	kvm->arch.vgic.vgic_dist_base = VGIC_ADDR_UNDEF;
119 
120 	if (type == KVM_DEV_TYPE_ARM_VGIC_V2)
121 		kvm->arch.vgic.vgic_cpu_base = VGIC_ADDR_UNDEF;
122 	else
123 		INIT_LIST_HEAD(&kvm->arch.vgic.rd_regions);
124 
125 out_unlock:
126 	mutex_unlock(&kvm->arch.config_lock);
127 	unlock_all_vcpus(kvm);
128 	return ret;
129 }
130 
131 /* INIT/DESTROY */
132 
133 /**
134  * kvm_vgic_dist_init: initialize the dist data structures
135  * @kvm: kvm struct pointer
136  * @nr_spis: number of spis, frozen by caller
137  */
138 static int kvm_vgic_dist_init(struct kvm *kvm, unsigned int nr_spis)
139 {
140 	struct vgic_dist *dist = &kvm->arch.vgic;
141 	struct kvm_vcpu *vcpu0 = kvm_get_vcpu(kvm, 0);
142 	int i;
143 
144 	dist->spis = kcalloc(nr_spis, sizeof(struct vgic_irq), GFP_KERNEL_ACCOUNT);
145 	if (!dist->spis)
146 		return  -ENOMEM;
147 
148 	/*
149 	 * In the following code we do not take the irq struct lock since
150 	 * no other action on irq structs can happen while the VGIC is
151 	 * not initialized yet:
152 	 * If someone wants to inject an interrupt or does a MMIO access, we
153 	 * require prior initialization in case of a virtual GICv3 or trigger
154 	 * initialization when using a virtual GICv2.
155 	 */
156 	for (i = 0; i < nr_spis; i++) {
157 		struct vgic_irq *irq = &dist->spis[i];
158 
159 		irq->intid = i + VGIC_NR_PRIVATE_IRQS;
160 		INIT_LIST_HEAD(&irq->ap_list);
161 		raw_spin_lock_init(&irq->irq_lock);
162 		irq->vcpu = NULL;
163 		irq->target_vcpu = vcpu0;
164 		kref_init(&irq->refcount);
165 		switch (dist->vgic_model) {
166 		case KVM_DEV_TYPE_ARM_VGIC_V2:
167 			irq->targets = 0;
168 			irq->group = 0;
169 			break;
170 		case KVM_DEV_TYPE_ARM_VGIC_V3:
171 			irq->mpidr = 0;
172 			irq->group = 1;
173 			break;
174 		default:
175 			kfree(dist->spis);
176 			dist->spis = NULL;
177 			return -EINVAL;
178 		}
179 	}
180 	return 0;
181 }
182 
183 static int vgic_allocate_private_irqs_locked(struct kvm_vcpu *vcpu)
184 {
185 	struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
186 	int i;
187 
188 	lockdep_assert_held(&vcpu->kvm->arch.config_lock);
189 
190 	if (vgic_cpu->private_irqs)
191 		return 0;
192 
193 	vgic_cpu->private_irqs = kcalloc(VGIC_NR_PRIVATE_IRQS,
194 					 sizeof(struct vgic_irq),
195 					 GFP_KERNEL_ACCOUNT);
196 
197 	if (!vgic_cpu->private_irqs)
198 		return -ENOMEM;
199 
200 	/*
201 	 * Enable and configure all SGIs to be edge-triggered and
202 	 * configure all PPIs as level-triggered.
203 	 */
204 	for (i = 0; i < VGIC_NR_PRIVATE_IRQS; i++) {
205 		struct vgic_irq *irq = &vgic_cpu->private_irqs[i];
206 
207 		INIT_LIST_HEAD(&irq->ap_list);
208 		raw_spin_lock_init(&irq->irq_lock);
209 		irq->intid = i;
210 		irq->vcpu = NULL;
211 		irq->target_vcpu = vcpu;
212 		kref_init(&irq->refcount);
213 		if (vgic_irq_is_sgi(i)) {
214 			/* SGIs */
215 			irq->enabled = 1;
216 			irq->config = VGIC_CONFIG_EDGE;
217 		} else {
218 			/* PPIs */
219 			irq->config = VGIC_CONFIG_LEVEL;
220 		}
221 	}
222 
223 	return 0;
224 }
225 
226 static int vgic_allocate_private_irqs(struct kvm_vcpu *vcpu)
227 {
228 	int ret;
229 
230 	mutex_lock(&vcpu->kvm->arch.config_lock);
231 	ret = vgic_allocate_private_irqs_locked(vcpu);
232 	mutex_unlock(&vcpu->kvm->arch.config_lock);
233 
234 	return ret;
235 }
236 
237 /**
238  * kvm_vgic_vcpu_init() - Initialize static VGIC VCPU data
239  * structures and register VCPU-specific KVM iodevs
240  *
241  * @vcpu: pointer to the VCPU being created and initialized
242  *
243  * Only do initialization, but do not actually enable the
244  * VGIC CPU interface
245  */
246 int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu)
247 {
248 	struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
249 	struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
250 	int ret = 0;
251 
252 	vgic_cpu->rd_iodev.base_addr = VGIC_ADDR_UNDEF;
253 
254 	INIT_LIST_HEAD(&vgic_cpu->ap_list_head);
255 	raw_spin_lock_init(&vgic_cpu->ap_list_lock);
256 	atomic_set(&vgic_cpu->vgic_v3.its_vpe.vlpi_count, 0);
257 
258 	if (!irqchip_in_kernel(vcpu->kvm))
259 		return 0;
260 
261 	ret = vgic_allocate_private_irqs(vcpu);
262 	if (ret)
263 		return ret;
264 
265 	/*
266 	 * If we are creating a VCPU with a GICv3 we must also register the
267 	 * KVM io device for the redistributor that belongs to this VCPU.
268 	 */
269 	if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) {
270 		mutex_lock(&vcpu->kvm->slots_lock);
271 		ret = vgic_register_redist_iodev(vcpu);
272 		mutex_unlock(&vcpu->kvm->slots_lock);
273 	}
274 	return ret;
275 }
276 
277 static void kvm_vgic_vcpu_enable(struct kvm_vcpu *vcpu)
278 {
279 	if (kvm_vgic_global_state.type == VGIC_V2)
280 		vgic_v2_enable(vcpu);
281 	else
282 		vgic_v3_enable(vcpu);
283 }
284 
285 /*
286  * vgic_init: allocates and initializes dist and vcpu data structures
287  * depending on two dimensioning parameters:
288  * - the number of spis
289  * - the number of vcpus
290  * The function is generally called when nr_spis has been explicitly set
291  * by the guest through the KVM DEVICE API. If not nr_spis is set to 256.
292  * vgic_initialized() returns true when this function has succeeded.
293  */
294 int vgic_init(struct kvm *kvm)
295 {
296 	struct vgic_dist *dist = &kvm->arch.vgic;
297 	struct kvm_vcpu *vcpu;
298 	int ret = 0, i;
299 	unsigned long idx;
300 
301 	lockdep_assert_held(&kvm->arch.config_lock);
302 
303 	if (vgic_initialized(kvm))
304 		return 0;
305 
306 	/* Are we also in the middle of creating a VCPU? */
307 	if (kvm->created_vcpus != atomic_read(&kvm->online_vcpus))
308 		return -EBUSY;
309 
310 	/* freeze the number of spis */
311 	if (!dist->nr_spis)
312 		dist->nr_spis = VGIC_NR_IRQS_LEGACY - VGIC_NR_PRIVATE_IRQS;
313 
314 	ret = kvm_vgic_dist_init(kvm, dist->nr_spis);
315 	if (ret)
316 		goto out;
317 
318 	/* Initialize groups on CPUs created before the VGIC type was known */
319 	kvm_for_each_vcpu(idx, vcpu, kvm) {
320 		ret = vgic_allocate_private_irqs_locked(vcpu);
321 		if (ret)
322 			goto out;
323 
324 		for (i = 0; i < VGIC_NR_PRIVATE_IRQS; i++) {
325 			struct vgic_irq *irq = vgic_get_irq(kvm, vcpu, i);
326 
327 			switch (dist->vgic_model) {
328 			case KVM_DEV_TYPE_ARM_VGIC_V3:
329 				irq->group = 1;
330 				irq->mpidr = kvm_vcpu_get_mpidr_aff(vcpu);
331 				break;
332 			case KVM_DEV_TYPE_ARM_VGIC_V2:
333 				irq->group = 0;
334 				irq->targets = 1U << idx;
335 				break;
336 			default:
337 				ret = -EINVAL;
338 			}
339 
340 			vgic_put_irq(kvm, irq);
341 
342 			if (ret)
343 				goto out;
344 		}
345 	}
346 
347 	/*
348 	 * If we have GICv4.1 enabled, unconditionally request enable the
349 	 * v4 support so that we get HW-accelerated vSGIs. Otherwise, only
350 	 * enable it if we present a virtual ITS to the guest.
351 	 */
352 	if (vgic_supports_direct_msis(kvm)) {
353 		ret = vgic_v4_init(kvm);
354 		if (ret)
355 			goto out;
356 	}
357 
358 	kvm_for_each_vcpu(idx, vcpu, kvm)
359 		kvm_vgic_vcpu_enable(vcpu);
360 
361 	ret = kvm_vgic_setup_default_irq_routing(kvm);
362 	if (ret)
363 		goto out;
364 
365 	vgic_debug_init(kvm);
366 
367 	/*
368 	 * If userspace didn't set the GIC implementation revision,
369 	 * default to the latest and greatest. You know want it.
370 	 */
371 	if (!dist->implementation_rev)
372 		dist->implementation_rev = KVM_VGIC_IMP_REV_LATEST;
373 	dist->initialized = true;
374 
375 out:
376 	return ret;
377 }
378 
379 static void kvm_vgic_dist_destroy(struct kvm *kvm)
380 {
381 	struct vgic_dist *dist = &kvm->arch.vgic;
382 	struct vgic_redist_region *rdreg, *next;
383 
384 	dist->ready = false;
385 	dist->initialized = false;
386 
387 	kfree(dist->spis);
388 	dist->spis = NULL;
389 	dist->nr_spis = 0;
390 	dist->vgic_dist_base = VGIC_ADDR_UNDEF;
391 
392 	if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) {
393 		list_for_each_entry_safe(rdreg, next, &dist->rd_regions, list)
394 			vgic_v3_free_redist_region(kvm, rdreg);
395 		INIT_LIST_HEAD(&dist->rd_regions);
396 	} else {
397 		dist->vgic_cpu_base = VGIC_ADDR_UNDEF;
398 	}
399 
400 	if (vgic_supports_direct_msis(kvm))
401 		vgic_v4_teardown(kvm);
402 
403 	xa_destroy(&dist->lpi_xa);
404 }
405 
406 static void __kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu)
407 {
408 	struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
409 
410 	/*
411 	 * Retire all pending LPIs on this vcpu anyway as we're
412 	 * going to destroy it.
413 	 */
414 	vgic_flush_pending_lpis(vcpu);
415 
416 	INIT_LIST_HEAD(&vgic_cpu->ap_list_head);
417 	kfree(vgic_cpu->private_irqs);
418 	vgic_cpu->private_irqs = NULL;
419 
420 	if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) {
421 		vgic_unregister_redist_iodev(vcpu);
422 		vgic_cpu->rd_iodev.base_addr = VGIC_ADDR_UNDEF;
423 	}
424 }
425 
426 void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu)
427 {
428 	struct kvm *kvm = vcpu->kvm;
429 
430 	mutex_lock(&kvm->slots_lock);
431 	__kvm_vgic_vcpu_destroy(vcpu);
432 	mutex_unlock(&kvm->slots_lock);
433 }
434 
435 void kvm_vgic_destroy(struct kvm *kvm)
436 {
437 	struct kvm_vcpu *vcpu;
438 	unsigned long i;
439 
440 	mutex_lock(&kvm->slots_lock);
441 	mutex_lock(&kvm->arch.config_lock);
442 
443 	vgic_debug_destroy(kvm);
444 
445 	kvm_for_each_vcpu(i, vcpu, kvm)
446 		__kvm_vgic_vcpu_destroy(vcpu);
447 
448 	kvm_vgic_dist_destroy(kvm);
449 
450 	mutex_unlock(&kvm->arch.config_lock);
451 	mutex_unlock(&kvm->slots_lock);
452 }
453 
454 /**
455  * vgic_lazy_init: Lazy init is only allowed if the GIC exposed to the guest
456  * is a GICv2. A GICv3 must be explicitly initialized by userspace using the
457  * KVM_DEV_ARM_VGIC_GRP_CTRL KVM_DEVICE group.
458  * @kvm: kvm struct pointer
459  */
460 int vgic_lazy_init(struct kvm *kvm)
461 {
462 	int ret = 0;
463 
464 	if (unlikely(!vgic_initialized(kvm))) {
465 		/*
466 		 * We only provide the automatic initialization of the VGIC
467 		 * for the legacy case of a GICv2. Any other type must
468 		 * be explicitly initialized once setup with the respective
469 		 * KVM device call.
470 		 */
471 		if (kvm->arch.vgic.vgic_model != KVM_DEV_TYPE_ARM_VGIC_V2)
472 			return -EBUSY;
473 
474 		mutex_lock(&kvm->arch.config_lock);
475 		ret = vgic_init(kvm);
476 		mutex_unlock(&kvm->arch.config_lock);
477 	}
478 
479 	return ret;
480 }
481 
482 /* RESOURCE MAPPING */
483 
484 /**
485  * kvm_vgic_map_resources - map the MMIO regions
486  * @kvm: kvm struct pointer
487  *
488  * Map the MMIO regions depending on the VGIC model exposed to the guest
489  * called on the first VCPU run.
490  * Also map the virtual CPU interface into the VM.
491  * v2 calls vgic_init() if not already done.
492  * v3 and derivatives return an error if the VGIC is not initialized.
493  * vgic_ready() returns true if this function has succeeded.
494  */
495 int kvm_vgic_map_resources(struct kvm *kvm)
496 {
497 	struct vgic_dist *dist = &kvm->arch.vgic;
498 	enum vgic_type type;
499 	gpa_t dist_base;
500 	int ret = 0;
501 
502 	if (likely(vgic_ready(kvm)))
503 		return 0;
504 
505 	mutex_lock(&kvm->slots_lock);
506 	mutex_lock(&kvm->arch.config_lock);
507 	if (vgic_ready(kvm))
508 		goto out;
509 
510 	if (!irqchip_in_kernel(kvm))
511 		goto out;
512 
513 	if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V2) {
514 		ret = vgic_v2_map_resources(kvm);
515 		type = VGIC_V2;
516 	} else {
517 		ret = vgic_v3_map_resources(kvm);
518 		type = VGIC_V3;
519 	}
520 
521 	if (ret)
522 		goto out;
523 
524 	dist->ready = true;
525 	dist_base = dist->vgic_dist_base;
526 	mutex_unlock(&kvm->arch.config_lock);
527 
528 	ret = vgic_register_dist_iodev(kvm, dist_base, type);
529 	if (ret)
530 		kvm_err("Unable to register VGIC dist MMIO regions\n");
531 
532 	goto out_slots;
533 out:
534 	mutex_unlock(&kvm->arch.config_lock);
535 out_slots:
536 	mutex_unlock(&kvm->slots_lock);
537 
538 	if (ret)
539 		kvm_vgic_destroy(kvm);
540 
541 	return ret;
542 }
543 
544 /* GENERIC PROBE */
545 
546 void kvm_vgic_cpu_up(void)
547 {
548 	enable_percpu_irq(kvm_vgic_global_state.maint_irq, 0);
549 }
550 
551 
552 void kvm_vgic_cpu_down(void)
553 {
554 	disable_percpu_irq(kvm_vgic_global_state.maint_irq);
555 }
556 
557 static irqreturn_t vgic_maintenance_handler(int irq, void *data)
558 {
559 	/*
560 	 * We cannot rely on the vgic maintenance interrupt to be
561 	 * delivered synchronously. This means we can only use it to
562 	 * exit the VM, and we perform the handling of EOIed
563 	 * interrupts on the exit path (see vgic_fold_lr_state).
564 	 */
565 	return IRQ_HANDLED;
566 }
567 
568 static struct gic_kvm_info *gic_kvm_info;
569 
570 void __init vgic_set_kvm_info(const struct gic_kvm_info *info)
571 {
572 	BUG_ON(gic_kvm_info != NULL);
573 	gic_kvm_info = kmalloc(sizeof(*info), GFP_KERNEL);
574 	if (gic_kvm_info)
575 		*gic_kvm_info = *info;
576 }
577 
578 /**
579  * kvm_vgic_init_cpu_hardware - initialize the GIC VE hardware
580  *
581  * For a specific CPU, initialize the GIC VE hardware.
582  */
583 void kvm_vgic_init_cpu_hardware(void)
584 {
585 	BUG_ON(preemptible());
586 
587 	/*
588 	 * We want to make sure the list registers start out clear so that we
589 	 * only have the program the used registers.
590 	 */
591 	if (kvm_vgic_global_state.type == VGIC_V2)
592 		vgic_v2_init_lrs();
593 	else
594 		kvm_call_hyp(__vgic_v3_init_lrs);
595 }
596 
597 /**
598  * kvm_vgic_hyp_init: populates the kvm_vgic_global_state variable
599  * according to the host GIC model. Accordingly calls either
600  * vgic_v2/v3_probe which registers the KVM_DEVICE that can be
601  * instantiated by a guest later on .
602  */
603 int kvm_vgic_hyp_init(void)
604 {
605 	bool has_mask;
606 	int ret;
607 
608 	if (!gic_kvm_info)
609 		return -ENODEV;
610 
611 	has_mask = !gic_kvm_info->no_maint_irq_mask;
612 
613 	if (has_mask && !gic_kvm_info->maint_irq) {
614 		kvm_err("No vgic maintenance irq\n");
615 		return -ENXIO;
616 	}
617 
618 	/*
619 	 * If we get one of these oddball non-GICs, taint the kernel,
620 	 * as we have no idea of how they *really* behave.
621 	 */
622 	if (gic_kvm_info->no_hw_deactivation) {
623 		kvm_info("Non-architectural vgic, tainting kernel\n");
624 		add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);
625 		kvm_vgic_global_state.no_hw_deactivation = true;
626 	}
627 
628 	switch (gic_kvm_info->type) {
629 	case GIC_V2:
630 		ret = vgic_v2_probe(gic_kvm_info);
631 		break;
632 	case GIC_V3:
633 		ret = vgic_v3_probe(gic_kvm_info);
634 		if (!ret) {
635 			static_branch_enable(&kvm_vgic_global_state.gicv3_cpuif);
636 			kvm_info("GIC system register CPU interface enabled\n");
637 		}
638 		break;
639 	default:
640 		ret = -ENODEV;
641 	}
642 
643 	kvm_vgic_global_state.maint_irq = gic_kvm_info->maint_irq;
644 
645 	kfree(gic_kvm_info);
646 	gic_kvm_info = NULL;
647 
648 	if (ret)
649 		return ret;
650 
651 	if (!has_mask && !kvm_vgic_global_state.maint_irq)
652 		return 0;
653 
654 	ret = request_percpu_irq(kvm_vgic_global_state.maint_irq,
655 				 vgic_maintenance_handler,
656 				 "vgic", kvm_get_running_vcpus());
657 	if (ret) {
658 		kvm_err("Cannot register interrupt %d\n",
659 			kvm_vgic_global_state.maint_irq);
660 		return ret;
661 	}
662 
663 	kvm_info("vgic interrupt IRQ%d\n", kvm_vgic_global_state.maint_irq);
664 	return 0;
665 }
666