From: "Jan Beulich" Subject: [PATCH] make do_sched_op_compat() x86-specific Date: Mon, 08 Jun 2015 14:28:36 +0100 Message-ID: <5575B4A4020000780008222D@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part44706994.2__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z1x6Y-0007bD-7p for xen-devel@lists.xenproject.org; Mon, 08 Jun 2015 13:28:42 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Ian Campbell , Andrew Cooper , Keir Fraser , Ian Jackson , Tim Deegan List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part44706994.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Being a pre-3.1 compatibility hypercall handler only, it's not needed on ARM or any future architectures Xen may get ported to. Also the function shouldn't really be used internally - its use should be limited to its purpose (and hence there's also no need for a prototype). Signed-off-by: Jan Beulich --- a/xen/arch/x86/compat.c +++ b/xen/arch/x86/compat.c @@ -5,9 +5,10 @@ * hypercall after doing necessary argument munging. */ =20 -#include #include #include +#include +#include =20 #ifndef COMPAT typedef long ret_t; @@ -26,6 +27,28 @@ ret_t do_physdev_op_compat(XEN_GUEST_HAN =20 #ifndef COMPAT =20 +/* Legacy hypercall (as of 0x00030101). */ +long do_sched_op_compat(int cmd, unsigned long arg) +{ + switch ( cmd ) + { + case SCHEDOP_yield: + case SCHEDOP_block: + return do_sched_op(cmd, guest_handle_from_ptr(NULL, void)); + + case SCHEDOP_shutdown: + TRACE_3D(TRC_SCHED_SHUTDOWN, + current->domain->domain_id, current->vcpu_id, arg); + domain_shutdown(current->domain, (u8)arg); + break; + + default: + return -ENOSYS; + } + + return 0; +} + /* Legacy hypercall (as of 0x00030202). */ long do_event_channel_op_compat(XEN_GUEST_HANDLE_PARAM(evtchn_op_t) uop) { --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -2705,7 +2705,7 @@ void hvm_hlt(unsigned long rflags) if ( unlikely(!(rflags & X86_EFLAGS_IF)) ) return hvm_vcpu_down(curr); =20 - do_sched_op_compat(SCHEDOP_block, 0); + do_sched_op(SCHEDOP_block, guest_handle_from_ptr(NULL, void)); =20 HVMTRACE_1D(HLT, /* pending =3D */ vcpu_runnable(curr)); } --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -1988,7 +1988,7 @@ static void svm_vmexit_do_pause(struct c * Do something useful, like reschedule the guest */ perfc_incr(pauseloop_exits); - do_sched_op_compat(SCHEDOP_yield, 0); + do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void)); } =20 static void --- a/xen/arch/x86/hvm/viridian.c +++ b/xen/arch/x86/hvm/viridian.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -561,7 +562,7 @@ int viridian_hypercall(struct cpu_user_r { case HvNotifyLongSpinWait: perfc_incr(mshv_call_long_wait); - do_sched_op_compat(SCHEDOP_yield, 0); + do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void)); status =3D HV_STATUS_SUCCESS; break; default: --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include @@ -3198,7 +3198,7 @@ void vmx_vmexit_handler(struct cpu_user_ =20 case EXIT_REASON_PAUSE_INSTRUCTION: perfc_incr(pauseloop_exits); - do_sched_op_compat(SCHEDOP_yield, 0); + do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void)); break; =20 case EXIT_REASON_XSETBV: --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -882,39 +882,6 @@ void watchdog_domain_destroy(struct doma kill_timer(&d->watchdog_timer[i]); } =20 -long do_sched_op_compat(int cmd, unsigned long arg) -{ - long ret =3D 0; - - switch ( cmd ) - { - case SCHEDOP_yield: - { - ret =3D vcpu_yield(); - break; - } - - case SCHEDOP_block: - { - vcpu_block_enable_events(); - break; - } - - case SCHEDOP_shutdown: - { - TRACE_3D(TRC_SCHED_SHUTDOWN, - current->domain->domain_id, current->vcpu_id, arg); - domain_shutdown(current->domain, (u8)arg); - break; - } - - default: - ret =3D -ENOSYS; - } - - return ret; -} - typedef long ret_t; =20 #endif /* !COMPAT */ --- a/xen/include/xen/hypercall.h +++ b/xen/include/xen/hypercall.h @@ -22,11 +22,6 @@ do_ni_hypercall( void); =20 extern long -do_sched_op_compat( - int cmd, - unsigned long arg); - -extern long do_sched_op( int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); --=__Part44706994.2__= Content-Type: text/plain; name="sched-op-compat-x86-only.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="sched-op-compat-x86-only.patch" make do_sched_op_compat() x86-specific=0A=0ABeing a pre-3.1 compatibility = hypercall handler only, it's not needed=0Aon ARM or any future architecture= s Xen may get ported to.=0A=0AAlso the function shouldn't really be used = internally - its use should=0Abe limited to its purpose (and hence there's = also no need for a=0Aprototype).=0A=0ASigned-off-by: Jan Beulich =0A=0A--- a/xen/arch/x86/compat.c=0A+++ b/xen/arch/x86/compat.c=0A= @@ -5,9 +5,10 @@=0A * hypercall after doing necessary argument munging.=0A= */=0A =0A-#include =0A #include =0A = #include =0A+#include =0A+#include =0A =0A #ifndef COMPAT=0A typedef long ret_t;=0A@@ -26,6 +27,28 @@ = ret_t do_physdev_op_compat(XEN_GUEST_HAN=0A =0A #ifndef COMPAT=0A =0A+/* = Legacy hypercall (as of 0x00030101). */=0A+long do_sched_op_compat(int = cmd, unsigned long arg)=0A+{=0A+ switch ( cmd )=0A+ {=0A+ case = SCHEDOP_yield:=0A+ case SCHEDOP_block:=0A+ return do_sched_op(cmd= , guest_handle_from_ptr(NULL, void));=0A+=0A+ case SCHEDOP_shutdown:=0A+= TRACE_3D(TRC_SCHED_SHUTDOWN,=0A+ current->domain->d= omain_id, current->vcpu_id, arg);=0A+ domain_shutdown(current->domai= n, (u8)arg);=0A+ break;=0A+=0A+ default:=0A+ return = -ENOSYS;=0A+ }=0A+=0A+ return 0;=0A+}=0A+=0A /* Legacy hypercall (as = of 0x00030202). */=0A long do_event_channel_op_compat(XEN_GUEST_HANDLE_PARA= M(evtchn_op_t) uop)=0A {=0A--- a/xen/arch/x86/hvm/hvm.c=0A+++ b/xen/arch/x8= 6/hvm/hvm.c=0A@@ -2705,7 +2705,7 @@ void hvm_hlt(unsigned long rflags)=0A = if ( unlikely(!(rflags & X86_EFLAGS_IF)) )=0A return hvm_vcpu_do= wn(curr);=0A =0A- do_sched_op_compat(SCHEDOP_block, 0);=0A+ = do_sched_op(SCHEDOP_block, guest_handle_from_ptr(NULL, void));=0A =0A = HVMTRACE_1D(HLT, /* pending =3D */ vcpu_runnable(curr));=0A }=0A--- = a/xen/arch/x86/hvm/svm/svm.c=0A+++ b/xen/arch/x86/hvm/svm/svm.c=0A@@ -36,7 = +36,7 @@=0A #include =0A #include =0A = #include =0A-#include =0A+#include =0A #include =0A #include =0A #include = =0A@@ -1988,7 +1988,7 @@ static void svm_vmexit_do_pause(struct= c=0A * Do something useful, like reschedule the guest=0A */=0A = perfc_incr(pauseloop_exits);=0A- do_sched_op_compat(SCHEDOP_yield, = 0);=0A+ do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, = void));=0A }=0A =0A static void=0A--- a/xen/arch/x86/hvm/viridian.c=0A+++ = b/xen/arch/x86/hvm/viridian.c=0A@@ -9,6 +9,7 @@=0A #include = =0A #include =0A #include =0A+#include = =0A #include =0A #include =0A = #include =0A@@ -561,7 +562,7 @@ int viridian_hypercall(struct = cpu_user_r=0A {=0A case HvNotifyLongSpinWait:=0A perfc_incr= (mshv_call_long_wait);=0A- do_sched_op_compat(SCHEDOP_yield, = 0);=0A+ do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, = void));=0A status =3D HV_STATUS_SUCCESS;=0A break;=0A = default:=0A--- a/xen/arch/x86/hvm/vmx/vmx.c=0A+++ b/xen/arch/x86/hvm/vmx/vm= x.c=0A@@ -32,7 +32,7 @@=0A #include =0A #include =0A #include =0A-#include =0A+#include = =0A #include =0A #include = =0A #include =0A@@ -3198,7 +3198,7 @@ void vmx_vmexit_handler= (struct cpu_user_=0A =0A case EXIT_REASON_PAUSE_INSTRUCTION:=0A = perfc_incr(pauseloop_exits);=0A- do_sched_op_compat(SCHEDOP_yield, = 0);=0A+ do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, = void));=0A break;=0A =0A case EXIT_REASON_XSETBV:=0A--- = a/xen/common/schedule.c=0A+++ b/xen/common/schedule.c=0A@@ -882,39 +882,6 = @@ void watchdog_domain_destroy(struct doma=0A kill_timer(&d->watch= dog_timer[i]);=0A }=0A =0A-long do_sched_op_compat(int cmd, unsigned long = arg)=0A-{=0A- long ret =3D 0;=0A-=0A- switch ( cmd )=0A- {=0A- = case SCHEDOP_yield:=0A- {=0A- ret =3D vcpu_yield();=0A- = break;=0A- }=0A-=0A- case SCHEDOP_block:=0A- {=0A- = vcpu_block_enable_events();=0A- break;=0A- }=0A-=0A- case = SCHEDOP_shutdown:=0A- {=0A- TRACE_3D(TRC_SCHED_SHUTDOWN,=0A- = current->domain->domain_id, current->vcpu_id, arg);=0A- = domain_shutdown(current->domain, (u8)arg);=0A- break;=0A- = }=0A-=0A- default:=0A- ret =3D -ENOSYS;=0A- }=0A-=0A- = return ret;=0A-}=0A-=0A typedef long ret_t;=0A =0A #endif /* !COMPAT = */=0A--- a/xen/include/xen/hypercall.h=0A+++ b/xen/include/xen/hypercall.h= =0A@@ -22,11 +22,6 @@ do_ni_hypercall(=0A void);=0A =0A extern = long=0A-do_sched_op_compat(=0A- int cmd,=0A- unsigned long = arg);=0A-=0A-extern long=0A do_sched_op(=0A int cmd,=0A XEN_GUEST_H= ANDLE_PARAM(void) arg);=0A --=__Part44706994.2__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part44706994.2__=--