All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Mayer" <l_indien@magic.fr>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Cuda device fixes
Date: Mon, 18 Apr 2005 10:36:47 +0200	[thread overview]
Message-ID: <1113813408.11980.95.camel@rapid> (raw)

[-- Attachment #1: Type: text/plain, Size: 218 bytes --]

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 <l_indien@magic.fr>
Never organized

[-- Attachment #2: ppc_cuda.diff --]
[-- Type: text/x-patch, Size: 1642 bytes --]

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:

                 reply	other threads:[~2005-04-18  8:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1113813408.11980.95.camel@rapid \
    --to=l_indien@magic.fr \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.