1 /*
2  * Copyright 2024 The Hafnium Authors.
3  *
4  * Use of this source code is governed by a BSD-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/BSD-3-Clause.
7  */
8 
9 #include "hf/api.h"
10 #include "hf/check.h"
11 #include "hf/vm.h"
12 
ffa_interrupts_handle_secure_interrupt(struct vcpu * current,struct vcpu ** next)13 void ffa_interrupts_handle_secure_interrupt(struct vcpu *current,
14 					    struct vcpu **next)
15 {
16 	(void)current;
17 	(void)next;
18 
19 	/*
20 	 * SPMD uses FFA_INTERRUPT ABI to convey secure interrupt to
21 	 * SPMC. Execution should not reach hypervisor with this ABI.
22 	 */
23 	CHECK(false);
24 }
25 
ffa_interrupts_inject_notification_pending_interrupt(struct vcpu_locked target_locked,struct vm_locked receiver_locked)26 bool ffa_interrupts_inject_notification_pending_interrupt(
27 	struct vcpu_locked target_locked, struct vm_locked receiver_locked)
28 {
29 	(void)target_locked;
30 	(void)receiver_locked;
31 
32 	return false;
33 }
34 
35 /**
36  * Enable relevant virtual interrupts for VMs.
37  */
ffa_interrupts_enable_virtual_interrupts(struct vcpu_locked current_locked,struct vm_locked vm_locked)38 void ffa_interrupts_enable_virtual_interrupts(struct vcpu_locked current_locked,
39 					      struct vm_locked vm_locked)
40 {
41 	if (vm_locked.vm->notifications.enabled) {
42 		vcpu_virt_interrupt_enable(current_locked,
43 					   HF_NOTIFICATION_PENDING_INTID, true);
44 	}
45 }
46 
ffa_interrupts_intercept_call(struct vcpu_locked current_locked,struct vcpu_locked next_locked,struct ffa_value * signal_interrupt)47 bool ffa_interrupts_intercept_call(struct vcpu_locked current_locked,
48 				   struct vcpu_locked next_locked,
49 				   struct ffa_value *signal_interrupt)
50 {
51 	(void)current_locked;
52 	(void)next_locked;
53 	(void)signal_interrupt;
54 	return false;
55 }
56