Skip to content

Commit

Permalink
tbd(acpi): do not add CPU info in DSDT
Browse files Browse the repository at this point in the history
In theory that should be ok, since we pass all the required info via
MADT.

Signed-off-by: Babis Chalios <bchalios@amazon.es>
  • Loading branch information
bchalios committed Feb 27, 2024
1 parent 95f3c20 commit 743c14e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 48 deletions.
12 changes: 1 addition & 11 deletions src/vmm/src/acpi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use acpi_tables::fadt::{FADT_F_HW_REDUCED_ACPI, FADT_F_PWR_BUTTON, FADT_F_SLP_BUTTON};
use acpi_tables::{aml, Aml, Dsdt, Fadt, Madt, Rsdp, Sdt, Xsdt};
use acpi_tables::{Aml, Dsdt, Fadt, Madt, Rsdp, Sdt, Xsdt};
use log::debug;
use vm_allocator::AllocPolicy;

Expand Down Expand Up @@ -55,16 +55,6 @@ impl Vmm {
debug!("acpi: building DSDT table");
let mut dsdt_data = Vec::new();

// CPU-related Aml data
let hid = aml::Name::new("_HID".into(), &"ACPI0010");
let uid = aml::Name::new("_CID".into(), &aml::EisaName::new("PNP0A05"));
let cpu_methods = aml::Method::new("CSCN".into(), 0, true, vec![]);
let mut cpu_inner_data: Vec<&dyn Aml> = vec![&hid, &uid, &cpu_methods];
for vcpu in vcpus {
cpu_inner_data.push(vcpu);
}
aml::Device::new("_SB_.CPUS".into(), cpu_inner_data).append_aml_bytes(&mut dsdt_data);

// Virtio-devices DSDT data
self.mmio_device_manager.append_aml_bytes(&mut dsdt_data);

Expand Down
37 changes: 0 additions & 37 deletions src/vmm/src/vstate/vcpu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ use std::sync::Mutex;
use std::sync::{Arc, Barrier};
use std::{fmt, io, thread};

#[cfg(target_arch = "x86_64")]
use acpi_tables::madt::LocalAPIC;
use acpi_tables::{aml, Aml};
use kvm_bindings::{KVM_SYSTEM_EVENT_RESET, KVM_SYSTEM_EVENT_SHUTDOWN};
use kvm_ioctls::VcpuExit;
use libc::{c_int, c_void, siginfo_t};
Expand All @@ -25,8 +22,6 @@ use utils::errno;
use utils::eventfd::EventFd;
use utils::signal::{register_signal_handler, sigrtmin, Killable};
use utils::sm::StateMachine;
#[cfg(target_arch = "x86_64")]
use zerocopy::AsBytes;

use crate::cpu_config::templates::{CpuConfiguration, GuestConfigError};
use crate::logger::{IncMetric, METRICS};
Expand Down Expand Up @@ -554,38 +549,6 @@ impl Vcpu {
}
}
}

#[cfg(target_arch = "x86_64")]
fn generate_acpi_mat(&self) -> Vec<u8> {
LocalAPIC::new(self.kvm_vcpu.index).as_bytes().into()
}

#[cfg(target_arch = "aarch64")]
fn generate_acpi_mat(&self) -> Vec<u8> {
unimplemented!()
}
}

impl Aml for Vcpu {
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
let mat_data: Vec<u8> = self.generate_acpi_mat();
aml::Device::new(
format!("C{:03}", self.kvm_vcpu.index).as_str().into(),
vec![
&aml::Name::new("_HID".into(), &"ACPI0007"),
&aml::Name::new("_UID".into(), &self.kvm_vcpu.index),
&aml::Method::new(
"_STA".into(),
0,
false,
// Mark CPU present
vec![&aml::Return::new(&0xfu8)],
),
&aml::Name::new("_MAT".into(), &aml::Buffer::new(mat_data)),
],
)
.append_aml_bytes(bytes);
}
}

impl Drop for Vcpu {
Expand Down

0 comments on commit 743c14e

Please sign in to comment.