[PATCH 6/6] kvm.git allow reserved pages to be used as guest phys ram

Andrea Arcangeli
2008-07-25T14:44:04Z

This is an incremental fix on top of Ben-Ami reserved-pages-mmio
patch. I need this for the reserved-ram 1:1 patch because I must allow
to map reserved pages with a valid pfn in the user address space of
the kvm task. This is because those reserved pages aren't mmio regions
for me but the real backing of the guest physical ram.

Reserved pages can be mapped through the ->fault api just fine, as
long as a pfn exists for them, and the reserved-ram patch ensures that
a pfn exists for them and that they're marked reserved as expected by
special ram reserved at boot time.

Signed-off-by: Andrea Arcangeli <andrea@qumranet.com>

kvm_main.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

Index: virt/kvm/kvm_main.c
--- virt/kvm/kvm_main.c.orig 2008-06-25 02:39:51.000000000 +0200
+++ a/virt/kvm/kvm_main.c 2008-06-25 02:40:35.000000000 +0200
@@ -604,10 +604,9 @@ struct page *gfn_to_page(struct kvm *kvm
pfn_t pfn;

pfn = gfn_to_pfn(kvm, gfn);
- if (!is_mmio_pfn(pfn))
+ if (pfn_valid(pfn))
return pfn_to_page(pfn);
-
- WARN_ON(is_mmio_pfn(pfn));
+ WARN_ON(1);

get_page(bad_page);
return bad_page;