[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v8 9/9] qdev-monitor: print the device's clock with info qtre
From: |
Alistair Francis |
Subject: |
Re: [PATCH v8 9/9] qdev-monitor: print the device's clock with info qtree |
Date: |
Wed, 26 Feb 2020 14:49:40 -0800 |
On Tue, Feb 25, 2020 at 5:52 AM Damien Hedde <address@hidden> wrote:
>
> This prints the clocks attached to a DeviceState when using
> "info qtree" monitor command. For every clock, it displays the
> direction, the name and if the clock is forwarded. For input clock,
> it displays also the frequency.
>
> This is based on the original work of Frederic Konrad.
>
> Here follows a sample of `info qtree` output on xilinx_zynq machine
> after linux boot with only one uart clocked:
> > bus: main-system-bus
> > type System
> > [...]
> > dev: cadence_uart, id ""
> > gpio-out "sysbus-irq" 1
> > clock-in "refclk" freq_hz=0.000000e+00
> > chardev = ""
> > mmio 00000000e0001000/0000000000001000
> > dev: cadence_uart, id ""
> > gpio-out "sysbus-irq" 1
> > clock-in "refclk" freq_hz=1.375661e+07
> > chardev = "serial0"
> > mmio 00000000e0000000/0000000000001000
> > [...]
> > dev: xilinx,zynq_slcr, id ""
> > clock-out "uart1_ref_clk" freq_hz=0.000000e+00
> > clock-out "uart0_ref_clk" freq_hz=1.375661e+07
> > clock-in "ps_clk" freq_hz=3.333333e+07
> > mmio 00000000f8000000/0000000000001000
>
> Signed-off-by: Damien Hedde <address@hidden>
> Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> Reviewed-by: Peter Maydell <address@hidden>
Reviewed-by: Alistair Francis <address@hidden>
Alistair
> ---
>
> v7:
> + print output clocks frequencies too
> + add sample of qtree message above
> + display frequencies in floating-point
> ---
> qdev-monitor.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/qdev-monitor.c b/qdev-monitor.c
> index 8ce71a206b..1d84b4e416 100644
> --- a/qdev-monitor.c
> +++ b/qdev-monitor.c
> @@ -38,6 +38,7 @@
> #include "migration/misc.h"
> #include "migration/migration.h"
> #include "qemu/cutils.h"
> +#include "hw/clock.h"
>
> /*
> * Aliases were a bad idea from the start. Let's keep them
> @@ -736,6 +737,7 @@ static void qdev_print(Monitor *mon, DeviceState *dev,
> int indent)
> ObjectClass *class;
> BusState *child;
> NamedGPIOList *ngl;
> + NamedClockList *ncl;
>
> qdev_printf("dev: %s, id \"%s\"\n", object_get_typename(OBJECT(dev)),
> dev->id ? dev->id : "");
> @@ -750,6 +752,13 @@ static void qdev_print(Monitor *mon, DeviceState *dev,
> int indent)
> ngl->num_out);
> }
> }
> + QLIST_FOREACH(ncl, &dev->clocks, node) {
> + qdev_printf("clock-%s%s \"%s\" freq_hz=%e\n",
> + ncl->output ? "out" : "in",
> + ncl->alias ? " (alias)" : "",
> + ncl->name,
> + CLOCK_PERIOD_TO_HZ(1.0 * clock_get(ncl->clock)));
> + }
> class = object_get_class(OBJECT(dev));
> do {
> qdev_print_props(mon, dev, DEVICE_CLASS(class)->props_, indent);
> --
> 2.25.1
>
>
- [PATCH v8 0/9] Clock framework API, Damien Hedde, 2020/02/25
- [PATCH v8 1/9] hw/core/clock: introduce clock object, Damien Hedde, 2020/02/25
- [PATCH v8 2/9] hw/core/clock-vmstate: define a vmstate entry for clock state, Damien Hedde, 2020/02/25
- [PATCH v8 4/9] qdev-clock: introduce an init array to ease the device construction, Damien Hedde, 2020/02/25
- [PATCH v8 3/9] qdev: add clock input&output support to devices., Damien Hedde, 2020/02/25
- [PATCH v8 9/9] qdev-monitor: print the device's clock with info qtree, Damien Hedde, 2020/02/25
- Re: [PATCH v8 9/9] qdev-monitor: print the device's clock with info qtree,
Alistair Francis <=
- [PATCH v8 6/9] hw/misc/zynq_slcr: add clock generation for uarts, Damien Hedde, 2020/02/25
- [PATCH v8 7/9] hw/char/cadence_uart: add clock support, Damien Hedde, 2020/02/25
- [PATCH v8 8/9] hw/arm/xilinx_zynq: connect uart clocks to slcr, Damien Hedde, 2020/02/25
- [PATCH v8 5/9] docs/clocks: add device's clock documentation, Damien Hedde, 2020/02/25