diff options
author | Avi Kivity <avi@qumranet.com> | 2007-01-05 16:36:42 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2007-01-05 23:55:24 -0800 |
commit | 25c0de2cc6c26cb99553c2444936a7951c120c09 (patch) | |
tree | c2b5bd7ff189a1232ed3a89b50caa2ebbad67634 /drivers/kvm/mmu.c | |
parent | aef3d3fe1314f2a130f5ccc7114df20865ba784f (diff) | |
download | op-kernel-dev-25c0de2cc6c26cb99553c2444936a7951c120c09.zip op-kernel-dev-25c0de2cc6c26cb99553c2444936a7951c120c09.tar.gz |
[PATCH] KVM: MMU: Make kvm_mmu_alloc_page() return a kvm_mmu_page pointer
This allows further manipulation on the shadow page table.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/kvm/mmu.c')
-rw-r--r-- | drivers/kvm/mmu.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index 1dcbbd5..da4d7dd 100644 --- a/drivers/kvm/mmu.c +++ b/drivers/kvm/mmu.c @@ -292,12 +292,13 @@ static int is_empty_shadow_page(hpa_t page_hpa) return 1; } -static hpa_t kvm_mmu_alloc_page(struct kvm_vcpu *vcpu, u64 *parent_pte) +static struct kvm_mmu_page *kvm_mmu_alloc_page(struct kvm_vcpu *vcpu, + u64 *parent_pte) { struct kvm_mmu_page *page; if (list_empty(&vcpu->free_pages)) - return INVALID_PAGE; + return NULL; page = list_entry(vcpu->free_pages.next, struct kvm_mmu_page, link); list_del(&page->link); @@ -306,7 +307,7 @@ static hpa_t kvm_mmu_alloc_page(struct kvm_vcpu *vcpu, u64 *parent_pte) page->slot_bitmap = 0; page->global = 1; page->parent_pte = parent_pte; - return page->page_hpa; + return page; } static void page_header_update_slot(struct kvm *kvm, void *pte, gpa_t gpa) @@ -402,19 +403,16 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, hpa_t p) } if (table[index] == 0) { - hpa_t new_table = kvm_mmu_alloc_page(vcpu, - &table[index]); + struct kvm_mmu_page *new_table; - if (!VALID_PAGE(new_table)) { + new_table = kvm_mmu_alloc_page(vcpu, &table[index]); + if (!new_table) { pgprintk("nonpaging_map: ENOMEM\n"); return -ENOMEM; } - if (level == PT32E_ROOT_LEVEL) - table[index] = new_table | PT_PRESENT_MASK; - else - table[index] = new_table | PT_PRESENT_MASK | - PT_WRITABLE_MASK | PT_USER_MASK; + table[index] = new_table->page_hpa | PT_PRESENT_MASK + | PT_WRITABLE_MASK | PT_USER_MASK; } table_addr = table[index] & PT64_BASE_ADDR_MASK; } @@ -454,7 +452,7 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu) hpa_t root = vcpu->mmu.root_hpa; ASSERT(!VALID_PAGE(root)); - root = kvm_mmu_alloc_page(vcpu, NULL); + root = kvm_mmu_alloc_page(vcpu, NULL)->page_hpa; vcpu->mmu.root_hpa = root; return; } @@ -463,7 +461,7 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu) hpa_t root = vcpu->mmu.pae_root[i]; ASSERT(!VALID_PAGE(root)); - root = kvm_mmu_alloc_page(vcpu, NULL); + root = kvm_mmu_alloc_page(vcpu, NULL)->page_hpa; vcpu->mmu.pae_root[i] = root | PT_PRESENT_MASK; } vcpu->mmu.root_hpa = __pa(vcpu->mmu.pae_root); |