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

sram.h (670B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2#ifndef __ASM_SRAM_H
      3#define __ASM_SRAM_H
      4
      5#ifdef CONFIG_HAVE_SRAM_POOL
      6
      7#include <linux/spinlock.h>
      8#include <linux/genalloc.h>
      9
     10/* arch/sh/mm/sram.c */
     11extern struct gen_pool *sram_pool;
     12
     13static inline unsigned long sram_alloc(size_t len)
     14{
     15	if (!sram_pool)
     16		return 0UL;
     17
     18	return gen_pool_alloc(sram_pool, len);
     19}
     20
     21static inline void sram_free(unsigned long addr, size_t len)
     22{
     23	return gen_pool_free(sram_pool, addr, len);
     24}
     25
     26#else
     27
     28static inline unsigned long sram_alloc(size_t len)
     29{
     30	return 0;
     31}
     32
     33static inline void sram_free(unsigned long addr, size_t len)
     34{
     35}
     36
     37#endif /* CONFIG_HAVE_SRAM_POOL */
     38
     39#endif /* __ASM_SRAM_H */