[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] fix ia64 breakage with PHYSDEVOP_pirq_eoi_mfn (was Re: [Xen-devel] [PATCH 2/2] linux/x86: use shared page indicating the need for an EOI notification)



On Tue, Dec 09, 2008 at 10:54:57AM +0000, Jan Beulich wrote:
> >Introduce ptep_to_machine() or something like that?
> Yes, if that name isn't ambiguous in some way.

Like this?
To be honest, I haven't tested the patch with highpte yet.

blktap, gntdev: fix highpte handling.

In case of highpte, virt_to_machine() can't be used.
Introduce ptep_to_machine() and use it.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff --git a/drivers/xen/blktap/blktap.c b/drivers/xen/blktap/blktap.c
--- a/drivers/xen/blktap/blktap.c
+++ b/drivers/xen/blktap/blktap.c
@@ -54,6 +54,7 @@
 #include <linux/poll.h>
 #include <linux/delay.h>
 #include <asm/tlbflush.h>
+#include <asm/pgtable.h>
 
 #define MAX_TAP_DEV 256     /*the maximum number of tapdisk ring devices    */
 #define MAX_DEV_NAME 100    /*the max tapdisk ring device name e.g. blktap0 */
@@ -364,7 +365,7 @@ static pte_t blktap_clear_pte(struct vm_
                BUG_ON(xen_feature(XENFEAT_auto_translated_physmap));
 
                copy = *ptep;
-               gnttab_set_unmap_op(&unmap[count], virt_to_machine(ptep), 
+               gnttab_set_unmap_op(&unmap[count], ptep_to_machine(ptep), 
                                    GNTMAP_host_map 
                                    | GNTMAP_application_map 
                                    | GNTMAP_contains_pte,
diff --git a/drivers/xen/gntdev/gntdev.c b/drivers/xen/gntdev/gntdev.c
--- a/drivers/xen/gntdev/gntdev.c
+++ b/drivers/xen/gntdev/gntdev.c
@@ -34,7 +34,7 @@
 
 #include <linux/types.h>
 #include <xen/public/gntdev.h>
-
+#include <asm/pgtable.h>
 
 #define DRIVER_AUTHOR "Derek G. Murray <Derek.Murray@xxxxxxxxxxxx>"
 #define DRIVER_DESC   "User-space granted page access driver"
@@ -769,7 +769,7 @@ static pte_t gntdev_clear_pte(struct vm_
                    GNTDEV_INVALID_HANDLE && 
                    !xen_feature(XENFEAT_auto_translated_physmap)) {
                        /* NOT USING SHADOW PAGE TABLES. */
-                       gnttab_set_unmap_op(&op, virt_to_machine(ptep), 
+                       gnttab_set_unmap_op(&op, ptep_to_machine(ptep), 
                                            GNTMAP_contains_pte,
                                            private_data->grants[slot_index]
                                            .u.valid.user_handle);
diff --git a/include/asm-i386/mach-xen/asm/pgtable.h 
b/include/asm-i386/mach-xen/asm/pgtable.h
--- a/include/asm-i386/mach-xen/asm/pgtable.h
+++ b/include/asm-i386/mach-xen/asm/pgtable.h
@@ -488,6 +488,17 @@ void make_pages_writable(void *va, unsig
        (((maddr_t)pte_mfn(*virt_to_ptep(va)) << PAGE_SHIFT)            \
         | ((unsigned long)(va) & (PAGE_SIZE - 1)))
 
+#ifdef CONFIG_HIGHPTE
+#define ptep_to_machine(ptep)                                          \
+({                                                                     \
+       (unsigned long)(ptep) >= (unsigned long)high_memory?            \
+               arbitrary_virt_to_machine(ptep) :                       \
+               virt_to_machine(ptep);                                  \
+})
+#else
+#define ptep_to_machine(ptep)  virt_to_machine(ptep)
+#endif
+
 #endif /* !__ASSEMBLY__ */
 
 #ifdef CONFIG_FLATMEM
diff --git a/include/asm-ia64/maddr.h b/include/asm-ia64/maddr.h
--- a/include/asm-ia64/maddr.h
+++ b/include/asm-ia64/maddr.h
@@ -100,6 +100,7 @@ mfn_to_local_pfn(unsigned long mfn)
 #define virt_to_mfn(virt) (__pa(virt) >> PAGE_SHIFT)
 #define virt_to_machine(virt) __pa(virt) /* for tpmfront.c */
 #define arbitrary_virt_to_machine(virt) virt_to_machine(ia64_imva(virt))
+#define ptep_to_machine(virt) virt_to_machine(virt)
 
 #define set_phys_to_machine(pfn, mfn) do { } while (0)
 
diff --git a/include/asm-x86_64/mach-xen/asm/pgtable.h 
b/include/asm-x86_64/mach-xen/asm/pgtable.h
--- a/include/asm-x86_64/mach-xen/asm/pgtable.h
+++ b/include/asm-x86_64/mach-xen/asm/pgtable.h
@@ -30,6 +30,8 @@ extern pte_t *lookup_address(unsigned lo
 #define arbitrary_virt_to_machine(va)                                  \
        (((maddr_t)pte_mfn(*virt_to_ptep(va)) << PAGE_SHIFT)            \
         | ((unsigned long)(va) & (PAGE_SIZE - 1)))
+
+#define ptep_to_machine(ptep)  virt_to_machine(ptep)
 #endif
 
 extern pud_t level3_kernel_pgt[512];


-- 
yamahata

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.