rust: cpu: Add CpuId::current() to retrieve current CPU ID
authorViresh Kumar <viresh.kumar@linaro.org>
Mon, 9 Jun 2025 11:14:16 +0000 (16:44 +0530)
committerViresh Kumar <viresh.kumar@linaro.org>
Thu, 12 Jun 2025 05:01:28 +0000 (10:31 +0530)
commitc7f005f70d22cd5613cac30bf6d34867189e36a9
treeca697ecc8168ed4d9ca9315ac08ed530ac204c61
parent33db8c97b4cfa0328054fb755dfbcd6e7f3c7a9d
rust: cpu: Add CpuId::current() to retrieve current CPU ID

Introduce `CpuId::current()`, a constructor that wraps the C function
`raw_smp_processor_id()` to retrieve the current CPU identifier without
guaranteeing stability.

This function should be used only when the caller can ensure that
the CPU ID won't change unexpectedly due to preemption or migration.

Suggested-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
MAINTAINERS
rust/helpers/cpu.c [new file with mode: 0644]
rust/helpers/helpers.c
rust/kernel/cpu.rs