root/arch/arm/include/asm/stage2_pgtable.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. stage2_pgd_addr_end
  2. stage2_pmd_addr_end
  3. kvm_stage2_has_pud
  4. kvm_stage2_has_pmd

   1 /* SPDX-License-Identifier: GPL-2.0-only */
   2 /*
   3  * Copyright (C) 2016 - ARM Ltd
   4  *
   5  * stage2 page table helpers
   6  */
   7 
   8 #ifndef __ARM_S2_PGTABLE_H_
   9 #define __ARM_S2_PGTABLE_H_
  10 
  11 /*
  12  * kvm_mmu_cache_min_pages() is the number of pages required
  13  * to install a stage-2 translation. We pre-allocate the entry
  14  * level table at VM creation. Since we have a 3 level page-table,
  15  * we need only two pages to add a new mapping.
  16  */
  17 #define kvm_mmu_cache_min_pages(kvm)    2
  18 
  19 #define stage2_pgd_none(kvm, pgd)               pgd_none(pgd)
  20 #define stage2_pgd_clear(kvm, pgd)              pgd_clear(pgd)
  21 #define stage2_pgd_present(kvm, pgd)            pgd_present(pgd)
  22 #define stage2_pgd_populate(kvm, pgd, pud)      pgd_populate(NULL, pgd, pud)
  23 #define stage2_pud_offset(kvm, pgd, address)    pud_offset(pgd, address)
  24 #define stage2_pud_free(kvm, pud)               do { } while (0)
  25 
  26 #define stage2_pud_none(kvm, pud)               pud_none(pud)
  27 #define stage2_pud_clear(kvm, pud)              pud_clear(pud)
  28 #define stage2_pud_present(kvm, pud)            pud_present(pud)
  29 #define stage2_pud_populate(kvm, pud, pmd)      pud_populate(NULL, pud, pmd)
  30 #define stage2_pmd_offset(kvm, pud, address)    pmd_offset(pud, address)
  31 #define stage2_pmd_free(kvm, pmd)               free_page((unsigned long)pmd)
  32 
  33 #define stage2_pud_huge(kvm, pud)               pud_huge(pud)
  34 
  35 /* Open coded p*d_addr_end that can deal with 64bit addresses */
  36 static inline phys_addr_t
  37 stage2_pgd_addr_end(struct kvm *kvm, phys_addr_t addr, phys_addr_t end)
  38 {
  39         phys_addr_t boundary = (addr + PGDIR_SIZE) & PGDIR_MASK;
  40 
  41         return (boundary - 1 < end - 1) ? boundary : end;
  42 }
  43 
  44 #define stage2_pud_addr_end(kvm, addr, end)     (end)
  45 
  46 static inline phys_addr_t
  47 stage2_pmd_addr_end(struct kvm *kvm, phys_addr_t addr, phys_addr_t end)
  48 {
  49         phys_addr_t boundary = (addr + PMD_SIZE) & PMD_MASK;
  50 
  51         return (boundary - 1 < end - 1) ? boundary : end;
  52 }
  53 
  54 #define stage2_pgd_index(kvm, addr)             pgd_index(addr)
  55 
  56 #define stage2_pte_table_empty(kvm, ptep)       kvm_page_empty(ptep)
  57 #define stage2_pmd_table_empty(kvm, pmdp)       kvm_page_empty(pmdp)
  58 #define stage2_pud_table_empty(kvm, pudp)       false
  59 
  60 static inline bool kvm_stage2_has_pud(struct kvm *kvm)
  61 {
  62         return false;
  63 }
  64 
  65 #define S2_PMD_MASK                             PMD_MASK
  66 #define S2_PMD_SIZE                             PMD_SIZE
  67 #define S2_PUD_MASK                             PUD_MASK
  68 #define S2_PUD_SIZE                             PUD_SIZE
  69 
  70 static inline bool kvm_stage2_has_pmd(struct kvm *kvm)
  71 {
  72         return true;
  73 }
  74 
  75 #endif  /* __ARM_S2_PGTABLE_H_ */

/* [<][>][^][v][top][bottom][index][help] */