cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

igt_atomic.c (750B)


      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
     12static void __preempt_begin(void)
     13{
     14	preempt_disable();
     15}
     16
     17static void __preempt_end(void)
     18{
     19	preempt_enable();
     20}
     21
     22static void __softirq_begin(void)
     23{
     24	local_bh_disable();
     25}
     26
     27static void __softirq_end(void)
     28{
     29	local_bh_enable();
     30}
     31
     32static void __hardirq_begin(void)
     33{
     34	local_irq_disable();
     35}
     36
     37static void __hardirq_end(void)
     38{
     39	local_irq_enable();
     40}
     41
     42const 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};