# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 0379ac3367b2a772f81ebc16cc204b5c17c803b8
# Parent 7b6f0a4d5cdd9a29d66a2faff340c23933060793
[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>
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
xen/arch/powerpc/iommu.c | 7 +++----
xen/arch/powerpc/usercopy.c | 30 +++++-------------------------
xen/include/asm-powerpc/debugger.h | 5 ++++-
xen/include/asm-powerpc/mm.h | 17 ++++++++++++++++-
xen/include/asm-powerpc/page.h | 2 ++
5 files changed, 30 insertions(+), 31 deletions(-)
diff -r 7b6f0a4d5cdd -r 0379ac3367b2 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 7b6f0a4d5cdd -r 0379ac3367b2 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
@@ -39,40 +39,20 @@ static unsigned long paddr_to_maddr(unsi
{
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;
-
- pa = pfn2mfn(d, pfn, &mtype);
+ gpfn = pa >> PAGE_SHIFT;
+
+ 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 7b6f0a4d5cdd -r 0379ac3367b2 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 7b6f0a4d5cdd -r 0379ac3367b2 xen/include/asm-powerpc/mm.h
--- a/xen/include/asm-powerpc/mm.h Mon Oct 02 19:55:18 2006 -0400
+++ b/xen/include/asm-powerpc/mm.h Mon Oct 02 21:40:26 2006 -0400
@@ -247,7 +247,22 @@ long arch_memory_op(int op, XEN_GUEST_HA
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)
diff -r 7b6f0a4d5cdd -r 0379ac3367b2 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
*
* 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)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|