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

tlbflush-radix.h (3370B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2#ifndef _ASM_POWERPC_TLBFLUSH_RADIX_H
      3#define _ASM_POWERPC_TLBFLUSH_RADIX_H
      4
      5#include <asm/hvcall.h>
      6
      7#define RIC_FLUSH_TLB 0
      8#define RIC_FLUSH_PWC 1
      9#define RIC_FLUSH_ALL 2
     10
     11struct vm_area_struct;
     12struct mm_struct;
     13struct mmu_gather;
     14
     15static inline u64 psize_to_rpti_pgsize(unsigned long psize)
     16{
     17	if (psize == MMU_PAGE_4K)
     18		return H_RPTI_PAGE_4K;
     19	if (psize == MMU_PAGE_64K)
     20		return H_RPTI_PAGE_64K;
     21	if (psize == MMU_PAGE_2M)
     22		return H_RPTI_PAGE_2M;
     23	if (psize == MMU_PAGE_1G)
     24		return H_RPTI_PAGE_1G;
     25	return H_RPTI_PAGE_ALL;
     26}
     27
     28static inline int mmu_get_ap(int psize)
     29{
     30	return mmu_psize_defs[psize].ap;
     31}
     32
     33#ifdef CONFIG_PPC_RADIX_MMU
     34extern void radix__tlbiel_all(unsigned int action);
     35extern void radix__flush_tlb_lpid_page(unsigned int lpid,
     36					unsigned long addr,
     37					unsigned long page_size);
     38extern void radix__flush_pwc_lpid(unsigned int lpid);
     39extern void radix__flush_all_lpid(unsigned int lpid);
     40extern void radix__flush_all_lpid_guest(unsigned int lpid);
     41#else
     42static inline void radix__tlbiel_all(unsigned int action) { WARN_ON(1); }
     43static inline void radix__flush_tlb_lpid_page(unsigned int lpid,
     44					unsigned long addr,
     45					unsigned long page_size)
     46{
     47	WARN_ON(1);
     48}
     49static inline void radix__flush_pwc_lpid(unsigned int lpid)
     50{
     51	WARN_ON(1);
     52}
     53static inline void radix__flush_all_lpid(unsigned int lpid)
     54{
     55	WARN_ON(1);
     56}
     57static inline void radix__flush_all_lpid_guest(unsigned int lpid)
     58{
     59	WARN_ON(1);
     60}
     61#endif
     62
     63extern void radix__flush_hugetlb_tlb_range(struct vm_area_struct *vma,
     64					   unsigned long start, unsigned long end);
     65extern void radix__flush_tlb_range_psize(struct mm_struct *mm, unsigned long start,
     66					 unsigned long end, int psize);
     67void radix__flush_tlb_pwc_range_psize(struct mm_struct *mm, unsigned long start,
     68				      unsigned long end, int psize);
     69extern void radix__flush_pmd_tlb_range(struct vm_area_struct *vma,
     70				       unsigned long start, unsigned long end);
     71extern void radix__flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
     72			    unsigned long end);
     73extern void radix__flush_tlb_kernel_range(unsigned long start, unsigned long end);
     74
     75extern void radix__local_flush_tlb_mm(struct mm_struct *mm);
     76extern void radix__local_flush_all_mm(struct mm_struct *mm);
     77extern void radix__local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
     78extern void radix__local_flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
     79					      int psize);
     80extern void radix__tlb_flush(struct mmu_gather *tlb);
     81#ifdef CONFIG_SMP
     82extern void radix__flush_tlb_mm(struct mm_struct *mm);
     83extern void radix__flush_all_mm(struct mm_struct *mm);
     84extern void radix__flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
     85extern void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
     86					int psize);
     87#else
     88#define radix__flush_tlb_mm(mm)		radix__local_flush_tlb_mm(mm)
     89#define radix__flush_all_mm(mm)		radix__local_flush_all_mm(mm)
     90#define radix__flush_tlb_page(vma,addr)	radix__local_flush_tlb_page(vma,addr)
     91#define radix__flush_tlb_page_psize(mm,addr,p) radix__local_flush_tlb_page_psize(mm,addr,p)
     92#endif
     93extern void radix__flush_tlb_pwc(struct mmu_gather *tlb, unsigned long addr);
     94extern void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr);
     95extern void radix__flush_tlb_all(void);
     96
     97#endif