Skip to contentSkip to conversation

linux/x86: make xen_change_pte_range() compatible with CONFIG_HIGHPTE

PATCH New Jan Beulich 1 participant 1 message Feb 1, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux/x86: make xen_change_pte_range() compatible with CONFIG_HIGHPTE

Cannot use virt_to_machine() on a kmap()-ed address.

As usual, written and tested on 2.6.24 and made apply to the 2.6.18 tree without further testing.

arch/i386/mm/hypervisor.c +3 -1
Index: head-2008-01-28/arch/i386/mm/hypervisor.c
===================================================================
@@ -569,7 +569,9 @@ int xen_change_pte_range(struct mm_struc
 	pte = pte_offset_map_lock(mm, pmd, addr, &ptl);
 	do {
 		if (pte_present(*pte)) {
-			u[i].ptr = virt_to_machine(pte) | MMU_PT_UPDATE_PRESERVE_AD;
+			u[i].ptr = (__pmd_val(*pmd) & PHYSICAL_PAGE_MASK)
+				   | ((unsigned long)pte & ~PAGE_MASK)
+				   | MMU_PT_UPDATE_PRESERVE_AD;
 			u[i].val = __pte_val(pte_modify(*pte, newprot));
 			if (++i == MAX_BATCHED_FULL_PTES) {
 				if ((rc = HYPERVISOR_mmu_update(