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

[Xen-ia64-devel] [Patch] Fix for re-enabling PV-on-HVM on IPF

To: xen-ia64-devel <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-ia64-devel] [Patch] Fix for re-enabling PV-on-HVM on IPF
From: DOI Tsunehisa <Doi.Tsunehisa@xxxxxxxxxxxxxx>
Date: Tue, 06 Mar 2007 21:56:14 +0900
Delivery-date: Tue, 06 Mar 2007 04:56:31 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.9 (Windows/20061207)
Hi all,

  In last week, I submitted the patch to fix for compiling PV-on-HVM.
But, it crashed hypervisor, so..

I (Doi.Tsunehisa) said:
>   We'll have to modify the arch_memory_op code to follow dynamic grant
> table size feature in the hypervisor side.

  I've be investigating this issue, thus I found the reason of it.

  * That patch itself was correct.
  * not follow dynamic grant_table for PV-on-HVM on IPF
    - we have to modify the arch_memory_op code.
    - we have to modify guest_physmap_add_page() to support it.
      (this is straight reason of hypervisor crash)
  * in some case, a return value of hypercall from VT-i domain is broken.

  So, I'll submit these patch..

  * pvfix.patch
    - fix for compling PV-on-HVM driver on IPF.
    - this is same as that I send in last week.
  * dynmic-gnttab.patch
    - follow dynamic grant_table for PV-on-HVM on IPF
  * avoid-crash.patch
    - modify guest_physmap_add_page()
  * hcall-rval.patch
    - fix about a return value of hypercall from VT-i domain.

  And, it requires the patch of xen-unstable.hg(cs:14089) for
PV-on-HVM enabling.

  In out simple test, PV-on-HVM on IPF works.

Thanks,
- Tsunehisa Doi
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Date 1173182115 -32400
# Node ID 59655cf89ac90a1f566bf8a59dbb65cf76d980e5
# Parent  8a58ea36e4207e6d47f8870632ab8fe14e3622cb
Fix for compiling PV-on-HVM driver on IPF

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>

diff -r 8a58ea36e420 -r 59655cf89ac9 
unmodified_drivers/linux-2.6/platform-pci/xen_support.c
--- a/unmodified_drivers/linux-2.6/platform-pci/xen_support.c   Thu Mar 01 
15:02:09 2007 -0700
+++ b/unmodified_drivers/linux-2.6/platform-pci/xen_support.c   Tue Mar 06 
20:55:15 2007 +0900
@@ -45,7 +45,13 @@ unsigned long __hypercall(unsigned long 
        return __res;
 }
 EXPORT_SYMBOL(__hypercall);
-#endif
+
+int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
+{
+       return xencomm_mini_hypercall_grant_table_op(cmd, uop, count);
+}
+EXPORT_SYMBOL(HYPERVISOR_grant_table_op);
+#endif /* __ia64__ */
 
 void xen_machphys_update(unsigned long mfn, unsigned long pfn)
 {
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Date 1173182911 -32400
# Node ID 4a02f5baf293c5f0dcfe425a42957b61aef619df
# Parent  08949bfc0193e4bbecba470cee40e30816392699
Avoid hypervisor crash for PV-on-HVM on IPF

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>

diff -r 08949bfc0193 -r 4a02f5baf293 xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Tue Mar 06 21:04:28 2007 +0900
+++ b/xen/arch/ia64/xen/mm.c    Tue Mar 06 21:08:31 2007 +0900
@@ -1710,11 +1710,17 @@ guest_physmap_add_page(struct domain *d,
     int ret;
 
     BUG_ON(!mfn_valid(mfn));
-    ret = get_page(mfn_to_page(mfn), d);
-    BUG_ON(ret == 0);
+    if (!IS_XEN_HEAP_FRAME(mfn_to_page(mfn))) {
+        ret = get_page(mfn_to_page(mfn), d);
+        BUG_ON(ret == 0);
+    }
     set_gpfn_from_mfn(mfn, gpfn);
     smp_mb();
-    assign_domain_page_replace(d, gpfn << PAGE_SHIFT, mfn,
+    if (IS_XEN_HEAP_FRAME(mfn_to_page(mfn)))
+        assign_domain_page_replace(d, gpfn << PAGE_SHIFT, mfn,
+                               ASSIGN_writable);
+    else
+        assign_domain_page_replace(d, gpfn << PAGE_SHIFT, mfn,
                                ASSIGN_writable | ASSIGN_pgc_allocated);
 
     //BUG_ON(mfn != ((lookup_domain_mpa(d, gpfn << PAGE_SHIFT) & _PFN_MASK) >> 
PAGE_SHIFT));
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Date 1173182668 -32400
# Node ID 08949bfc0193e4bbecba470cee40e30816392699
# Parent  59655cf89ac90a1f566bf8a59dbb65cf76d980e5
Follow dynamic grant_table for PV-on-HVM on IPF

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>

diff -r 59655cf89ac9 -r 08949bfc0193 xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Tue Mar 06 20:55:15 2007 +0900
+++ b/xen/arch/ia64/xen/mm.c    Tue Mar 06 21:04:28 2007 +0900
@@ -2087,12 +2087,23 @@ arch_memory_op(int op, XEN_GUEST_HANDLE(
             break;
         case XENMAPSPACE_grant_table:
             spin_lock(&d->grant_table->lock);
+
+            if ((xatp.idx >= nr_grant_frames(d->grant_table)) &&
+                (xatp.idx < max_nr_grant_frames))
+                gnttab_grow_table(d, xatp.idx + 1);
+
             if (xatp.idx < nr_grant_frames(d->grant_table))
-                mfn = virt_to_mfn(d->grant_table->shared) + xatp.idx;
+                mfn = virt_to_mfn(d->grant_table->shared[xatp.idx]);
+
             spin_unlock(&d->grant_table->lock);
             break;
         default:
             break;
+        }
+
+        if (mfn == 0) {
+            put_domain(d);
+            return -EINVAL;
         }
 
         LOCK_BIGLOCK(d);
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Date 1173183097 -32400
# Node ID c3fdaff60c05896fbbf13fa096eb1e4803c6ae8a
# Parent  4a02f5baf293c5f0dcfe425a42957b61aef619df
Fix about a return value of hypercall from VT-i domain

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>

diff -r 4a02f5baf293 -r c3fdaff60c05 xen/arch/ia64/vmx/vmx_entry.S
--- a/xen/arch/ia64/vmx/vmx_entry.S     Tue Mar 06 21:08:31 2007 +0900
+++ b/xen/arch/ia64/vmx/vmx_entry.S     Tue Mar 06 21:11:37 2007 +0900
@@ -477,6 +477,11 @@ GLOBAL_ENTRY(ia64_leave_hypercall)
      * resumes at .work_processed_syscall with p6 set to 1 if the 
extra-work-check
      * needs to be redone.
      */
+    ;;
+    adds r16=PT(R8)+16,r12
+    ;;
+    st8 [r16]=r8
+    ;;
 (pUStk) rsm psr.i
     cmp.eq pLvSys,p0=r0,r0             // pLvSys=1: leave from syscall
 (pUStk) cmp.eq.unc p6,p0=r0,r0         // p6 <- pUStk
@@ -484,6 +489,11 @@ GLOBAL_ENTRY(ia64_leave_hypercall)
     br.call.sptk.many b0=leave_hypervisor_tail
 .work_processed_syscall:
     //clean up bank 1 registers
+    ;;
+    adds r16=PT(R8)+16,r12
+    ;;
+    ld8 r8=[r16]
+    ;;
     mov r16=r0
     mov r17=r0
     mov r18=r0
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel