* [PATCH v2] hw/m68k/mcf5206.c: Switch to transaction-based ptimer API
@ 2019-10-21 14:06 Peter Maydell
2019-10-22 11:40 ` Thomas Huth
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2019-10-21 14:06 UTC (permalink / raw)
To: qemu-devel; +Cc: Thomas Huth, Philippe Mathieu-Daudé, Richard Henderson
Switch the mcf5206 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>
---
Changes v1->v2:
* turn the early-exit in m5206_timer_recalibrate() into a goto-exit
so we can end the ptimer transaction
I'm not resending the whole v1 patchset, since this patch is
independent of the others in the series and I'm planning to
take them through my tree anyway.
---
hw/m68k/mcf5206.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c
index a49096367cb..b155dd81705 100644
--- a/hw/m68k/mcf5206.c
+++ b/hw/m68k/mcf5206.c
@@ -8,7 +8,6 @@
#include "qemu/osdep.h"
#include "qemu/error-report.h"
-#include "qemu/main-loop.h"
#include "cpu.h"
#include "hw/hw.h"
#include "hw/irq.h"
@@ -57,10 +56,12 @@ static void m5206_timer_recalibrate(m5206_timer_state *s)
int prescale;
int mode;
+ ptimer_transaction_begin(s->timer);
ptimer_stop(s->timer);
- if ((s->tmr & TMR_RST) == 0)
- return;
+ if ((s->tmr & TMR_RST) == 0) {
+ goto exit;
+ }
prescale = (s->tmr >> 8) + 1;
mode = (s->tmr >> 1) & 3;
@@ -78,6 +79,8 @@ static void m5206_timer_recalibrate(m5206_timer_state *s)
ptimer_set_limit(s->timer, s->trr, 0);
ptimer_run(s->timer, 0);
+exit:
+ ptimer_transaction_commit(s->timer);
}
static void m5206_timer_trigger(void *opaque)
@@ -123,7 +126,9 @@ static void m5206_timer_write(m5206_timer_state *s, uint32_t addr, uint32_t val)
s->tcr = val;
break;
case 0xc:
+ ptimer_transaction_begin(s->timer);
ptimer_set_count(s->timer, val);
+ ptimer_transaction_commit(s->timer);
break;
case 0x11:
s->ter &= ~val;
@@ -137,11 +142,9 @@ static void m5206_timer_write(m5206_timer_state *s, uint32_t addr, uint32_t val)
static m5206_timer_state *m5206_timer_init(qemu_irq irq)
{
m5206_timer_state *s;
- QEMUBH *bh;
s = g_new0(m5206_timer_state, 1);
- bh = qemu_bh_new(m5206_timer_trigger, s);
- s->timer = ptimer_init_with_bh(bh, PTIMER_POLICY_DEFAULT);
+ s->timer = ptimer_init(m5206_timer_trigger, s, PTIMER_POLICY_DEFAULT);
s->irq = irq;
m5206_timer_reset(s);
return s;
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] hw/m68k/mcf5206.c: Switch to transaction-based ptimer API
2019-10-21 14:06 [PATCH v2] hw/m68k/mcf5206.c: Switch to transaction-based ptimer API Peter Maydell
@ 2019-10-22 11:40 ` Thomas Huth
2019-10-24 12:20 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2019-10-22 11:40 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Thomas Huth, Philippe Mathieu-Daudé, Richard Henderson
On 21/10/2019 16.06, Peter Maydell wrote:
> Switch the mcf5206 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>
> ---
> Changes v1->v2:
> * turn the early-exit in m5206_timer_recalibrate() into a goto-exit
> so we can end the ptimer transaction
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] hw/m68k/mcf5206.c: Switch to transaction-based ptimer API
2019-10-22 11:40 ` Thomas Huth
@ 2019-10-24 12:20 ` Peter Maydell
0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2019-10-24 12:20 UTC (permalink / raw)
To: Thomas Huth
Cc: Thomas Huth, Philippe Mathieu-Daudé,
Richard Henderson, QEMU Developers
On Tue, 22 Oct 2019 at 12:40, Thomas Huth <th.huth@posteo.de> wrote:
>
> On 21/10/2019 16.06, Peter Maydell wrote:
> > Switch the mcf5206 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>
> > ---
> > Changes v1->v2:
> > * turn the early-exit in m5206_timer_recalibrate() into a goto-exit
> > so we can end the ptimer transaction
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-24 13:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 14:06 [PATCH v2] hw/m68k/mcf5206.c: Switch to transaction-based ptimer API Peter Maydell
2019-10-22 11:40 ` Thomas Huth
2019-10-24 12:20 ` Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.