Skip to content

Commit 6915264

Browse files
Sainath GrandhiEddie Dong
authored andcommitted
hv: Use virtual APIC IDs for Pre-launched VMs
For Pre-launched VMs, ACRN uses mptable for reporting APIC IDs to guest OS. In current code, ACRN uses physical LAPIC IDs for vLAPIC IDs. This patch is to let ACRN use vCPU id for vLAPIC IDs and also report the same when building mptable. ACRN should still use physical LAPIC IDs for SOS because host ACPI tables are passthru to SOS. Tracked-On: #2934 Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com> Acked-by: Eddie Dong <eddie.dong@Intel.com>
1 parent 8796ded commit 6915264

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

hypervisor/arch/x86/guest/vlapic.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,21 +166,16 @@ vlapic_build_id(const struct acrn_vlapic *vlapic)
166166
const struct acrn_vcpu *vcpu = vlapic->vcpu;
167167
uint32_t vlapic_id, lapic_regs_id;
168168

169-
#ifdef CONFIG_PARTITION_MODE
170-
/*
171-
* Partition mode UOS is forced to use physical mode in xAPIC
172-
* Hence ACRN needs to maintain physical APIC ids for partition
173-
* mode.
174-
*/
175-
vlapic_id = per_cpu(lapic_id, vcpu->pcpu_id);
176-
#else
177169
if (is_sos_vm(vcpu->vm)) {
178-
/* Get APIC ID sequence format from cpu_storage */
170+
/*
171+
* For SOS_VM type, pLAPIC IDs need to be used because
172+
* host ACPI tables are passthru to SOS.
173+
* Get APIC ID sequence format from cpu_storage
174+
*/
179175
vlapic_id = per_cpu(lapic_id, vcpu->vcpu_id);
180176
} else {
181177
vlapic_id = (uint32_t)vcpu->vcpu_id;
182178
}
183-
#endif
184179

185180
if (is_x2apic_enabled(vlapic)) {
186181
lapic_regs_id = vlapic_id;

hypervisor/dm/vmptable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ int32_t mptable_build(struct acrn_vm *vm)
115115

116116
(void *)memcpy_s((void *)(mptable->proc_entry_array + i), sizeof(struct proc_entry),
117117
(const void *)&proc_entry_template, sizeof(struct proc_entry));
118-
mptable->proc_entry_array[i].apic_id = per_cpu(lapic_id, pcpu_id);
118+
mptable->proc_entry_array[i].apic_id = (uint8_t) i;
119119
if (i == 0) {
120120
mptable->proc_entry_array[i].cpu_flags |= PROCENTRY_FLAG_BP;
121121
}

0 commit comments

Comments
 (0)