WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [PATCH] fix ia64 breakage with PHYSDEVOP_pirq_eoi_mfn (was Re: [Xen-

To: Jan Beulich <jbeulich@xxxxxxxxxx>
Subject: 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)
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Wed, 10 Dec 2008 13:09:36 +0900
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Tue, 09 Dec 2008 20:10:00 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <493E5C91.76E4.0078.0@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <493D30D6.76E4.0078.0@xxxxxxxxxx> <20081209034038.GO5454%yamahata@xxxxxxxxxxxxx> <493E50D7.76E4.0078.0@xxxxxxxxxx> <20081209104310.GR5454%yamahata@xxxxxxxxxxxxx> <493E5C91.76E4.0078.0@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.6i
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

<Prev in Thread] Current Thread [Next in Thread>