Pierre-Clément Tosi | 4ce55c0 | 2023-03-09 15:31:03 +0000 | [diff] [blame] | 1 | // 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 | |
| 17 | use crate::hvc; |
| 18 | use crate::smccc; |
| 19 | |
| 20 | pub fn hyp_meminfo() -> smccc::Result<u64> { |
| 21 | hvc::kvm_hyp_meminfo() |
| 22 | } |
| 23 | |
| 24 | pub fn mem_share(base_ipa: u64) -> smccc::Result<()> { |
| 25 | hvc::kvm_mem_share(base_ipa) |
| 26 | } |
| 27 | |
| 28 | pub fn mem_unshare(base_ipa: u64) -> smccc::Result<()> { |
| 29 | hvc::kvm_mem_unshare(base_ipa) |
| 30 | } |
| 31 | |
| 32 | pub fn mmio_guard_info() -> smccc::Result<u64> { |
| 33 | hvc::kvm_mmio_guard_info() |
| 34 | } |
| 35 | |
| 36 | pub fn mmio_guard_enroll() -> smccc::Result<()> { |
| 37 | hvc::kvm_mmio_guard_enroll() |
| 38 | } |
| 39 | |
| 40 | pub fn mmio_guard_map(ipa: u64) -> smccc::Result<()> { |
| 41 | hvc::kvm_mmio_guard_map(ipa) |
| 42 | } |
| 43 | |
| 44 | pub fn mmio_guard_unmap(ipa: u64) -> smccc::Result<()> { |
| 45 | hvc::kvm_mmio_guard_unmap(ipa) |
| 46 | } |