
  0   Cˆl–ßi~”êh¥8 Eq–îå1hßÔ756_ŒuÐb&=Ly[Ï¿ÁÓ ô    Cý7zXZ  i"Þ6 !   t/å£àCµ] ýßíEÌªÉë[â^ áý.€'µ`‹¥ÍÁR«žd½!5U�OO�F9âX™NòÀe &ÓÞýÌˆ¸æ¤�c?Ï–ë&8E¸3-v
Å2ûùv¾ZÄ&äP�4Xeœü�üïfþãÉ“Ç¦ážáù"•ðá©-�þŒ§.ŽRLç³t…ÜF	d–càXÛ)uƒ#Êß,¸`]Å¯'ÉÙë*ƒçõ9èk§o-HbK[­Nâv¤¸|Ït¾ºaìÍÜÏ¢û’‡ìò‰à”z}â-%�Ü$%ôð¹Q>Ã- s,ˆ2g†‹\8¯0€Ø ¼ÁyÜ*aÕýùÂ«©¯Ú4‰K¸q&Â™'¾“qsë†Óß*Õi¨VÃR™—}(h³O@ù;ˆL 3½”Å(6M®IV-þt˜	ïe¢Ú=EãºÁ¯ó³�ŸßÁýÝ2ÂFÕÓš}^m?î{4ó\	j)YEž0ø×µþ‰$vCÆ2ÍÛ\#úfâàa)%quùlD"�Ðþ%¸çÚƒµ0†uê÷+�X„rˆûexýË¹¡hý6Æ�3g	A¤ý­Ùönï(×a(ý®§‚‰œU‡ü¤�7^¬+nW„F!ÿ©ZAÐ}Ú'âù„ˆ|` Z¡6¼§¥Õ]•êóáA(o±à7#xÆj×«AbïZläøÇÒrb¼$(º(êa.´i^ùj°V¦®Í…ŒáÚåkéP†3aèlx8Œmê‹êº¥Ý:œî?VËlcø`"öKw ZWä¶7MÅ£îrñIosõû?µsÁãe®¯n'L�-�$$ÜøôoÅñ¨ØQ¢®2QlòDÐ£öRøÔcX©DZŸ2p£²oN5OÞ²Çï˜QnðƒÛR8~å:O 7àx“8³æ¥g³¢šÔ      ¯Ïá ÍÄ  .~ÿQ>0‹    YZ     EˆÏÕ„m<ÿÐÁÓ <�    E/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _ASM_X86_APIC_H
#define _ASM_X86_APIC_H

#include <linux/cpumask.h>
#include <linux/static_call.h>

#include <asm/alternative.h>
#include <asm/cpufeature.h>
#include <asm/apicdef.h>
#include <linux/atomic.h>
#include <asm/fixmap.h>
#include <asm/mpspec.h>
#include <asm/msr.h>
#include <asm/hardirq.h>

#include <linux/rh_kabi.h>

#define ARCH_APICTIMER_STOPS_ON_C3	1

/* Macros for apic_extnmi which controls external NMI masking */
#define APIC_EXTNMI_BSP		0 /* Default */
#define APIC_EXTNMI_ALL		1
#define APIC_EXTNMI_NONE	2

/*
 * Debugging macros
 */
#define APIC_QUIET   0
#define APIC_VERBOSE 1
#define APIC_DEBUG   2

/*
 * Define the default level of output to be very little This can be turned
 * up by using apic=verbose for more information and apic=debug for _lots_
 * of information.  apic_verbosity is defined in apic.c
 */
#define apic_printk(v, s, a...)			\
do {						\
	if ((v) <= apic_verbosity)		\
		printk(s, ##a);			\
} while (0)

#define apic_pr_verbose(s, a...)	apic_printk(APIC_VERBOSE, KERN_INFO s, ##a)
#define apic_pr_debug(s, a...)		apic_printk(APIC_DEBUG, KERN_DEBUG s, ##a)
#define apic_pr_debug_cont(s, a...)	apic_printk(APIC_DEBUG, KERN_CONT s, ##a)
/* Unconditional debug prints for code which is guarded by apic_verbosity already */
#define apic_dbg(s, a...)		printk(KERN_DEBUG s, ##a)

#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32)
extern void x86_32_probe_apic(void);
#else
static inline void x86_32_probe_apic(void) { }
#endif

extern u32 cpuid_to_apicid[];

#define CPU_ACPIID_INVALID	U32_MAX

#ifdef CONFIG_X86_LOCAL_APIC

extern int apic_verbosity;
extern int local_apic_timer_c2_ok;

extern bool apic_is_disabled;
extern unsigned int lapic_timer_period;

extern enum apic_intr_mode_id apic_intr_mode;
enum apic_intr_mode_id {
	APIC_PIC,
	APIC_VIRTUAL_WIRE,
	APIC_VIRTUAL_WIRE_NO_CONFIG,
	APIC_SYMMETRIC_IO,
	APIC_SYMMETRIC_IO_NO_ROUTING
};

/*
 * With 82489DX we can't rely on apic feature bit
 * retrieved via cpuid but still have to deal with
 * such an apic chip so we assume that SMP configuration
 * is found from MP table (64bit case uses ACPI mostly
 * which set smp presence flag as well so we are safe
 * to use this helper too).
 */
static inline bool apic_from_smp_config(void)
{
	return smp_found_config && !apic_is_disabled;
}

/*
 * Basic functions accessing APICs.
 */
#ifdef CONFIG_PARAVIRT
#include <asm/paravirt.h>
#endif

static inline void native_apic_mem_write(u32 reg, u32 v)
{
	volatile u32 *addr = (volatile u32 *)(APIC_BASE + reg);

	alternative_io("movl %0, %P1", "xchgl %0, %P1", X86_BUG_11AP,
		       ASM_OUTPUT2("=r" (v), "=m" (*addr)),
		       ASM_OUTPUT2("0" (v), "m" (*addr)));
}

static inline u32 native_apic_mem_read(u32 reg)
{
	return *((volatile u32 *)(APIC_BASE + reg));
}

static inline void native_apic_mem_eoi(void)
{
	native_apic_mem_write(APIC_EOI, APIC_EOI_ACK);
}

extern void native_apic_icr_write(u32 low, u32 id);
extern u64 native_apic_icr_read(void);

static inline bool apic_is_x2apic_enabled(void)
{
	u64 msr;

	if (rdmsrl_safe(MSR_IA32_APICBASE, &msr))
		return false;
	return msr & X2APIC_ENABLE;
}

extern void enable_IR_x2apic(void);

extern int get_physical_broadcast(void)