From owner-p4-projects@FreeBSD.ORG Tue Feb 19 00:34:07 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8042316A468; Tue, 19 Feb 2008 00:34:07 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D1F016A420 for ; Tue, 19 Feb 2008 00:34:07 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 21EB113C44B for ; Tue, 19 Feb 2008 00:34:07 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m1J0Y608008072 for ; Tue, 19 Feb 2008 00:34:06 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m1J0Y65Q008069 for perforce@freebsd.org; Tue, 19 Feb 2008 00:34:06 GMT (envelope-from kmacy@freebsd.org) Date: Tue, 19 Feb 2008 00:34:06 GMT Message-Id: <200802190034.m1J0Y65Q008069@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 135689 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2008 00:34:07 -0000 http://perforce.freebsd.org/chv.cgi?CH=135689 Change 135689 by kmacy@pandemonium:kmacy:xen31 on 2008/02/19 00:33:47 add in more backward compatibility support Affected files ... .. //depot/projects/xen31/sys/i386/i386/machdep.c#16 edit .. //depot/projects/xen31/sys/i386/include/xen/hypercall.h#9 edit .. //depot/projects/xen31/sys/i386/include/xen/hypervisor.h#7 edit Differences ... ==== //depot/projects/xen31/sys/i386/i386/machdep.c#16 (text+ko) ==== @@ -2166,10 +2166,17 @@ void init386(int first) { - int error, gsel_tss, metadata_missing, x; unsigned long gdtmachpfn; struct pcpu *pc; + struct callback_register event = { + .type = CALLBACKTYPE_event, + .address = {GSEL(GCODE_SEL, SEL_KPL), (unsigned long)Xhypervisor_callback }, + }; + struct callback_register failsafe = { + .type = CALLBACKTYPE_failsafe, + .address = {GSEL(GCODE_SEL, SEL_KPL), (unsigned long)failsafe_callback }, + }; thread0.td_kstack = proc0kstack; thread0.td_pcb = (struct pcb *) @@ -2238,10 +2245,16 @@ if ((error = HYPERVISOR_set_trap_table(trap_table)) != 0) { panic("set_trap_table failed - error %d\n", error); } - HYPERVISOR_set_callbacks(GSEL(GCODE_SEL, SEL_KPL), - (unsigned long)Xhypervisor_callback, - GSEL(GCODE_SEL, SEL_KPL), (unsigned long)failsafe_callback); - + + error = HYPERVISOR_callback_op(CALLBACKOP_register, &event); + if (error == 0) + error = HYPERVISOR_callback_op(CALLBACKOP_register, &failsafe); +#if CONFIG_XEN_COMPAT <= 0x030002 + if (error == -ENOXENSYS) + HYPERVISOR_set_callbacks(GSEL(GCODE_SEL, SEL_KPL), + (unsigned long)Xhypervisor_callback, + GSEL(GCODE_SEL, SEL_KPL), (unsigned long)failsafe_callback); +#endif pcpu_init(pc, 0, sizeof(struct pcpu)); PCPU_SET(prvspace, pc); PCPU_SET(curthread, &thread0); ==== //depot/projects/xen31/sys/i386/include/xen/hypercall.h#9 (text+ko) ==== @@ -37,6 +37,7 @@ #define __STR(x) #x #define STR(x) __STR(x) #define ENOXENSYS 38 +#define CONFIG_XEN_COMPAT 0x030002 #if defined(XEN) @@ -259,6 +260,7 @@ { int rc = _hypercall2(int, event_channel_op, cmd, arg); +#if CONFIG_XEN_COMPAT <= 0x030002 if (__predict_false(rc == -ENOXENSYS)) { struct evtchn_op op; op.cmd = cmd; @@ -266,7 +268,7 @@ rc = _hypercall1(int, event_channel_op_compat, &op); memcpy(arg, &op.u, sizeof(op.u)); } - +#endif return (rc); } @@ -289,7 +291,7 @@ int cmd, void *arg) { int rc = _hypercall2(int, physdev_op, cmd, arg); - +#if CONFIG_XEN_COMPAT <= 0x030002 if (__predict_false(rc == -ENOXENSYS)) { struct physdev_op op; op.cmd = cmd; @@ -297,7 +299,7 @@ rc = _hypercall1(int, physdev_op_compat, &op); memcpy(arg, &op.u, sizeof(op.u)); } - +#endif return (rc); } @@ -344,34 +346,40 @@ }; int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown, &sched_shutdown, srec); +#if CONFIG_XEN_COMPAT <= 0x030002 if (rc == -ENOXENSYS) rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown, SHUTDOWN_suspend, srec); +#endif return (rc); } + +#if CONFIG_XEN_COMPAT <= 0x030002 static inline int HYPERVISOR_nmi_op( unsigned long op, void *arg) { return _hypercall2(int, nmi_op, op, arg); } +#endif -#ifdef notyet +static inline int +HYPERVISOR_callback_op( + int cmd, void *arg) +{ + return _hypercall2(int, callback_op, cmd, arg); +} + +#ifndef CONFIG_XEN static inline unsigned long HYPERVISOR_hvm_op( int op, void *arg) { return _hypercall2(unsigned long, hvm_op, op, arg); } +#endif static inline int -HYPERVISOR_callback_op( - int cmd, void *arg) -{ - return _hypercall2(int, callback_op, cmd, arg); -} - -static inline int HYPERVISOR_xenoprof_op( int op, void *arg) { @@ -384,7 +392,6 @@ { return _hypercall2(int, kexec_op, op, args); } -#endif #endif /* __HYPERCALL_H__ */ /* ==== //depot/projects/xen31/sys/i386/include/xen/hypervisor.h#7 (text+ko) ==== @@ -12,8 +12,10 @@ #define is_running_on_xen() 1 #ifdef PAE +#ifndef CONFIG_X86_PAE #define CONFIG_X86_PAE #endif +#endif #include #include @@ -22,6 +24,7 @@ #include #include #include +#include #include #if defined(__amd64__) @@ -55,7 +58,11 @@ { int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL); - return rc; +#if CONFIG_XEN_COMPAT <= 0x030002 + if (rc == -ENOXENSYS) + rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0); +#endif + return (rc); } static inline int @@ -64,18 +71,25 @@ { int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL); - return rc; +#if CONFIG_XEN_COMPAT <= 0x030002 + if (rc == -ENOXENSYS) + rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0); +#endif + return (rc); } -static inline int +static inline void HYPERVISOR_shutdown(unsigned int reason) { struct sched_shutdown sched_shutdown = { .reason = reason }; - return HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown); + HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown); +#if CONFIG_XEN_COMPAT <= 0x030002 + HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason); +#endif } static inline void @@ -92,13 +106,19 @@ HYPERVISOR_poll( evtchn_port_t *ports, unsigned int nr_ports, int ticks) { + int rc; struct sched_poll sched_poll = { .nr_ports = nr_ports, .timeout = get_system_time(ticks) }; set_xen_guest_handle(sched_poll.ports, ports); - return HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll); + rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll); +#if CONFIG_XEN_COMPAT <= 0x030002 + if (rc == -ENOXENSYS) + rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0); +#endif + return (rc); } static inline void