xref: /linux/drivers/gpu/drm/i915/selftests/igt_atomic.c (revision a4eb44a6435d6d8f9e642407a4a06f65eb90ca04)
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 
12 static void __preempt_begin(void)
13 {
14 	preempt_disable();
15 }
16 
17 static void __preempt_end(void)
18 {
19 	preempt_enable();
20 }
21 
22 static void __softirq_begin(void)
23 {
24 	local_bh_disable();
25 }
26 
27 static void __softirq_end(void)
28 {
29 	local_bh_enable();
30 }
31 
32 static void __hardirq_begin(void)
33 {
34 	local_irq_disable();
35 }
36 
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