Struct vm_topology::processor::TopologyBuilder
source · pub struct TopologyBuilder<T: ArchTopology> { /* private fields */ }
Expand description
A builder for ProcessorTopology
.
Implementations§
source§impl TopologyBuilder<Aarch64Topology>
impl TopologyBuilder<Aarch64Topology>
sourcepub fn new_aarch64(gic: GicInfo) -> Self
pub fn new_aarch64(gic: GicInfo) -> Self
Returns a builder for creating an x86 processor topology.
sourcepub fn build(
&self,
proc_count: u32,
) -> Result<ProcessorTopology<Aarch64Topology>, InvalidTopology>
pub fn build( &self, proc_count: u32, ) -> Result<ProcessorTopology<Aarch64Topology>, InvalidTopology>
Builds a processor topology with proc_count
processors.
sourcepub fn build_with_vp_info(
&self,
vps: impl IntoIterator<Item = Aarch64VpInfo>,
) -> Result<ProcessorTopology<Aarch64Topology>, InvalidTopology>
pub fn build_with_vp_info( &self, vps: impl IntoIterator<Item = Aarch64VpInfo>, ) -> Result<ProcessorTopology<Aarch64Topology>, InvalidTopology>
Builds a processor topology with processors with the specified information.
source§impl TopologyBuilder<X86Topology>
impl TopologyBuilder<X86Topology>
sourcepub fn from_host_topology() -> Result<Self, HostTopologyError>
pub fn from_host_topology() -> Result<Self, HostTopologyError>
Returns a builder initialized from host information (via CPUID).
Note that this only queries SMT state and the socket size, it does not otherwise affect APIC configuration.
sourcepub fn from_cpuid(
cpuid: &mut dyn FnMut(u32, u32) -> [u32; 4],
) -> Result<Self, HostTopologyError>
pub fn from_cpuid( cpuid: &mut dyn FnMut(u32, u32) -> [u32; 4], ) -> Result<Self, HostTopologyError>
Returns a builder initialized from cpuid information.
Note that this only queries SMT state and the socket size, it does not otherwise affect APIC configuration.
sourcepub fn apic_id_offset(&mut self, offset: u32) -> &mut Self
pub fn apic_id_offset(&mut self, offset: u32) -> &mut Self
Sets the APIC ID offset. Each APIC ID will be offset by this value, rounded up to the socket size.
sourcepub fn x2apic(&mut self, x2apic: X2ApicState) -> &mut Self
pub fn x2apic(&mut self, x2apic: X2ApicState) -> &mut Self
Sets the X2APIC configuration.
sourcepub fn build(
&self,
proc_count: u32,
) -> Result<ProcessorTopology<X86Topology>, InvalidTopology>
pub fn build( &self, proc_count: u32, ) -> Result<ProcessorTopology<X86Topology>, InvalidTopology>
Builds a processor topology with proc_count
processors.
sourcepub fn build_with_vp_info(
&self,
vps: impl IntoIterator<Item = X86VpInfo>,
) -> Result<ProcessorTopology<X86Topology>, InvalidTopology>
pub fn build_with_vp_info( &self, vps: impl IntoIterator<Item = X86VpInfo>, ) -> Result<ProcessorTopology<X86Topology>, InvalidTopology>
Builds a processor topology with processors with the specified information.
source§impl<T: ArchTopology> TopologyBuilder<T>
impl<T: ArchTopology> TopologyBuilder<T>
sourcepub fn vps_per_socket(&mut self, count: u32) -> &mut Self
pub fn vps_per_socket(&mut self, count: u32) -> &mut Self
Sets the number of VPs per socket.
This does not need to be a power of 2, but it should be a multiple of 2 if SMT is enabled.
The number of VPs per socket will be rounded up to a power of 2 for purposes of defining the x2APIC ID.
sourcepub fn smt_enabled(&mut self, enabled: bool) -> &mut Self
pub fn smt_enabled(&mut self, enabled: bool) -> &mut Self
Sets whether SMT (hyperthreading) is enabled.
This is ignored if vps_per_socket
is 1.