qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups
@ 2016-01-23 20:39 Hervé Poussineau
  2016-01-23 20:39 ` [Qemu-devel] [PATCH 01/13] cuda: add a framework to handle commands Hervé Poussineau
                   ` (16 more replies)
  0 siblings, 17 replies; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-23 20:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mark Cave-Ayland, Alexander Graf, Alyssa Milburn,
	Hervé Poussineau, qemu-ppc, David Gibson

Hi,

This patchset cleans up a little bit the Apple CUDA emulation:
- correctly reject unknown commands
- correctly reject commands with wrong parameters
- support changing the frequency of auto-polling
- support changing device list probed in auto-poll
- add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
- remove unused commands (GET/SET_6805_ADDR)
- remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC

GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once
we implement the I2C bus provided by CUDA.

This also fixes MacBugs hanging at startup in the absence of
ADB mouse input.

Hervé

Hervé Poussineau (13):
  cuda: add a framework to handle commands
  cuda: reject unknown commands
  cuda: port AUTOPOLL command to new framework
  cuda: port SET_AUTO_RATE command to new framework
  cuda: port SET_DEVICE_LIST command to new framework
  cuda: port POWERDOWN command to new framework
  cuda: port RESET_SYSTEM command to new framework
  cuda: port FILE_SERVER_FLAG command to new framework
  cuda: port SET_POWER_MESSAGES command to new framework
  cuda: port GET_TIME command to new framework
  cuda: port SET_TIME command to new framework
  cuda: remove GET_6805_ADDR command
  cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands

 hw/input/adb.c         |  18 ++--
 hw/misc/macio/cuda.c   | 268 ++++++++++++++++++++++++++++++++++++-------------
 hw/ppc/mac.h           |   2 +
 include/hw/input/adb.h |   2 +-
 roms/SLOF              |   2 +-
 roms/openbios          |   2 +-
 6 files changed, 215 insertions(+), 79 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [Qemu-devel] [PATCH 01/13] cuda: add a framework to handle commands
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
@ 2016-01-23 20:39 ` Hervé Poussineau
  2016-01-24 23:10   ` David Gibson
  2016-01-23 20:39 ` [Qemu-devel] [PATCH 02/13] cuda: reject unknown commands Hervé Poussineau
                   ` (15 subsequent siblings)
  16 siblings, 1 reply; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-23 20:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mark Cave-Ayland, Alexander Graf, Alyssa Milburn,
	Hervé Poussineau, qemu-ppc, David Gibson

Next commits will port existing CUDA commands to this framework.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 9db4c64..69f69c2 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -534,13 +534,47 @@ static void cuda_adb_poll(void *opaque)
                    (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
 }
 
+/* description of commands */
+typedef struct CudaCommand {
+    uint8_t command;
+    const char *name;
+    bool (*handler)(CUDAState *s,
+                    const uint8_t *in_args, int in_len,
+                    uint8_t *out_args, int *out_len);
+} CudaCommand;
+
+static const CudaCommand handlers[] = {
+};
+
 static void cuda_receive_packet(CUDAState *s,
                                 const uint8_t *data, int len)
 {
     uint8_t obuf[16] = { CUDA_PACKET, 0, data[0] };
     int autopoll;
+    int i, out_len = 0;
     uint32_t ti;
 
+    for (i = 0; i < ARRAY_SIZE(handlers); i++) {
+        const CudaCommand *desc = &handlers[i];
+        if (desc->command == data[0]) {
+            CUDA_DPRINTF("handling command %s\n", desc->name);
+            out_len = 0;
+            if (desc->handler(s, data + 1, len - 1, obuf + 3, &out_len)) {
+                cuda_send_packet_to_host(s, obuf, 3 + out_len);
+            } else {
+                qemu_log_mask(LOG_GUEST_ERROR,
+                              "CUDA: %s: wrong parameters %d\n",
+                              desc->name, len);
+                obuf[0] = ERROR_PACKET;
+                obuf[1] = 0x5; /* bad parameters */
+                obuf[2] = CUDA_PACKET;
+                obuf[3] = data[0];
+                cuda_send_packet_to_host(s, obuf, 4);
+            }
+            return;
+        }
+    }
+
     switch(data[0]) {
     case CUDA_AUTOPOLL:
         autopoll = (data[1] != 0);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [Qemu-devel] [PATCH 02/13] cuda: reject unknown commands
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
  2016-01-23 20:39 ` [Qemu-devel] [PATCH 01/13] cuda: add a framework to handle commands Hervé Poussineau
@ 2016-01-23 20:39 ` Hervé Poussineau
  2016-01-24 23:12   ` David Gibson
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 03/13] cuda: port AUTOPOLL command to new framework Hervé Poussineau
                   ` (14 subsequent siblings)
  16 siblings, 1 reply; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-23 20:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mark Cave-Ayland, Alexander Graf, Alyssa Milburn,
	Hervé Poussineau, qemu-ppc, David Gibson

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 69f69c2..f27dd19 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -589,15 +589,15 @@ static void cuda_receive_packet(CUDAState *s,
             }
         }
         cuda_send_packet_to_host(s, obuf, 3);
-        break;
+        return;
     case CUDA_GET_6805_ADDR:
         cuda_send_packet_to_host(s, obuf, 3);
-        break;
+        return;
     case CUDA_SET_TIME:
         ti = (((uint32_t)data[1]) << 24) + (((uint32_t)data[2]) << 16) + (((uint32_t)data[3]) << 8) + data[4];
         s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / get_ticks_per_sec());
         cuda_send_packet_to_host(s, obuf, 3);
-        break;
+        return;
     case CUDA_GET_TIME:
         ti = s->tick_offset + (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / get_ticks_per_sec());
         obuf[3] = ti >> 24;
@@ -605,28 +605,28 @@ static void cuda_receive_packet(CUDAState *s,
         obuf[5] = ti >> 8;
         obuf[6] = ti;
         cuda_send_packet_to_host(s, obuf, 7);
-        break;
+        return;
     case CUDA_FILE_SERVER_FLAG:
     case CUDA_SET_DEVICE_LIST:
     case CUDA_SET_AUTO_RATE:
     case CUDA_SET_POWER_MESSAGES:
         cuda_send_packet_to_host(s, obuf, 3);
-        break;
+        return;
     case CUDA_POWERDOWN:
         cuda_send_packet_to_host(s, obuf, 3);
         qemu_system_shutdown_request();
-        break;
+        return;
     case CUDA_RESET_SYSTEM:
         cuda_send_packet_to_host(s, obuf, 3);
         qemu_system_reset_request();
-        break;
+        return;
     case CUDA_COMBINED_FORMAT_IIC:
         obuf[0] = ERROR_PACKET;
         obuf[1] = 0x5;
         obuf[2] = CUDA_PACKET;
         obuf[3] = data[0];
         cuda_send_packet_to_host(s, obuf, 4);
-        break;
+        return;
     case CUDA_GET_SET_IIC:
         if (len == 4) {
             cuda_send_packet_to_host(s, obuf, 3);
@@ -637,10 +637,17 @@ static void cuda_receive_packet(CUDAState *s,
             obuf[3] = data[0];
             cuda_send_packet_to_host(s, obuf, 4);
         }
-        break;
+        return;
     default:
         break;
     }
+
+    qemu_log_mask(LOG_GUEST_ERROR, "CUDA: unknown command 0x%02x\n", data[0]);
+    obuf[0] = ERROR_PACKET;
+    obuf[1] = 0x2; /* unknown command */
+    obuf[2] = CUDA_PACKET;
+    obuf[3] = data[0];
+    cuda_send_packet_to_host(s, obuf, 4);
 }
 
 static void cuda_receive_packet_from_host(CUDAState *s,
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [Qemu-devel] [PATCH 03/13] cuda: port AUTOPOLL command to new framework
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
  2016-01-23 20:39 ` [Qemu-devel] [PATCH 01/13] cuda: add a framework to handle commands Hervé Poussineau
  2016-01-23 20:39 ` [Qemu-devel] [PATCH 02/13] cuda: reject unknown commands Hervé Poussineau
@ 2016-01-23 20:40 ` Hervé Poussineau
  2016-01-24 23:13   ` David Gibson
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 04/13] cuda: port SET_AUTO_RATE " Hervé Poussineau
                   ` (13 subsequent siblings)
  16 siblings, 1 reply; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-23 20:40 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mark Cave-Ayland, Alexander Graf, Alyssa Milburn,
	Hervé Poussineau, qemu-ppc, David Gibson

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 40 +++++++++++++++++++++++++---------------
 1 file changed, 25 insertions(+), 15 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index f27dd19..37406fc 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -543,14 +543,38 @@ typedef struct CudaCommand {
                     uint8_t *out_args, int *out_len);
 } CudaCommand;
 
+static bool cuda_cmd_autopoll(CUDAState *s,
+                              const uint8_t *in_data, int in_len,
+                              uint8_t *out_data, int *out_len)
+{
+    int autopoll;
+
+    if (in_len != 1) {
+        return false;
+    }
+
+    autopoll = (in_data[0] != 0);
+    if (autopoll != s->autopoll) {
+        s->autopoll = autopoll;
+        if (autopoll) {
+            timer_mod(s->adb_poll_timer,
+                      qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
+                      (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
+        } else {
+            timer_del(s->adb_poll_timer);
+        }
+    }
+    return true;
+}
+
 static const CudaCommand handlers[] = {
+    { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
 };
 
 static void cuda_receive_packet(CUDAState *s,
                                 const uint8_t *data, int len)
 {
     uint8_t obuf[16] = { CUDA_PACKET, 0, data[0] };
-    int autopoll;
     int i, out_len = 0;
     uint32_t ti;
 
@@ -576,20 +600,6 @@ static void cuda_receive_packet(CUDAState *s,
     }
 
     switch(data[0]) {
-    case CUDA_AUTOPOLL:
-        autopoll = (data[1] != 0);
-        if (autopoll != s->autopoll) {
-            s->autopoll = autopoll;
-            if (autopoll) {
-                timer_mod(s->adb_poll_timer,
-                               qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
-                               (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
-            } else {
-                timer_del(s->adb_poll_timer);
-            }
-        }
-        cuda_send_packet_to_host(s, obuf, 3);
-        return;
     case CUDA_GET_6805_ADDR:
         cuda_send_packet_to_host(s, obuf, 3);
         return;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [Qemu-devel] [PATCH 04/13] cuda: port SET_AUTO_RATE command to new framework
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (2 preceding siblings ...)
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 03/13] cuda: port AUTOPOLL command to new framework Hervé Poussineau
@ 2016-01-23 20:40 ` Hervé Poussineau
  2016-01-24 18:33   ` Hervé Poussineau
                     ` (2 more replies)
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 05/13] cuda: port SET_DEVICE_LIST " Hervé Poussineau
                   ` (12 subsequent siblings)
  16 siblings, 3 replies; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-23 20:40 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mark Cave-Ayland, Alexander Graf, Alyssa Milburn,
	Hervé Poussineau, qemu-ppc, David Gibson

Take requested autopoll rate into account

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 31 +++++++++++++++++++++++++++----
 hw/ppc/mac.h         |  1 +
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 37406fc..9ec642f 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -105,7 +105,6 @@
 #define CUDA_COMBINED_FORMAT_IIC	0x25
 
 #define CUDA_TIMER_FREQ (4700000 / 6)
-#define CUDA_ADB_POLL_FREQ 50
 
 /* CUDA returns time_t's offset from Jan 1, 1904, not 1970 */
 #define RTC_OFFSET                      2082844800
@@ -531,7 +530,7 @@ static void cuda_adb_poll(void *opaque)
     }
     timer_mod(s->adb_poll_timer,
                    qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
-                   (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
+                   (get_ticks_per_sec() / (1000 / s->auto_rate_ms)));
 }
 
 /* description of commands */
@@ -559,7 +558,7 @@ static bool cuda_cmd_autopoll(CUDAState *s,
         if (autopoll) {
             timer_mod(s->adb_poll_timer,
                       qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
-                      (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
+                      (get_ticks_per_sec() / (1000 / s->auto_rate_ms)));
         } else {
             timer_del(s->adb_poll_timer);
         }
@@ -567,8 +566,32 @@ static bool cuda_cmd_autopoll(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_set_autorate(CUDAState *s,
+                                  const uint8_t *in_data, int in_len,
+                                  uint8_t *out_data, int *out_len)
+{
+    if (in_len != 1) {
+        return false;
+    }
+
+    /* we don't want a period of 0 ms */
+    /* FIXME: check what real hardware does */
+    if (in_data[0] == 0) {
+        return;
+    }
+
+    s->auto_rate_ms = in_data[0];
+    if (s->autopoll) {
+        timer_mod(s->adb_poll_timer,
+                  qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
+                  (get_ticks_per_sec() / (1000 / s->auto_rate_ms)));
+    }
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
+    { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -618,7 +641,6 @@ static void cuda_receive_packet(CUDAState *s,
         return;
     case CUDA_FILE_SERVER_FLAG:
     case CUDA_SET_DEVICE_LIST:
-    case CUDA_SET_AUTO_RATE:
     case CUDA_SET_POWER_MESSAGES:
         cuda_send_packet_to_host(s, obuf, 3);
         return;
@@ -824,6 +846,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp)
     s->tick_offset = (uint32_t)mktimegm(&tm) + RTC_OFFSET;
 
     s->adb_poll_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_adb_poll, s);
+    s->auto_rate_ms = 20;
 }
 
 static void cuda_initfn(Object *obj)
diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
index e375ed2..90fcb69 100644
--- a/hw/ppc/mac.h
+++ b/hw/ppc/mac.h
@@ -111,6 +111,7 @@ typedef struct CUDAState {
     int data_out_index;
 
     qemu_irq irq;
+    uint8_t auto_rate_ms;
     uint8_t autopoll;
     uint8_t data_in[128];
     uint8_t data_out[16];
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [Qemu-devel] [PATCH 05/13] cuda: port SET_DEVICE_LIST command to new framework
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (3 preceding siblings ...)
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 04/13] cuda: port SET_AUTO_RATE " Hervé Poussineau
@ 2016-01-23 20:40 ` Hervé Poussineau
  2016-01-24 23:23   ` David Gibson
  2016-02-07 19:35   ` Mark Cave-Ayland
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 06/13] cuda: port POWERDOWN " Hervé Poussineau
                   ` (11 subsequent siblings)
  16 siblings, 2 replies; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-23 20:40 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mark Cave-Ayland, Alexander Graf, Alyssa Milburn,
	Hervé Poussineau, qemu-ppc, David Gibson

Take device list mask into account when polling ADB devices.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/input/adb.c         | 18 ++++++++++--------
 hw/misc/macio/cuda.c   | 17 +++++++++++++++--
 hw/ppc/mac.h           |  1 +
 include/hw/input/adb.h |  2 +-
 roms/SLOF              |  2 +-
 roms/openbios          |  2 +-
 6 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/hw/input/adb.c b/hw/input/adb.c
index 09eead9..d05fdfd 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -88,7 +88,7 @@ int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len)
 }
 
 /* XXX: move that to cuda ? */
-int adb_poll(ADBBusState *s, uint8_t *obuf)
+int adb_poll(ADBBusState *s, uint8_t *obuf, uint16_t poll_mask)
 {
     ADBDevice *d;
     int olen, i;
@@ -99,13 +99,15 @@ int adb_poll(ADBBusState *s, uint8_t *obuf)
         if (s->poll_index >= s->nb_devices)
             s->poll_index = 0;
         d = s->devices[s->poll_index];
-        buf[0] = ADB_READREG | (d->devaddr << 4);
-        olen = adb_request(s, obuf + 1, buf, 1);
-        /* if there is data, we poll again the same device */
-        if (olen > 0) {
-            obuf[0] = buf[0];
-            olen++;
-            break;
+        if ((1 << d->devaddr) & poll_mask) {
+            buf[0] = ADB_READREG | (d->devaddr << 4);
+            olen = adb_request(s, obuf + 1, buf, 1);
+            /* if there is data, we poll again the same device */
+            if (olen > 0) {
+                obuf[0] = buf[0];
+                olen++;
+                break;
+            }
         }
         s->poll_index++;
     }
diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 9ec642f..9af8e1d 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -522,7 +522,7 @@ static void cuda_adb_poll(void *opaque)
     uint8_t obuf[ADB_MAX_OUT_LEN + 2];
     int olen;
 
-    olen = adb_poll(&s->adb_bus, obuf + 2);
+    olen = adb_poll(&s->adb_bus, obuf + 2, s->poll_mask);
     if (olen > 0) {
         obuf[0] = ADB_PACKET;
         obuf[1] = 0x40; /* polled data */
@@ -589,9 +589,22 @@ static bool cuda_cmd_set_autorate(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_set_device_list(CUDAState *s,
+                                     const uint8_t *in_data, int in_len,
+                                     uint8_t *out_data, int *out_len)
+{
+    if (in_len != 2) {
+        return false;
+    }
+
+    s->poll_mask = (((uint16_t)in_data[0]) << 8) | in_data[1];
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
     { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
+    { CUDA_SET_DEVICE_LIST, "SET_DEVICE_LIST", cuda_cmd_set_device_list },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -640,7 +653,6 @@ static void cuda_receive_packet(CUDAState *s,
         cuda_send_packet_to_host(s, obuf, 7);
         return;
     case CUDA_FILE_SERVER_FLAG:
-    case CUDA_SET_DEVICE_LIST:
     case CUDA_SET_POWER_MESSAGES:
         cuda_send_packet_to_host(s, obuf, 3);
         return;
@@ -847,6 +859,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp)
 
     s->adb_poll_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_adb_poll, s);
     s->auto_rate_ms = 20;
+    s->poll_mask = 0xffff;
 }
 
 static void cuda_initfn(Object *obj)
diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
index 90fcb69..506f7a8 100644
--- a/hw/ppc/mac.h
+++ b/hw/ppc/mac.h
@@ -111,6 +111,7 @@ typedef struct CUDAState {
     int data_out_index;
 
     qemu_irq irq;
+    uint16_t poll_mask;
     uint8_t auto_rate_ms;
     uint8_t autopoll;
     uint8_t data_in[128];
diff --git a/include/hw/input/adb.h b/include/hw/input/adb.h
index bdfccd4..db51d03 100644
--- a/include/hw/input/adb.h
+++ b/include/hw/input/adb.h
@@ -79,7 +79,7 @@ struct ADBBusState {
 
 int adb_request(ADBBusState *s, uint8_t *buf_out,
                 const uint8_t *buf, int len);
-int adb_poll(ADBBusState *s, uint8_t *buf_out);
+int adb_poll(ADBBusState *s, uint8_t *buf_out, uint16_t poll_mask);
 
 #define TYPE_ADB_KEYBOARD "adb-keyboard"
 #define TYPE_ADB_MOUSE "adb-mouse"
diff --git a/roms/SLOF b/roms/SLOF
index b4c9380..811277a 160000
--- a/roms/SLOF
+++ b/roms/SLOF
@@ -1 +1 @@
-Subproject commit b4c93802a5b2c72f096649c497ec9ff5708e4456
+Subproject commit 811277ac91f674a9273e2b529791e9b75350f3e8
diff --git a/roms/openbios b/roms/openbios
index 3caee17..18f02b1 160000
--- a/roms/openbios
+++ b/roms/openbios
@@ -1 +1 @@
-Subproject commit 3caee1794ac3f742315823d8447d21f33ce019e9
+Subproject commit 18f02b14de795c1aab4fe23c1810bfd0944da6aa
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [Qemu-devel] [PATCH 06/13] cuda: port POWERDOWN command to new framework
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (4 preceding siblings ...)
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 05/13] cuda: port SET_DEVICE_LIST " Hervé Poussineau
@ 2016-01-23 20:40 ` Hervé Poussineau
  2016-01-24 23:24   ` David Gibson
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 07/13] cuda: port RESET_SYSTEM " Hervé Poussineau
                   ` (10 subsequent siblings)
  16 siblings, 1 reply; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-23 20:40 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mark Cave-Ayland, Alexander Graf, Alyssa Milburn,
	Hervé Poussineau, qemu-ppc, David Gibson

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 9af8e1d..df4797f 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -601,10 +601,23 @@ static bool cuda_cmd_set_device_list(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_powerdown(CUDAState *s,
+                               const uint8_t *in_data, int in_len,
+                               uint8_t *out_data, int *out_len)
+{
+    if (in_len != 0) {
+        return false;
+    }
+
+    qemu_system_shutdown_request();
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
     { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
     { CUDA_SET_DEVICE_LIST, "SET_DEVICE_LIST", cuda_cmd_set_device_list },
+    { CUDA_POWERDOWN, "POWERDOWN", cuda_cmd_powerdown },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -656,10 +669,6 @@ static void cuda_receive_packet(CUDAState *s,
     case CUDA_SET_POWER_MESSAGES:
         cuda_send_packet_to_host(s, obuf, 3);
         return;
-    case CUDA_POWERDOWN:
-        cuda_send_packet_to_host(s, obuf, 3);
-        qemu_system_shutdown_request();
-        return;
     case CUDA_RESET_SYSTEM:
         cuda_send_packet_to_host(s, obuf, 3);
         qemu_system_reset_request();
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [Qemu-devel] [PATCH 07/13] cuda: port RESET_SYSTEM command to new framework
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (5 preceding siblings ...)
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 06/13] cuda: port POWERDOWN " Hervé Poussineau
@ 2016-01-23 20:40 ` Hervé Poussineau
  2016-01-24 23:24   ` David Gibson
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 08/13] cuda: port FILE_SERVER_FLAG " Hervé Poussineau
                   ` (9 subsequent siblings)
  16 siblings, 1 reply; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-23 20:40 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mark Cave-Ayland, Alexander Graf, Alyssa Milburn,
	Hervé Poussineau, qemu-ppc, David Gibson

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index df4797f..70a5d0c 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -613,11 +613,24 @@ static bool cuda_cmd_powerdown(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_reset_system(CUDAState *s,
+                                  const uint8_t *in_data, int in_len,
+                                  uint8_t *out_data, int *out_len)
+{
+    if (in_len != 0) {
+        return false;
+    }
+
+    qemu_system_reset_request();
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
     { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
     { CUDA_SET_DEVICE_LIST, "SET_DEVICE_LIST", cuda_cmd_set_device_list },
     { CUDA_POWERDOWN, "POWERDOWN", cuda_cmd_powerdown },
+    { CUDA_RESET_SYSTEM, "RESET_SYSTEM", cuda_cmd_reset_system },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -669,10 +682,6 @@ static void cuda_receive_packet(CUDAState *s,
     case CUDA_SET_POWER_MESSAGES:
         cuda_send_packet_to_host(s, obuf, 3);
         return;
-    case CUDA_RESET_SYSTEM:
-        cuda_send_packet_to_host(s, obuf, 3);
-        qemu_system_reset_request();
-        return;
     case CUDA_COMBINED_FORMAT_IIC:
         obuf[0] = ERROR_PACKET;
         obuf[1] = 0x5;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [Qemu-devel] [PATCH 08/13] cuda: port FILE_SERVER_FLAG command to new framework
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (6 preceding siblings ...)
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 07/13] cuda: port RESET_SYSTEM " Hervé Poussineau
@ 2016-01-23 20:40 ` Hervé Poussineau
  2016-01-24 23:25   ` David Gibson
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 09/13] cuda: port SET_POWER_MESSAGES " Hervé Poussineau
                   ` (8 subsequent siblings)
  16 siblings, 1 reply; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-23 20:40 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mark Cave-Ayland, Alexander Graf, Alyssa Milburn,
	Hervé Poussineau, qemu-ppc, David Gibson

This command tells if computer should automatically wake-up after a power loss.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 70a5d0c..294e8fb 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -625,12 +625,28 @@ static bool cuda_cmd_reset_system(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_set_file_server_flag(CUDAState *s,
+                                          const uint8_t *in_data, int in_len,
+                                          uint8_t *out_data, int *out_len)
+{
+    if (in_len != 1) {
+        return false;
+    }
+
+    qemu_log_mask(LOG_UNIMP,
+                  "CUDA: unimplemented command FILE_SERVER_FLAG %d\n",
+                  in_data[0]);
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
     { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
     { CUDA_SET_DEVICE_LIST, "SET_DEVICE_LIST", cuda_cmd_set_device_list },
     { CUDA_POWERDOWN, "POWERDOWN", cuda_cmd_powerdown },
     { CUDA_RESET_SYSTEM, "RESET_SYSTEM", cuda_cmd_reset_system },
+    { CUDA_FILE_SERVER_FLAG, "FILE_SERVER_FLAG",
+      cuda_cmd_set_file_server_flag },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -678,7 +694,6 @@ static void cuda_receive_packet(CUDAState *s,
         obuf[6] = ti;
         cuda_send_packet_to_host(s, obuf, 7);
         return;
-    case CUDA_FILE_SERVER_FLAG:
     case CUDA_SET_POWER_MESSAGES:
         cuda_send_packet_to_host(s, obuf, 3);
         return;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [Qemu-devel] [PATCH 09/13] cuda: port SET_POWER_MESSAGES command to new framework
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (7 preceding siblings ...)
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 08/13] cuda: port FILE_SERVER_FLAG " Hervé Poussineau
@ 2016-01-23 20:40 ` Hervé Poussineau
  2016-01-24 23:26   ` David Gibson
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 10/13] cuda: port GET_TIME " Hervé Poussineau
                   ` (7 subsequent siblings)
  16 siblings, 1 reply; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-23 20:40 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mark Cave-Ayland, Alexander Graf, Alyssa Milburn,
	Hervé Poussineau, qemu-ppc, David Gibson

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 294e8fb..64a3e79 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -639,6 +639,20 @@ static bool cuda_cmd_set_file_server_flag(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_set_power_message(CUDAState *s,
+                                       const uint8_t *in_data, int in_len,
+                                       uint8_t *out_data, int *out_len)
+{
+    if (in_len != 1) {
+        return false;
+    }
+
+    qemu_log_mask(LOG_UNIMP,
+                  "CUDA: unimplemented command SET_POWER_MESSAGE %d\n",
+                  in_data[0]);
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
     { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
@@ -647,6 +661,8 @@ static const CudaCommand handlers[] = {
     { CUDA_RESET_SYSTEM, "RESET_SYSTEM", cuda_cmd_reset_system },
     { CUDA_FILE_SERVER_FLAG, "FILE_SERVER_FLAG",
       cuda_cmd_set_file_server_flag },
+    { CUDA_SET_POWER_MESSAGES, "SET_POWER_MESSAGES",
+      cuda_cmd_set_power_message },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -694,9 +710,6 @@ static void cuda_receive_packet(CUDAState *s,
         obuf[6] = ti;
         cuda_send_packet_to_host(s, obuf, 7);
         return;
-    case CUDA_SET_POWER_MESSAGES:
-        cuda_send_packet_to_host(s, obuf, 3);
-        return;
     case CUDA_COMBINED_FORMAT_IIC:
         obuf[0] = ERROR_PACKET;
         obuf[1] = 0x5;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [Qemu-devel] [PATCH 10/13] cuda: port GET_TIME command to new framework
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (8 preceding siblings ...)
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 09/13] cuda: port SET_POWER_MESSAGES " Hervé Poussineau
@ 2016-01-23 20:40 ` Hervé Poussineau
  2016-01-24 23:27   ` David Gibson
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 11/13] cuda: port SET_TIME " Hervé Poussineau
                   ` (6 subsequent siblings)
  16 siblings, 1 reply; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-23 20:40 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mark Cave-Ayland, Alexander Graf, Alyssa Milburn,
	Hervé Poussineau, qemu-ppc, David Gibson

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 64a3e79..55e9cff 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -653,6 +653,26 @@ static bool cuda_cmd_set_power_message(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_get_time(CUDAState *s,
+                              const uint8_t *in_data, int in_len,
+                              uint8_t *out_data, int *out_len)
+{
+    uint32_t ti;
+
+    if (in_len != 0) {
+        return false;
+    }
+
+    ti = s->tick_offset + (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)
+                           / get_ticks_per_sec());
+    out_data[0] = ti >> 24;
+    out_data[1] = ti >> 16;
+    out_data[2] = ti >> 8;
+    out_data[3] = ti;
+    *out_len = 4;
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
     { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
@@ -663,6 +683,7 @@ static const CudaCommand handlers[] = {
       cuda_cmd_set_file_server_flag },
     { CUDA_SET_POWER_MESSAGES, "SET_POWER_MESSAGES",
       cuda_cmd_set_power_message },
+    { CUDA_GET_TIME, "GET_TIME", cuda_cmd_get_time },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -702,14 +723,6 @@ static void cuda_receive_packet(CUDAState *s,
         s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / get_ticks_per_sec());
         cuda_send_packet_to_host(s, obuf, 3);
         return;
-    case CUDA_GET_TIME:
-        ti = s->tick_offset + (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / get_ticks_per_sec());
-        obuf[3] = ti >> 24;
-        obuf[4] = ti >> 16;
-        obuf[5] = ti >> 8;
-        obuf[6] = ti;
-        cuda_send_packet_to_host(s, obuf, 7);
-        return;
     case CUDA_COMBINED_FORMAT_IIC:
         obuf[0] = ERROR_PACKET;
         obuf[1] = 0x5;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [Qemu-devel] [PATCH 11/13] cuda: port SET_TIME command to new framework
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (9 preceding siblings ...)
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 10/13] cuda: port GET_TIME " Hervé Poussineau
@ 2016-01-23 20:40 ` Hervé Poussineau
  2016-01-24 23:27   ` David Gibson
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 12/13] cuda: remove GET_6805_ADDR command Hervé Poussineau
                   ` (5 subsequent siblings)
  16 siblings, 1 reply; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-23 20:40 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mark Cave-Ayland, Alexander Graf, Alyssa Milburn,
	Hervé Poussineau, qemu-ppc, David Gibson

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 55e9cff..49a79fc 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -673,6 +673,23 @@ static bool cuda_cmd_get_time(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_set_time(CUDAState *s,
+                              const uint8_t *in_data, int in_len,
+                              uint8_t *out_data, int *out_len)
+{
+    uint32_t ti;
+
+    if (in_len != 4) {
+        return false;
+    }
+
+    ti = (((uint32_t)in_data[1]) << 24) + (((uint32_t)in_data[2]) << 16)
+         + (((uint32_t)in_data[3]) << 8) + in_data[4];
+    s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)
+                           / get_ticks_per_sec());
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
     { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
@@ -684,6 +701,7 @@ static const CudaCommand handlers[] = {
     { CUDA_SET_POWER_MESSAGES, "SET_POWER_MESSAGES",
       cuda_cmd_set_power_message },
     { CUDA_GET_TIME, "GET_TIME", cuda_cmd_get_time },
+    { CUDA_SET_TIME, "SET_TIME", cuda_cmd_set_time },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -691,7 +709,6 @@ static void cuda_receive_packet(CUDAState *s,
 {
     uint8_t obuf[16] = { CUDA_PACKET, 0, data[0] };
     int i, out_len = 0;
-    uint32_t ti;
 
     for (i = 0; i < ARRAY_SIZE(handlers); i++) {
         const CudaCommand *desc = &handlers[i];
@@ -718,11 +735,6 @@ static void cuda_receive_packet(CUDAState *s,
     case CUDA_GET_6805_ADDR:
         cuda_send_packet_to_host(s, obuf, 3);
         return;
-    case CUDA_SET_TIME:
-        ti = (((uint32_t)data[1]) << 24) + (((uint32_t)data[2]) << 16) + (((uint32_t)data[3]) << 8) + data[4];
-        s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / get_ticks_per_sec());
-        cuda_send_packet_to_host(s, obuf, 3);
-        return;
     case CUDA_COMBINED_FORMAT_IIC:
         obuf[0] = ERROR_PACKET;
         obuf[1] = 0x5;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [Qemu-devel] [PATCH 12/13] cuda: remove GET_6805_ADDR command
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (10 preceding siblings ...)
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 11/13] cuda: port SET_TIME " Hervé Poussineau
@ 2016-01-23 20:40 ` Hervé Poussineau
  2016-01-25  8:35   ` Alyssa Milburn
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 13/13] cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands Hervé Poussineau
                   ` (4 subsequent siblings)
  16 siblings, 1 reply; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-23 20:40 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mark Cave-Ayland, Alexander Graf, Alyssa Milburn,
	Hervé Poussineau, qemu-ppc, David Gibson

It doesn't seem to be used, and operating systems should accept a 'unknown command' answer.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 49a79fc..d1a7ae2 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -732,9 +732,6 @@ static void cuda_receive_packet(CUDAState *s,
     }
 
     switch(data[0]) {
-    case CUDA_GET_6805_ADDR:
-        cuda_send_packet_to_host(s, obuf, 3);
-        return;
     case CUDA_COMBINED_FORMAT_IIC:
         obuf[0] = ERROR_PACKET;
         obuf[1] = 0x5;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [Qemu-devel] [PATCH 13/13] cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (11 preceding siblings ...)
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 12/13] cuda: remove GET_6805_ADDR command Hervé Poussineau
@ 2016-01-23 20:40 ` Hervé Poussineau
  2016-01-25 10:00   ` Alyssa Milburn
  2016-01-24 23:29 ` [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups David Gibson
                   ` (3 subsequent siblings)
  16 siblings, 1 reply; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-23 20:40 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mark Cave-Ayland, Alexander Graf, Alyssa Milburn,
	Hervé Poussineau, qemu-ppc, David Gibson

We currently don't emulate the I2C bus provided by CUDA.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index d1a7ae2..80eea1b 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -731,29 +731,6 @@ static void cuda_receive_packet(CUDAState *s,
         }
     }
 
-    switch(data[0]) {
-    case CUDA_COMBINED_FORMAT_IIC:
-        obuf[0] = ERROR_PACKET;
-        obuf[1] = 0x5;
-        obuf[2] = CUDA_PACKET;
-        obuf[3] = data[0];
-        cuda_send_packet_to_host(s, obuf, 4);
-        return;
-    case CUDA_GET_SET_IIC:
-        if (len == 4) {
-            cuda_send_packet_to_host(s, obuf, 3);
-        } else {
-            obuf[0] = ERROR_PACKET;
-            obuf[1] = 0x2;
-            obuf[2] = CUDA_PACKET;
-            obuf[3] = data[0];
-            cuda_send_packet_to_host(s, obuf, 4);
-        }
-        return;
-    default:
-        break;
-    }
-
     qemu_log_mask(LOG_GUEST_ERROR, "CUDA: unknown command 0x%02x\n", data[0]);
     obuf[0] = ERROR_PACKET;
     obuf[1] = 0x2; /* unknown command */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 04/13] cuda: port SET_AUTO_RATE command to new framework
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 04/13] cuda: port SET_AUTO_RATE " Hervé Poussineau
@ 2016-01-24 18:33   ` Hervé Poussineau
  2016-01-24 23:21   ` David Gibson
  2016-02-07 19:27   ` Mark Cave-Ayland
  2 siblings, 0 replies; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-24 18:33 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, Alexander Graf, David Gibson

Le 23/01/2016 21:40, Hervé Poussineau a écrit :
> Take requested autopoll rate into account
>
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
> ---
>   hw/misc/macio/cuda.c | 31 +++++++++++++++++++++++++++----
>   hw/ppc/mac.h         |  1 +
>   2 files changed, 28 insertions(+), 4 deletions(-)
>
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index 37406fc..9ec642f 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -105,7 +105,6 @@
>   #define CUDA_COMBINED_FORMAT_IIC	0x25
>
>   #define CUDA_TIMER_FREQ (4700000 / 6)
> -#define CUDA_ADB_POLL_FREQ 50
>
>   /* CUDA returns time_t's offset from Jan 1, 1904, not 1970 */
>   #define RTC_OFFSET                      2082844800
> @@ -531,7 +530,7 @@ static void cuda_adb_poll(void *opaque)
>       }
>       timer_mod(s->adb_poll_timer,
>                      qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> -                   (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
> +                   (get_ticks_per_sec() / (1000 / s->auto_rate_ms)));
>   }
>
>   /* description of commands */
> @@ -559,7 +558,7 @@ static bool cuda_cmd_autopoll(CUDAState *s,
>           if (autopoll) {
>               timer_mod(s->adb_poll_timer,
>                         qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> -                      (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
> +                      (get_ticks_per_sec() / (1000 / s->auto_rate_ms)));
>           } else {
>               timer_del(s->adb_poll_timer);
>           }
> @@ -567,8 +566,32 @@ static bool cuda_cmd_autopoll(CUDAState *s,
>       return true;
>   }
>
> +static bool cuda_cmd_set_autorate(CUDAState *s,
> +                                  const uint8_t *in_data, int in_len,
> +                                  uint8_t *out_data, int *out_len)
> +{
> +    if (in_len != 1) {
> +        return false;
> +    }
> +
> +    /* we don't want a period of 0 ms */
> +    /* FIXME: check what real hardware does */
> +    if (in_data[0] == 0) {
> +        return;

This 'return' should be changed into a 'return false'.

> +    }
> +
> +    s->auto_rate_ms = in_data[0];
> +    if (s->autopoll) {
> +        timer_mod(s->adb_poll_timer,
> +                  qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> +                  (get_ticks_per_sec() / (1000 / s->auto_rate_ms)));
> +    }
> +    return true;
> +}
> +
>   static const CudaCommand handlers[] = {
>       { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
> +    { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
>   };
>
>   static void cuda_receive_packet(CUDAState *s,
> @@ -618,7 +641,6 @@ static void cuda_receive_packet(CUDAState *s,
>           return;
>       case CUDA_FILE_SERVER_FLAG:
>       case CUDA_SET_DEVICE_LIST:
> -    case CUDA_SET_AUTO_RATE:
>       case CUDA_SET_POWER_MESSAGES:
>           cuda_send_packet_to_host(s, obuf, 3);
>           return;
> @@ -824,6 +846,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp)
>       s->tick_offset = (uint32_t)mktimegm(&tm) + RTC_OFFSET;
>
>       s->adb_poll_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_adb_poll, s);
> +    s->auto_rate_ms = 20;
>   }
>
>   static void cuda_initfn(Object *obj)
> diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
> index e375ed2..90fcb69 100644
> --- a/hw/ppc/mac.h
> +++ b/hw/ppc/mac.h
> @@ -111,6 +111,7 @@ typedef struct CUDAState {
>       int data_out_index;
>
>       qemu_irq irq;
> +    uint8_t auto_rate_ms;
>       uint8_t autopoll;
>       uint8_t data_in[128];
>       uint8_t data_out[16];
>

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 01/13] cuda: add a framework to handle commands
  2016-01-23 20:39 ` [Qemu-devel] [PATCH 01/13] cuda: add a framework to handle commands Hervé Poussineau
@ 2016-01-24 23:10   ` David Gibson
  0 siblings, 0 replies; 45+ messages in thread
From: David Gibson @ 2016-01-24 23:10 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, qemu-devel, Alexander Graf

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

On Sat, Jan 23, 2016 at 09:39:58PM +0100, Hervé Poussineau wrote:
> Next commits will port existing CUDA commands to this framework.
> 
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/misc/macio/cuda.c | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index 9db4c64..69f69c2 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -534,13 +534,47 @@ static void cuda_adb_poll(void *opaque)
>                     (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
>  }
>  
> +/* description of commands */
> +typedef struct CudaCommand {
> +    uint8_t command;
> +    const char *name;
> +    bool (*handler)(CUDAState *s,
> +                    const uint8_t *in_args, int in_len,
> +                    uint8_t *out_args, int *out_len);
> +} CudaCommand;
> +
> +static const CudaCommand handlers[] = {
> +};
> +
>  static void cuda_receive_packet(CUDAState *s,
>                                  const uint8_t *data, int len)
>  {
>      uint8_t obuf[16] = { CUDA_PACKET, 0, data[0] };
>      int autopoll;
> +    int i, out_len = 0;
>      uint32_t ti;
>  
> +    for (i = 0; i < ARRAY_SIZE(handlers); i++) {
> +        const CudaCommand *desc = &handlers[i];
> +        if (desc->command == data[0]) {
> +            CUDA_DPRINTF("handling command %s\n", desc->name);
> +            out_len = 0;
> +            if (desc->handler(s, data + 1, len - 1, obuf + 3, &out_len)) {
> +                cuda_send_packet_to_host(s, obuf, 3 + out_len);
> +            } else {
> +                qemu_log_mask(LOG_GUEST_ERROR,
> +                              "CUDA: %s: wrong parameters %d\n",
> +                              desc->name, len);
> +                obuf[0] = ERROR_PACKET;
> +                obuf[1] = 0x5; /* bad parameters */
> +                obuf[2] = CUDA_PACKET;
> +                obuf[3] = data[0];
> +                cuda_send_packet_to_host(s, obuf, 4);
> +            }
> +            return;
> +        }
> +    }
> +
>      switch(data[0]) {
>      case CUDA_AUTOPOLL:
>          autopoll = (data[1] != 0);

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 02/13] cuda: reject unknown commands
  2016-01-23 20:39 ` [Qemu-devel] [PATCH 02/13] cuda: reject unknown commands Hervé Poussineau
@ 2016-01-24 23:12   ` David Gibson
  0 siblings, 0 replies; 45+ messages in thread
From: David Gibson @ 2016-01-24 23:12 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, qemu-devel, Alexander Graf

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

On Sat, Jan 23, 2016 at 09:39:59PM +0100, Hervé Poussineau wrote:
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
> ---
>  hw/misc/macio/cuda.c | 25 ++++++++++++++++---------
>  1 file changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index 69f69c2..f27dd19 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -589,15 +589,15 @@ static void cuda_receive_packet(CUDAState *s,
>              }
>          }
>          cuda_send_packet_to_host(s, obuf, 3);
> -        break;
> +        return;
>      case CUDA_GET_6805_ADDR:
>          cuda_send_packet_to_host(s, obuf, 3);
> -        break;
> +        return;
>      case CUDA_SET_TIME:
>          ti = (((uint32_t)data[1]) << 24) + (((uint32_t)data[2]) << 16) + (((uint32_t)data[3]) << 8) + data[4];
>          s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / get_ticks_per_sec());
>          cuda_send_packet_to_host(s, obuf, 3);
> -        break;
> +        return;
>      case CUDA_GET_TIME:
>          ti = s->tick_offset + (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / get_ticks_per_sec());
>          obuf[3] = ti >> 24;
> @@ -605,28 +605,28 @@ static void cuda_receive_packet(CUDAState *s,
>          obuf[5] = ti >> 8;
>          obuf[6] = ti;
>          cuda_send_packet_to_host(s, obuf, 7);
> -        break;
> +        return;
>      case CUDA_FILE_SERVER_FLAG:
>      case CUDA_SET_DEVICE_LIST:
>      case CUDA_SET_AUTO_RATE:
>      case CUDA_SET_POWER_MESSAGES:
>          cuda_send_packet_to_host(s, obuf, 3);
> -        break;
> +        return;
>      case CUDA_POWERDOWN:
>          cuda_send_packet_to_host(s, obuf, 3);
>          qemu_system_shutdown_request();
> -        break;
> +        return;
>      case CUDA_RESET_SYSTEM:
>          cuda_send_packet_to_host(s, obuf, 3);
>          qemu_system_reset_request();
> -        break;
> +        return;
>      case CUDA_COMBINED_FORMAT_IIC:
>          obuf[0] = ERROR_PACKET;
>          obuf[1] = 0x5;
>          obuf[2] = CUDA_PACKET;
>          obuf[3] = data[0];
>          cuda_send_packet_to_host(s, obuf, 4);
> -        break;
> +        return;
>      case CUDA_GET_SET_IIC:
>          if (len == 4) {
>              cuda_send_packet_to_host(s, obuf, 3);
> @@ -637,10 +637,17 @@ static void cuda_receive_packet(CUDAState *s,
>              obuf[3] = data[0];
>              cuda_send_packet_to_host(s, obuf, 4);
>          }
> -        break;
> +        return;
>      default:
>          break;
>      }
> +
> +    qemu_log_mask(LOG_GUEST_ERROR, "CUDA: unknown command 0x%02x\n", data[0]);

AFAICT qemu_log isn't much used these days, and it's not already used
in this file.  I think you'd be better off with either CUDA_DPRINTF()
or a tracepoint.

> +    obuf[0] = ERROR_PACKET;
> +    obuf[1] = 0x2; /* unknown command */
> +    obuf[2] = CUDA_PACKET;
> +    obuf[3] = data[0];
> +    cuda_send_packet_to_host(s, obuf, 4);
>  }
>  
>  static void cuda_receive_packet_from_host(CUDAState *s,

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 03/13] cuda: port AUTOPOLL command to new framework
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 03/13] cuda: port AUTOPOLL command to new framework Hervé Poussineau
@ 2016-01-24 23:13   ` David Gibson
  0 siblings, 0 replies; 45+ messages in thread
From: David Gibson @ 2016-01-24 23:13 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, qemu-devel, Alexander Graf

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

On Sat, Jan 23, 2016 at 09:40:00PM +0100, Hervé Poussineau wrote:
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/misc/macio/cuda.c | 40 +++++++++++++++++++++++++---------------
>  1 file changed, 25 insertions(+), 15 deletions(-)
> 
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index f27dd19..37406fc 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -543,14 +543,38 @@ typedef struct CudaCommand {
>                      uint8_t *out_args, int *out_len);
>  } CudaCommand;
>  
> +static bool cuda_cmd_autopoll(CUDAState *s,
> +                              const uint8_t *in_data, int in_len,
> +                              uint8_t *out_data, int *out_len)
> +{
> +    int autopoll;
> +
> +    if (in_len != 1) {
> +        return false;
> +    }
> +
> +    autopoll = (in_data[0] != 0);
> +    if (autopoll != s->autopoll) {
> +        s->autopoll = autopoll;
> +        if (autopoll) {
> +            timer_mod(s->adb_poll_timer,
> +                      qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> +                      (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
> +        } else {
> +            timer_del(s->adb_poll_timer);
> +        }
> +    }
> +    return true;
> +}
> +
>  static const CudaCommand handlers[] = {
> +    { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
>  };
>  
>  static void cuda_receive_packet(CUDAState *s,
>                                  const uint8_t *data, int len)
>  {
>      uint8_t obuf[16] = { CUDA_PACKET, 0, data[0] };
> -    int autopoll;
>      int i, out_len = 0;
>      uint32_t ti;
>  
> @@ -576,20 +600,6 @@ static void cuda_receive_packet(CUDAState *s,
>      }
>  
>      switch(data[0]) {
> -    case CUDA_AUTOPOLL:
> -        autopoll = (data[1] != 0);
> -        if (autopoll != s->autopoll) {
> -            s->autopoll = autopoll;
> -            if (autopoll) {
> -                timer_mod(s->adb_poll_timer,
> -                               qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> -                               (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
> -            } else {
> -                timer_del(s->adb_poll_timer);
> -            }
> -        }
> -        cuda_send_packet_to_host(s, obuf, 3);
> -        return;
>      case CUDA_GET_6805_ADDR:
>          cuda_send_packet_to_host(s, obuf, 3);
>          return;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 04/13] cuda: port SET_AUTO_RATE command to new framework
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 04/13] cuda: port SET_AUTO_RATE " Hervé Poussineau
  2016-01-24 18:33   ` Hervé Poussineau
@ 2016-01-24 23:21   ` David Gibson
  2016-02-07 19:27   ` Mark Cave-Ayland
  2 siblings, 0 replies; 45+ messages in thread
From: David Gibson @ 2016-01-24 23:21 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, qemu-devel, Alexander Graf

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

On Sat, Jan 23, 2016 at 09:40:01PM +0100, Hervé Poussineau wrote:
> Take requested autopoll rate into account

Commit message needs some work - as far as I can tell this is
not just moving this to the new framework, but implementing it -
previously the command was silently ignored.

> 
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
> ---
>  hw/misc/macio/cuda.c | 31 +++++++++++++++++++++++++++----
>  hw/ppc/mac.h         |  1 +
>  2 files changed, 28 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index 37406fc..9ec642f 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -105,7 +105,6 @@
>  #define CUDA_COMBINED_FORMAT_IIC	0x25
>  
>  #define CUDA_TIMER_FREQ (4700000 / 6)
> -#define CUDA_ADB_POLL_FREQ 50
>  
>  /* CUDA returns time_t's offset from Jan 1, 1904, not 1970 */
>  #define RTC_OFFSET                      2082844800
> @@ -531,7 +530,7 @@ static void cuda_adb_poll(void *opaque)
>      }
>      timer_mod(s->adb_poll_timer,
>                     qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> -                   (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
> +                   (get_ticks_per_sec() / (1000 / s->auto_rate_ms)));

I believe you can reduce the rounding errors by expressing this as:
        (s->auto_rate_ms * get_ticks_per_sec()) / 1000
	

>  }
>  
>  /* description of commands */
> @@ -559,7 +558,7 @@ static bool cuda_cmd_autopoll(CUDAState *s,
>          if (autopoll) {
>              timer_mod(s->adb_poll_timer,
>                        qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> -                      (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
> +                      (get_ticks_per_sec() / (1000 / s->auto_rate_ms)));
>          } else {
>              timer_del(s->adb_poll_timer);
>          }
> @@ -567,8 +566,32 @@ static bool cuda_cmd_autopoll(CUDAState *s,
>      return true;
>  }
>  
> +static bool cuda_cmd_set_autorate(CUDAState *s,
> +                                  const uint8_t *in_data, int in_len,
> +                                  uint8_t *out_data, int *out_len)
> +{
> +    if (in_len != 1) {
> +        return false;
> +    }
> +
> +    /* we don't want a period of 0 ms */
> +    /* FIXME: check what real hardware does */
> +    if (in_data[0] == 0) {
> +        return;
> +    }
> +
> +    s->auto_rate_ms = in_data[0];
> +    if (s->autopoll) {
> +        timer_mod(s->adb_poll_timer,
> +                  qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> +                  (get_ticks_per_sec() / (1000 / s->auto_rate_ms)));

IIUC this will make the next even occur in auto_rate_ms milliseconds,
rather than auto_rate_ms from the previous event.  i.e. it discards
any time elapsed on the currently running timer.

That may be the intended behaviour, or at least close enough that it
doesn't matter, but I think it deserves comment.

> +    }
> +    return true;
> +}
> +
>  static const CudaCommand handlers[] = {
>      { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
> +    { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
>  };
>  
>  static void cuda_receive_packet(CUDAState *s,
> @@ -618,7 +641,6 @@ static void cuda_receive_packet(CUDAState *s,
>          return;
>      case CUDA_FILE_SERVER_FLAG:
>      case CUDA_SET_DEVICE_LIST:
> -    case CUDA_SET_AUTO_RATE:
>      case CUDA_SET_POWER_MESSAGES:
>          cuda_send_packet_to_host(s, obuf, 3);
>          return;
> @@ -824,6 +846,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp)
>      s->tick_offset = (uint32_t)mktimegm(&tm) + RTC_OFFSET;
>  
>      s->adb_poll_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_adb_poll, s);
> +    s->auto_rate_ms = 20;
>  }
>  
>  static void cuda_initfn(Object *obj)
> diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
> index e375ed2..90fcb69 100644
> --- a/hw/ppc/mac.h
> +++ b/hw/ppc/mac.h
> @@ -111,6 +111,7 @@ typedef struct CUDAState {
>      int data_out_index;
>  
>      qemu_irq irq;
> +    uint8_t auto_rate_ms;
>      uint8_t autopoll;
>      uint8_t data_in[128];
>      uint8_t data_out[16];

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 05/13] cuda: port SET_DEVICE_LIST command to new framework
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 05/13] cuda: port SET_DEVICE_LIST " Hervé Poussineau
@ 2016-01-24 23:23   ` David Gibson
  2016-02-07 19:35   ` Mark Cave-Ayland
  1 sibling, 0 replies; 45+ messages in thread
From: David Gibson @ 2016-01-24 23:23 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, qemu-devel, Alexander Graf

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

On Sat, Jan 23, 2016 at 09:40:02PM +0100, Hervé Poussineau wrote:
> Take device list mask into account when polling ADB devices.

Again, this appears to implement the command, not just move it.


> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
> ---
>  hw/input/adb.c         | 18 ++++++++++--------
>  hw/misc/macio/cuda.c   | 17 +++++++++++++++--
>  hw/ppc/mac.h           |  1 +
>  include/hw/input/adb.h |  2 +-
>  roms/SLOF              |  2 +-
>  roms/openbios          |  2 +-
>  6 files changed, 29 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/input/adb.c b/hw/input/adb.c
> index 09eead9..d05fdfd 100644
> --- a/hw/input/adb.c
> +++ b/hw/input/adb.c
> @@ -88,7 +88,7 @@ int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len)
>  }
>  
>  /* XXX: move that to cuda ? */
> -int adb_poll(ADBBusState *s, uint8_t *obuf)
> +int adb_poll(ADBBusState *s, uint8_t *obuf, uint16_t poll_mask)
>  {
>      ADBDevice *d;
>      int olen, i;
> @@ -99,13 +99,15 @@ int adb_poll(ADBBusState *s, uint8_t *obuf)
>          if (s->poll_index >= s->nb_devices)
>              s->poll_index = 0;
>          d = s->devices[s->poll_index];
> -        buf[0] = ADB_READREG | (d->devaddr << 4);
> -        olen = adb_request(s, obuf + 1, buf, 1);
> -        /* if there is data, we poll again the same device */
> -        if (olen > 0) {
> -            obuf[0] = buf[0];
> -            olen++;
> -            break;
> +        if ((1 << d->devaddr) & poll_mask) {
> +            buf[0] = ADB_READREG | (d->devaddr << 4);
> +            olen = adb_request(s, obuf + 1, buf, 1);
> +            /* if there is data, we poll again the same device */
> +            if (olen > 0) {
> +                obuf[0] = buf[0];
> +                olen++;
> +                break;
> +            }
>          }
>          s->poll_index++;
>      }
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index 9ec642f..9af8e1d 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -522,7 +522,7 @@ static void cuda_adb_poll(void *opaque)
>      uint8_t obuf[ADB_MAX_OUT_LEN + 2];
>      int olen;
>  
> -    olen = adb_poll(&s->adb_bus, obuf + 2);
> +    olen = adb_poll(&s->adb_bus, obuf + 2, s->poll_mask);
>      if (olen > 0) {
>          obuf[0] = ADB_PACKET;
>          obuf[1] = 0x40; /* polled data */
> @@ -589,9 +589,22 @@ static bool cuda_cmd_set_autorate(CUDAState *s,
>      return true;
>  }
>  
> +static bool cuda_cmd_set_device_list(CUDAState *s,
> +                                     const uint8_t *in_data, int in_len,
> +                                     uint8_t *out_data, int *out_len)
> +{
> +    if (in_len != 2) {
> +        return false;
> +    }
> +
> +    s->poll_mask = (((uint16_t)in_data[0]) << 8) | in_data[1];
> +    return true;
> +}
> +
>  static const CudaCommand handlers[] = {
>      { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
>      { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
> +    { CUDA_SET_DEVICE_LIST, "SET_DEVICE_LIST", cuda_cmd_set_device_list },
>  };
>  
>  static void cuda_receive_packet(CUDAState *s,
> @@ -640,7 +653,6 @@ static void cuda_receive_packet(CUDAState *s,
>          cuda_send_packet_to_host(s, obuf, 7);
>          return;
>      case CUDA_FILE_SERVER_FLAG:
> -    case CUDA_SET_DEVICE_LIST:
>      case CUDA_SET_POWER_MESSAGES:
>          cuda_send_packet_to_host(s, obuf, 3);
>          return;
> @@ -847,6 +859,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp)
>  
>      s->adb_poll_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_adb_poll, s);
>      s->auto_rate_ms = 20;
> +    s->poll_mask = 0xffff;
>  }
>  
>  static void cuda_initfn(Object *obj)
> diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
> index 90fcb69..506f7a8 100644
> --- a/hw/ppc/mac.h
> +++ b/hw/ppc/mac.h
> @@ -111,6 +111,7 @@ typedef struct CUDAState {
>      int data_out_index;
>  
>      qemu_irq irq;
> +    uint16_t poll_mask;
>      uint8_t auto_rate_ms;
>      uint8_t autopoll;
>      uint8_t data_in[128];
> diff --git a/include/hw/input/adb.h b/include/hw/input/adb.h
> index bdfccd4..db51d03 100644
> --- a/include/hw/input/adb.h
> +++ b/include/hw/input/adb.h
> @@ -79,7 +79,7 @@ struct ADBBusState {
>  
>  int adb_request(ADBBusState *s, uint8_t *buf_out,
>                  const uint8_t *buf, int len);
> -int adb_poll(ADBBusState *s, uint8_t *buf_out);
> +int adb_poll(ADBBusState *s, uint8_t *buf_out, uint16_t poll_mask);
>  
>  #define TYPE_ADB_KEYBOARD "adb-keyboard"
>  #define TYPE_ADB_MOUSE "adb-mouse"
> diff --git a/roms/SLOF b/roms/SLOF
> index b4c9380..811277a 160000
> --- a/roms/SLOF
> +++ b/roms/SLOF
> @@ -1 +1 @@
> -Subproject commit b4c93802a5b2c72f096649c497ec9ff5708e4456
> +Subproject commit 811277ac91f674a9273e2b529791e9b75350f3e8
> diff --git a/roms/openbios b/roms/openbios
> index 3caee17..18f02b1 160000
> --- a/roms/openbios
> +++ b/roms/openbios
> @@ -1 +1 @@
> -Subproject commit 3caee1794ac3f742315823d8447d21f33ce019e9
> +Subproject commit 18f02b14de795c1aab4fe23c1810bfd0944da6aa

These SLOF and openbios changes look unrelated.  If they're not, they
definitely need to be mentioned in the commit message.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 06/13] cuda: port POWERDOWN command to new framework
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 06/13] cuda: port POWERDOWN " Hervé Poussineau
@ 2016-01-24 23:24   ` David Gibson
  0 siblings, 0 replies; 45+ messages in thread
From: David Gibson @ 2016-01-24 23:24 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, qemu-devel, Alexander Graf

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

On Sat, Jan 23, 2016 at 09:40:03PM +0100, Hervé Poussineau wrote:
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/misc/macio/cuda.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index 9af8e1d..df4797f 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -601,10 +601,23 @@ static bool cuda_cmd_set_device_list(CUDAState *s,
>      return true;
>  }
>  
> +static bool cuda_cmd_powerdown(CUDAState *s,
> +                               const uint8_t *in_data, int in_len,
> +                               uint8_t *out_data, int *out_len)
> +{
> +    if (in_len != 0) {
> +        return false;
> +    }
> +
> +    qemu_system_shutdown_request();
> +    return true;
> +}
> +
>  static const CudaCommand handlers[] = {
>      { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
>      { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
>      { CUDA_SET_DEVICE_LIST, "SET_DEVICE_LIST", cuda_cmd_set_device_list },
> +    { CUDA_POWERDOWN, "POWERDOWN", cuda_cmd_powerdown },
>  };
>  
>  static void cuda_receive_packet(CUDAState *s,
> @@ -656,10 +669,6 @@ static void cuda_receive_packet(CUDAState *s,
>      case CUDA_SET_POWER_MESSAGES:
>          cuda_send_packet_to_host(s, obuf, 3);
>          return;
> -    case CUDA_POWERDOWN:
> -        cuda_send_packet_to_host(s, obuf, 3);
> -        qemu_system_shutdown_request();
> -        return;
>      case CUDA_RESET_SYSTEM:
>          cuda_send_packet_to_host(s, obuf, 3);
>          qemu_system_reset_request();

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 07/13] cuda: port RESET_SYSTEM command to new framework
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 07/13] cuda: port RESET_SYSTEM " Hervé Poussineau
@ 2016-01-24 23:24   ` David Gibson
  0 siblings, 0 replies; 45+ messages in thread
From: David Gibson @ 2016-01-24 23:24 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, qemu-devel, Alexander Graf

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

On Sat, Jan 23, 2016 at 09:40:04PM +0100, Hervé Poussineau wrote:
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/misc/macio/cuda.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index df4797f..70a5d0c 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -613,11 +613,24 @@ static bool cuda_cmd_powerdown(CUDAState *s,
>      return true;
>  }
>  
> +static bool cuda_cmd_reset_system(CUDAState *s,
> +                                  const uint8_t *in_data, int in_len,
> +                                  uint8_t *out_data, int *out_len)
> +{
> +    if (in_len != 0) {
> +        return false;
> +    }
> +
> +    qemu_system_reset_request();
> +    return true;
> +}
> +
>  static const CudaCommand handlers[] = {
>      { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
>      { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
>      { CUDA_SET_DEVICE_LIST, "SET_DEVICE_LIST", cuda_cmd_set_device_list },
>      { CUDA_POWERDOWN, "POWERDOWN", cuda_cmd_powerdown },
> +    { CUDA_RESET_SYSTEM, "RESET_SYSTEM", cuda_cmd_reset_system },
>  };
>  
>  static void cuda_receive_packet(CUDAState *s,
> @@ -669,10 +682,6 @@ static void cuda_receive_packet(CUDAState *s,
>      case CUDA_SET_POWER_MESSAGES:
>          cuda_send_packet_to_host(s, obuf, 3);
>          return;
> -    case CUDA_RESET_SYSTEM:
> -        cuda_send_packet_to_host(s, obuf, 3);
> -        qemu_system_reset_request();
> -        return;
>      case CUDA_COMBINED_FORMAT_IIC:
>          obuf[0] = ERROR_PACKET;
>          obuf[1] = 0x5;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 08/13] cuda: port FILE_SERVER_FLAG command to new framework
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 08/13] cuda: port FILE_SERVER_FLAG " Hervé Poussineau
@ 2016-01-24 23:25   ` David Gibson
  0 siblings, 0 replies; 45+ messages in thread
From: David Gibson @ 2016-01-24 23:25 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, qemu-devel, Alexander Graf

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

On Sat, Jan 23, 2016 at 09:40:05PM +0100, Hervé Poussineau wrote:
> This command tells if computer should automatically wake-up after a power loss.
> 
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/misc/macio/cuda.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index 70a5d0c..294e8fb 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -625,12 +625,28 @@ static bool cuda_cmd_reset_system(CUDAState *s,
>      return true;
>  }
>  
> +static bool cuda_cmd_set_file_server_flag(CUDAState *s,
> +                                          const uint8_t *in_data, int in_len,
> +                                          uint8_t *out_data, int *out_len)
> +{
> +    if (in_len != 1) {
> +        return false;
> +    }
> +
> +    qemu_log_mask(LOG_UNIMP,
> +                  "CUDA: unimplemented command FILE_SERVER_FLAG %d\n",
> +                  in_data[0]);
> +    return true;
> +}
> +
>  static const CudaCommand handlers[] = {
>      { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
>      { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
>      { CUDA_SET_DEVICE_LIST, "SET_DEVICE_LIST", cuda_cmd_set_device_list },
>      { CUDA_POWERDOWN, "POWERDOWN", cuda_cmd_powerdown },
>      { CUDA_RESET_SYSTEM, "RESET_SYSTEM", cuda_cmd_reset_system },
> +    { CUDA_FILE_SERVER_FLAG, "FILE_SERVER_FLAG",
> +      cuda_cmd_set_file_server_flag },
>  };
>  
>  static void cuda_receive_packet(CUDAState *s,
> @@ -678,7 +694,6 @@ static void cuda_receive_packet(CUDAState *s,
>          obuf[6] = ti;
>          cuda_send_packet_to_host(s, obuf, 7);
>          return;
> -    case CUDA_FILE_SERVER_FLAG:
>      case CUDA_SET_POWER_MESSAGES:
>          cuda_send_packet_to_host(s, obuf, 3);
>          return;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 09/13] cuda: port SET_POWER_MESSAGES command to new framework
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 09/13] cuda: port SET_POWER_MESSAGES " Hervé Poussineau
@ 2016-01-24 23:26   ` David Gibson
  0 siblings, 0 replies; 45+ messages in thread
From: David Gibson @ 2016-01-24 23:26 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, qemu-devel, Alexander Graf

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

On Sat, Jan 23, 2016 at 09:40:06PM +0100, Hervé Poussineau wrote:
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>

Revieed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/misc/macio/cuda.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index 294e8fb..64a3e79 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -639,6 +639,20 @@ static bool cuda_cmd_set_file_server_flag(CUDAState *s,
>      return true;
>  }
>  
> +static bool cuda_cmd_set_power_message(CUDAState *s,
> +                                       const uint8_t *in_data, int in_len,
> +                                       uint8_t *out_data, int *out_len)
> +{
> +    if (in_len != 1) {
> +        return false;
> +    }
> +
> +    qemu_log_mask(LOG_UNIMP,
> +                  "CUDA: unimplemented command SET_POWER_MESSAGE %d\n",
> +                  in_data[0]);
> +    return true;
> +}
> +
>  static const CudaCommand handlers[] = {
>      { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
>      { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
> @@ -647,6 +661,8 @@ static const CudaCommand handlers[] = {
>      { CUDA_RESET_SYSTEM, "RESET_SYSTEM", cuda_cmd_reset_system },
>      { CUDA_FILE_SERVER_FLAG, "FILE_SERVER_FLAG",
>        cuda_cmd_set_file_server_flag },
> +    { CUDA_SET_POWER_MESSAGES, "SET_POWER_MESSAGES",
> +      cuda_cmd_set_power_message },
>  };
>  
>  static void cuda_receive_packet(CUDAState *s,
> @@ -694,9 +710,6 @@ static void cuda_receive_packet(CUDAState *s,
>          obuf[6] = ti;
>          cuda_send_packet_to_host(s, obuf, 7);
>          return;
> -    case CUDA_SET_POWER_MESSAGES:
> -        cuda_send_packet_to_host(s, obuf, 3);
> -        return;
>      case CUDA_COMBINED_FORMAT_IIC:
>          obuf[0] = ERROR_PACKET;
>          obuf[1] = 0x5;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 10/13] cuda: port GET_TIME command to new framework
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 10/13] cuda: port GET_TIME " Hervé Poussineau
@ 2016-01-24 23:27   ` David Gibson
  0 siblings, 0 replies; 45+ messages in thread
From: David Gibson @ 2016-01-24 23:27 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, qemu-devel, Alexander Graf

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

On Sat, Jan 23, 2016 at 09:40:07PM +0100, Hervé Poussineau wrote:
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/misc/macio/cuda.c | 29 +++++++++++++++++++++--------
>  1 file changed, 21 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index 64a3e79..55e9cff 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -653,6 +653,26 @@ static bool cuda_cmd_set_power_message(CUDAState *s,
>      return true;
>  }
>  
> +static bool cuda_cmd_get_time(CUDAState *s,
> +                              const uint8_t *in_data, int in_len,
> +                              uint8_t *out_data, int *out_len)
> +{
> +    uint32_t ti;
> +
> +    if (in_len != 0) {
> +        return false;
> +    }
> +
> +    ti = s->tick_offset + (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)
> +                           / get_ticks_per_sec());
> +    out_data[0] = ti >> 24;
> +    out_data[1] = ti >> 16;
> +    out_data[2] = ti >> 8;
> +    out_data[3] = ti;
> +    *out_len = 4;
> +    return true;
> +}
> +
>  static const CudaCommand handlers[] = {
>      { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
>      { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
> @@ -663,6 +683,7 @@ static const CudaCommand handlers[] = {
>        cuda_cmd_set_file_server_flag },
>      { CUDA_SET_POWER_MESSAGES, "SET_POWER_MESSAGES",
>        cuda_cmd_set_power_message },
> +    { CUDA_GET_TIME, "GET_TIME", cuda_cmd_get_time },
>  };
>  
>  static void cuda_receive_packet(CUDAState *s,
> @@ -702,14 +723,6 @@ static void cuda_receive_packet(CUDAState *s,
>          s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / get_ticks_per_sec());
>          cuda_send_packet_to_host(s, obuf, 3);
>          return;
> -    case CUDA_GET_TIME:
> -        ti = s->tick_offset + (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / get_ticks_per_sec());
> -        obuf[3] = ti >> 24;
> -        obuf[4] = ti >> 16;
> -        obuf[5] = ti >> 8;
> -        obuf[6] = ti;
> -        cuda_send_packet_to_host(s, obuf, 7);
> -        return;
>      case CUDA_COMBINED_FORMAT_IIC:
>          obuf[0] = ERROR_PACKET;
>          obuf[1] = 0x5;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 11/13] cuda: port SET_TIME command to new framework
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 11/13] cuda: port SET_TIME " Hervé Poussineau
@ 2016-01-24 23:27   ` David Gibson
  0 siblings, 0 replies; 45+ messages in thread
From: David Gibson @ 2016-01-24 23:27 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, qemu-devel, Alexander Graf

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

On Sat, Jan 23, 2016 at 09:40:08PM +0100, Hervé Poussineau wrote:
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/misc/macio/cuda.c | 24 ++++++++++++++++++------
>  1 file changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index 55e9cff..49a79fc 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -673,6 +673,23 @@ static bool cuda_cmd_get_time(CUDAState *s,
>      return true;
>  }
>  
> +static bool cuda_cmd_set_time(CUDAState *s,
> +                              const uint8_t *in_data, int in_len,
> +                              uint8_t *out_data, int *out_len)
> +{
> +    uint32_t ti;
> +
> +    if (in_len != 4) {
> +        return false;
> +    }
> +
> +    ti = (((uint32_t)in_data[1]) << 24) + (((uint32_t)in_data[2]) << 16)
> +         + (((uint32_t)in_data[3]) << 8) + in_data[4];
> +    s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)
> +                           / get_ticks_per_sec());
> +    return true;
> +}
> +
>  static const CudaCommand handlers[] = {
>      { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
>      { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
> @@ -684,6 +701,7 @@ static const CudaCommand handlers[] = {
>      { CUDA_SET_POWER_MESSAGES, "SET_POWER_MESSAGES",
>        cuda_cmd_set_power_message },
>      { CUDA_GET_TIME, "GET_TIME", cuda_cmd_get_time },
> +    { CUDA_SET_TIME, "SET_TIME", cuda_cmd_set_time },
>  };
>  
>  static void cuda_receive_packet(CUDAState *s,
> @@ -691,7 +709,6 @@ static void cuda_receive_packet(CUDAState *s,
>  {
>      uint8_t obuf[16] = { CUDA_PACKET, 0, data[0] };
>      int i, out_len = 0;
> -    uint32_t ti;
>  
>      for (i = 0; i < ARRAY_SIZE(handlers); i++) {
>          const CudaCommand *desc = &handlers[i];
> @@ -718,11 +735,6 @@ static void cuda_receive_packet(CUDAState *s,
>      case CUDA_GET_6805_ADDR:
>          cuda_send_packet_to_host(s, obuf, 3);
>          return;
> -    case CUDA_SET_TIME:
> -        ti = (((uint32_t)data[1]) << 24) + (((uint32_t)data[2]) << 16) + (((uint32_t)data[3]) << 8) + data[4];
> -        s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / get_ticks_per_sec());
> -        cuda_send_packet_to_host(s, obuf, 3);
> -        return;
>      case CUDA_COMBINED_FORMAT_IIC:
>          obuf[0] = ERROR_PACKET;
>          obuf[1] = 0x5;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (12 preceding siblings ...)
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 13/13] cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands Hervé Poussineau
@ 2016-01-24 23:29 ` David Gibson
  2016-01-25  9:58 ` Alyssa Milburn
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 45+ messages in thread
From: David Gibson @ 2016-01-24 23:29 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, qemu-devel, Alexander Graf

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

On Sat, Jan 23, 2016 at 09:39:57PM +0100, Hervé Poussineau wrote:
> Hi,
> 
> This patchset cleans up a little bit the Apple CUDA emulation:
> - correctly reject unknown commands
> - correctly reject commands with wrong parameters
> - support changing the frequency of auto-polling
> - support changing device list probed in auto-poll
> - add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
> - remove unused commands (GET/SET_6805_ADDR)
> - remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
> 
> GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once
> we implement the I2C bus provided by CUDA.
> 
> This also fixes MacBugs hanging at startup in the absence of
> ADB mouse input.
> 
> Hervé

This series looks sound in concept, but there's a couple of things I
need before applying it:
  * On inspection I noticed a handful of small problems, noted in
    comments on the individual patches
  * I'm not really set up to test Mac, so if I can get a Tested-by
    from someone who can, that would be good (Mark?).

Thanks,
David.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 12/13] cuda: remove GET_6805_ADDR command
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 12/13] cuda: remove GET_6805_ADDR command Hervé Poussineau
@ 2016-01-25  8:35   ` Alyssa Milburn
  2016-01-25  8:48     ` Mark Cave-Ayland
  0 siblings, 1 reply; 45+ messages in thread
From: Alyssa Milburn @ 2016-01-25  8:35 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: Mark Cave-Ayland, qemu-devel, Alexander Graf, Alyssa Milburn,
	qemu-ppc, David Gibson

On Sat, Jan 23, 2016 at 09:40:09PM +0100, Hervé Poussineau wrote:
> It doesn't seem to be used, and operating systems should accept a 'unknown command' answer.

Mac OS 9 does seem to make the call, but it seems happy getting an 'unknown
command' response; I can't find the original MOL tree (I guess it used to be
in BitKeeper at mol.bkbits.net?) to work out why it's there - I assume
that's where it's derived from - but it does seem unnecessary.

- Alyssa

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 12/13] cuda: remove GET_6805_ADDR command
  2016-01-25  8:35   ` Alyssa Milburn
@ 2016-01-25  8:48     ` Mark Cave-Ayland
  2016-01-25  9:51       ` Alyssa Milburn
  0 siblings, 1 reply; 45+ messages in thread
From: Mark Cave-Ayland @ 2016-01-25  8:48 UTC (permalink / raw)
  To: Alyssa Milburn, Hervé Poussineau
  Cc: David Gibson, qemu-ppc, qemu-devel, Alexander Graf

On 25/01/16 08:35, Alyssa Milburn wrote:

> On Sat, Jan 23, 2016 at 09:40:09PM +0100, Hervé Poussineau wrote:
>> It doesn't seem to be used, and operating systems should accept a 'unknown command' answer.
> 
> Mac OS 9 does seem to make the call, but it seems happy getting an 'unknown
> command' response; I can't find the original MOL tree (I guess it used to be
> in BitKeeper at mol.bkbits.net?) to work out why it's there - I assume
> that's where it's derived from - but it does seem unnecessary.

Yeah, a lot of the CUDA patches were based upon MOL, i.e. some things
aren't explicitly documented in the source but as they appear to work it
makes sense to copy the same behaviour in QEMU.

The main source tree I used came from the SF project page here:
http://sourceforge.net/projects/mac-on-linux/.


ATB,

Mark.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 12/13] cuda: remove GET_6805_ADDR command
  2016-01-25  8:48     ` Mark Cave-Ayland
@ 2016-01-25  9:51       ` Alyssa Milburn
  0 siblings, 0 replies; 45+ messages in thread
From: Alyssa Milburn @ 2016-01-25  9:51 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: qemu-devel, Alexander Graf, Alyssa Milburn, qemu-ppc,
	Hervé Poussineau, David Gibson

On Mon, Jan 25, 2016 at 08:48:05AM +0000, Mark Cave-Ayland wrote:
> > Mac OS 9 does seem to make the call, but it seems happy getting an 'unknown
> > command' response; I can't find the original MOL tree (I guess it used to be
> > in BitKeeper at mol.bkbits.net?) to work out why it's there - I assume
> > that's where it's derived from - but it does seem unnecessary.
> 
> Yeah, a lot of the CUDA patches were based upon MOL, i.e. some things
> aren't explicitly documented in the source but as they appear to work it
> makes sense to copy the same behaviour in QEMU.
> 
> The main source tree I used came from the SF project page here:
> http://sourceforge.net/projects/mac-on-linux/.

Only the "recent" changes are there (it seems the project moved there after
a new maintainer took over), unfortunately. It doesn't matter; I was just
curious if these changes were justifed somewhere, in case any of the strange
"hacks" are actually necessary.

- Alyssa

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (13 preceding siblings ...)
  2016-01-24 23:29 ` [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups David Gibson
@ 2016-01-25  9:58 ` Alyssa Milburn
  2016-01-25 13:08   ` Mark Cave-Ayland
  2016-01-25 22:08   ` Hervé Poussineau
  2016-02-04 20:15 ` [Qemu-devel] " Alyssa Milburn
  2016-02-06 13:32 ` Mark Cave-Ayland
  16 siblings, 2 replies; 45+ messages in thread
From: Alyssa Milburn @ 2016-01-25  9:58 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: Mark Cave-Ayland, qemu-devel, Alexander Graf, Alyssa Milburn,
	qemu-ppc, David Gibson

On Sat, Jan 23, 2016 at 09:39:57PM +0100, Hervé Poussineau wrote:
> Hi,
> 
> This patchset cleans up a little bit the Apple CUDA emulation:
> - correctly reject unknown commands
> - correctly reject commands with wrong parameters
> - support changing the frequency of auto-polling
> - support changing device list probed in auto-poll
> - add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
> - remove unused commands (GET/SET_6805_ADDR)
> - remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
> 
> GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once
> we implement the I2C bus provided by CUDA.

Neat! (I wish I'd seen this before trying to debug issues with this code!)
Do you have any plans to work on this code further? The VIA register code
doesn't seem to really match what the hardware does, and I've been wondering
if it's responsible for weird input problems under Mac OS, but didn't find
time to look into it yet (and don't want to duplicate effort).

- Alyssa

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 13/13] cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 13/13] cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands Hervé Poussineau
@ 2016-01-25 10:00   ` Alyssa Milburn
  0 siblings, 0 replies; 45+ messages in thread
From: Alyssa Milburn @ 2016-01-25 10:00 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: Mark Cave-Ayland, qemu-devel, Alexander Graf, Alyssa Milburn,
	qemu-ppc, David Gibson

On Sat, Jan 23, 2016 at 09:40:10PM +0100, Hervé Poussineau wrote:
> We currently don't emulate the I2C bus provided by CUDA.

The MOL source has the comment /* this reply is important on B&W G3 */ in
the CUDA_COMBINED_FORMAT_IIC case (differentiating it from the general 0x2
error case); any idea if that's relevant? (0x5 is an SRQ error? I guess it
would also be nice to add constants for all these magic numbers.)

- Alyssa

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups
  2016-01-25  9:58 ` Alyssa Milburn
@ 2016-01-25 13:08   ` Mark Cave-Ayland
  2016-01-25 22:08   ` Hervé Poussineau
  1 sibling, 0 replies; 45+ messages in thread
From: Mark Cave-Ayland @ 2016-01-25 13:08 UTC (permalink / raw)
  To: Alyssa Milburn, Hervé Poussineau
  Cc: David Gibson, qemu-ppc, qemu-devel, Alexander Graf

On 25/01/16 09:58, Alyssa Milburn wrote:

> On Sat, Jan 23, 2016 at 09:39:57PM +0100, Hervé Poussineau wrote:
>> Hi,
>>
>> This patchset cleans up a little bit the Apple CUDA emulation:
>> - correctly reject unknown commands
>> - correctly reject commands with wrong parameters
>> - support changing the frequency of auto-polling
>> - support changing device list probed in auto-poll
>> - add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
>> - remove unused commands (GET/SET_6805_ADDR)
>> - remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
>>
>> GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once
>> we implement the I2C bus provided by CUDA.
> 
> Neat! (I wish I'd seen this before trying to debug issues with this code!)
> Do you have any plans to work on this code further? The VIA register code
> doesn't seem to really match what the hardware does, and I've been wondering
> if it's responsible for weird input problems under Mac OS, but didn't find
> time to look into it yet (and don't want to duplicate effort).

David had some review comments (and I still need to have a look in
detail) so as long as it passes my various OpenBIOS OS tests then there
is a good chance it can be applied during this release cycle.


ATB,

Mark.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups
  2016-01-25  9:58 ` Alyssa Milburn
  2016-01-25 13:08   ` Mark Cave-Ayland
@ 2016-01-25 22:08   ` Hervé Poussineau
  2016-01-26 11:32     ` [Qemu-devel] [Qemu-ppc] " BALATON Zoltan
  1 sibling, 1 reply; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-25 22:08 UTC (permalink / raw)
  To: Alyssa Milburn
  Cc: qemu-ppc, David Gibson, Mark Cave-Ayland, qemu-devel, Alexander Graf

Hi,

Le 25/01/2016 10:58, Alyssa Milburn a écrit :
> On Sat, Jan 23, 2016 at 09:39:57PM +0100, Hervé Poussineau wrote:
>> Hi,
>>
>> This patchset cleans up a little bit the Apple CUDA emulation:
>> - correctly reject unknown commands
>> - correctly reject commands with wrong parameters
>> - support changing the frequency of auto-polling
>> - support changing device list probed in auto-poll
>> - add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
>> - remove unused commands (GET/SET_6805_ADDR)
>> - remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
>>
>> GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once
>> we implement the I2C bus provided by CUDA.
>
> Neat! (I wish I'd seen this before trying to debug issues with this code!)
> Do you have any plans to work on this code further? The VIA register code
> doesn't seem to really match what the hardware does, and I've been wondering
> if it's responsible for weird input problems under Mac OS, but didn't find
> time to look into it yet (and don't want to duplicate effort).

I already have some code to add the I2C bus, but it's mostly used by MacOS 9 which probably tries to configure some devices.

Do you have a Linux/NetBSD/... image, where I can run some command line tool to probe the I2C bus?

Hervé

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH 00/13] cuda: misc fixes and cleanups
  2016-01-25 22:08   ` Hervé Poussineau
@ 2016-01-26 11:32     ` BALATON Zoltan
  2016-01-27 22:35       ` Hervé Poussineau
  0 siblings, 1 reply; 45+ messages in thread
From: BALATON Zoltan @ 2016-01-26 11:32 UTC (permalink / raw)
  To: Hervé Poussineau; +Cc: Alyssa Milburn, qemu-ppc, qemu-devel, David Gibson

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

On Mon, 25 Jan 2016, Hervé Poussineau wrote:
> Do you have a Linux/NetBSD/... image, where I can run some command line tool 
> to probe the I2C bus?

Have you tried the iso from www.finnix.org? When booting it you may see a 
boot prompt on black screen with dark gray text first which is hard to 
read but pressing enter here should go on to boot.

Regards,
BALATON Zoltan

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH 00/13] cuda: misc fixes and cleanups
  2016-01-26 11:32     ` [Qemu-devel] [Qemu-ppc] " BALATON Zoltan
@ 2016-01-27 22:35       ` Hervé Poussineau
  2016-01-28  1:45         ` BALATON Zoltan
  0 siblings, 1 reply; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-27 22:35 UTC (permalink / raw)
  To: BALATON Zoltan; +Cc: Alyssa Milburn, qemu-ppc, qemu-devel, David Gibson

Le 26/01/2016 12:32, BALATON Zoltan a écrit :
> On Mon, 25 Jan 2016, Hervé Poussineau wrote:
>> Do you have a Linux/NetBSD/... image, where I can run some command line tool to probe the I2C bus?
>
> Have you tried the iso from www.finnix.org? When booting it you may see a boot prompt on black screen with dark gray text first which is hard to read but pressing enter here should go on to boot.
>

Unfortunately, Finnix doesn't try to access I2C bus, not even to initialize it. I suppose it is because OpenBIOS doesn't describe the I2C bus in the device tree...

Hervé

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH 00/13] cuda: misc fixes and cleanups
  2016-01-27 22:35       ` Hervé Poussineau
@ 2016-01-28  1:45         ` BALATON Zoltan
  2016-01-28 13:43           ` Hervé Poussineau
  0 siblings, 1 reply; 45+ messages in thread
From: BALATON Zoltan @ 2016-01-28  1:45 UTC (permalink / raw)
  To: Hervé Poussineau; +Cc: Alyssa Milburn, qemu-ppc, qemu-devel, David Gibson

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

On Wed, 27 Jan 2016, Hervé Poussineau wrote:
> Unfortunately, Finnix doesn't try to access I2C bus, not even to initialize 
> it. I suppose it is because OpenBIOS doesn't describe the I2C bus in the 
> device tree...

The kernel in Finnix seems to have a driver but unfortunately I2C 
debugging is not enabled so you probably won't get much useful info. The 
best idea in this case is probably to compile a kernel with debugging 
messages for I2C so you get some info on where it fails if it tries to 
find the bus at all.

It could be that the problem is that the device tree does not correctly 
describe something. Real hardware seems to have two i2c aliases related to 
some serial ports that is believed to maybe causing problems with MacOS 9
(see: 
http://web.archive.org/web/20090107145016/http://penguinppc.org/historical/dev-trees-html/g4_agp_400_1.html#.)

ki2c-serial: /pci@f2000000/@d/mac-io@7/i2c/cereal
and
ui2c-serial: /uni-n/i2c/cereal

but I don't know if any of this is relevant, just mentioning it in the 
hope that some of this might help. (I've also noticed that real 
PowerMac3,1 seems to have a modem connected to one of its serial ports so 
that could also be something MacOS 9 is looking for or tries to use.)

Regards,
BALATON Zoltan

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH 00/13] cuda: misc fixes and cleanups
  2016-01-28  1:45         ` BALATON Zoltan
@ 2016-01-28 13:43           ` Hervé Poussineau
  0 siblings, 0 replies; 45+ messages in thread
From: Hervé Poussineau @ 2016-01-28 13:43 UTC (permalink / raw)
  To: BALATON Zoltan; +Cc: Alyssa Milburn, qemu-ppc, qemu-devel, David Gibson

Le 28/01/2016 02:45, BALATON Zoltan a écrit :
> On Wed, 27 Jan 2016, Hervé Poussineau wrote:
>> Unfortunately, Finnix doesn't try to access I2C bus, not even to initialize it. I suppose it is because OpenBIOS doesn't describe the I2C bus in the device tree...
>
> The kernel in Finnix seems to have a driver but unfortunately I2C debugging is not enabled so you probably won't get much useful info. The best idea in this case is probably to compile a kernel with
> debugging messages for I2C so you get some info on where it fails if it tries to find the bus at all.
>

I just checked Linux source. arch/powerpc/platforms/powermac/low_i2c.c is searching for 3 types of I2C buses
- if some device in DT is compatible with "keywest-i2c"
- if CONFIG_ADB_PMU is set, if some device in DT is named "pmu-i2c" or "via-pmu"
- if CONFIG_PMAC_SMU is set, if some device in DT is named "smu-i2c-control" or "smu"
So, OpenBIOS needs to be changed to declare an I2C bus.

Then, maybe, I'll get some bus probing.

Regards,

Hervé

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (14 preceding siblings ...)
  2016-01-25  9:58 ` Alyssa Milburn
@ 2016-02-04 20:15 ` Alyssa Milburn
  2016-02-06 13:32 ` Mark Cave-Ayland
  16 siblings, 0 replies; 45+ messages in thread
From: Alyssa Milburn @ 2016-02-04 20:15 UTC (permalink / raw)
  To: Hervé Poussineau
  Cc: qemu-ppc, David Gibson, Mark Cave-Ayland, qemu-devel, Alexander Graf

On Sat, Jan 23, 2016 at 09:39:57PM +0100, Hervé Poussineau wrote:
> This patchset cleans up a little bit the Apple CUDA emulation:
> - correctly reject unknown commands
> - correctly reject commands with wrong parameters
> - support changing the frequency of auto-polling
> - support changing device list probed in auto-poll
> - add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
> - remove unused commands (GET/SET_6805_ADDR)
> - remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
> 
> GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once
> we implement the I2C bus provided by CUDA.

Overall, this doesn't seem to make any obvious functional difference in
Mac OS 8/9 nor the Linux/BSD images I checked - but it's a clear improvement
and it's also a much nicer baseline to build on! I can't think of any
comments other than what has already been said.

I wrote some code for the one-timer mode, and also added some more #defines
instead of the magical constants. I guess I should refactor that on top of
this patchset, though. You're going to look at the I2C code (I see that at
least the EDID stuff uses it)?

- Alyssa

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups
  2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (15 preceding siblings ...)
  2016-02-04 20:15 ` [Qemu-devel] " Alyssa Milburn
@ 2016-02-06 13:32 ` Mark Cave-Ayland
  2016-02-06 14:30   ` Hervé Poussineau
  16 siblings, 1 reply; 45+ messages in thread
From: Mark Cave-Ayland @ 2016-02-06 13:32 UTC (permalink / raw)
  To: Hervé Poussineau, qemu-devel
  Cc: Alyssa Milburn, qemu-ppc, Alexander Graf, David Gibson

On 23/01/16 20:39, Hervé Poussineau wrote:

> Hi,
> 
> This patchset cleans up a little bit the Apple CUDA emulation:
> - correctly reject unknown commands
> - correctly reject commands with wrong parameters
> - support changing the frequency of auto-polling
> - support changing device list probed in auto-poll
> - add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
> - remove unused commands (GET/SET_6805_ADDR)
> - remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
> 
> GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once
> we implement the I2C bus provided by CUDA.
> 
> This also fixes MacBugs hanging at startup in the absence of
> ADB mouse input.
> 
> Hervé

Hi Hervé,

I've just tried to rebase your git remote onto master to run some tests
and it looks like due to recent changes then I get a number of
conflicts. Any chance that you could rebase this patchset onto master
and update your remote accordingly?


Many thanks,

Mark.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups
  2016-02-06 13:32 ` Mark Cave-Ayland
@ 2016-02-06 14:30   ` Hervé Poussineau
  2016-02-07 19:50     ` Mark Cave-Ayland
  0 siblings, 1 reply; 45+ messages in thread
From: Hervé Poussineau @ 2016-02-06 14:30 UTC (permalink / raw)
  To: Mark Cave-Ayland, qemu-devel
  Cc: Alyssa Milburn, qemu-ppc, Alexander Graf, David Gibson

Hi Mark,

Le 06/02/2016 14:32, Mark Cave-Ayland a écrit :
> On 23/01/16 20:39, Hervé Poussineau wrote:
>
>> Hi,
>>
>> This patchset cleans up a little bit the Apple CUDA emulation:
>> - correctly reject unknown commands
>> - correctly reject commands with wrong parameters
>> - support changing the frequency of auto-polling
>> - support changing device list probed in auto-poll
>> - add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
>> - remove unused commands (GET/SET_6805_ADDR)
>> - remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
>>
>> GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once
>> we implement the I2C bus provided by CUDA.
>>
>> This also fixes MacBugs hanging at startup in the absence of
>> ADB mouse input.
>>
>> Hervé
>
> Hi Hervé,
>
> I've just tried to rebase your git remote onto master to run some tests
> and it looks like due to recent changes then I get a number of
> conflicts. Any chance that you could rebase this patchset onto master
> and update your remote accordingly?

I've rebased this patchset. This is available at
http://repo.or.cz/qemu/hpoussin.git branch cuda

As a bonus, you have an implementation of CUDA_GET_SET_IIC command and the I2C bus.
Unfortunately, I was unable to test if it really works.

Regards,

Hervé

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 04/13] cuda: port SET_AUTO_RATE command to new framework
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 04/13] cuda: port SET_AUTO_RATE " Hervé Poussineau
  2016-01-24 18:33   ` Hervé Poussineau
  2016-01-24 23:21   ` David Gibson
@ 2016-02-07 19:27   ` Mark Cave-Ayland
  2 siblings, 0 replies; 45+ messages in thread
From: Mark Cave-Ayland @ 2016-02-07 19:27 UTC (permalink / raw)
  To: Hervé Poussineau, qemu-devel
  Cc: Alyssa Milburn, qemu-ppc, Alexander Graf, David Gibson

On 23/01/16 20:40, Hervé Poussineau wrote:

> Take requested autopoll rate into account
> 
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
> ---
>  hw/misc/macio/cuda.c | 31 +++++++++++++++++++++++++++----
>  hw/ppc/mac.h         |  1 +
>  2 files changed, 28 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index 37406fc..9ec642f 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -105,7 +105,6 @@
>  #define CUDA_COMBINED_FORMAT_IIC	0x25
>  
>  #define CUDA_TIMER_FREQ (4700000 / 6)
> -#define CUDA_ADB_POLL_FREQ 50
>  
>  /* CUDA returns time_t's offset from Jan 1, 1904, not 1970 */
>  #define RTC_OFFSET                      2082844800
> @@ -531,7 +530,7 @@ static void cuda_adb_poll(void *opaque)
>      }
>      timer_mod(s->adb_poll_timer,
>                     qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> -                   (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
> +                   (get_ticks_per_sec() / (1000 / s->auto_rate_ms)));
>  }
>  
>  /* description of commands */
> @@ -559,7 +558,7 @@ static bool cuda_cmd_autopoll(CUDAState *s,
>          if (autopoll) {
>              timer_mod(s->adb_poll_timer,
>                        qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> -                      (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
> +                      (get_ticks_per_sec() / (1000 / s->auto_rate_ms)));
>          } else {
>              timer_del(s->adb_poll_timer);
>          }
> @@ -567,8 +566,32 @@ static bool cuda_cmd_autopoll(CUDAState *s,
>      return true;
>  }
>  
> +static bool cuda_cmd_set_autorate(CUDAState *s,
> +                                  const uint8_t *in_data, int in_len,
> +                                  uint8_t *out_data, int *out_len)
> +{
> +    if (in_len != 1) {
> +        return false;
> +    }
> +
> +    /* we don't want a period of 0 ms */
> +    /* FIXME: check what real hardware does */
> +    if (in_data[0] == 0) {
> +        return;
> +    }
> +
> +    s->auto_rate_ms = in_data[0];
> +    if (s->autopoll) {
> +        timer_mod(s->adb_poll_timer,
> +                  qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> +                  (get_ticks_per_sec() / (1000 / s->auto_rate_ms)));
> +    }
> +    return true;
> +}
> +
>  static const CudaCommand handlers[] = {
>      { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
> +    { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
>  };
>  
>  static void cuda_receive_packet(CUDAState *s,
> @@ -618,7 +641,6 @@ static void cuda_receive_packet(CUDAState *s,
>          return;
>      case CUDA_FILE_SERVER_FLAG:
>      case CUDA_SET_DEVICE_LIST:
> -    case CUDA_SET_AUTO_RATE:
>      case CUDA_SET_POWER_MESSAGES:
>          cuda_send_packet_to_host(s, obuf, 3);
>          return;
> @@ -824,6 +846,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp)
>      s->tick_offset = (uint32_t)mktimegm(&tm) + RTC_OFFSET;
>  
>      s->adb_poll_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_adb_poll, s);
> +    s->auto_rate_ms = 20;

Can we call this s->autopoll_rate_ms instead for consistency?

>  }
>  
>  static void cuda_initfn(Object *obj)
> diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
> index e375ed2..90fcb69 100644
> --- a/hw/ppc/mac.h
> +++ b/hw/ppc/mac.h
> @@ -111,6 +111,7 @@ typedef struct CUDAState {
>      int data_out_index;
>  
>      qemu_irq irq;
> +    uint8_t auto_rate_ms;
>      uint8_t autopoll;
>      uint8_t data_in[128];
>      uint8_t data_out[16];
> 

I think that the autopoll rate field will also need adding to
VMStateDescription for CUDA (along with a corresponding increase in
version number).


ATB,

Mark.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 05/13] cuda: port SET_DEVICE_LIST command to new framework
  2016-01-23 20:40 ` [Qemu-devel] [PATCH 05/13] cuda: port SET_DEVICE_LIST " Hervé Poussineau
  2016-01-24 23:23   ` David Gibson
@ 2016-02-07 19:35   ` Mark Cave-Ayland
  1 sibling, 0 replies; 45+ messages in thread
From: Mark Cave-Ayland @ 2016-02-07 19:35 UTC (permalink / raw)
  To: Hervé Poussineau, qemu-devel
  Cc: Alyssa Milburn, qemu-ppc, Alexander Graf, David Gibson

On 23/01/16 20:40, Hervé Poussineau wrote:
> Take device list mask into account when polling ADB devices.
> 
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
> ---
>  hw/input/adb.c         | 18 ++++++++++--------
>  hw/misc/macio/cuda.c   | 17 +++++++++++++++--
>  hw/ppc/mac.h           |  1 +
>  include/hw/input/adb.h |  2 +-
>  roms/SLOF              |  2 +-
>  roms/openbios          |  2 +-
>  6 files changed, 29 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/input/adb.c b/hw/input/adb.c
> index 09eead9..d05fdfd 100644
> --- a/hw/input/adb.c
> +++ b/hw/input/adb.c
> @@ -88,7 +88,7 @@ int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len)
>  }
>  
>  /* XXX: move that to cuda ? */
> -int adb_poll(ADBBusState *s, uint8_t *obuf)
> +int adb_poll(ADBBusState *s, uint8_t *obuf, uint16_t poll_mask)
>  {
>      ADBDevice *d;
>      int olen, i;
> @@ -99,13 +99,15 @@ int adb_poll(ADBBusState *s, uint8_t *obuf)
>          if (s->poll_index >= s->nb_devices)
>              s->poll_index = 0;
>          d = s->devices[s->poll_index];
> -        buf[0] = ADB_READREG | (d->devaddr << 4);
> -        olen = adb_request(s, obuf + 1, buf, 1);
> -        /* if there is data, we poll again the same device */
> -        if (olen > 0) {
> -            obuf[0] = buf[0];
> -            olen++;
> -            break;
> +        if ((1 << d->devaddr) & poll_mask) {
> +            buf[0] = ADB_READREG | (d->devaddr << 4);
> +            olen = adb_request(s, obuf + 1, buf, 1);
> +            /* if there is data, we poll again the same device */
> +            if (olen > 0) {
> +                obuf[0] = buf[0];
> +                olen++;
> +                break;
> +            }
>          }
>          s->poll_index++;
>      }
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index 9ec642f..9af8e1d 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -522,7 +522,7 @@ static void cuda_adb_poll(void *opaque)
>      uint8_t obuf[ADB_MAX_OUT_LEN + 2];
>      int olen;
>  
> -    olen = adb_poll(&s->adb_bus, obuf + 2);
> +    olen = adb_poll(&s->adb_bus, obuf + 2, s->poll_mask);
>      if (olen > 0) {
>          obuf[0] = ADB_PACKET;
>          obuf[1] = 0x40; /* polled data */
> @@ -589,9 +589,22 @@ static bool cuda_cmd_set_autorate(CUDAState *s,
>      return true;
>  }
>  
> +static bool cuda_cmd_set_device_list(CUDAState *s,
> +                                     const uint8_t *in_data, int in_len,
> +                                     uint8_t *out_data, int *out_len)
> +{
> +    if (in_len != 2) {
> +        return false;
> +    }
> +
> +    s->poll_mask = (((uint16_t)in_data[0]) << 8) | in_data[1];
> +    return true;
> +}
> +
>  static const CudaCommand handlers[] = {
>      { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
>      { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
> +    { CUDA_SET_DEVICE_LIST, "SET_DEVICE_LIST", cuda_cmd_set_device_list },
>  };
>  
>  static void cuda_receive_packet(CUDAState *s,
> @@ -640,7 +653,6 @@ static void cuda_receive_packet(CUDAState *s,
>          cuda_send_packet_to_host(s, obuf, 7);
>          return;
>      case CUDA_FILE_SERVER_FLAG:
> -    case CUDA_SET_DEVICE_LIST:
>      case CUDA_SET_POWER_MESSAGES:
>          cuda_send_packet_to_host(s, obuf, 3);
>          return;
> @@ -847,6 +859,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp)
>  
>      s->adb_poll_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_adb_poll, s);
>      s->auto_rate_ms = 20;
> +    s->poll_mask = 0xffff;

How about calling this s->adb_poll_mask to both match adb_poll_timer and
also indicate that this is related to ADB?

>  }
>  
>  static void cuda_initfn(Object *obj)
> diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
> index 90fcb69..506f7a8 100644
> --- a/hw/ppc/mac.h
> +++ b/hw/ppc/mac.h
> @@ -111,6 +111,7 @@ typedef struct CUDAState {
>      int data_out_index;
>  
>      qemu_irq irq;
> +    uint16_t poll_mask;

Again, with this you'll need a VMStateDescription update.

>      uint8_t auto_rate_ms;
>      uint8_t autopoll;
>      uint8_t data_in[128];
> diff --git a/include/hw/input/adb.h b/include/hw/input/adb.h
> index bdfccd4..db51d03 100644
> --- a/include/hw/input/adb.h
> +++ b/include/hw/input/adb.h
> @@ -79,7 +79,7 @@ struct ADBBusState {
>  
>  int adb_request(ADBBusState *s, uint8_t *buf_out,
>                  const uint8_t *buf, int len);
> -int adb_poll(ADBBusState *s, uint8_t *buf_out);
> +int adb_poll(ADBBusState *s, uint8_t *buf_out, uint16_t poll_mask);
>  
>  #define TYPE_ADB_KEYBOARD "adb-keyboard"
>  #define TYPE_ADB_MOUSE "adb-mouse"
> diff --git a/roms/SLOF b/roms/SLOF
> index b4c9380..811277a 160000
> --- a/roms/SLOF
> +++ b/roms/SLOF
> @@ -1 +1 @@
> -Subproject commit b4c93802a5b2c72f096649c497ec9ff5708e4456
> +Subproject commit 811277ac91f674a9273e2b529791e9b75350f3e8
> diff --git a/roms/openbios b/roms/openbios
> index 3caee17..18f02b1 160000
> --- a/roms/openbios
> +++ b/roms/openbios
> @@ -1 +1 @@
> -Subproject commit 3caee1794ac3f742315823d8447d21f33ce019e9
> +Subproject commit 18f02b14de795c1aab4fe23c1810bfd0944da6aa

And these ROM changes shouldn't be included here either.


ATB,

Mark.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups
  2016-02-06 14:30   ` Hervé Poussineau
@ 2016-02-07 19:50     ` Mark Cave-Ayland
  2016-02-07 20:38       ` Hervé Poussineau
  0 siblings, 1 reply; 45+ messages in thread
From: Mark Cave-Ayland @ 2016-02-07 19:50 UTC (permalink / raw)
  To: Hervé Poussineau, qemu-devel
  Cc: Alyssa Milburn, qemu-ppc, Alexander Graf, David Gibson

On 06/02/16 14:30, Hervé Poussineau wrote:

> Hi Mark,
> 
> Le 06/02/2016 14:32, Mark Cave-Ayland a écrit :
>> On 23/01/16 20:39, Hervé Poussineau wrote:
>>
>>> Hi,
>>>
>>> This patchset cleans up a little bit the Apple CUDA emulation:
>>> - correctly reject unknown commands
>>> - correctly reject commands with wrong parameters
>>> - support changing the frequency of auto-polling
>>> - support changing device list probed in auto-poll
>>> - add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
>>> - remove unused commands (GET/SET_6805_ADDR)
>>> - remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
>>>
>>> GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once
>>> we implement the I2C bus provided by CUDA.
>>>
>>> This also fixes MacBugs hanging at startup in the absence of
>>> ADB mouse input.
>>>
>>> Hervé
>>
>> Hi Hervé,
>>
>> I've just tried to rebase your git remote onto master to run some tests
>> and it looks like due to recent changes then I get a number of
>> conflicts. Any chance that you could rebase this patchset onto master
>> and update your remote accordingly?
> 
> I've rebased this patchset. This is available at
> http://repo.or.cz/qemu/hpoussin.git branch cuda
> 
> As a bonus, you have an implementation of CUDA_GET_SET_IIC command and
> the I2C bus.
> Unfortunately, I was unable to test if it really works.

I've posted a couple of minor comments on a couple of patches, but in
general I think this is a good improvement, especially given that there
is active work fixing up more CUDA functionality.

Other than the comments mentioned above, there is also the compile fix
for patch 4 posted to the list plus I still see some IIC debugging
enabled from the git repository which outputs to stdout, e.g.

CUDA: XXX receive data from I2C [addr 48] => ff
CUDA: XXX send data to I2C [addr 40]: 05 c0

Perhaps for the moment it is best to leave out the IIC functionality
simply to get the majority of the patchset included in preparation for
more detailed work later?

With all these issues addressed in a revised v2 patchset, I'm fairly
confident I can give the Tested-by requested by David before inclusion
in ppc-next since I didn't observe any regressions on my test images
with the patchset in its current form.


ATB,

Mark.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups
  2016-02-07 19:50     ` Mark Cave-Ayland
@ 2016-02-07 20:38       ` Hervé Poussineau
  0 siblings, 0 replies; 45+ messages in thread
From: Hervé Poussineau @ 2016-02-07 20:38 UTC (permalink / raw)
  To: Mark Cave-Ayland, qemu-devel
  Cc: Alyssa Milburn, qemu-ppc, Alexander Graf, David Gibson

Le 07/02/2016 20:50, Mark Cave-Ayland a écrit :
> On 06/02/16 14:30, Hervé Poussineau wrote:
>
>> Hi Mark,
>>
>> Le 06/02/2016 14:32, Mark Cave-Ayland a écrit :
>>> On 23/01/16 20:39, Hervé Poussineau wrote:
>>>
>>>> Hi,
>>>>
>>>> This patchset cleans up a little bit the Apple CUDA emulation:
>>>> - correctly reject unknown commands
>>>> - correctly reject commands with wrong parameters
>>>> - support changing the frequency of auto-polling
>>>> - support changing device list probed in auto-poll
>>>> - add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
>>>> - remove unused commands (GET/SET_6805_ADDR)
>>>> - remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
>>>>
>>>> GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once
>>>> we implement the I2C bus provided by CUDA.
>>>>
>>>> This also fixes MacBugs hanging at startup in the absence of
>>>> ADB mouse input.
>>>>
>>>> Hervé
>>>
>>> Hi Hervé,
>>>
>>> I've just tried to rebase your git remote onto master to run some tests
>>> and it looks like due to recent changes then I get a number of
>>> conflicts. Any chance that you could rebase this patchset onto master
>>> and update your remote accordingly?
>>
>> I've rebased this patchset. This is available at
>> http://repo.or.cz/qemu/hpoussin.git branch cuda
>>
>> As a bonus, you have an implementation of CUDA_GET_SET_IIC command and
>> the I2C bus.
>> Unfortunately, I was unable to test if it really works.
>
> I've posted a couple of minor comments on a couple of patches, but in
> general I think this is a good improvement, especially given that there
> is active work fixing up more CUDA functionality.
>
> Other than the comments mentioned above, there is also the compile fix
> for patch 4 posted to the list plus I still see some IIC debugging
> enabled from the git repository which outputs to stdout, e.g.
>
> CUDA: XXX receive data from I2C [addr 48] => ff
> CUDA: XXX send data to I2C [addr 40]: 05 c0
>
> Perhaps for the moment it is best to leave out the IIC functionality
> simply to get the majority of the patchset included in preparation for
> more detailed work later?

I2C bus is not meant to be committed right now. That's only a proof a concept of how things can work.
You can note that commit message was starting with "[RFC]".

>
> With all these issues addressed in a revised v2 patchset, I'm fairly
> confident I can give the Tested-by requested by David before inclusion
> in ppc-next since I didn't observe any regressions on my test images
> with the patchset in its current form.

Patchset v2 has just been sent a few minutes ago. Thanks for you review!

Hervé

^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2016-02-07 20:38 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-23 20:39 [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups Hervé Poussineau
2016-01-23 20:39 ` [Qemu-devel] [PATCH 01/13] cuda: add a framework to handle commands Hervé Poussineau
2016-01-24 23:10   ` David Gibson
2016-01-23 20:39 ` [Qemu-devel] [PATCH 02/13] cuda: reject unknown commands Hervé Poussineau
2016-01-24 23:12   ` David Gibson
2016-01-23 20:40 ` [Qemu-devel] [PATCH 03/13] cuda: port AUTOPOLL command to new framework Hervé Poussineau
2016-01-24 23:13   ` David Gibson
2016-01-23 20:40 ` [Qemu-devel] [PATCH 04/13] cuda: port SET_AUTO_RATE " Hervé Poussineau
2016-01-24 18:33   ` Hervé Poussineau
2016-01-24 23:21   ` David Gibson
2016-02-07 19:27   ` Mark Cave-Ayland
2016-01-23 20:40 ` [Qemu-devel] [PATCH 05/13] cuda: port SET_DEVICE_LIST " Hervé Poussineau
2016-01-24 23:23   ` David Gibson
2016-02-07 19:35   ` Mark Cave-Ayland
2016-01-23 20:40 ` [Qemu-devel] [PATCH 06/13] cuda: port POWERDOWN " Hervé Poussineau
2016-01-24 23:24   ` David Gibson
2016-01-23 20:40 ` [Qemu-devel] [PATCH 07/13] cuda: port RESET_SYSTEM " Hervé Poussineau
2016-01-24 23:24   ` David Gibson
2016-01-23 20:40 ` [Qemu-devel] [PATCH 08/13] cuda: port FILE_SERVER_FLAG " Hervé Poussineau
2016-01-24 23:25   ` David Gibson
2016-01-23 20:40 ` [Qemu-devel] [PATCH 09/13] cuda: port SET_POWER_MESSAGES " Hervé Poussineau
2016-01-24 23:26   ` David Gibson
2016-01-23 20:40 ` [Qemu-devel] [PATCH 10/13] cuda: port GET_TIME " Hervé Poussineau
2016-01-24 23:27   ` David Gibson
2016-01-23 20:40 ` [Qemu-devel] [PATCH 11/13] cuda: port SET_TIME " Hervé Poussineau
2016-01-24 23:27   ` David Gibson
2016-01-23 20:40 ` [Qemu-devel] [PATCH 12/13] cuda: remove GET_6805_ADDR command Hervé Poussineau
2016-01-25  8:35   ` Alyssa Milburn
2016-01-25  8:48     ` Mark Cave-Ayland
2016-01-25  9:51       ` Alyssa Milburn
2016-01-23 20:40 ` [Qemu-devel] [PATCH 13/13] cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands Hervé Poussineau
2016-01-25 10:00   ` Alyssa Milburn
2016-01-24 23:29 ` [Qemu-devel] [PATCH 00/13] cuda: misc fixes and cleanups David Gibson
2016-01-25  9:58 ` Alyssa Milburn
2016-01-25 13:08   ` Mark Cave-Ayland
2016-01-25 22:08   ` Hervé Poussineau
2016-01-26 11:32     ` [Qemu-devel] [Qemu-ppc] " BALATON Zoltan
2016-01-27 22:35       ` Hervé Poussineau
2016-01-28  1:45         ` BALATON Zoltan
2016-01-28 13:43           ` Hervé Poussineau
2016-02-04 20:15 ` [Qemu-devel] " Alyssa Milburn
2016-02-06 13:32 ` Mark Cave-Ayland
2016-02-06 14:30   ` Hervé Poussineau
2016-02-07 19:50     ` Mark Cave-Ayland
2016-02-07 20:38       ` Hervé Poussineau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).