misc: simplify configure_vcpu() signature on x86_64

It is always called with topology provided, so there is no
need to pass topology as an Option. Simplifying the signature
makes further topology-related changes to arc/src/x86_64 module
simpler.

Signed-off-by: Peter Oskolkov <posk@google.com>
This commit is contained in:
Peter Oskolkov 2025-08-13 19:26:24 +00:00 committed by Rob Bradford
parent 10b79431f6
commit 34385e99f2
2 changed files with 10 additions and 10 deletions

View file

@ -832,9 +832,9 @@ pub fn configure_vcpu(
cpuid: Vec<CpuIdEntry>,
kvm_hyperv: bool,
cpu_vendor: CpuVendor,
topology: Option<(u16, u16, u16, u16)>,
topology: (u16, u16, u16, u16),
) -> super::Result<()> {
let x2apic_id = get_x2apic_id(id, topology);
let x2apic_id = get_x2apic_id(id, Some(topology));
// Per vCPU CPUID changes; common are handled via generate_common_cpuid()
let mut cpuid = cpuid;
@ -856,9 +856,9 @@ pub fn configure_vcpu(
}
assert!(apic_id_patched);
if let Some(t) = topology {
update_cpuid_topology(&mut cpuid, t.0, t.1, t.2, t.3, cpu_vendor, id);
}
update_cpuid_topology(
&mut cpuid, topology.0, topology.1, topology.2, topology.3, cpu_vendor, id,
);
// The TSC frequency CPUID leaf should not be included when running with HyperV emulation
if !kvm_hyperv {

View file

@ -390,7 +390,7 @@ impl Vcpu {
boot_setup: Option<(EntryPoint, &GuestMemoryAtomic<GuestMemoryMmap>)>,
#[cfg(target_arch = "x86_64")] cpuid: Vec<CpuIdEntry>,
#[cfg(target_arch = "x86_64")] kvm_hyperv: bool,
#[cfg(target_arch = "x86_64")] topology: Option<(u16, u16, u16, u16)>,
#[cfg(target_arch = "x86_64")] topology: (u16, u16, u16, u16),
) -> Result<()> {
#[cfg(target_arch = "aarch64")]
{
@ -885,20 +885,20 @@ impl CpuManager {
#[cfg(target_arch = "x86_64")]
let topology = self.config.topology.clone().map_or_else(
|| {
Some((
(
1_u16,
u16::try_from(self.boot_vcpus()).unwrap(),
1_u16,
1_u16,
))
)
},
|t| {
Some((
(
t.threads_per_core.into(),
t.cores_per_die.into(),
t.dies_per_package.into(),
t.packages.into(),
))
)
},
);
#[cfg(target_arch = "x86_64")]