vmbase: Move hvc to aarch64

This commit move ARM hypercall interface to aarch64 directories.

Bug: 362733888
Test: m libvmbase

Change-Id: I17666437670feb9528c6871a36f9d6ecd3ea95d4
diff --git a/libs/libvmbase/src/arch/aarch64.rs b/libs/libvmbase/src/arch/aarch64.rs
index a3f1dd5..f888ccf 100644
--- a/libs/libvmbase/src/arch/aarch64.rs
+++ b/libs/libvmbase/src/arch/aarch64.rs
@@ -15,6 +15,7 @@
 //! Wrappers of assembly calls.
 
 pub mod dbm;
+pub mod hvc;
 pub mod layout;
 pub mod linker;
 pub mod page_table;
diff --git a/libs/libvmbase/src/hvc.rs b/libs/libvmbase/src/arch/aarch64/hvc.rs
similarity index 83%
rename from libs/libvmbase/src/hvc.rs
rename to libs/libvmbase/src/arch/aarch64/hvc.rs
index 1197143..b20f62d 100644
--- a/libs/libvmbase/src/hvc.rs
+++ b/libs/libvmbase/src/arch/aarch64/hvc.rs
@@ -14,6 +14,7 @@
 
 //! Wrappers around calls to the hypervisor.
 
+/// TRNG ARM specific module
 pub mod trng;
 use self::trng::Error;
 use smccc::{
@@ -21,12 +22,18 @@
     hvc64,
 };
 
+/// ARM HVC call number that will return TRNG version
 const ARM_SMCCC_TRNG_VERSION: u32 = 0x8400_0050;
+/// ARM TRNG feature hypercall number
 const ARM_SMCCC_TRNG_FEATURES: u32 = 0x8400_0051;
 #[allow(dead_code)]
+/// ARM SMCC TRNG get uuid hypercall number
 const ARM_SMCCC_TRNG_GET_UUID: u32 = 0x8400_0052;
 #[allow(dead_code)]
+/// ARM SMCC TRNG 32BIT random hypercall number
 const ARM_SMCCC_TRNG_RND32: u32 = 0x8400_0053;
+
+/// ARM SMCCC 64BIT random hypercall number
 pub const ARM_SMCCC_TRNG_RND64: u32 = 0xc400_0053;
 
 /// Returns the (major, minor) version tuple, as defined by the SMCCC TRNG.
@@ -37,8 +44,10 @@
     (version as u32 as i32).try_into()
 }
 
+/// Buffer for random number
 pub type TrngRng64Entropy = [u64; 3];
 
+/// Return hardware backed entropy from TRNG
 pub fn trng_rnd64(nbits: u64) -> trng::Result<TrngRng64Entropy> {
     let mut args = [0u64; 17];
     args[0] = nbits;
@@ -49,6 +58,7 @@
     Ok([regs[1], regs[2], regs[3]])
 }
 
+/// Return TRNG feature
 pub fn trng_features(fid: u32) -> trng::Result<u64> {
     let mut args = [0u64; 17];
     args[0] = fid as u64;
diff --git a/libs/libvmbase/src/hvc/trng.rs b/libs/libvmbase/src/arch/aarch64/hvc/trng.rs
similarity index 97%
rename from libs/libvmbase/src/hvc/trng.rs
rename to libs/libvmbase/src/arch/aarch64/hvc/trng.rs
index efb86f6..26a515e 100644
--- a/libs/libvmbase/src/hvc/trng.rs
+++ b/libs/libvmbase/src/arch/aarch64/hvc/trng.rs
@@ -54,12 +54,15 @@
     }
 }
 
+/// Local result alias
 pub type Result<T> = result::Result<T, Error>;
 
 /// A version of the SMCCC TRNG interface.
 #[derive(Copy, Clone, Eq, Ord, PartialEq, PartialOrd)]
 pub struct Version {
+    /// Version majon number
     pub major: u16,
+    /// Version minor number
     pub minor: u16,
 }
 
diff --git a/libs/libvmbase/src/lib.rs b/libs/libvmbase/src/lib.rs
index 57b7f56..a2032ec 100644
--- a/libs/libvmbase/src/lib.rs
+++ b/libs/libvmbase/src/lib.rs
@@ -25,7 +25,6 @@
 pub mod exceptions;
 pub mod fdt;
 pub mod heap;
-mod hvc;
 pub mod layout;
 pub mod logger;
 pub mod memory;
diff --git a/libs/libvmbase/src/rand.rs b/libs/libvmbase/src/rand.rs
index 16c7b6a..e4623b7 100644
--- a/libs/libvmbase/src/rand.rs
+++ b/libs/libvmbase/src/rand.rs
@@ -14,7 +14,7 @@
 
 //! Functions and drivers for obtaining true entropy.
 
-use crate::hvc;
+use crate::arch::aarch64::hvc;
 use core::fmt;
 use core::mem::size_of;
 use smccc::{self, Hvc};