Commit 0fe4e1b3 authored by Charles E. Youse's avatar Charles E. Youse Committed by Anas Nashif
Browse files

arch/x86: x2APIC support is not specific to jailhouse



Simple renaming and Kconfig reorganization. Choice of local APIC
access method isn't specific to the Jailhouse hypervisor.

Signed-off-by: default avatarCharles E. Youse <charles.youse@intel.com>
parent ba516e8e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ z_set_thread_return_value(struct k_thread *thread, unsigned int value)

extern void k_cpu_atomic_idle(unsigned int key);

#ifdef CONFIG_JAILHOUSE_X2APIC
#ifdef CONFIG_X2APIC
#define MSR_X2APIC_BASE 0x00000800

static inline u32_t read_x2apic(unsigned int reg)
+0 −4
Original line number Diff line number Diff line
@@ -9,8 +9,4 @@ config JAILHOUSE
	bool "Zephyr port to boot as a (x86) Jailhouse inmate cell payload"
	default y

config JAILHOUSE_X2APIC
	depends on JAILHOUSE
	bool "When in Jailhouse inmate cell mode, access APIC in x2APIC mode"

endif # BOARD_X86_JAILHOUSE
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ CONFIG_BOARD_X86_JAILHOUSE=y
CONFIG_CPU_MINUTEIA=y
CONFIG_IA32_LEGACY_IO_PORTS=y
CONFIG_JAILHOUSE=y
CONFIG_JAILHOUSE_X2APIC=y
CONFIG_X2APIC=y
CONFIG_KERNEL_ENTRY="__jh_entry"
CONFIG_IOAPIC_MASK_RTE=n
CONFIG_PIC_DISABLE=n
+6 −0
Original line number Diff line number Diff line
@@ -20,6 +20,12 @@ config LOAPIC_BASE_ADDRESS
	help
	  This option specifies the base address of the Local APIC device.

config X2APIC
	bool "Access local APIC in x2APIC mode"
	default n
	help
	  If your local APIC supports x2APIC mode, turn this on.

config LOAPIC_SPURIOUS_VECTOR
	bool "Handle LOAPIC spurious interrupts"
	help
+4 −5
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@ static u32_t loapic_device_power_state = DEVICE_PM_ACTIVE_STATE;

static ALWAYS_INLINE u32_t LOAPIC_READ(mem_addr_t addr)
{
#ifndef CONFIG_JAILHOUSE_X2APIC
#ifndef CONFIG_X2APIC
	return sys_read32(CONFIG_LOAPIC_BASE_ADDRESS + addr);
#else
	return read_x2apic(addr >> 4);
@@ -181,7 +181,7 @@ static ALWAYS_INLINE u32_t LOAPIC_READ(mem_addr_t addr)

static ALWAYS_INLINE void LOAPIC_WRITE(mem_addr_t addr, u32_t data)
{
#ifndef CONFIG_JAILHOUSE_X2APIC
#ifndef CONFIG_X2APIC
	sys_write32(data, CONFIG_LOAPIC_BASE_ADDRESS + addr);
#else
	write_x2apic(addr >> 4, data);
@@ -209,9 +209,8 @@ static int loapic_init(struct device *unused)

	/* reset the DFR, TPR, TIMER_CONFIG, and TIMER_ICR */

	/* Jailhouse does not allow writes to DFR in x2APIC mode */
#ifndef CONFIG_JAILHOUSE_X2APIC
	LOAPIC_WRITE(LOAPIC_DFR, 0xffffffff);
#ifndef CONFIG_X2APIC
	LOAPIC_WRITE(LOAPIC_DFR, 0xffffffff);	/* no DFR in x2APIC mode */
#endif

	LOAPIC_WRITE(LOAPIC_TPR, 0x0);
Loading