Find the physical address through kmap_atomic_to_page(). Signed-off-by: Marcelo Tosatti <[EMAIL PROTECTED]>
Index: kvm.first/arch/x86/kernel/kvm.c =================================================================== --- kvm.first.orig/arch/x86/kernel/kvm.c +++ kvm.first/arch/x86/kernel/kvm.c @@ -26,6 +26,7 @@ #include <linux/cpu.h> #include <linux/mm.h> #include <linux/hardirq.h> +#include <linux/highmem.h> #include <asm/tlbflush.h> #include <asm/asm.h> @@ -205,11 +206,23 @@ static void __init setup_guest_cr3_cache static void kvm_mmu_write(void *dest, u64 val) { - struct kvm_mmu_op_write_pte wpte = { - .header.op = KVM_MMU_OP_WRITE_PTE, - .pte_phys = (unsigned long)__pa(dest), - .pte_val = val, - }; + __u64 pte_phys; + struct kvm_mmu_op_write_pte wpte; + +#ifdef CONFIG_HIGHPTE + struct page *page; + unsigned long dst = (unsigned long) dest; + + page = kmap_atomic_to_page(dest); + pte_phys = page_to_pfn(page); + pte_phys <<= PAGE_SHIFT; + pte_phys += (dst & ~(PAGE_MASK)); +#else + pte_phys = (unsigned long)__pa(dest); +#endif + wpte.header.op = KVM_MMU_OP_WRITE_PTE; + wpte.pte_val = val; + wpte.pte_phys = pte_phys; kvm_deferred_mmu_op(&wpte, sizeof wpte); } -- ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel