base: Add IRQ affinity logging and CPU tracking to pcid (P49)
Track the target CPU ID in InterruptVector, and log the interrupt type (MSI-X/MSI/Legacy) and CPU affinity at allocation time in pci_allocate_interrupt_vector. Add log_affinity() helper for drivers to call after setup.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
diff --git a/drivers/pcid/src/driver_interface/irq_helpers.rs b/drivers/pcid/src/driver_interface/irq_helpers.rs
|
||||
index 28ca077a..dadf6192 100644
|
||||
--- a/drivers/pcid/src/driver_interface/irq_helpers.rs
|
||||
+++ b/drivers/pcid/src/driver_interface/irq_helpers.rs
|
||||
@@ -233,0 +234 @@ pub struct InterruptVector {
|
||||
+ cpu_id: usize,
|
||||
@@ -251,0 +253,4 @@ impl InterruptVector {
|
||||
+ pub fn cpu_id(&self) -> usize {
|
||||
+ self.cpu_id
|
||||
+ }
|
||||
+
|
||||
@@ -260,0 +266,14 @@ impl InterruptVector {
|
||||
+
|
||||
+ /// Log the IRQ affinity for this vector.
|
||||
+ pub fn log_affinity(&self, driver: &str) {
|
||||
+ let kind_str = match self.kind {
|
||||
+ InterruptVectorKind::Legacy => "legacy",
|
||||
+ InterruptVectorKind::Msi => "MSI",
|
||||
+ InterruptVectorKind::MsiX { .. } => "MSI-X",
|
||||
+ };
|
||||
+ log::info!(
|
||||
+ "{driver}: IRQ affinity = {kind_str} on CPU {} vector {}",
|
||||
+ self.cpu_id,
|
||||
+ self.vector
|
||||
+ );
|
||||
+ }
|
||||
@@ -294,0 +314 @@ pub fn pci_allocate_interrupt_vector(
|
||||
+ log::info!("{driver}: allocated MSI-X interrupt on CPU {bsp_cpu_id}");
|
||||
@@ -297,0 +318 @@ pub fn pci_allocate_interrupt_vector(
|
||||
+ cpu_id: bsp_cpu_id,
|
||||
@@ -300,0 +322,3 @@ pub fn pci_allocate_interrupt_vector(
|
||||
+ let bsp_cpu_id = read_bsp_apic_id()
|
||||
+ .unwrap_or_else(|err| panic!("{driver}: failed to read BSP APIC ID: {err}"));
|
||||
+ log::info!("{driver}: allocated MSI interrupt on CPU {bsp_cpu_id}");
|
||||
@@ -303,0 +328 @@ pub fn pci_allocate_interrupt_vector(
|
||||
+ cpu_id: bsp_cpu_id,
|
||||
@@ -307,0 +333,2 @@ pub fn pci_allocate_interrupt_vector(
|
||||
+ let bsp_cpu_id = read_bsp_apic_id().unwrap_or(0);
|
||||
+ log::info!("{driver}: allocated legacy INTx interrupt on CPU {bsp_cpu_id}");
|
||||
@@ -310,0 +338 @@ pub fn pci_allocate_interrupt_vector(
|
||||
+ cpu_id: bsp_cpu_id,
|
||||
@@ -325,0 +354,2 @@ pub fn pci_allocate_interrupt_vector(
|
||||
+ let bsp_cpu_id = read_bsp_apic_id().unwrap_or(0);
|
||||
+ log::info!("{driver}: allocated legacy INTx interrupt on CPU {bsp_cpu_id}");
|
||||
@@ -328,0 +359 @@ pub fn pci_allocate_interrupt_vector(
|
||||
+ cpu_id: bsp_cpu_id,
|
||||
@@ -97,6 +97,8 @@ patches = [
|
||||
"P47-thermald-backend.patch",
|
||||
# P48: Add ACPI fan device discovery and status exposure
|
||||
"P48-acpid-fan-support.patch",
|
||||
# P49: Add IRQ affinity logging and CPU tracking to pcid
|
||||
"P49-irq-affinity-logging.patch",
|
||||
]
|
||||
|
||||
[package]
|
||||
|
||||
Reference in New Issue
Block a user