qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/3] ppc: Generalize the kvmppc_get_clockfreq()


From: David Gibson
Subject: Re: [Qemu-devel] [PATCH 1/3] ppc: Generalize the kvmppc_get_clockfreq() function
Date: Tue, 11 Oct 2011 15:29:25 +1100
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Sep 30, 2011 at 08:06:59PM +0200, Alexander Graf wrote:
> 
> Am 30.09.2011 um 09:50 schrieb David Gibson <address@hidden>:
> 
> > Currently the kvmppc_get_clockfreq() function reads the host's clock
> > frequency from /proc/device-tree, which is useful to past to the guest
> > in KVM setups.  However, there are some other host properties
> > advertised in the device tree which can also be relevant to the
> > guests.
> > 
> > This patch, therefore, replaces kvmppc_get_clockfreq() which can
> > retrieve any named, single integer property from the host device
> > tree's CPU node.
> > 
> > Signed-off-by: David Gibson <address@hidden>
> > ---
> > hw/ppc440_bamboo.c     |    2 +-
> > hw/ppce500_mpc8544ds.c |    2 +-
> > hw/spapr.c             |   13 ++++++++++++-
> > target-ppc/kvm.c       |   30 +++++++++++++++++++-----------
> > target-ppc/kvm_ppc.h   |    4 ++--
> > 5 files changed, 35 insertions(+), 16 deletions(-)
> > 
> > diff --git a/hw/ppc440_bamboo.c b/hw/ppc440_bamboo.c
> > index 1523764..df85da0 100644
> > --- a/hw/ppc440_bamboo.c
> > +++ b/hw/ppc440_bamboo.c
> > @@ -83,7 +83,7 @@ static int bamboo_load_device_tree(target_phys_addr_t 
> > addr,
> >      * the correct frequencies. */
> >     if (kvm_enabled()) {
> >         tb_freq = kvmppc_get_tbfreq();
> > -        clock_freq = kvmppc_get_clockfreq();
> > +        clock_freq = kvmppc_read_int_cpu_dt("clock-frequency");
> 
> Hrm. I was actually trying to abstract host dt handling away
> here. The idea was to use the helper inside of kvm.c, but still
> expose specific functions for specific properties.

Ok, fair enough.

> >     }
> > 
> >     qemu_devtree_setprop_cell(fdt, "/cpus/address@hidden", 
> > "clock-frequency",
> > diff --git a/hw/ppce500_mpc8544ds.c b/hw/ppce500_mpc8544ds.c
> > index f00367e..eb37c3d 100644
> > --- a/hw/ppce500_mpc8544ds.c
> > +++ b/hw/ppce500_mpc8544ds.c
> > @@ -112,7 +112,7 @@ static int mpc8544_load_device_tree(CPUState *env,
> > 
> >     if (kvm_enabled()) {
> >         /* Read out host's frequencies */
> > -        clock_freq = kvmppc_get_clockfreq();
> > +        clock_freq = kvmppc_read_int_cpu_dt("clock-frequency");
> >         tb_freq = kvmppc_get_tbfreq();
> > 
> >         /* indicate KVM hypercall interface */
> > diff --git a/hw/spapr.c b/hw/spapr.c
> > index 9a3a1ea..ea5690e 100644
> > --- a/hw/spapr.c
> > +++ b/hw/spapr.c
> > @@ -185,7 +185,8 @@ static void *spapr_create_fdt_skel(const char 
> > *cpu_model,
> >         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;
> > +        uint32_t cpufreq = kvm_enabled() ?
> > +            kvmppc_read_int_cpu_dt("clock-frequency") : 1000000000;
> > 
> >         if ((index % smt) != 0) {
> >             continue;
> > @@ -233,6 +234,16 @@ static void *spapr_create_fdt_skel(const char 
> > *cpu_model,
> >                                segs, sizeof(segs))));
> >         }
> > 
> > +        /* Advertise VMX/VSX (vector extensions) if available */
> > +        if (vmx) {
> > +            _FDT((fdt_property_cell(fdt, "ibm,vmx", vmx)));
> > +        }
> > +
> > +        /* Advertise DFP (Decimal Floating Point) if available */
> > +        if (dfp) {
> > +            _FDT((fdt_property_cell(fdt, "ibm,dfp", dfp)));
> > +        }
> > +
> 
> Please make sure that your patch set is bisectable :)

Oops, bad split - that hunk was supposed to be in the other patch of
the series.  I'll resend with both the above fixed momentarily.

-- 
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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]