fix(fw_cfg): do not build fw_cfg on aarch64

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
This commit is contained in:
Changyuan Lyu 2024-07-19 13:12:20 -07:00 committed by Lencerf
parent 6ee75346aa
commit 5de0d7583c
4 changed files with 10 additions and 0 deletions

View file

@ -12,7 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#[cfg(target_arch = "x86_64")]
use std::ffi::CString;
#[cfg(target_arch = "x86_64")]
use std::fs::File;
use std::path::PathBuf;
@ -127,6 +129,7 @@ struct RunArgs {
#[arg(long)]
pvpanic: bool,
#[cfg(target_arch = "x86_64")]
#[arg(long = "fw-cfg")]
fw_cfgs: Vec<String>,
@ -229,6 +232,7 @@ fn main_run(args: RunArgs) -> Result<(), Error> {
vm.add_pvpanic().context(error::CreateDevice)?;
}
#[cfg(target_arch = "x86_64")]
if args.firmware.is_some() || !args.fw_cfgs.is_empty() {
let params = args
.fw_cfgs

View file

@ -32,6 +32,7 @@ use crate::arch::layout::{
PCIE_MMIO_32_NON_PREFETCHABLE_START, PCIE_MMIO_32_PREFETCHABLE_END,
PCIE_MMIO_32_PREFETCHABLE_START, RAM_32_SIZE,
};
#[cfg(target_arch = "x86_64")]
use crate::device::fw_cfg::FwCfg;
use crate::errors::{trace_error, DebugTrace};
use crate::hv::{Coco, Vcpu, Vm, VmEntry, VmExit};
@ -127,6 +128,7 @@ where
#[cfg(target_arch = "aarch64")]
pub mmio_devs: RwLock<Vec<(u64, Arc<MemRegion>)>>,
pub pci_bus: PciBus,
#[cfg(target_arch = "x86_64")]
pub fw_cfg: Mutex<Option<Arc<Mutex<FwCfg>>>>,
}

View file

@ -13,6 +13,7 @@
// limitations under the License.
pub mod console;
#[cfg(target_arch = "x86_64")]
#[path = "fw_cfg/fw_cfg.rs"]
pub mod fw_cfg;
#[cfg(target_arch = "aarch64")]

View file

@ -23,6 +23,7 @@ use snafu::{ResultExt, Snafu};
#[cfg(target_arch = "aarch64")]
use crate::arch::layout::PL011_START;
use crate::board::{ArchBoard, Board, BoardConfig, STATE_CREATED, STATE_RUNNING};
#[cfg(target_arch = "x86_64")]
use crate::device::fw_cfg::{FwCfg, FwCfgItemParam, PORT_SELECTOR};
#[cfg(target_arch = "aarch64")]
use crate::device::pl011::Pl011;
@ -108,6 +109,7 @@ where
#[cfg(target_arch = "aarch64")]
mmio_devs: RwLock::new(Vec::new()),
pci_bus: PciBus::new(),
#[cfg(target_arch = "x86_64")]
fw_cfg: Mutex::new(None),
});
@ -181,6 +183,7 @@ where
self.add_pci_dev(None, pci_dev)
}
#[cfg(target_arch = "x86_64")]
pub fn add_fw_cfg(
&mut self,
params: impl Iterator<Item = FwCfgItemParam>,