From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNUM5-0006Q7-OA for qemu-devel@nongnu.org; Sun, 24 Jan 2016 18:46:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNUM2-0000rl-AE for qemu-devel@nongnu.org; Sun, 24 Jan 2016 18:46:01 -0500 Date: Mon, 25 Jan 2016 10:27:05 +1100 From: David Gibson Message-ID: <20160124232705.GW27454@voom.redhat.com> References: <1453581610-23179-1-git-send-email-hpoussin@reactos.org> <1453581610-23179-11-git-send-email-hpoussin@reactos.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8bLSEqNM5P+Jqlqx" Content-Disposition: inline In-Reply-To: <1453581610-23179-11-git-send-email-hpoussin@reactos.org> Subject: Re: [Qemu-devel] [PATCH 10/13] cuda: port GET_TIME command to new framework List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Herv=E9?= Poussineau Cc: qemu-ppc@nongnu.org, Alyssa Milburn , Mark Cave-Ayland , qemu-devel@nongnu.org, Alexander Graf --8bLSEqNM5P+Jqlqx Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 23, 2016 at 09:40:07PM +0100, Herv=E9 Poussineau wrote: > Signed-off-by: Herv=E9 Poussineau Reviewed-by: David Gibson > --- > hw/misc/macio/cuda.c | 29 +++++++++++++++++++++-------- > 1 file changed, 21 insertions(+), 8 deletions(-) >=20 > 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; > } > =20 > +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 !=3D 0) { > + return false; > + } > + > + ti =3D s->tick_offset + (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) > + / get_ticks_per_sec()); > + out_data[0] =3D ti >> 24; > + out_data[1] =3D ti >> 16; > + out_data[2] =3D ti >> 8; > + out_data[3] =3D ti; > + *out_len =3D 4; > + return true; > +} > + > static const CudaCommand handlers[] =3D { > { 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[] =3D { > 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 }, > }; > =20 > static void cuda_receive_packet(CUDAState *s, > @@ -702,14 +723,6 @@ static void cuda_receive_packet(CUDAState *s, > s->tick_offset =3D 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 =3D s->tick_offset + (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) /= get_ticks_per_sec()); > - obuf[3] =3D ti >> 24; > - obuf[4] =3D ti >> 16; > - obuf[5] =3D ti >> 8; > - obuf[6] =3D ti; > - cuda_send_packet_to_host(s, obuf, 7); > - return; > case CUDA_COMBINED_FORMAT_IIC: > obuf[0] =3D ERROR_PACKET; > obuf[1] =3D 0x5; --=20 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 --8bLSEqNM5P+Jqlqx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWpV3JAAoJEGw4ysog2bOSP+UP/jcy3Yub2CZKQy+SIRR0O7XL Uo+m3CMNoKko78RAUIwUvvHHj4rTKr4D9LBby+YZmnXrPuExCV9KUIVB95uNjo+z sXQAByH6fZhaKWZgADSCBVA+XsMPYvRh4NBU8xJqMRRHClt1L3oBxm0ellODu2uk gaXjQg51D3EKPZa0BTchn+HwcmewG84tvy6G33cy7RUiJ0GQPWCynivNLF2GW/bZ YSrOwqBFDcfMny02BbxF9ceRqj4uTpToRZgt/6MD+lvDuV7bFxM5HVvubc4vdUF8 uMddlSOo4pHDMx147iOz3KD6w6TkqDvza3jHM4TOvbp0X3M7T9sp6VZiMUvFNdLM D+VIe6/3FwoHqhdV+1d3GnnjfUE04/mfCETkdX5HYEpL90992ektJ3lqswhO5hSp PYhLve9nG1uprXrFhkuaKg/ptIHcgdGDrq9jrzEk2kK0sqBxfinkNUAW9x1MKtzo FDViPPmG/QO7HpxAdJj4d0MhGNH/6wmJ1I2hhpbPX9n5WE8suG59i6GhbOWrap11 do5/4gRVV3TdXR/Y/NS4gSYEdX4/oVGSYi+AASFIeZWxugFE163HfJecojn/EUFX 0CgV/R0SwZziMH9rg/ychzTrxeHNgyCV1tYTzMjdhz8SO37nI+vYtacwD3qjR8KZ lJr61p7CXSuQeL1mRIZ6 =5ZRW -----END PGP SIGNATURE----- --8bLSEqNM5P+Jqlqx--