Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 373145
b: refs/heads/master
c: 3562c76
h: refs/heads/master
i:
  373143: 0d6fd31
v: v3
  • Loading branch information
Marc Zyngier authored and Christoffer Dall committed Apr 29, 2013
1 parent 693a503 commit 09fbef6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6060df84cbe0d36b8e1415b68e3f67b77f27052a
refs/heads/master: 3562c76dcb9ce84853c835eec12a911bf3a8e2da
21 changes: 10 additions & 11 deletions trunk/arch/arm/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,12 @@ static void create_hyp_pte_mappings(pmd_t *pmd, unsigned long start,
pte_t *pte;
unsigned long addr;

for (addr = start; addr < end; addr += PAGE_SIZE) {
addr = start;
do {
pte = pte_offset_kernel(pmd, addr);
kvm_set_pte(pte, pfn_pte(pfn, prot));
pfn++;
}
} while (addr += PAGE_SIZE, addr != end);
}

static int create_hyp_pmd_mappings(pud_t *pud, unsigned long start,
Expand All @@ -146,7 +147,8 @@ static int create_hyp_pmd_mappings(pud_t *pud, unsigned long start,
pte_t *pte;
unsigned long addr, next;

for (addr = start; addr < end; addr = next) {
addr = start;
do {
pmd = pmd_offset(pud, addr);

BUG_ON(pmd_sect(*pmd));
Expand All @@ -164,7 +166,7 @@ static int create_hyp_pmd_mappings(pud_t *pud, unsigned long start,

create_hyp_pte_mappings(pmd, addr, next, pfn, prot);
pfn += (next - addr) >> PAGE_SHIFT;
}
} while (addr = next, addr != end);

return 0;
}
Expand All @@ -179,11 +181,10 @@ static int __create_hyp_mappings(pgd_t *pgdp,
unsigned long addr, next;
int err = 0;

if (start >= end)
return -EINVAL;

mutex_lock(&kvm_hyp_pgd_mutex);
for (addr = start & PAGE_MASK; addr < end; addr = next) {
addr = start & PAGE_MASK;
end = PAGE_ALIGN(end);
do {
pgd = pgdp + pgd_index(addr);
pud = pud_offset(pgd, addr);

Expand All @@ -202,7 +203,7 @@ static int __create_hyp_mappings(pgd_t *pgdp,
if (err)
goto out;
pfn += (next - addr) >> PAGE_SHIFT;
}
} while (addr = next, addr != end);
out:
mutex_unlock(&kvm_hyp_pgd_mutex);
return err;
Expand All @@ -216,8 +217,6 @@ static int __create_hyp_mappings(pgd_t *pgdp,
* The same virtual address as the kernel virtual address is also used
* in Hyp-mode mapping (modulo HYP_PAGE_OFFSET) to the same underlying
* physical pages.
*
* Note: Wrapping around zero in the "to" address is not supported.
*/
int create_hyp_mappings(void *from, void *to)
{
Expand Down

0 comments on commit 09fbef6

Please sign in to comment.