mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
hypervisor: mshv: get_msr_list return vector instead fam-wrapper
New MSHV version updates the get_msr_list output as vector instead of fam-wrapper. It avoids unnecessary conversions. Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
committed by
Muminul Islam Russell
parent
c58c686f3e
commit
4af98f4cb2
@@ -262,7 +262,7 @@ impl MshvHypervisor {
|
|||||||
///
|
///
|
||||||
/// Retrieve the list of MSRs supported by MSHV.
|
/// Retrieve the list of MSRs supported by MSHV.
|
||||||
///
|
///
|
||||||
fn get_msr_list(&self) -> hypervisor::Result<MsrList> {
|
fn get_msr_list(&self) -> hypervisor::Result<Vec<u32>> {
|
||||||
self.mshv
|
self.mshv
|
||||||
.get_msr_index_list()
|
.get_msr_index_list()
|
||||||
.map_err(|e| hypervisor::HypervisorError::GetMsrList(e.into()))
|
.map_err(|e| hypervisor::HypervisorError::GetMsrList(e.into()))
|
||||||
@@ -347,15 +347,13 @@ impl MshvHypervisor {
|
|||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
{
|
{
|
||||||
let msr_list = self.get_msr_list()?;
|
let msr_list = self.get_msr_list()?;
|
||||||
let num_msrs = msr_list.as_fam_struct_ref().nmsrs as usize;
|
|
||||||
let mut msrs: Vec<MsrEntry> = vec![
|
let mut msrs: Vec<MsrEntry> = vec![
|
||||||
MsrEntry {
|
MsrEntry {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
num_msrs
|
msr_list.len()
|
||||||
];
|
];
|
||||||
let indices = msr_list.as_slice();
|
for (pos, index) in msr_list.iter().enumerate() {
|
||||||
for (pos, index) in indices.iter().enumerate() {
|
|
||||||
msrs[pos].index = *index;
|
msrs[pos].index = *index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user