Skip to content

firmware_uefi: add diagnostics service for uefi logs #1209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
601250a
Initial commit, defined diagnostics subsystem and laid out IoPort int…
maheeraeron Apr 19, 2025
7fe0fcc
Forgot to add diagnostics.rs itself
maheeraeron Apr 19, 2025
c6dbbae
Defined advanced logger types and laid out logic for parsing
maheeraeron Apr 19, 2025
5d5e724
Merge branch 'main' into user/maheeraeron/efi-diagnostics
maheeraeron Apr 19, 2025
633fdbc
Now parsing the buffer but getting rate limited
maheeraeron Apr 20, 2025
d43cefd
Significant error handling improvements
maheeraeron Apr 20, 2025
9bc2936
Added advanced_logger.rs instead to clarify type ownership
maheeraeron Apr 20, 2025
a94d854
Moved diagnostics state to UefiDevice instead
maheeraeron Apr 20, 2025
17ddf48
Removed redundant variable useage in advanced_logger.rs validation fu…
maheeraeron Apr 20, 2025
8be2496
Modified trace prefix message
maheeraeron Apr 20, 2025
20c08aa
Switched to tracing::info!() instead
maheeraeron Apr 20, 2025
288dbea
fixed error strings
maheeraeron Apr 20, 2025
997cd1b
process diagnostics when UefiDevice stops or resets
maheeraeron Apr 20, 2025
5956808
Remove trailing newlines characters
maheeraeron Apr 20, 2025
adb4307
clippy fixes
maheeraeron Apr 20, 2025
b06ba41
use ALIGNMENT constant, handle remaining messages
maheeraeron Apr 20, 2025
866cf0e
More clippy fixes, move functionality from specs to service, added to…
maheeraeron Apr 21, 2025
042d407
Invalid UTF8 gives error, improve tracing::info!() when logging logs
maheeraeron Apr 21, 2025
af9299a
Improved error handling v2
maheeraeron Apr 21, 2025
8cdc11a
changes tracelimit error when a diagnostics error occurs
maheeraeron Apr 21, 2025
7910dc9
Moved diagnostics state to service, changed to ebs_complete flag
maheeraeron Apr 22, 2025
79db679
Publicize runtime state and use that instead of ebs_complete
maheeraeron Apr 22, 2025
5132b02
Fixed Validator spelling
maheeraeron Apr 22, 2025
7a5756f
Merge branch 'main' into user/maheeraeron/efi-diagnostics
maheeraeron Apr 23, 2025
8a6b62a
Update mu_msvm version
maheeraeron Apr 23, 2025
cac77ad
Changed message to description, clarified units for timestamp, use an…
maheeraeron Apr 24, 2025
bc1bb38
Separate entry processing to its own function, clarify doc comments, …
maheeraeron Apr 24, 2025
d218bd5
Add no-boot test for efi diagnostics for openhcl_uefi_x64 only
maheeraeron Apr 25, 2025
4f6872f
Rename to ticks and message instead, process remaining messages, earl…
maheeraeron Apr 30, 2025
35fe96c
restore nvram spec_services module to undo pub, plumb new flush flag …
maheeraeron Apr 30, 2025
b86d0e0
Merge branch 'main' into user/maheeraeron/efi-diagnostics
maheeraeron Apr 30, 2025
2518300
Unpub nvram subservice
maheeraeron Apr 30, 2025
d8ac1a3
Fixed test
maheeraeron Apr 30, 2025
153f8b1
Fix test using frontpage to prevent halting
maheeraeron Apr 30, 2025
8fb909f
Add and require doc comments
maheeraeron May 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1687,6 +1687,7 @@ dependencies = [
name = "firmware_uefi"
version = "0.0.0"
dependencies = [
"anyhow",
"async-trait",
"bitfield-struct 0.10.1",
"chipset_device",
Expand Down
2 changes: 1 addition & 1 deletion flowey/flowey_lib_hvlite/src/_jobs/cfg_versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub const MDBOOK: &str = "0.4.40";
pub const MDBOOK_ADMONISH: &str = "1.18.0";
pub const MDBOOK_MERMAID: &str = "0.14.0";
pub const RUSTUP_TOOLCHAIN: &str = "1.86.0";
pub const MU_MSVM: &str = "24.0.4";
pub const MU_MSVM: &str = "25.0.1";
pub const NEXTEST: &str = "0.9.74";
pub const NODEJS: &str = "18.x";
pub const OPENHCL_KERNEL_DEV_VERSION: &str = "6.6.63.2";
Expand Down
1 change: 1 addition & 0 deletions vm/devices/firmware/firmware_uefi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ open_enum.workspace = true
pal_async.workspace = true
ucs2.workspace = true

anyhow.workspace = true
async-trait.workspace = true
bitfield-struct.workspace = true
der = { workspace = true, features = ["derive", "alloc", "oid"], optional = true }
Expand Down
15 changes: 15 additions & 0 deletions vm/devices/firmware/firmware_uefi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ struct UefiDeviceServices {
generation_id: service::generation_id::GenerationIdServices,
#[inspect(mut)]
time: service::time::TimeServices,
diagnostics: service::diagnostics::DiagnosticsServices,
}

// Begin and end range are inclusive.
Expand Down Expand Up @@ -199,6 +200,7 @@ impl UefiDevice {
generation_id_deps,
),
time: service::time::TimeServices::new(time_source),
diagnostics: service::diagnostics::DiagnosticsServices::new(),
},
};
Ok(uefi)
Expand Down Expand Up @@ -252,6 +254,8 @@ impl UefiDevice {
);
}
}
UefiCommand::SET_EFI_DIAGNOSTICS_GPA => self.service.diagnostics.set_gpa(data),
UefiCommand::PROCESS_EFI_DIAGNOSTICS => self.process_diagnostics(self.gm.clone()),
_ => tracelimit::warn_ratelimited!(addr, data, "unknown uefi write"),
}
}
Expand Down Expand Up @@ -400,6 +404,10 @@ open_enum::open_enum! {
WATCHDOG_RESOLUTION = 0x28,
WATCHDOG_COUNT = 0x29,

// EFI Diagnostics
SET_EFI_DIAGNOSTICS_GPA = 0x2B,
PROCESS_EFI_DIAGNOSTICS = 0x2C,

// Event Logging (Windows 8.1 MQ/M0)
EVENT_LOG_FLUSH = 0x30,

Expand Down Expand Up @@ -432,6 +440,7 @@ mod save_restore {
use vmcore::save_restore::SaveRestore;

mod state {
use crate::service::diagnostics::DiagnosticsServices;
use crate::service::event_log::EventLogServices;
use crate::service::generation_id::GenerationIdServices;
use crate::service::nvram::NvramServices;
Expand All @@ -457,6 +466,8 @@ mod save_restore {
pub generation_id: <GenerationIdServices as SaveRestore>::SavedState,
#[mesh(6)]
pub time: <TimeServices as SaveRestore>::SavedState,
#[mesh(7)]
pub diagnostics: <DiagnosticsServices as SaveRestore>::SavedState,
}
}

Expand All @@ -475,6 +486,7 @@ mod save_restore {
uefi_watchdog,
generation_id,
time,
diagnostics,
},
address,
} = self;
Expand All @@ -487,6 +499,7 @@ mod save_restore {
watchdog: uefi_watchdog.save()?,
generation_id: generation_id.save()?,
time: time.save()?,
diagnostics: diagnostics.save()?,
})
}

Expand All @@ -499,6 +512,7 @@ mod save_restore {
watchdog,
generation_id,
time,
diagnostics,
} = state;

self.address = address;
Expand All @@ -508,6 +522,7 @@ mod save_restore {
self.service.uefi_watchdog.restore(watchdog)?;
self.service.generation_id.restore(generation_id)?;
self.service.time.restore(time)?;
self.service.diagnostics.restore(diagnostics)?;

Ok(())
}
Expand Down
Loading