mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
hypervisor: arch: Move PMU IRQ definition from arch to hypervisor crate
Since this would be used in other places inside the hypervisor and hypervisor crate cannot take a dependency on arch crate, as that creates cyclic dependency. Signed-off-by: Jinank Jain <jinankjain@microsoft.com>
This commit is contained in:
@@ -17,7 +17,7 @@ use byteorder::{BigEndian, ByteOrder};
|
||||
use hypervisor::arch::aarch64::gic::Vgic;
|
||||
use hypervisor::arch::aarch64::regs::{
|
||||
AARCH64_ARCH_TIMER_HYP_IRQ, AARCH64_ARCH_TIMER_PHYS_NONSECURE_IRQ,
|
||||
AARCH64_ARCH_TIMER_PHYS_SECURE_IRQ, AARCH64_ARCH_TIMER_VIRT_IRQ,
|
||||
AARCH64_ARCH_TIMER_PHYS_SECURE_IRQ, AARCH64_ARCH_TIMER_VIRT_IRQ, AARCH64_PMU_IRQ,
|
||||
};
|
||||
use thiserror::Error;
|
||||
use vm_fdt::{FdtWriter, FdtWriterResult};
|
||||
@@ -63,9 +63,6 @@ const GIC_FDT_IRQ_TYPE_PPI: u32 = 1;
|
||||
const IRQ_TYPE_EDGE_RISING: u32 = 1;
|
||||
const IRQ_TYPE_LEVEL_HI: u32 = 4;
|
||||
|
||||
// PMU PPI interrupt number
|
||||
pub const AARCH64_PMU_IRQ: u32 = 7;
|
||||
|
||||
// Keys and Buttons
|
||||
// System Power Down
|
||||
const KEY_POWER: u32 = 116;
|
||||
|
||||
@@ -221,3 +221,6 @@ pub const AARCH64_ARCH_TIMER_PHYS_SECURE_IRQ: u32 = 13;
|
||||
pub const AARCH64_ARCH_TIMER_PHYS_NONSECURE_IRQ: u32 = 14;
|
||||
pub const AARCH64_ARCH_TIMER_VIRT_IRQ: u32 = 11;
|
||||
pub const AARCH64_ARCH_TIMER_HYP_IRQ: u32 = 10;
|
||||
|
||||
// PMU PPI interrupt number
|
||||
pub const AARCH64_PMU_IRQ: u32 = 7;
|
||||
|
||||
@@ -60,6 +60,8 @@ use devices::legacy::Serial;
|
||||
#[cfg(feature = "pvmemcontrol")]
|
||||
use devices::pvmemcontrol::{PvmemcontrolBusDevice, PvmemcontrolPciDevice};
|
||||
use devices::{interrupt_controller, AcpiNotificationFlags};
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
use hypervisor::arch::aarch64::regs::AARCH64_PMU_IRQ;
|
||||
use hypervisor::IoEventAddress;
|
||||
use libc::{
|
||||
tcsetattr, termios, MAP_NORESERVE, MAP_PRIVATE, MAP_SHARED, O_TMPFILE, PROT_READ, PROT_WRITE,
|
||||
@@ -1488,7 +1490,7 @@ impl DeviceManager {
|
||||
.cpu_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.init_pmu(arch::aarch64::fdt::AARCH64_PMU_IRQ + 16)
|
||||
.init_pmu(AARCH64_PMU_IRQ + 16)
|
||||
.is_err()
|
||||
{
|
||||
info!("Failed to initialize PMU");
|
||||
|
||||
@@ -39,6 +39,8 @@ use devices::AcpiNotificationFlags;
|
||||
use gdbstub_arch::aarch64::reg::AArch64CoreRegs as CoreRegs;
|
||||
#[cfg(all(target_arch = "x86_64", feature = "guest_debug"))]
|
||||
use gdbstub_arch::x86::reg::X86_64CoreRegs as CoreRegs;
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
use hypervisor::arch::aarch64::regs::AARCH64_PMU_IRQ;
|
||||
use hypervisor::{HypervisorVmError, VmOps};
|
||||
use libc::{termios, SIGWINCH};
|
||||
use linux_loader::cmdline::Cmdline;
|
||||
@@ -1382,7 +1384,7 @@ impl Vm {
|
||||
.cpu_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.init_pmu(arch::aarch64::fdt::AARCH64_PMU_IRQ + 16)
|
||||
.init_pmu(AARCH64_PMU_IRQ + 16)
|
||||
.map_err(|_| {
|
||||
Error::ConfigureSystem(arch::Error::PlatformSpecific(
|
||||
arch::aarch64::Error::VcpuInitPmu,
|
||||
|
||||
Reference in New Issue
Block a user