• Home
  • Raw
  • Download

Lines Matching refs:lg

88 	return &cpu->lg->pgdirs[i].pgdir[index];  in spgd_addr()
139 return cpu->lg->pgdirs[cpu->cpu_pgd].gpgdir + index * sizeof(pgd_t); in gpgd_addr()
219 base = (unsigned long)cpu->lg->mem_base / PAGE_SIZE; in gpte_to_spte()
256 pte_pfn(gpte) >= cpu->lg->pfn_limit) { in check_gpte()
266 (pgd_pfn(gpgd) >= cpu->lg->pfn_limit)) { in check_gpgd()
277 (pmd_pfn(gpmd) >= cpu->lg->pfn_limit)) { in check_gpmd()
628 static void flush_user_mappings(struct lguest *lg, int idx) in flush_user_mappings() argument
632 for (i = 0; i < pgd_index(lg->kernel_address); i++) in flush_user_mappings()
633 release_pgd(lg->pgdirs[idx].pgdir + i); in flush_user_mappings()
645 flush_user_mappings(cpu->lg, cpu->cpu_pgd); in guest_pagetable_flush_user()
689 static unsigned int find_pgdir(struct lguest *lg, unsigned long pgtable) in find_pgdir() argument
692 for (i = 0; i < ARRAY_SIZE(lg->pgdirs); i++) in find_pgdir()
693 if (lg->pgdirs[i].pgdir && lg->pgdirs[i].gpgdir == pgtable) in find_pgdir()
713 next = prandom_u32() % ARRAY_SIZE(cpu->lg->pgdirs); in new_pgdir()
715 if (!cpu->lg->pgdirs[next].pgdir) { in new_pgdir()
716 cpu->lg->pgdirs[next].pgdir = in new_pgdir()
719 if (!cpu->lg->pgdirs[next].pgdir) in new_pgdir()
730 cpu->lg->pgdirs[next].gpgdir = gpgdir; in new_pgdir()
732 flush_user_mappings(cpu->lg, next); in new_pgdir()
735 cpu->lg->pgdirs[next].last_host_cpu = -1; in new_pgdir()
774 cpu->lg->pgdirs[cpu->cpu_pgd].switcher_mapped = true; in allocate_switcher_mapping()
783 static void release_all_pagetables(struct lguest *lg) in release_all_pagetables() argument
788 for (i = 0; i < ARRAY_SIZE(lg->pgdirs); i++) { in release_all_pagetables()
789 if (!lg->pgdirs[i].pgdir) in release_all_pagetables()
794 release_pgd(lg->pgdirs[i].pgdir + j); in release_all_pagetables()
795 lg->pgdirs[i].switcher_mapped = false; in release_all_pagetables()
796 lg->pgdirs[i].last_host_cpu = -1; in release_all_pagetables()
808 release_all_pagetables(cpu->lg); in guest_pagetable_clear_all()
832 release_all_pagetables(cpu->lg); in guest_new_pagetable()
835 newpgdir = ARRAY_SIZE(cpu->lg->pgdirs); in guest_new_pagetable()
838 newpgdir = find_pgdir(cpu->lg, pgtable); in guest_new_pagetable()
845 if (newpgdir == ARRAY_SIZE(cpu->lg->pgdirs)) in guest_new_pagetable()
856 if (!cpu->lg->pgdirs[cpu->cpu_pgd].switcher_mapped) { in guest_new_pagetable()
957 if (vaddr >= cpu->lg->kernel_address) { in guest_set_pte()
959 for (i = 0; i < ARRAY_SIZE(cpu->lg->pgdirs); i++) in guest_set_pte()
960 if (cpu->lg->pgdirs[i].pgdir) in guest_set_pte()
964 int pgdir = find_pgdir(cpu->lg, gpgdir); in guest_set_pte()
965 if (pgdir != ARRAY_SIZE(cpu->lg->pgdirs)) in guest_set_pte()
985 void guest_set_pgd(struct lguest *lg, unsigned long gpgdir, u32 idx) in guest_set_pgd() argument
990 kill_guest(&lg->cpus[0], "Attempt to set pgd %u/%u", in guest_set_pgd()
996 pgdir = find_pgdir(lg, gpgdir); in guest_set_pgd()
997 if (pgdir < ARRAY_SIZE(lg->pgdirs)) { in guest_set_pgd()
999 release_pgd(lg->pgdirs[pgdir].pgdir + idx); in guest_set_pgd()
1001 if (!allocate_switcher_mapping(&lg->cpus[0])) { in guest_set_pgd()
1002 kill_guest(&lg->cpus[0], in guest_set_pgd()
1005 lg->pgdirs[pgdir].last_host_cpu = -1; in guest_set_pgd()
1011 void guest_set_pmd(struct lguest *lg, unsigned long pmdp, u32 idx) in guest_set_pmd() argument
1013 guest_pagetable_clear_all(&lg->cpus[0]); in guest_set_pmd()
1028 int init_guest_pagetable(struct lguest *lg) in init_guest_pagetable() argument
1030 struct lg_cpu *cpu = &lg->cpus[0]; in init_guest_pagetable()
1043 release_all_pagetables(lg); in init_guest_pagetable()
1061 if (get_user(cpu->lg->kernel_address, in page_table_guest_data_init()
1062 &cpu->lg->lguest_data->kernel_address) in page_table_guest_data_init()
1067 || put_user(top, &cpu->lg->lguest_data->reserve_mem)) { in page_table_guest_data_init()
1068 kill_guest(cpu, "bad guest page %p", cpu->lg->lguest_data); in page_table_guest_data_init()
1077 if (cpu->lg->kernel_address >= switcher_addr) in page_table_guest_data_init()
1079 cpu->lg->kernel_address); in page_table_guest_data_init()
1083 void free_guest_pagetable(struct lguest *lg) in free_guest_pagetable() argument
1088 release_all_pagetables(lg); in free_guest_pagetable()
1090 for (i = 0; i < ARRAY_SIZE(lg->pgdirs); i++) in free_guest_pagetable()
1091 free_page((long)lg->pgdirs[i].pgdir); in free_guest_pagetable()
1127 struct pgdir *pgdir = &cpu->lg->pgdirs[cpu->cpu_pgd]; in map_switcher_in_guest()