mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 12:09:31 +00:00
acpi: Remove netlink based propagation of power button events
It is wrong to unconditionally propagate ACPI power button events in the host to the guest, since some guests (e.g. ARCVM) don't expect them and misbehave when such an event is received. If at all, this propagation should be enabled only in crosvm builds with "direct" feature enabled, i.e. crosvm-direct builds for ManaTEE. Moreover, even for ManaTEE, the correct approach is to propagate them via direct forwarding of physical ACPI events, rather than via listening on ACPI netlink events in the host (in particular because we want them to be handled in the guest only, not in the host). Since CL:3645408 and CL:3599200 we are using direct forwarding of ACPI power button events, so the netlink based forwarding in the ACPI event listener is no more used by anyone and can be removed. BUG=b:241191471, b:230592368 TEST=ACPI power button events are not propagated to ARCVM guest. Change-Id: I2541bf900d51507dc246b46fb6691dfa0b1c2956 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3859626 Tested-by: Dmytro Maluka <dmaluka@google.com> Reviewed-by: Grzegorz Jaszczyk <jaz@semihalf.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Dmytro Maluka <dmaluka@google.com>
This commit is contained in:
parent
4e871b389b
commit
425c618676
3 changed files with 1 additions and 24 deletions
|
@ -261,7 +261,6 @@ fn run_worker(
|
|||
crate::sys::acpi_event_run(
|
||||
&acpi_event_sock,
|
||||
&gpe0,
|
||||
&pm1,
|
||||
&sci_evt,
|
||||
&acpi_event_ignored_gpe,
|
||||
);
|
||||
|
@ -318,7 +317,7 @@ impl Drop for ACPIPMResource {
|
|||
}
|
||||
|
||||
impl Pm1Resource {
|
||||
pub(crate) fn trigger_sci(&self, sci_evt: &IrqLevelEvent) {
|
||||
fn trigger_sci(&self, sci_evt: &IrqLevelEvent) {
|
||||
if self.status & self.enable & ACPIPMFixedEvent::bitmask_all() != 0 {
|
||||
if let Err(e) = sci_evt.trigger() {
|
||||
error!("ACPIPM: failed to trigger sci event for pm1: {}", e);
|
||||
|
|
|
@ -12,9 +12,7 @@ use base::NetlinkGenericSocket;
|
|||
use sync::Mutex;
|
||||
|
||||
use crate::acpi::ACPIPMError;
|
||||
use crate::acpi::ACPIPMFixedEvent;
|
||||
use crate::acpi::GpeResource;
|
||||
use crate::acpi::Pm1Resource;
|
||||
use crate::IrqLevelEvent;
|
||||
|
||||
pub(crate) fn get_acpi_event_sock() -> Result<Option<NetlinkGenericSocket>, ACPIPMError> {
|
||||
|
@ -57,7 +55,6 @@ fn get_acpi_event_group() -> Option<u32> {
|
|||
pub(crate) fn acpi_event_run(
|
||||
acpi_event_sock: &Option<NetlinkGenericSocket>,
|
||||
gpe0: &Arc<Mutex<GpeResource>>,
|
||||
pm1: &Arc<Mutex<Pm1Resource>>,
|
||||
sci_evt: &IrqLevelEvent,
|
||||
ignored_gpe: &[u32],
|
||||
) {
|
||||
|
@ -88,28 +85,11 @@ pub(crate) fn acpi_event_run(
|
|||
ignored_gpe,
|
||||
);
|
||||
}
|
||||
"button/power" => acpi_event_handle_power_button(acpi_event, pm1, sci_evt),
|
||||
c => debug!("ignored acpi event {}", c),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const ACPI_BUTTON_NOTIFY_STATUS: u32 = 0x80;
|
||||
|
||||
fn acpi_event_handle_power_button(
|
||||
acpi_event: AcpiNotifyEvent,
|
||||
pm1: &Arc<Mutex<Pm1Resource>>,
|
||||
sci_evt: &IrqLevelEvent,
|
||||
) {
|
||||
// If received power button event, emulate PM/PWRBTN_STS and trigger SCI
|
||||
if acpi_event._type == ACPI_BUTTON_NOTIFY_STATUS && acpi_event.bus_id.contains("LNXPWRBN") {
|
||||
let mut pm1 = pm1.lock();
|
||||
|
||||
pm1.status |= ACPIPMFixedEvent::PowerButton.bitmask();
|
||||
pm1.trigger_sci(sci_evt);
|
||||
}
|
||||
}
|
||||
|
||||
fn acpi_event_handle_gpe(
|
||||
gpe_number: u32,
|
||||
_type: u32,
|
||||
|
|
|
@ -9,7 +9,6 @@ use sync::Mutex;
|
|||
|
||||
use crate::acpi::ACPIPMError;
|
||||
use crate::acpi::GpeResource;
|
||||
use crate::acpi::Pm1Resource;
|
||||
use crate::IrqLevelEvent;
|
||||
|
||||
pub(crate) fn get_acpi_event_sock() -> Result<Option<Descriptor>, ACPIPMError> {
|
||||
|
@ -19,7 +18,6 @@ pub(crate) fn get_acpi_event_sock() -> Result<Option<Descriptor>, ACPIPMError> {
|
|||
pub(crate) fn acpi_event_run(
|
||||
_acpi_event_sock: &Option<Descriptor>,
|
||||
_gpe0: &Arc<Mutex<GpeResource>>,
|
||||
_pm1: &Arc<Mutex<Pm1Resource>>,
|
||||
_sci_evt: &IrqLevelEvent,
|
||||
_ignored_gpe: &[u32],
|
||||
) {
|
||||
|
|
Loading…
Reference in a new issue