blob: 22609c5db287d5e9e40af7349e02ca8725f573a8 [file] [log] [blame]
Pierre-Clément Tosi4ce55c02023-03-09 15:31:03 +00001// Copyright 2023, The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Wrappers around hypervisor back-ends.
16
17use crate::hvc;
Pierre-Clément Tosi4ce55c02023-03-09 15:31:03 +000018
19pub fn hyp_meminfo() -> smccc::Result<u64> {
20 hvc::kvm_hyp_meminfo()
21}
22
23pub fn mem_share(base_ipa: u64) -> smccc::Result<()> {
24 hvc::kvm_mem_share(base_ipa)
25}
26
27pub fn mem_unshare(base_ipa: u64) -> smccc::Result<()> {
28 hvc::kvm_mem_unshare(base_ipa)
29}
30
31pub fn mmio_guard_info() -> smccc::Result<u64> {
32 hvc::kvm_mmio_guard_info()
33}
34
35pub fn mmio_guard_enroll() -> smccc::Result<()> {
36 hvc::kvm_mmio_guard_enroll()
37}
38
39pub fn mmio_guard_map(ipa: u64) -> smccc::Result<()> {
40 hvc::kvm_mmio_guard_map(ipa)
41}
42
43pub fn mmio_guard_unmap(ipa: u64) -> smccc::Result<()> {
44 hvc::kvm_mmio_guard_unmap(ipa)
45}