Skip to content

Commit

Permalink
apic: add proper handling of SPIV register
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
  • Loading branch information
wipawel committed Nov 10, 2020
1 parent 1e1efee commit 169b3e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 5 additions & 1 deletion arch/x86/apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ apic_mode_t apic_get_mode(void) { return apic_mode; }
void init_apic(unsigned int cpu, apic_mode_t mode) {
percpu_t *percpu = get_percpu_page(cpu);
apic_base_t apic_base;
apic_spiv_t spiv;

BUG_ON(mode < APIC_MODE_DISABLED);

Expand Down Expand Up @@ -149,5 +150,8 @@ void init_apic(unsigned int cpu, apic_mode_t mode) {
if (apic_mode == APIC_MODE_XAPIC)
vmap(apic_get_base(apic_base), apic_base.base, PAGE_ORDER_4K, L1_PROT);

apic_write(APIC_SPIV, APIC_SPIV_APIC_ENABLED | 0xff);
spiv.reg = apic_read(APIC_SPIV);
spiv.vector = 0xFF;
spiv.apic_enable = 1;
apic_write(APIC_SPIV, spiv.reg);
}
5 changes: 1 addition & 4 deletions include/arch/x86/apic.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
#include <lib.h>
#include <page.h>

/* Local APIC definitions */
#define APIC_SPIV_APIC_ENABLED 0x00100

#define MSR_X2APIC_REGS 0x800U
#define MSR_X2APIC_REGS 0x800U

#ifndef __ASSEMBLY__

Expand Down

0 comments on commit 169b3e6

Please sign in to comment.