#-1# SPDX-License-Identifier: BSD-2-Clause2#3# Copyright (c) 2023 Arm Ltd4#5# Redistribution and use in source and binary forms, with or without6# modification, are permitted provided that the following conditions7# are met:8# 1. Redistributions of source code must retain the above copyright9# notice, this list of conditions and the following disclaimer.10# 2. Redistributions in binary form must reproduce the above copyright11# notice, this list of conditions and the following disclaimer in the12# documentation and/or other materials provided with the distribution.13#14# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND15# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE16# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE17# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF24# SUCH DAMAGE.25#2627INTERFACE vgic;2829HEADER {30struct hyp;31struct hypctx;32struct vm_vgic_descr;33};3435METHOD void init {36device_t dev;37}3839METHOD int attach_to_vm {40device_t dev;41struct hyp *hyp;42struct vm_vgic_descr *descr;43};4445METHOD void detach_from_vm {46device_t dev;47struct hyp *hyp;48}4950METHOD void vminit {51device_t dev;52struct hyp *hyp;53}5455METHOD void cpuinit {56device_t dev;57struct hypctx *hypctx;58}5960METHOD void cpucleanup {61device_t dev;62struct hypctx *hypctx;63}6465METHOD void vmcleanup {66device_t dev;67struct hyp *hyp;68}6970METHOD int max_cpu_count {71device_t dev;72struct hyp *hyp;73}7475METHOD bool has_pending_irq {76device_t dev;77struct hypctx *hypctx;78}7980METHOD int inject_irq {81device_t dev;82struct hyp *hyp;83int vcpuid;84uint32_t irqid;85bool level;86}8788METHOD int inject_msi {89device_t dev;90struct hyp *hyp;91uint64_t msg;92uint64_t addr;93}9495METHOD void flush_hwstate {96device_t dev;97struct hypctx *hypctx;98}99100METHOD void sync_hwstate {101device_t dev;102struct hypctx *hypctx;103}104105106