From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ling, Xiaofeng" Subject: [PATCH] fix kbd issue on 2.6 kernel in vmx guest. Date: Tue, 15 Nov 2005 13:06:37 +0800 Message-ID: <43796CDD.7050701@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050802020604090208020903" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------050802020604090208020903 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit This patch fixed keyboard issue for linux kernel 2.6 in vmx guest. linux 2.6 kernel keyboard use a timer to poll the kbd state,in virtualization environment,the kbd interrupt injection is very likely to happend just after kbd state query in the kbd timer and thus will reverse sequence of scan code. Also fix env->send_event SMP issue. Signed-off-by: Xiaofeng Ling Signed-off-by: Edwin Zhai Signed-off-by: Eddion Dong Signed-off-by: Asit Mallick diff -r 090e44133d40 tools/ioemu/target-i386-dm/helper2.c --- a/tools/ioemu/target-i386-dm/helper2.c Mon Nov 14 18:13:38 2005 +0100 +++ b/tools/ioemu/target-i386-dm/helper2.c Tue Nov 15 12:53:12 2005 +0800 @@ -416,6 +416,7 @@ FD_ZERO(&wakeup_rfds); FD_SET(evtchn_fd, &wakeup_rfds); highest_fds = evtchn_fd; + env->send_event = 0 while (1) { if (vm_running) { if (shutdown_requested) { @@ -431,7 +432,6 @@ tv.tv_sec = 0; tv.tv_usec = 100000; - env->send_event = 0; retval = select(highest_fds+1, &wakeup_rfds, NULL, NULL, &tv); if (retval == -1) { perror("select"); @@ -447,12 +447,13 @@ #define ULONGLONG_MAX ULONG_MAX #endif - main_loop_wait(0); tun_receive_handler(&rfds); if ( FD_ISSET(evtchn_fd, &rfds) ) { cpu_handle_ioreq(env); } + main_loop_wait(0); if (env->send_event) { + env->send_event = 0; struct ioctl_evtchn_notify notify; notify.port = ioreq_local_port; (void)ioctl(evtchn_fd, IOCTL_EVTCHN_NOTIFY, ¬ify); --------------050802020604090208020903 Content-Type: text/x-patch; name="kbdfix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="kbdfix.patch" # HG changeset patch # User Xiaofeng Ling # Node ID 23df47d825f17e22f7af0deea53d9423d1717731 # Parent 090e44133d40247bc3ccbb565b644d02fdac6829 This patch fixed keyboard issue for linux kernel 2.6 in vmx guest. linux 2.6 kernel keyboard use a timer to poll the kbd state,in virtualization environment,the kbd interrupt injection is very likely to happend just after kbd state query in the kbd timer and thus will reverse sequence of scan code. Also fix env->send_event SMP issue. Signed-off-by: Xiaofeng Ling Signed-off-by: Edwin Zhai Signed-off-by: Eddion Dong Signed-off-by: Asit Mallick diff -r 090e44133d40 tools/ioemu/target-i386-dm/helper2.c --- a/tools/ioemu/target-i386-dm/helper2.c Mon Nov 14 18:13:38 2005 +0100 +++ b/tools/ioemu/target-i386-dm/helper2.c Tue Nov 15 12:53:12 2005 +0800 @@ -416,6 +416,7 @@ FD_ZERO(&wakeup_rfds); FD_SET(evtchn_fd, &wakeup_rfds); highest_fds = evtchn_fd; + env->send_event = 0 while (1) { if (vm_running) { if (shutdown_requested) { @@ -431,7 +432,6 @@ tv.tv_sec = 0; tv.tv_usec = 100000; - env->send_event = 0; retval = select(highest_fds+1, &wakeup_rfds, NULL, NULL, &tv); if (retval == -1) { perror("select"); @@ -447,12 +447,13 @@ #define ULONGLONG_MAX ULONG_MAX #endif - main_loop_wait(0); tun_receive_handler(&rfds); if ( FD_ISSET(evtchn_fd, &rfds) ) { cpu_handle_ioreq(env); } + main_loop_wait(0); if (env->send_event) { + env->send_event = 0; struct ioctl_evtchn_notify notify; notify.port = ioreq_local_port; (void)ioctl(evtchn_fd, IOCTL_EVTCHN_NOTIFY, ¬ify); --------------050802020604090208020903 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.xensource.com http://lists.xensource.com/xen-devel --------------050802020604090208020903--