# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Date 1172876810 21600
# Node ID d13289d7e61b3359eae9d835495522ad29acc1b1
# Parent  c01731b8cc990ad394c5693002666260958cc4a5
[POWERPC][XEN] Introduce "platform" abstraction to describe the IO hole.
Signed-off-by: Ryan Harper <[EMAIL PROTECTED]>
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/Makefile           |    1 
 xen/arch/powerpc/mm.c               |    5 ++--
 xen/arch/powerpc/papr/xlate.c       |    3 +-
 xen/arch/powerpc/platform.c         |   43 ++++++++++++++++++++++++++++++++++++
 xen/arch/powerpc/powerpc64/ppc970.c |   12 ----------
 xen/include/asm-powerpc/processor.h |    1 
 xen/include/asm/platform.h          |   28 +++++++++++++++++++++++
 7 files changed, 77 insertions(+), 16 deletions(-)

diff -r c01731b8cc99 -r d13289d7e61b xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Thu Mar 01 15:04:45 2007 -0600
+++ b/xen/arch/powerpc/Makefile Fri Mar 02 17:06:50 2007 -0600
@@ -33,6 +33,7 @@ obj-y += ofd_fixup.o
 obj-y += ofd_fixup.o
 obj-y += ofd_fixup_memory.o
 obj-y += physdev.o
+obj-y += platform.o
 obj-y += rtas.o
 obj-y += setup.o
 obj-y += shadow.o
diff -r c01731b8cc99 -r d13289d7e61b xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c     Thu Mar 01 15:04:45 2007 -0600
+++ b/xen/arch/powerpc/mm.c     Fri Mar 02 17:06:50 2007 -0600
@@ -27,6 +27,7 @@
 #include <xen/perfc.h>
 #include <asm/init.h>
 #include <asm/page.h>
+#include <asm/platform.h>
 #include <asm/string.h>
 #include <public/arch-powerpc.h>
 
@@ -416,7 +417,7 @@ ulong pfn2mfn(struct domain *d, ulong pf
         /* Its a grant table access */
         t = PFN_TYPE_GNTTAB;
         mfn = gnttab_shared_mfn(d, d->grant_table, (pfn - max_page));
-    } else if (d->is_privileged && cpu_io_mfn(pfn)) {
+    } else if (d->is_privileged && platform_io_mfn(pfn)) {
         t = PFN_TYPE_IO;
         mfn = pfn;
     } else {
@@ -496,7 +497,7 @@ unsigned long mfn_to_gmfn(struct domain 
         return max_page + (mfn - gnttab_mfn);
 
     /* IO? */
-    if (d->is_privileged && cpu_io_mfn(mfn))
+    if (d->is_privileged && platform_io_mfn(mfn))
         return mfn;
 
     rma_mfn = page_to_mfn(d->arch.rma_page);
diff -r c01731b8cc99 -r d13289d7e61b xen/arch/powerpc/papr/xlate.c
--- a/xen/arch/powerpc/papr/xlate.c     Thu Mar 01 15:04:45 2007 -0600
+++ b/xen/arch/powerpc/papr/xlate.c     Fri Mar 02 17:06:50 2007 -0600
@@ -29,6 +29,7 @@
 #include <asm/current.h>
 #include <asm/papr.h>
 #include <asm/hcalls.h>
+#include <asm/platform.h>
 
 #ifdef DEBUG
 #define DBG(fmt...) printk(fmt)
@@ -536,7 +537,7 @@ long pte_remove(ulong flags, ulong ptex,
 
     if (lpte.bits.v) {
         ulong mfn = lpte.bits.rpn;
-        if (!cpu_io_mfn(mfn)) {
+        if (!platform_io_mfn(mfn)) {
             struct page_info *pg = mfn_to_page(mfn);
             struct domain *f = page_get_owner(pg);
             
diff -r c01731b8cc99 -r d13289d7e61b xen/arch/powerpc/platform.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/powerpc/platform.c       Fri Mar 02 17:06:50 2007 -0600
@@ -0,0 +1,43 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright IBM Corp. 2007
+ *
+ * Authors: Ryan Harper <[EMAIL PROTECTED]>
+ *          Hollis Blanchard <[EMAIL PROTECTED]>
+ */
+
+#include <asm/page.h>
+#include <asm/platform.h>
+
+#define IO_RANGE_START (2UL << 30)
+#define IO_RANGE_END   (4UL << 30)
+#define IO_SIZE        (IO_RANGE_END - IO_RANGE_START)
+
+unsigned long platform_iohole_base(void)
+{
+    return IO_RANGE_START;
+}
+
+unsigned long platform_iohole_size(void)
+{
+    return IO_SIZE;
+}
+
+int platform_io_mfn(unsigned long mfn)
+{
+    unsigned long maddr = mfn << PAGE_SHIFT;
+    return maddr > IO_RANGE_START && maddr < IO_RANGE_END;
+}
diff -r c01731b8cc99 -r d13289d7e61b xen/arch/powerpc/powerpc64/ppc970.c
--- a/xen/arch/powerpc/powerpc64/ppc970.c       Thu Mar 01 15:04:45 2007 -0600
+++ b/xen/arch/powerpc/powerpc64/ppc970.c       Fri Mar 02 17:06:50 2007 -0600
@@ -129,18 +129,6 @@ unsigned int cpu_extent_order(void)
     return log_large_page_sizes[0] - PAGE_SHIFT;
 }
 
-/* This is more a platform thing than a CPU thing, but we only have
- * one platform now */
-int cpu_io_mfn(ulong mfn)
-{
-    /* totally cheating */
-    if (mfn >= (2UL << (30 - PAGE_SHIFT)) && /* 2GiB */
-        mfn < (4UL << (30 - PAGE_SHIFT)))    /* 4GiB */
-        return 1;
-
-    return 0;
-}
-
 int cpu_threads(int cpuid)
 {
     return 1;
diff -r c01731b8cc99 -r d13289d7e61b xen/include/asm-powerpc/processor.h
--- a/xen/include/asm-powerpc/processor.h       Thu Mar 01 15:04:45 2007 -0600
+++ b/xen/include/asm-powerpc/processor.h       Fri Mar 02 17:06:50 2007 -0600
@@ -124,7 +124,6 @@ extern uint cpu_large_page_orders(uint *
 extern uint cpu_large_page_orders(uint *sizes, uint max);
 extern void cpu_initialize(int cpuid);
 extern void cpu_init_vcpu(struct vcpu *);
-extern int cpu_io_mfn(ulong mfn);
 extern int cpu_threads(int cpuid);
 extern void save_cpu_sprs(struct vcpu *);
 extern void load_cpu_sprs(struct vcpu *);
diff -r c01731b8cc99 -r d13289d7e61b xen/include/asm/platform.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm/platform.h        Fri Mar 02 17:06:50 2007 -0600
@@ -0,0 +1,28 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright IBM Corp. 2007
+ *
+ * Authors: Ryan Harper <[EMAIL PROTECTED]>
+ */
+
+#ifndef _ASM_PLATFORM_H_
+#define _ASM_PLATFORM_H_
+
+extern unsigned long platform_iohole_base(void);
+extern unsigned long platform_iohole_size(void);
+extern int platform_io_mfn(unsigned long mfn);
+
+#endif

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

Reply via email to