ia64/xen-unstable

changeset 12932:0379ac3367b2

[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@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Mon Oct 02 21:40:26 2006 -0400 (2006-10-02)
parents 7b6f0a4d5cdd
children a0b47a11b52d
files xen/arch/powerpc/iommu.c xen/arch/powerpc/usercopy.c xen/include/asm-powerpc/debugger.h xen/include/asm-powerpc/mm.h xen/include/asm-powerpc/page.h
line diff
     1.1 --- a/xen/arch/powerpc/iommu.c	Mon Oct 02 19:55:18 2006 -0400
     1.2 +++ b/xen/arch/powerpc/iommu.c	Mon Oct 02 21:40:26 2006 -0400
     1.3 @@ -46,12 +46,11 @@ int iommu_put(u32 buid, ulong ioba, unio
     1.4      struct domain *d = v->domain;
     1.5  
     1.6      if (buid < iommu_phbs_num && iommu_phbs[buid].iommu_put != NULL) {
     1.7 -        ulong pfn;
     1.8 +        ulong gpfn;
     1.9          ulong mfn;
    1.10 -        int mtype;
    1.11  
    1.12 -        pfn = tce.tce_bits.tce_rpn;
    1.13 -        mfn = pfn2mfn(d, pfn, &mtype);
    1.14 +        gpfn = tce.tce_bits.tce_rpn;
    1.15 +        mfn = gmfn_to_mfn(d, gpfn);
    1.16          if (mfn != INVALID_MFN) {
    1.17  #ifdef DEBUG
    1.18              printk("%s: ioba=0x%lx pfn=0x%lx mfn=0x%lx\n", __func__,
     2.1 --- a/xen/arch/powerpc/usercopy.c	Mon Oct 02 19:55:18 2006 -0400
     2.2 +++ b/xen/arch/powerpc/usercopy.c	Mon Oct 02 21:40:26 2006 -0400
     2.3 @@ -39,40 +39,20 @@ static unsigned long paddr_to_maddr(unsi
     2.4  {
     2.5      struct vcpu *v = get_current();
     2.6      struct domain *d = v->domain;
     2.7 -    int mtype;
     2.8 -    ulong pfn;
     2.9 +    ulong gpfn;
    2.10      ulong offset;
    2.11      ulong pa = paddr;
    2.12  
    2.13      offset = pa & ~PAGE_MASK;
    2.14 -    pfn = pa >> PAGE_SHIFT;
    2.15 +    gpfn = pa >> PAGE_SHIFT;
    2.16  
    2.17 -    pa = pfn2mfn(d, pfn, &mtype);
    2.18 +    pa = gmfn_to_mfn(d, gpfn);
    2.19      if (pa == INVALID_MFN) {
    2.20          printk("%s: Dom:%d bad paddr: 0x%lx\n",
    2.21                 __func__, d->domain_id, paddr);
    2.22          return 0;
    2.23      }
    2.24 -    switch (mtype) {
    2.25 -    case PFN_TYPE_RMA:
    2.26 -    case PFN_TYPE_LOGICAL:
    2.27 -        break;
    2.28  
    2.29 -    case PFN_TYPE_FOREIGN:
    2.30 -        /* I don't think this should ever happen, but I suppose it
    2.31 -         * could be possible */
    2.32 -        printk("%s: Dom:%d paddr: 0x%lx type: FOREIGN\n",
    2.33 -               __func__, d->domain_id, paddr);
    2.34 -        WARN();
    2.35 -        break;
    2.36 -
    2.37 -    case PFN_TYPE_IO:
    2.38 -    default:
    2.39 -        printk("%s: Dom:%d paddr: 0x%lx bad type: 0x%x\n",
    2.40 -               __func__, d->domain_id, paddr, mtype);
    2.41 -        WARN();
    2.42 -        return 0;
    2.43 -    }
    2.44      pa <<= PAGE_SHIFT;
    2.45      pa |= offset;
    2.46  
     3.1 --- a/xen/include/asm-powerpc/debugger.h	Mon Oct 02 19:55:18 2006 -0400
     3.2 +++ b/xen/include/asm-powerpc/debugger.h	Mon Oct 02 21:40:26 2006 -0400
     3.3 @@ -13,14 +13,17 @@
     3.4   * along with this program; if not, write to the Free Software
     3.5   * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     3.6   *
     3.7 - * Copyright (C) IBM Corp. 2005
     3.8 + * Copyright (C) IBM Corp. 2005, 2006
     3.9   *
    3.10   * Authors: Hollis Blanchard <hollisb@us.ibm.com>
    3.11 + *          Jimi Xenidis <jimix@watson.ibm.com>
    3.12   */
    3.13  
    3.14  #ifndef _ASM_DEBUGGER_H_
    3.15  #define _ASM_DEBUGGER_H_
    3.16  
    3.17 +#include <public/xen.h>
    3.18 +
    3.19  extern void show_backtrace_regs(struct cpu_user_regs *);
    3.20  extern void show_backtrace(ulong sp, ulong lr, ulong pc);
    3.21  
     4.1 --- a/xen/include/asm-powerpc/mm.h	Mon Oct 02 19:55:18 2006 -0400
     4.2 +++ b/xen/include/asm-powerpc/mm.h	Mon Oct 02 21:40:26 2006 -0400
     4.3 @@ -247,7 +247,22 @@ long arch_memory_op(int op, XEN_GUEST_HA
     4.4  
     4.5  static inline unsigned long gmfn_to_mfn(struct domain *d, unsigned long gmfn)
     4.6  {
     4.7 -	return pfn2mfn(d, gmfn, NULL);
     4.8 +    int mtype;
     4.9 +    ulong mfn;
    4.10 +    
    4.11 +    mfn = pfn2mfn(d, gmfn, &mtype);
    4.12 +    if (mfn != INVALID_MFN) {
    4.13 +        switch (mtype) {
    4.14 +        case PFN_TYPE_RMA:
    4.15 +        case PFN_TYPE_LOGICAL:
    4.16 +            break;
    4.17 +        default:
    4.18 +            WARN();
    4.19 +            mfn = INVALID_MFN;
    4.20 +            break;
    4.21 +        }
    4.22 +    }
    4.23 +    return mfn;
    4.24  }
    4.25  
    4.26  #define mfn_to_gmfn(_d, mfn) (mfn)
     5.1 --- a/xen/include/asm-powerpc/page.h	Mon Oct 02 19:55:18 2006 -0400
     5.2 +++ b/xen/include/asm-powerpc/page.h	Mon Oct 02 21:40:26 2006 -0400
     5.3 @@ -16,6 +16,7 @@
     5.4   * Copyright (C) IBM Corp. 2005
     5.5   *
     5.6   * Authors: Hollis Blanchard <hollisb@us.ibm.com>
     5.7 + *          Jimi Xenidis <jimix@watson.ibm.com>
     5.8   */
     5.9  
    5.10  #ifndef _ASM_PAGE_H
    5.11 @@ -29,6 +30,7 @@
    5.12  
    5.13  #include <xen/config.h>
    5.14  #include <asm/cache.h>
    5.15 +#include <asm/debugger.h>
    5.16  
    5.17  #define PFN_DOWN(x)   ((x) >> PAGE_SHIFT)
    5.18  #define PFN_UP(x)     (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)