Home | History | Annotate | Line # | Download | only in selftests
      1 /*	$NetBSD: igt_atomic.c,v 1.2 2021/12/18 23:45:31 riastradh Exp $	*/
      2 
      3 // SPDX-License-Identifier: MIT
      4 /*
      5  * Copyright  2018 Intel Corporation
      6  */
      7 
      8 #include <sys/cdefs.h>
      9 __KERNEL_RCSID(0, "$NetBSD: igt_atomic.c,v 1.2 2021/12/18 23:45:31 riastradh Exp $");
     10 
     11 #include <linux/preempt.h>
     12 #include <linux/bottom_half.h>
     13 #include <linux/irqflags.h>
     14 
     15 #include "igt_atomic.h"
     16 
     17 static void __preempt_begin(void)
     18 {
     19 	preempt_disable();
     20 }
     21 
     22 static void __preempt_end(void)
     23 {
     24 	preempt_enable();
     25 }
     26 
     27 static void __softirq_begin(void)
     28 {
     29 	local_bh_disable();
     30 }
     31 
     32 static void __softirq_end(void)
     33 {
     34 	local_bh_enable();
     35 }
     36 
     37 static void __hardirq_begin(void)
     38 {
     39 	local_irq_disable();
     40 }
     41 
     42 static void __hardirq_end(void)
     43 {
     44 	local_irq_enable();
     45 }
     46 
     47 const struct igt_atomic_section igt_atomic_phases[] = {
     48 	{ "preempt", __preempt_begin, __preempt_end },
     49 	{ "softirq", __softirq_begin, __softirq_end },
     50 	{ "hardirq", __hardirq_begin, __hardirq_end },
     51 	{ }
     52 };
     53