From 74ff71208539b782a9c773822344cb1e2a2a0506 Mon Sep 17 00:00:00 2001 From: Yu Wang Date: Wed, 22 Aug 2018 14:24:17 +0000 Subject: [PATCH] hv: vlapic: local APIC ID related code cleaning up From SDM Vol3 10.4.6: Some processors permit software to modify the APIC ID. However, the ability of software to modify the APIC ID is processor model specific. Because of this, operating system software should avoid writing to the local APIC ID register. So to permit change APIC ID is not one *must* feature. Keep it simple, we are also reject to modify it. This patch does code cleaning up for LAPIC ID related emulation. Signed-off-by: Yu Wang Acked-by: Anthony Xu --- hypervisor/arch/x86/guest/vlapic.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/hypervisor/arch/x86/guest/vlapic.c b/hypervisor/arch/x86/guest/vlapic.c index 62ad27fff..a65f5cec8 100644 --- a/hypervisor/arch/x86/guest/vlapic.c +++ b/hypervisor/arch/x86/guest/vlapic.c @@ -216,16 +216,10 @@ vlapic_ldr_write_handler(struct acrn_vlapic *vlapic) } static void -vlapic_id_write_handler(struct acrn_vlapic *vlapic) +vlapic_id_write_handler(__unused struct acrn_vlapic *vlapic) { - struct lapic_regs *lapic; - - /* - * We don't allow the ID register to be modified so reset it back to - * its default value. - */ - lapic = &(vlapic->apic_page); - lapic->id = vlapic_get_id(vlapic); + /* Force APIC ID as readonly */ + return; } static inline uint32_t @@ -1479,7 +1473,6 @@ vlapic_write(struct acrn_vlapic *vlapic, uint32_t offset, retval = 0; switch (offset) { case APIC_OFFSET_ID: - lapic->id = data32; vlapic_id_write_handler(vlapic); break; case APIC_OFFSET_TPR: