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-ppc-devel

[XenPPC] [xenppc-unstable] [XEN][POWERPC] Use gmfn_to_mfn() over pfn2mfn

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [xenppc-unstable] [XEN][POWERPC] Use gmfn_to_mfn() over pfn2mfn()
From: Xen patchbot-xenppc-unstable <patchbot-xenppc-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 03 Oct 2006 01:50:44 +0000
Delivery-date: Mon, 02 Oct 2006 20:02:40 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 6e451ba8bc03bd6c363058447e70643210b7011b
# Parent  d1138b71a50937503a6ec5800d7e8f4fd8b062e6
[XEN][POWERPC] Use gmfn_to_mfn() over pfn2mfn()

Should only use pfn2mfn() if you care about the type of memory.

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
 xen/arch/powerpc/iommu.c           |    7 +++----
 xen/arch/powerpc/usercopy.c        |   26 +++-----------------------
 xen/include/asm-powerpc/debugger.h |    5 ++++-
 xen/include/asm-powerpc/page.h     |   19 ++++++++++++++++++-
 4 files changed, 28 insertions(+), 29 deletions(-)

diff -r d1138b71a509 -r 6e451ba8bc03 xen/arch/powerpc/iommu.c
--- a/xen/arch/powerpc/iommu.c  Mon Oct 02 19:55:18 2006 -0400
+++ b/xen/arch/powerpc/iommu.c  Mon Oct 02 21:40:26 2006 -0400
@@ -46,12 +46,11 @@ int iommu_put(u32 buid, ulong ioba, unio
     struct domain *d = v->domain;
 
     if (buid < iommu_phbs_num && iommu_phbs[buid].iommu_put != NULL) {
-        ulong pfn;
+        ulong gpfn;
         ulong mfn;
-        int mtype;
 
-        pfn = tce.tce_bits.tce_rpn;
-        mfn = pfn2mfn(d, pfn, &mtype);
+        gpfn = tce.tce_bits.tce_rpn;
+        mfn = gmfn_to_mfn(d, gpfn);
         if (mfn != INVALID_MFN) {
 #ifdef DEBUG
             printk("%s: ioba=0x%lx pfn=0x%lx mfn=0x%lx\n", __func__,
diff -r d1138b71a509 -r 6e451ba8bc03 xen/arch/powerpc/usercopy.c
--- a/xen/arch/powerpc/usercopy.c       Mon Oct 02 19:55:18 2006 -0400
+++ b/xen/arch/powerpc/usercopy.c       Mon Oct 02 21:40:26 2006 -0400
@@ -29,40 +29,20 @@ unsigned long paddr_to_maddr(unsigned lo
 {
     struct vcpu *v = get_current();
     struct domain *d = v->domain;
-    int mtype;
-    ulong pfn;
+    ulong gpfn;
     ulong offset;
     ulong pa = paddr;
 
     offset = pa & ~PAGE_MASK;
-    pfn = pa >> PAGE_SHIFT;
+    gpfn = pa >> PAGE_SHIFT;
 
-    pa = pfn2mfn(d, pfn, &mtype);
+    pa = gmfn_to_mfn(d, gpfn);
     if (pa == INVALID_MFN) {
         printk("%s: Dom:%d bad paddr: 0x%lx\n",
                __func__, d->domain_id, paddr);
         return 0;
     }
-    switch (mtype) {
-    case PFN_TYPE_RMA:
-    case PFN_TYPE_LOGICAL:
-        break;
 
-    case PFN_TYPE_FOREIGN:
-        /* I don't think this should ever happen, but I suppose it
-         * could be possible */
-        printk("%s: Dom:%d paddr: 0x%lx type: FOREIGN\n",
-               __func__, d->domain_id, paddr);
-        WARN();
-        break;
-
-    case PFN_TYPE_IO:
-    default:
-        printk("%s: Dom:%d paddr: 0x%lx bad type: 0x%x\n",
-               __func__, d->domain_id, paddr, mtype);
-        WARN();
-        return 0;
-    }
     pa <<= PAGE_SHIFT;
     pa |= offset;
 
diff -r d1138b71a509 -r 6e451ba8bc03 xen/include/asm-powerpc/debugger.h
--- a/xen/include/asm-powerpc/debugger.h        Mon Oct 02 19:55:18 2006 -0400
+++ b/xen/include/asm-powerpc/debugger.h        Mon Oct 02 21:40:26 2006 -0400
@@ -13,13 +13,16 @@
  * along with this program; if not, write to the Free Software
  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- * Copyright (C) IBM Corp. 2005
+ * Copyright (C) IBM Corp. 2005, 2006
  *
  * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
+ *          Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
  */
 
 #ifndef _ASM_DEBUGGER_H_
 #define _ASM_DEBUGGER_H_
+
+#include <public/xen.h>
 
 extern void show_backtrace_regs(struct cpu_user_regs *);
 extern void show_backtrace(ulong sp, ulong lr, ulong pc);
diff -r d1138b71a509 -r 6e451ba8bc03 xen/include/asm-powerpc/page.h
--- a/xen/include/asm-powerpc/page.h    Mon Oct 02 19:55:18 2006 -0400
+++ b/xen/include/asm-powerpc/page.h    Mon Oct 02 21:40:26 2006 -0400
@@ -16,6 +16,7 @@
  * Copyright (C) IBM Corp. 2005, 2006
  *
  * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
+ *          Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
  */
 
 #ifndef _ASM_PAGE_H
@@ -29,6 +30,7 @@
 
 #include <xen/config.h>
 #include <asm/cache.h>
+#include <asm/debugger.h>
 
 #define PFN_DOWN(x)   ((x) >> PAGE_SHIFT)
 #define PFN_UP(x)     (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
@@ -146,7 +148,22 @@ extern unsigned long paddr_to_maddr(unsi
 
 static inline unsigned long gmfn_to_mfn(struct domain *d, unsigned long gmfn)
 {
-    return pfn2mfn(d, gmfn, NULL);
+    int mtype;
+    ulong mfn;
+    
+    mfn = pfn2mfn(d, gmfn, &mtype);
+    if (mfn != INVALID_MFN) {
+        switch (mtype) {
+        case PFN_TYPE_RMA:
+        case PFN_TYPE_LOGICAL:
+            break;
+        default:
+            WARN();
+            mfn = INVALID_MFN;
+            break;
+        }
+    }
+    return mfn;
 }
 
 #define mfn_to_gmfn(_d, mfn) (mfn)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [xenppc-unstable] [XEN][POWERPC] Use gmfn_to_mfn() over pfn2mfn(), Xen patchbot-xenppc-unstable <=