xref: /freebsd/sys/arm64/vmm/io/vgic_if.m (revision 2f9966ff63d65bd474478888c9088eeae3f9c669)
1#-
2# SPDX-License-Identifier: BSD-2-Clause
3#
4# Copyright (c) 2023 Arm Ltd
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12#    notice, this list of conditions and the following disclaimer in the
13#    documentation and/or other materials provided with the distribution.
14#
15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
27
28INTERFACE vgic;
29
30HEADER {
31	struct hyp;
32	struct hypctx;
33	struct vm_vgic_descr;
34};
35
36METHOD void init {
37	device_t dev;
38}
39
40METHOD int attach_to_vm {
41	device_t dev;
42	struct hyp *hyp;
43	struct vm_vgic_descr *descr;
44};
45
46METHOD void detach_from_vm {
47	device_t dev;
48	struct hyp *hyp;
49}
50
51METHOD void vminit {
52	device_t dev;
53	struct hyp *hyp;
54}
55
56METHOD void cpuinit {
57	device_t dev;
58	struct hypctx *hypctx;
59}
60
61METHOD void cpucleanup {
62	device_t dev;
63	struct hypctx *hypctx;
64}
65
66METHOD void vmcleanup {
67	device_t dev;
68	struct hyp *hyp;
69}
70
71METHOD int max_cpu_count {
72	device_t dev;
73	struct hyp *hyp;
74}
75
76METHOD bool has_pending_irq {
77	device_t dev;
78	struct hypctx *hypctx;
79}
80
81METHOD int inject_irq {
82	device_t dev;
83	struct hyp *hyp;
84	int vcpuid;
85	uint32_t irqid;
86	bool level;
87}
88
89METHOD int inject_msi {
90	device_t dev;
91	struct hyp *hyp;
92	uint64_t msg;
93	uint64_t addr;
94}
95
96METHOD void flush_hwstate {
97	device_t dev;
98	struct hypctx *hypctx;
99}
100
101METHOD void sync_hwstate {
102	device_t dev;
103	struct hypctx *hypctx;
104}
105