From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:57423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqzaP-0006Ty-9n for qemu-devel@nongnu.org; Tue, 09 Aug 2011 23:36:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QqzaL-0007DA-CW for qemu-devel@nongnu.org; Tue, 09 Aug 2011 23:36:05 -0400 Received: from ozlabs.org ([203.10.76.45]:54622) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqzaL-0007Cy-25 for qemu-devel@nongnu.org; Tue, 09 Aug 2011 23:36:01 -0400 Date: Wed, 10 Aug 2011 13:35:53 +1000 From: David Gibson Message-ID: <20110810033553.GJ23511@yookeroo.fritz.box> References: <1312907970-15440-1-git-send-email-agraf@suse.de> <1312907970-15440-4-git-send-email-agraf@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1312907970-15440-4-git-send-email-agraf@suse.de> Subject: Re: [Qemu-devel] [PATCH 3/3] PPC: SPAPR: Use KVM function for time info List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: paulus@samba.org, qemu-devel@nongnu.org On Tue, Aug 09, 2011 at 06:39:30PM +0200, Alexander Graf wrote: > One of the things we can't fake on PPC is the timer speed. So > we need to extract the frequency information from the host and > put it back into the guest device tree. > > Luckily, we already have functions for that from the non-pseries > targets, so all we need to do is to connect the dots and the guest > suddenly gets to know its real timer speeds. > > Signed-off-by: Alexander Graf > --- > hw/spapr.c | 8 ++++---- > 1 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/hw/spapr.c b/hw/spapr.c > index d56697a..a73f38a 100644 > --- a/hw/spapr.c > +++ b/hw/spapr.c > @@ -140,6 +140,8 @@ static void *spapr_create_fdt_skel(const char *cpu_model, > char *nodename; > uint32_t segs[] = {cpu_to_be32(28), cpu_to_be32(40), > 0xffffffff, 0xffffffff}; > + uint32_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TIMEBASE_FREQ; > + uint32_t cpufreq = kvm_enabled() ? kvmppc_get_clockfreq() : 1000000000; Um.. I see the kvmppc_get_tbfreq() function but not the kvmppc_get_clockfreq() function in my tree (pulled from upstream this morning). Is that something new in your ppc patch queue? > if (asprintf(&nodename, "%s@%x", modelname, index) < 0) { > fprintf(stderr, "Allocation failure\n"); > @@ -158,10 +160,8 @@ static void *spapr_create_fdt_skel(const char *cpu_model, > env->dcache_line_size))); > _FDT((fdt_property_cell(fdt, "icache-block-size", > env->icache_line_size))); > - _FDT((fdt_property_cell(fdt, "timebase-frequency", TIMEBASE_FREQ))); > - /* Hardcode CPU frequency for now. It's kind of arbitrary on > - * full emu, for kvm we should copy it from the host */ > - _FDT((fdt_property_cell(fdt, "clock-frequency", 1000000000))); > + _FDT((fdt_property_cell(fdt, "timebase-frequency", tbfreq))); > + _FDT((fdt_property_cell(fdt, "clock-frequency", cpufreq))); > _FDT((fdt_property_cell(fdt, "ibm,slb-size", env->slb_nr))); > _FDT((fdt_property(fdt, "ibm,pft-size", > pft_size_prop, sizeof(pft_size_prop)))); -- 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