Changeset 65336 in vbox
- Timestamp:
- Jan 16, 2017 2:02:35 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c
r62477 r65336 38 38 #include "r0drv/mp-r0drv.h" 39 39 40 41 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 71) && defined(CONFIG_SMP) 42 43 44 /********************************************************************************************************************************* 45 * Internal Functions * 46 *********************************************************************************************************************************/ 40 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) 41 42 static enum cpuhp_state g_rtR0MpOnline; 43 44 /* 45 * Linux 4.10 completely removed CPU notifiers. So let's switch to CPU hotplug 46 * notification. 47 */ 48 49 static int rtR0MpNotificationLinuxOnline(unsigned int cpu) 50 { 51 RTCPUID idCpu = RTMpCpuIdFromSetIndex(cpu); 52 rtMpNotificationDoCallbacks(RTMPEVENT_ONLINE, idCpu); 53 return 0; 54 } 55 56 static int rtR0MpNotificationLinuxOffline(unsigned int cpu) 57 { 58 RTCPUID idCpu = RTMpCpuIdFromSetIndex(cpu); 59 rtMpNotificationDoCallbacks(RTMPEVENT_OFFLINE, idCpu); 60 return 0; 61 } 62 63 DECLHIDDEN(int) rtR0MpNotificationNativeInit(void) 64 { 65 int rc; 66 IPRT_LINUX_SAVE_EFL_AC(); 67 rc = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "vboxdrv:online", 68 rtR0MpNotificationLinuxOnline, rtR0MpNotificationLinuxOffline); 69 IPRT_LINUX_RESTORE_EFL_AC(); 70 /* 71 * cpuhp_setup_state_nocalls() returns a positive state number for 72 * CPUHP_AP_ONLINE_DYN or -ENOSPC if there is no free slot available 73 * (see cpuhp_reserve_state / definition of CPUHP_AP_ONLINE_DYN). 74 */ 75 AssertMsgReturn(rc > 0, ("%d\n", rc), RTErrConvertFromErrno(rc)); 76 g_rtR0MpOnline = rc; 77 return VINF_SUCCESS; 78 } 79 80 81 DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void) 82 { 83 IPRT_LINUX_SAVE_EFL_AC(); 84 cpuhp_remove_state_nocalls(g_rtR0MpOnline); 85 IPRT_LINUX_RESTORE_EFL_AC(); 86 } 87 88 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 71) && defined(CONFIG_SMP) 89 47 90 static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock, unsigned long ulNativeEvent, void *pvCpu); 48 91 49 50 /*********************************************************************************************************************************51 * Global Variables *52 *********************************************************************************************************************************/53 92 /** 54 93 * The notifier block we use for registering the callback.
Note:
See TracChangeset
for help on using the changeset viewer.