Skip to main content

ApicIdDecoder

Struct ApicIdDecoder 

Source
pub struct ApicIdDecoder { /* private fields */ }
Expand description

ApicIdDecoder is a utility for extracting particular topological level IDs from an (x2)APIC ID.

In full generality, an APIC ID might decompose as follows:

§[intel/vol3]: Figure 8-5. Generalized Seven Level Interpretation of the APIC ID.

§| CLUSTER ID | PACKAGE ID | DIE ID | TILE ID | MODULE ID | CORE ID | SMT ID |

where the full ID width is 32-bit (if x2APIC) or 8-bit.

§This, however, is higher fidelity than we are able to make use of. Since CLUSTER ID and PACKAGE_ID are not directly enumerable from CPUID, we elide the two IDs into a single PACKAGE ID, defined as the rest of the ID above DIE. Moreover, the system currently has no use for enumerating tiles and modules directly (which is also a practice that AMD does not do): we elide the TILE and MODULE IDs into DIE ID alone. Accordingly, ApicIdDecoder partitions up the APIC address space as

§| PACKAGE ID | DIE ID | CORE ID | SMT ID |

Implementations§

Source§

impl ApicIdDecoder

Source

pub fn from_cpuid(cpuid: impl Cpuid) -> Self

Constructs a new ApicIdDecoder by querying the given Cpuid.

Source

pub const fn smt_id(&self, apic_id: u32) -> u32

Extracts the SMT ID from the provided APIC ID.

Source

pub const fn core_id(&self, apic_id: u32) -> u32

Extracts the Core ID from the provided APIC ID.

Source

pub const fn die_id(&self, apic_id: u32) -> u32

Extracts the Die ID from the provided APIC ID.

Source

pub const fn package_id(&self, apic_id: u32) -> u32

Extracts the Package ID from the provided APIC ID.

Source

pub const fn smt_id_width(&self) -> usize

Returns the bit width allocated to the SMT ID.

Source

pub const fn core_id_cumulative_width(&self) -> usize

Returns the cumulative bit width allocated to Core and SMT IDs.

Source

pub const fn die_id_cumulative_width(&self) -> usize

Returns the cumulative bit width allocated to Die, Core, and SMT IDs.

Trait Implementations§

Source§

impl Clone for ApicIdDecoder

Source§

fn clone(&self) -> ApicIdDecoder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable)§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ApicIdDecoder

Source§

impl Debug for ApicIdDecoder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ApicIdDecoder

Source§

fn default() -> ApicIdDecoder

Returns the “default value” for a type. Read more
Source§

impl Eq for ApicIdDecoder

Source§

impl PartialEq for ApicIdDecoder

Source§

fn eq(&self, other: &ApicIdDecoder) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable)§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ApicIdDecoder

Auto Trait Implementations§

§

impl Freeze for ApicIdDecoder

§

impl RefUnwindSafe for ApicIdDecoder

§

impl Send for ApicIdDecoder

§

impl Sync for ApicIdDecoder

§

impl Unpin for ApicIdDecoder

§

impl UnsafeUnpin for ApicIdDecoder

§

impl UnwindSafe for ApicIdDecoder

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

Source§

impl<Layout, Base> LayoutOver<Base> for Layout
where Layout: Copy + From<Base> + Into<Base>,

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = !

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.