qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Alexander Graf <agraf@suse.de>
Cc: "aik@ozlabs.ru" <aik@ozlabs.ru>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
	"mdroth@us.ibm.com" <mdroth@us.ibm.com>,
	"amit.shah@redhat.com" <amit.shah@redhat.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCHv2 8/8] pseries: Export RTC time via QOM
Date: Wed, 28 Jan 2015 16:28:24 +1100	[thread overview]
Message-ID: <20150128052824.GA14681@voom> (raw)
In-Reply-To: <7B1D741A-D9FD-4CE8-B6EB-C37D89BE6B5B@suse.de>

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

On Tue, Dec 23, 2014 at 07:33:30AM +0100, Alexander Graf wrote:
> 
> 
> 
> > Am 23.12.2014 um 04:14 schrieb David Gibson <david@gibson.dropbear.id.au>:
> > 
> >> On Tue, Dec 23, 2014 at 01:26:58AM +0100, Alexander Graf wrote:
> >> 
> >> 
> >>> On 23.12.14 01:17, David Gibson wrote:
> >>> On x86, the guest's RTC can be read with QMP, either from the RTC device's
> >>> "date" property or via the "rtc-time" property on the machine (which is an
> >>> alias to the former).  This is set up in the mc146818rtc driver, and
> >>> doesn't work on other targets.
> >>> 
> >>> This patch adds a similar "date" property to the pseries machine's RTAS RTC
> >>> and adds a compatible alias to the machine.
> >>> 
> >>> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> >> 
> >> Very nice, can we somehow get rid of an exported spapr_rtc_read() with
> >> this as well?
> > 
> > Uhhh.. we could, but I really don't like the idea.
> > 
> > It seems perverse to encode the current time into JSON, just so we can
> > decode it into a struct tm again in the events code.
> 
> I don't understand - what does JSON have to do with it?

My misunderstanding, it doesn't actually deal with JSON here.  But if
I'm following how this would work, it would be a way of getting a
struct tm from point A to point B, by:
  1. building a temporary visitor object (object_property_get_qobject)
  2. finding and calling the general property getter callback
     (object_property_get)
  3. Making multiple callbacks into the visitor with pieces of point
     A's struct tm (property_get_tm)
  4. In those visitor callbacks building an associative array
     (qmp_output_start_struct), then filling it with object wrappers
     around integers (qmp_output_type_int)
  5. Digging through the nested qobject thus constructed to extract
     the various ints and put them into point B's struct tm
     (hypothetical object_property_get_tm)
  6. Cleaning up the various temporaries created during the process


Seriously, w. t. f.!?

Maybe there's a simpler way of doing this via the object property
mechanism, but it's sure as hell not obvious to me.

-- 
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: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-01-28  5:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-23  0:16 [Qemu-devel] [PATCHv2 0/8] pseries: Fix and extend PAPR RTC implementation David Gibson
2014-12-23  0:16 ` [Qemu-devel] [PATCHv2 1/8] pseries: Move sPAPR RTC code into its own file David Gibson
2014-12-23  0:16 ` [Qemu-devel] [PATCHv2 2/8] pseries: Add more parameter validation in RTAS time of day functions David Gibson
2014-12-23  0:16 ` [Qemu-devel] [PATCHv2 3/8] pseries: Add spapr_rtc_read() helper function David Gibson
2014-12-23  0:17 ` [Qemu-devel] [PATCHv2 4/8] Generalize QOM publishing of date and time from mc146818rtc.c David Gibson
2014-12-23  0:17 ` [Qemu-devel] [PATCHv2 5/8] pseries: Make RTAS time of day functions respect -rtc options David Gibson
2014-12-23  0:17 ` [Qemu-devel] [PATCHv2 6/8] pseries: Make the PAPR RTC a qdev device David Gibson
2014-12-23  0:17 ` [Qemu-devel] [PATCHv2 7/8] pseries: Move rtc_offset into RTC device's state structure David Gibson
2014-12-23  0:30   ` Alexander Graf
2014-12-23  3:56     ` David Gibson
2014-12-23  6:41       ` Alexander Graf
2015-01-28  5:31         ` David Gibson
2014-12-23  0:17 ` [Qemu-devel] [PATCHv2 8/8] pseries: Export RTC time via QOM David Gibson
2014-12-23  0:26   ` Alexander Graf
2014-12-23  3:14     ` David Gibson
2014-12-23  6:33       ` Alexander Graf
2015-01-28  5:28         ` David Gibson [this message]
2014-12-23  0:31 ` [Qemu-devel] [PATCHv2 0/8] pseries: Fix and extend PAPR RTC implementation Alexander Graf

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20150128052824.GA14681@voom \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=amit.shah@redhat.com \
    --cc=mdroth@us.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is 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).