summaryrefslogtreecommitdiffstats
path: root/sys/x86/include/apicvar.h
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-02-09 21:00:56 +0000
committerkib <kib@FreeBSD.org>2015-02-09 21:00:56 +0000
commit0754f0eac9d97737274d7b77cb519abb250362b3 (patch)
treed2e88c87f150ce7e0dfe34e37fbc902c5f84fd8a /sys/x86/include/apicvar.h
parente83a0077986ede1b5481738b285a4612ca8636e1 (diff)
downloadFreeBSD-src-0754f0eac9d97737274d7b77cb519abb250362b3.zip
FreeBSD-src-0754f0eac9d97737274d7b77cb519abb250362b3.tar.gz
Add x2APIC support. Enable it by default if CPU is capable. The
hw.x2apic_enable tunable allows disabling it from the loader prompt. To closely repeat effects of the uncached memory ops when accessing registers in the xAPIC mode, the x2APIC writes to MSRs are preceeded by mfence, except for the EOI notifications. This is probably too strict, only ICR writes to send IPI require serialization to ensure that other CPUs see the previous actions when IPI is delivered. This may be changed later. In vmm justreturn IPI handler, call doreti_iret instead of doing iretd inline, to handle corner conditions. Note that the patch only switches LAPICs into x2APIC mode. It does not enables FreeBSD to support > 255 CPUs, which requires parsing x2APIC MADT entries and doing interrupts remapping, but is the required step on the way. Reviewed by: neel Tested by: pho (real hardware), neel (on bhyve) Discussed with: jhb, grehan Sponsored by: The FreeBSD Foundation MFC after: 2 months
Diffstat (limited to 'sys/x86/include/apicvar.h')
-rw-r--r--sys/x86/include/apicvar.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/x86/include/apicvar.h b/sys/x86/include/apicvar.h
index 35603e8..f7dfec8 100644
--- a/sys/x86/include/apicvar.h
+++ b/sys/x86/include/apicvar.h
@@ -189,6 +189,7 @@ int ioapic_set_smi(void *cookie, u_int pin);
struct apic_ops {
void (*create)(u_int, int);
void (*init)(vm_paddr_t);
+ void (*xapic_mode)(void);
void (*setup)(int);
void (*dump)(const char *);
void (*disable)(void);
@@ -243,6 +244,13 @@ lapic_init(vm_paddr_t addr)
}
static inline void
+lapic_xapic_mode(void)
+{
+
+ apic_ops.xapic_mode();
+}
+
+static inline void
lapic_setup(int boot)
{
@@ -417,5 +425,11 @@ void lapic_handle_intr(int vector, struct trapframe *frame);
void lapic_handle_timer(struct trapframe *frame);
void xen_intr_handle_upcall(struct trapframe *frame);
+extern int x2apic_mode;
+
+#ifdef _SYS_SYSCTL_H_
+SYSCTL_DECL(_hw_apic);
+#endif
+
#endif /* !LOCORE */
#endif /* _X86_APICVAR_H_ */
OpenPOWER on IntegriCloud