From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DNRqS-0007vU-So for qemu-devel@nongnu.org; Mon, 18 Apr 2005 04:43:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DNRp2-0007sz-TB for qemu-devel@nongnu.org; Mon, 18 Apr 2005 04:41:42 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DNRkr-0007Vw-Ga for qemu-devel@nongnu.org; Mon, 18 Apr 2005 04:37:19 -0400 Received: from [62.210.158.45] (helo=quito.magic.fr) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DNRls-00016T-5Z for qemu-devel@nongnu.org; Mon, 18 Apr 2005 04:38:20 -0400 From: "J. Mayer" Content-Type: multipart/mixed; boundary="=-mlpwuCwgxOAoHkpZuEIv" Date: Mon, 18 Apr 2005 10:36:47 +0200 Message-Id: <1113813408.11980.95.camel@rapid> Mime-Version: 1.0 Subject: [Qemu-devel] Cuda device fixes Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --=-mlpwuCwgxOAoHkpZuEIv Content-Type: text/plain Content-Transfer-Encoding: 7bit This patch fixes two bugs in cuda emulation: - the CUDA timer is always triggered twice, with current code - SET_TIME command is supposed to send back a 7 bytes packet -- J. Mayer Never organized --=-mlpwuCwgxOAoHkpZuEIv Content-Disposition: attachment; filename=ppc_cuda.diff Content-Type: text/x-patch; name=ppc_cuda.diff; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Index: hw/cuda.c =================================================================== RCS file: /cvsroot/qemu/qemu/hw/cuda.c,v retrieving revision 1.6 diff -u -d -w -B -b -d -p -r1.6 cuda.c --- hw/cuda.c 9 Feb 2005 00:07:08 -0000 1.6 +++ hw/cuda.c 18 Apr 2005 07:59:38 -0000 @@ -178,17 +178,20 @@ static int64_t get_next_irq_time(CUDATim /* current counter value */ d = muldiv64(current_time - s->load_time, CUDA_TIMER_FREQ, ticks_per_sec); - if (d <= s->counter_value) { + if (d < s->counter_value) { next_time = s->counter_value + 1; - } else { - base = ((d - s->counter_value) / s->latch); + } else + { + base = ((d - s->counter_value + 1) / s->latch); base = (base * s->latch) + s->counter_value; next_time = base + s->latch; } +#if 0 #ifdef DEBUG_CUDA printf("latch=%d counter=%lld delta_next=%lld\n", s->latch, d, next_time - d); #endif +#endif next_time = muldiv64(next_time, ticks_per_sec, CUDA_TIMER_FREQ) + s->load_time; if (next_time <= current_time) @@ -505,6 +508,7 @@ static void cuda_receive_packet(CUDAStat cuda_send_packet_to_host(s, obuf, 2); break; case CUDA_GET_TIME: + case CUDA_SET_TIME: /* XXX: add time support ? */ ti = time(NULL) + RTC_OFFSET; obuf[0] = CUDA_PACKET; @@ -516,7 +520,6 @@ static void cuda_receive_packet(CUDAStat obuf[6] = ti; cuda_send_packet_to_host(s, obuf, 7); break; - case CUDA_SET_TIME: case CUDA_FILE_SERVER_FLAG: case CUDA_SET_DEVICE_LIST: case CUDA_SET_AUTO_RATE: --=-mlpwuCwgxOAoHkpZuEIv--