]> git.pld-linux.org Git - packages/VirtualBox.git/blob - kernel-5.3.patch
993dab7ada153c70c43fb0a25d43c2374a7c787e
[packages/VirtualBox.git] / kernel-5.3.patch
1 On 7/23/19 5:33 PM, S?rgio Basto wrote:
2 > Hello,
3
4 > https://forums.virtualbox.org/viewtopic.php?f=3&t=93944
5
6 > have someone the solution ?
7
8 Yes, I do. The MIT-licensed patch is posted below. After I finish here, I will 
9 also post this material on the VBox forum.
10
11 The API changes are as follows:
12
13 1. The for_ifa() and endfor_ifa() macros are removed. They are so simple that it 
14 is better to turn then into in-line code.
15
16 2. Routine smp_call_function() is changed from type int to void.
17
18
19
20 Index: VirtualBox-6.0.10/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
21 ===================================================================
22 --- VirtualBox-6.0.10.orig/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
23 +++ VirtualBox-6.0.10/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
24 @@ -2123,7 +2123,10 @@ static int vboxNetFltLinuxEnumeratorCall
25  #endif
26      if (in_dev != NULL)
27      {
28 -        for_ifa(in_dev) {
29 +       /* macros for_ifa() and endfor_ifa() disappear for kernel 5.3
30 +        * Code them directly */
31 +        struct in_ifaddr *ifa;
32 +       for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
33              if (VBOX_IPV4_IS_LOOPBACK(ifa->ifa_address))
34                  return NOTIFY_OK;
35
36 @@ -2137,7 +2140,7 @@ static int vboxNetFltLinuxEnumeratorCall
37
38              pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort,
39                  /* :fAdded */ true, kIntNetAddrType_IPv4, &ifa->ifa_address);
40 -        } endfor_ifa(in_dev);
41 +        }
42      }
43  
44      /*
45 Index: VirtualBox-6.0.10/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
46 ===================================================================
47 --- VirtualBox-6.0.10.orig/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
48 +++ VirtualBox-6.0.10/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
49 @@ -283,12 +283,16 @@ RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnW
50      if (RTCpuSetCount(&OnlineSet) > 1)
51      {
52          /* Fire the function on all other CPUs without waiting for completion. */
53 -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
54 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
55 +       smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* wait */);
56 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
57          int rc = smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* wait */);
58 -# else
59 +#else
60          int rc = smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* retry */, 0 /* wait */);
61 -# endif
62 +#endif
63 +# if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)
64          Assert(!rc); NOREF(rc);
65 +#endif
66      }
67  #endif
68
69 @@ -326,7 +330,9 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER p
70  {
71  #ifdef CONFIG_SMP
72      IPRT_LINUX_SAVE_EFL_AC();
73 +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)
74      int rc;
75 +#endif
76      RTMPARGS Args;
77
78      RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
79 @@ -337,14 +343,18 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER p
80      Args.cHits = 0;
81
82      RTThreadPreemptDisable(&PreemptState);
83 -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
84 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
85 +    smp_call_function(rtmpLinuxWrapper, &Args, 1 /* wait */);
86 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
87      rc = smp_call_function(rtmpLinuxWrapper, &Args, 1 /* wait */);
88 -# else /* older kernels */
89 +#else /* older kernels */
90      rc = smp_call_function(rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */);
91 -# endif /* older kernels */
92 +#endif /* older kernels */
93      RTThreadPreemptRestore(&PreemptState);
94
95 +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)
96      Assert(rc == 0); NOREF(rc);
97 +#endif
98      IPRT_LINUX_RESTORE_EFL_AC();
99  #else
100      RT_NOREF(pfnWorker, pvUser1, pvUser2);
101
102 Larry
103
This page took 0.032126 seconds and 2 git commands to generate.