drm/panthor: Don't add write fences to the shared BOs
[drm/drm-misc.git] / arch / x86 / kernel / cpu / acrn.c
blob2c5b51aad91a03f0cc2b302087c383f0f882dbb4
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * ACRN detection support
5 * Copyright (C) 2019 Intel Corporation. All rights reserved.
7 * Jason Chen CJ <jason.cj.chen@intel.com>
8 * Zhao Yakui <yakui.zhao@intel.com>
12 #include <linux/interrupt.h>
14 #include <asm/acrn.h>
15 #include <asm/apic.h>
16 #include <asm/cpufeatures.h>
17 #include <asm/desc.h>
18 #include <asm/hypervisor.h>
19 #include <asm/idtentry.h>
20 #include <asm/irq_regs.h>
22 static u32 __init acrn_detect(void)
24 return acrn_cpuid_base();
27 static void __init acrn_init_platform(void)
29 /* Install system interrupt handler for ACRN hypervisor callback */
30 sysvec_install(HYPERVISOR_CALLBACK_VECTOR, sysvec_acrn_hv_callback);
32 x86_platform.calibrate_tsc = acrn_get_tsc_khz;
33 x86_platform.calibrate_cpu = acrn_get_tsc_khz;
36 static bool acrn_x2apic_available(void)
38 return boot_cpu_has(X86_FEATURE_X2APIC);
41 static void (*acrn_intr_handler)(void);
43 DEFINE_IDTENTRY_SYSVEC(sysvec_acrn_hv_callback)
45 struct pt_regs *old_regs = set_irq_regs(regs);
48 * The hypervisor requires that the APIC EOI should be acked.
49 * If the APIC EOI is not acked, the APIC ISR bit for the
50 * HYPERVISOR_CALLBACK_VECTOR will not be cleared and then it
51 * will block the interrupt whose vector is lower than
52 * HYPERVISOR_CALLBACK_VECTOR.
54 apic_eoi();
55 inc_irq_stat(irq_hv_callback_count);
57 if (acrn_intr_handler)
58 acrn_intr_handler();
60 set_irq_regs(old_regs);
63 void acrn_setup_intr_handler(void (*handler)(void))
65 acrn_intr_handler = handler;
67 EXPORT_SYMBOL_GPL(acrn_setup_intr_handler);
69 void acrn_remove_intr_handler(void)
71 acrn_intr_handler = NULL;
73 EXPORT_SYMBOL_GPL(acrn_remove_intr_handler);
75 const __initconst struct hypervisor_x86 x86_hyper_acrn = {
76 .name = "ACRN",
77 .detect = acrn_detect,
78 .type = X86_HYPER_ACRN,
79 .init.init_platform = acrn_init_platform,
80 .init.x2apic_available = acrn_x2apic_available,