blob: e06d809e9571be5747935c596b6214cdefa5f49e [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;
18use crate::smccc;
19
20pub fn hyp_meminfo() -> smccc::Result<u64> {
21 hvc::kvm_hyp_meminfo()
22}
23
24pub fn mem_share(base_ipa: u64) -> smccc::Result<()> {
25 hvc::kvm_mem_share(base_ipa)
26}
27
28pub fn mem_unshare(base_ipa: u64) -> smccc::Result<()> {
29 hvc::kvm_mem_unshare(base_ipa)
30}
31
32pub fn mmio_guard_info() -> smccc::Result<u64> {
33 hvc::kvm_mmio_guard_info()
34}
35
36pub fn mmio_guard_enroll() -> smccc::Result<()> {
37 hvc::kvm_mmio_guard_enroll()
38}
39
40pub fn mmio_guard_map(ipa: u64) -> smccc::Result<()> {
41 hvc::kvm_mmio_guard_map(ipa)
42}
43
44pub fn mmio_guard_unmap(ipa: u64) -> smccc::Result<()> {
45 hvc::kvm_mmio_guard_unmap(ipa)
46}