~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/kernel/cpu/acrn.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * ACRN detection support
  4  *
  5  * Copyright (C) 2019 Intel Corporation. All rights reserved.
  6  *
  7  * Jason Chen CJ <jason.cj.chen@intel.com>
  8  * Zhao Yakui <yakui.zhao@intel.com>
  9  *
 10  */
 11 
 12 #include <linux/interrupt.h>
 13 
 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>
 21 
 22 static u32 __init acrn_detect(void)
 23 {
 24         return acrn_cpuid_base();
 25 }
 26 
 27 static void __init acrn_init_platform(void)
 28 {
 29         /* Install system interrupt handler for ACRN hypervisor callback */
 30         sysvec_install(HYPERVISOR_CALLBACK_VECTOR, sysvec_acrn_hv_callback);
 31 
 32         x86_platform.calibrate_tsc = acrn_get_tsc_khz;
 33         x86_platform.calibrate_cpu = acrn_get_tsc_khz;
 34 }
 35 
 36 static bool acrn_x2apic_available(void)
 37 {
 38         return boot_cpu_has(X86_FEATURE_X2APIC);
 39 }
 40 
 41 static void (*acrn_intr_handler)(void);
 42 
 43 DEFINE_IDTENTRY_SYSVEC(sysvec_acrn_hv_callback)
 44 {
 45         struct pt_regs *old_regs = set_irq_regs(regs);
 46 
 47         /*
 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.
 53          */
 54         apic_eoi();
 55         inc_irq_stat(irq_hv_callback_count);
 56 
 57         if (acrn_intr_handler)
 58                 acrn_intr_handler();
 59 
 60         set_irq_regs(old_regs);
 61 }
 62 
 63 void acrn_setup_intr_handler(void (*handler)(void))
 64 {
 65         acrn_intr_handler = handler;
 66 }
 67 EXPORT_SYMBOL_GPL(acrn_setup_intr_handler);
 68 
 69 void acrn_remove_intr_handler(void)
 70 {
 71         acrn_intr_handler = NULL;
 72 }
 73 EXPORT_SYMBOL_GPL(acrn_remove_intr_handler);
 74 
 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,
 81 };
 82 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php