From: Alistair Francis <alistair23@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Jason Wang <jasowang@redhat.com>,
Alistair Francis <alistair@alistair23.me>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
qemu-arm <qemu-arm@nongnu.org>,
"open list:New World" <qemu-ppc@nongnu.org>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH 2/3] hw/timer/xilinx_timer.c: Switch to transaction-based ptimer API
Date: Thu, 17 Oct 2019 15:00:59 -0700 [thread overview]
Message-ID: <CAKmqyKMVf_htgF5MpKVV5gsD0iKasaPdKOQmgWTRL9i4JsYDfg@mail.gmail.com> (raw)
In-Reply-To: <20191017132122.4402-3-peter.maydell@linaro.org>
On Thu, Oct 17, 2019 at 6:50 AM Peter Maydell <peter.maydell@linaro.org> wrote:
>
> Switch the xilinx_timer code away from bottom-half based ptimers to
> the new transaction-based ptimer API. This just requires adding
> begin/commit calls around the various places that modify the ptimer
> state, and using the new ptimer_init() function to create the timer.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> hw/timer/xilinx_timer.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c
> index 92dbff304d9..7191ea54f58 100644
> --- a/hw/timer/xilinx_timer.c
> +++ b/hw/timer/xilinx_timer.c
> @@ -28,7 +28,6 @@
> #include "hw/ptimer.h"
> #include "hw/qdev-properties.h"
> #include "qemu/log.h"
> -#include "qemu/main-loop.h"
> #include "qemu/module.h"
>
> #define D(x)
> @@ -52,7 +51,6 @@
>
> struct xlx_timer
> {
> - QEMUBH *bh;
> ptimer_state *ptimer;
> void *parent;
> int nr; /* for debug. */
> @@ -134,6 +132,7 @@ timer_read(void *opaque, hwaddr addr, unsigned int size)
> return r;
> }
>
> +/* Must be called inside ptimer transaction block */
> static void timer_enable(struct xlx_timer *xt)
> {
> uint64_t count;
> @@ -174,8 +173,11 @@ timer_write(void *opaque, hwaddr addr,
> value &= ~TCSR_TINT;
>
> xt->regs[addr] = value & 0x7ff;
> - if (value & TCSR_ENT)
> + if (value & TCSR_ENT) {
> + ptimer_transaction_begin(xt->ptimer);
> timer_enable(xt);
> + ptimer_transaction_commit(xt->ptimer);
> + }
> break;
>
> default:
> @@ -220,9 +222,10 @@ static void xilinx_timer_realize(DeviceState *dev, Error **errp)
>
> xt->parent = t;
> xt->nr = i;
> - xt->bh = qemu_bh_new(timer_hit, xt);
> - xt->ptimer = ptimer_init_with_bh(xt->bh, PTIMER_POLICY_DEFAULT);
> + xt->ptimer = ptimer_init(timer_hit, xt, PTIMER_POLICY_DEFAULT);
> + ptimer_transaction_begin(xt->ptimer);
> ptimer_set_freq(xt->ptimer, t->freq_hz);
> + ptimer_transaction_commit(xt->ptimer);
> }
>
> memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t, "xlnx.xps-timer",
> --
> 2.20.1
>
>
next prev parent reply other threads:[~2019-10-17 22:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-17 13:21 [PATCH 0/3] Convert ppc and microblaze devices to new ptimer API Peter Maydell
2019-10-17 13:21 ` [PATCH 1/3] hw/net/fsl_etsec/etsec.c: Switch to transaction-based " Peter Maydell
2019-10-17 14:13 ` Richard Henderson
2019-10-17 14:57 ` Philippe Mathieu-Daudé
2019-10-17 22:00 ` Alistair Francis
2019-10-17 13:21 ` [PATCH 2/3] hw/timer/xilinx_timer.c: " Peter Maydell
2019-10-17 14:14 ` Richard Henderson
2019-10-17 14:56 ` Philippe Mathieu-Daudé
2019-10-17 15:03 ` Peter Maydell
2019-10-17 15:24 ` Philippe Mathieu-Daudé
2019-10-17 22:00 ` Alistair Francis [this message]
2019-10-17 13:21 ` [PATCH 3/3] hw/dma/xilinx_axidma.c: " Peter Maydell
2019-10-17 14:16 ` Richard Henderson
2019-10-17 15:01 ` Philippe Mathieu-Daudé
2019-10-17 15:06 ` Peter Maydell
2019-10-17 15:25 ` Philippe Mathieu-Daudé
2019-10-17 22:02 ` Alistair Francis
2019-10-24 12:16 ` [PATCH 0/3] Convert ppc and microblaze devices to new " Peter Maydell
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=CAKmqyKMVf_htgF5MpKVV5gsD0iKasaPdKOQmgWTRL9i4JsYDfg@mail.gmail.com \
--to=alistair23@gmail.com \
--cc=alistair@alistair23.me \
--cc=david@gibson.dropbear.id.au \
--cc=edgar.iglesias@gmail.com \
--cc=jasowang@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--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).