[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Grant table support changes and fix cmpxchg_user



ChangeSet 1.1726.1.8, 2005/06/28 14:01:51-06:00, djm@xxxxxxxxxxxxxxx

        Grant table support changes and fix cmpxchg_user
        Signed-off-by: Matt Chapman <matthewc@xxxxxx>



 arch/ia64/domain.c           |   36 +++++++++++++++++++++++++++++++++++-
 arch/ia64/grant_table.c      |   23 +++++++++++++++++++----
 include/asm-ia64/xensystem.h |    9 ++++-----
 3 files changed, 58 insertions(+), 10 deletions(-)


diff -Nru a/xen/arch/ia64/domain.c b/xen/arch/ia64/domain.c
--- a/xen/arch/ia64/domain.c    2005-06-29 18:03:19 -04:00
+++ b/xen/arch/ia64/domain.c    2005-06-29 18:03:19 -04:00
@@ -465,8 +465,42 @@
                set_pte(pte, pfn_pte(page_to_phys(p) >> PAGE_SHIFT,
                        __pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX)));
        }
-       else printk("map_new_domain_page: page %p already mapped!\n",p);
+       else printk("map_new_domain_page: mpaddr %lx already mapped!\n",mpaddr);
        return p;
+}
+
+/* map a physical address to the specified metaphysical addr */
+void map_domain_page(struct domain *d, unsigned long mpaddr, unsigned long 
physaddr)
+{
+       struct mm_struct *mm = d->arch.mm;
+       pgd_t *pgd;
+       pud_t *pud;
+       pmd_t *pmd;
+       pte_t *pte;
+
+       if (!mm->pgd) {
+               printk("map_domain_page: domain pgd must exist!\n");
+               return;
+       }
+       pgd = pgd_offset(mm,mpaddr);
+       if (pgd_none(*pgd))
+               pgd_populate(mm, pgd, pud_alloc_one(mm,mpaddr));
+
+       pud = pud_offset(pgd, mpaddr);
+       if (pud_none(*pud))
+               pud_populate(mm, pud, pmd_alloc_one(mm,mpaddr));
+
+       pmd = pmd_offset(pud, mpaddr);
+       if (pmd_none(*pmd))
+               pmd_populate_kernel(mm, pmd, pte_alloc_one_kernel(mm,mpaddr));
+//             pmd_populate(mm, pmd, pte_alloc_one(mm,mpaddr));
+
+       pte = pte_offset_map(pmd, mpaddr);
+       if (pte_none(*pte)) {
+               set_pte(pte, pfn_pte(physaddr >> PAGE_SHIFT,
+                       __pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX)));
+       }
+       else printk("map_domain_page: mpaddr %lx already mapped!\n",mpaddr);
 }
 
 void mpafoo(unsigned long mpaddr)
diff -Nru a/xen/arch/ia64/grant_table.c b/xen/arch/ia64/grant_table.c
--- a/xen/arch/ia64/grant_table.c       2005-06-29 18:03:19 -04:00
+++ b/xen/arch/ia64/grant_table.c       2005-06-29 18:03:19 -04:00
@@ -570,13 +570,13 @@
         /* Frame is now unmapped for device access. */
     }
 
-#ifdef __ia64__
-// FIXME-ia64: any error checking need to be done here?
-#else
     if ( (virt != 0) &&
          (flags & GNTMAP_host_map) &&
          ((act->pin & (GNTPIN_hstw_mask | GNTPIN_hstr_mask)) > 0))
     {
+#ifdef __ia64__
+// FIXME-ia64: any error checking need to be done here?
+#else
         l1_pgentry_t   *pl1e;
         unsigned long   _ol1e;
 
@@ -609,6 +609,7 @@
             rc = -EINVAL;
             goto unmap_out;
         }
+#endif
 
         map->ref_and_flags &= ~GNTMAP_host_map;
 
@@ -627,7 +628,6 @@
         rc = 0;
         *va = virt;
     }
-#endif
 
     if ( (map->ref_and_flags & (GNTMAP_device_map|GNTMAP_host_map)) == 0)
     {
@@ -696,6 +696,7 @@
     gnttab_setup_table_t  op;
     struct domain        *d;
     int                   i;
+    unsigned long addr;
 
     if ( count != 1 )
         return -EINVAL;
@@ -735,10 +736,24 @@
     {
         ASSERT(d->grant_table != NULL);
         (void)put_user(GNTST_okay, &uop->status);
+#ifdef __ia64__
+       if (d == dom0) {
+            for ( i = 0; i < op.nr_frames; i++ )
+                (void)put_user(
+                    (virt_to_phys(d->grant_table->shared) >> PAGE_SHIFT) + i,
+                    &uop->frame_list[i]);
+       } else {
+            /* IA64 hack - need to map it somewhere */
+            addr = (1UL << 40);
+            map_domain_page(d, addr, virt_to_phys(d->grant_table->shared));
+            (void)put_user(addr >> PAGE_SHIFT, &uop->frame_list[0]);
+        }
+#else
         for ( i = 0; i < op.nr_frames; i++ )
             (void)put_user(
                 (virt_to_phys(d->grant_table->shared) >> PAGE_SHIFT) + i,
                 &uop->frame_list[i]);
+#endif
     }
 
     put_domain(d);
diff -Nru a/xen/include/asm-ia64/xensystem.h b/xen/include/asm-ia64/xensystem.h
--- a/xen/include/asm-ia64/xensystem.h  2005-06-29 18:03:19 -04:00
+++ b/xen/include/asm-ia64/xensystem.h  2005-06-29 18:03:19 -04:00
@@ -66,13 +66,12 @@
        register long __gu_r8 asm ("r8");                               \
        register long __gu_r9 asm ("r9");                               \
        asm volatile ("mov ar.ccv=%0;;" :: "rO"(old));                  \
-       asm volatile ("mov %2=r0;;\n"                                   \
-               "[1:]\tcmpxchg"_size".acq %0=[%3],%4,ar.ccv\n"          \
-               "\t.xdata4 \"__ex_table\", 1b-., 1f-.+4\n"              \
+       asm volatile ("mov %1=r0;;\n"                                   \
+               "[1:]\tcmpxchg"_size".acq %0=[%2],%3,ar.ccv\n"          \
+               "\t.xdata4 \"__ex_table\", 1b-., 1f-.\n"                \
                "[1:]"                                                  \
-               : "=r"(old), "=r"(__gu_r9), "=r"(__gu_r8) :             \
+               : "=r"(old), "=r"(__gu_r8) :                            \
                "r"(ptr), "r"(new) : "memory");                         \
-       (old) = __gu_r9;                                                \
        __gu_r8;                                                        \
 })
 

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.