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

[Xen-ia64-devel] PATCH: use cpl=1 for pv-domain kernel


  • To: xen-ia64-devel <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Juergen Gross <juergen.gross@xxxxxxxxxxxxxxxxxxx>
  • Date: Tue, 26 Jun 2007 13:42:42 +0200
  • Delivery-date: Tue, 26 Jun 2007 04:40:34 -0700
  • Domainkey-signature: s=s768; d=fujitsu-siemens.com; c=nofws; q=dns; b=hyykdGXaAe2HF0Y/Xsz8qBz33pyUoD3qke8sgugg/ArbgTm05PeNfHtrhiPfY5b7/HYDd98OFGOv0PliHlK1D3D+hSThb7eRlPoaXp00O5veawH9vs+rc3ki3JNc77p6;
  • List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>

Hi,

this is another patch to be installed on top of my previous one.
It uses cpl=1 for pv-domain kernel mode.
I've fixed xenoprof.c and some more explicit cpl==2 test I've missed before.
A compiler warning in vcpu.c is fixed, too.

Tested by booting dom0.

Juergen

-- 
Juergen Gross                             Principal Developer
IP SW OS6                      Telephone: +49 (0) 89 636 47950
Fujitsu Siemens Computers         e-mail: juergen.gross@xxxxxxxxxxxxxxxxxxx
Otto-Hahn-Ring 6                Internet: www.fujitsu-siemens.com
D-81739 Muenchen         Company details: www.fujitsu-siemens.com/imprint.html
# HG changeset patch
# User gross@xxxxxxxxxxxxxxxxxxxx
# Node ID 33704dd9cbbc30cc0e58ec748657e26c97d21d7a
# Parent  985ececb1dcd1c7ef37170c641b41141a87afaa2
cpl=0 emulation for pv-domain

diff -r 985ececb1dcd -r 33704dd9cbbc xen/arch/ia64/xen/faults.c
--- a/xen/arch/ia64/xen/faults.c        Tue Jun 26 10:52:55 2007 +0200
+++ b/xen/arch/ia64/xen/faults.c        Tue Jun 26 13:37:48 2007 +0200
@@ -505,7 +505,7 @@ ia64_handle_break(unsigned long ifa, str
 
        /* FIXME: don't hardcode constant */
        if ((iim == 0x80001 || iim == 0x80002)
-           && ia64_get_cpl(regs->cr_ipsr) == 2) {
+           && ia64_get_cpl(regs->cr_ipsr) == CONFIG_CPL0_EMUL) {
                do_ssc(vcpu_get_gr(current, 36), regs);
        }
 #ifdef CRASH_DEBUG
@@ -515,7 +515,8 @@ ia64_handle_break(unsigned long ifa, str
                debugger_trap_fatal(0 /* don't care */ , regs);
        }
 #endif
-       else if (iim == d->arch.breakimm && ia64_get_cpl(regs->cr_ipsr) == 2) {
+       else if (iim == d->arch.breakimm &&
+                ia64_get_cpl(regs->cr_ipsr) == CONFIG_CPL0_EMUL) {
                /* by default, do not continue */
                v->arch.hypercall_continuation = 0;
 
@@ -525,7 +526,7 @@ ia64_handle_break(unsigned long ifa, str
                } else
                        reflect_interruption(isr, regs, vector);
        } else if ((iim - HYPERPRIVOP_START) < HYPERPRIVOP_MAX
-                  && ia64_get_cpl(regs->cr_ipsr) == 2) {
+                  && ia64_get_cpl(regs->cr_ipsr) == CONFIG_CPL0_EMUL) {
                if (ia64_hyperprivop(iim, regs))
                        vcpu_increment_iip(current);
        } else {
diff -r 985ececb1dcd -r 33704dd9cbbc xen/arch/ia64/xen/oprofile/xenoprof.c
--- a/xen/arch/ia64/xen/oprofile/xenoprof.c     Tue Jun 26 10:52:55 2007 +0200
+++ b/xen/arch/ia64/xen/oprofile/xenoprof.c     Tue Jun 26 13:37:48 2007 +0200
@@ -28,20 +28,23 @@ int
 int
 xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs)
 {
-    int mode = 0;
+    int mode;
 
     // mode
     // 0: user, 1: kernel, 2: xen
-    // Xen/IA64 uses ring2 for kernel, and doesn't use ring1.
-    if (ring_2(regs))
-        mode = 1;
-    else if (ring_0(regs))
-        mode = 2;
-    else if (ring_1(regs)) {
-        gdprintk(XENLOG_ERR, "%s:%d ring1 is used!\n", __func__, __LINE__);
-        mode = 1;// fall back to kernel mode.
+    switch (ring(regs))
+    {
+        case 3: mode = 0;
+                break;
+        case CONFIG_CPL0_EMUL: mode = 1;
+                break;
+        case 0: mode = 2;
+                break;
+        default:
+                gdprintk(XENLOG_ERR, "%s:%d ring%d is used!\n", __func__,
+                         __LINE__, 3 - CONFIG_CPL0_EMUL);
+                mode = 1;// fall back to kernel mode.
     }
-
     return mode;
 }
 
diff -r 985ececb1dcd -r 33704dd9cbbc xen/arch/ia64/xen/privop.c
--- a/xen/arch/ia64/xen/privop.c        Tue Jun 26 10:52:55 2007 +0200
+++ b/xen/arch/ia64/xen/privop.c        Tue Jun 26 13:37:48 2007 +0200
@@ -636,7 +636,7 @@ static IA64FAULT priv_handle_op(VCPU * v
        }
        if (slot_type == B && inst.generic.major == 0 && inst.B8.x6 == 0x0) {
                // break instr for privified cover
-       } else if (privlvl != 2)
+       } else if (privlvl > CONFIG_CPL0_EMUL)
                return IA64_ILLOP_FAULT;
        switch (slot_type) {
        case M:
diff -r 985ececb1dcd -r 33704dd9cbbc xen/arch/ia64/xen/vcpu.c
--- a/xen/arch/ia64/xen/vcpu.c  Tue Jun 26 10:52:55 2007 +0200
+++ b/xen/arch/ia64/xen/vcpu.c  Tue Jun 26 13:37:48 2007 +0200
@@ -496,7 +496,7 @@ IA64FAULT vcpu_set_psr(VCPU * vcpu, u64 
        PSCB(vcpu, interrupt_collection_enabled) = vpsr.ic;
        vcpu_set_metaphysical_mode(vcpu, !(vpsr.dt && vpsr.rt && vpsr.it));
 
-       newpsr.cpl |= max(vpsr.cpl, CONFIG_CPL0_EMUL);
+       newpsr.cpl |= max(vpsr.cpl, (u64)CONFIG_CPL0_EMUL);
 
        if (PSCB(vcpu, banknum) != vpsr.bn) {
                if (vpsr.bn)
diff -r 985ececb1dcd -r 33704dd9cbbc xen/include/asm-ia64/config.h
--- a/xen/include/asm-ia64/config.h     Tue Jun 26 10:52:55 2007 +0200
+++ b/xen/include/asm-ia64/config.h     Tue Jun 26 13:37:48 2007 +0200
@@ -56,7 +56,7 @@
 #define NR_hypercalls 64
 
 /* PV domains use this value for priv. level 0 emulation */
-#define CONFIG_CPL0_EMUL       2
+#define CONFIG_CPL0_EMUL       1
 
 #ifndef __ASSEMBLY__
 
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel

 


Rackspace

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