1 // SPDX-License-Identifier: MIT
2 /*
3  * Copyright © 2018 Intel Corporation
4  */
5 
6 #include <linux/preempt.h>
7 #include <linux/bottom_half.h>
8 #include <linux/irqflags.h>
9 
10 #include "igt_atomic.h"
11 
__preempt_begin(void)12 static void __preempt_begin(void)
13 {
14 	preempt_disable();
15 }
16 
__preempt_end(void)17 static void __preempt_end(void)
18 {
19 	preempt_enable();
20 }
21 
__softirq_begin(void)22 static void __softirq_begin(void)
23 {
24 	local_bh_disable();
25 }
26 
__softirq_end(void)27 static void __softirq_end(void)
28 {
29 	local_bh_enable();
30 }
31 
__hardirq_begin(void)32 static void __hardirq_begin(void)
33 {
34 	local_irq_disable();
35 }
36 
__hardirq_end(void)37 static void __hardirq_end(void)
38 {
39 	local_irq_enable();
40 }
41 
42 const struct igt_atomic_section igt_atomic_phases[] = {
43 	{ "preempt", __preempt_begin, __preempt_end },
44 	{ "softirq", __softirq_begin, __softirq_end },
45 	{ "hardirq", __hardirq_begin, __hardirq_end },
46 	{ }
47 };
48