All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Misc OpenRISC fixes for 9.2.0
@ 2024-11-23 10:38 Stafford Horne
  2024-11-23 10:38 ` [PATCH 1/2] hw/openrisc/openrisc_sim: keep serial@90000000 as default Stafford Horne
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Stafford Horne @ 2024-11-23 10:38 UTC (permalink / raw)
  To: QEMU Development; +Cc: Stafford Horne

This series has 2 fixes for OpenRISC that came in over that past few months.

Ahmad Fatoum (1):
  hw/openrisc/openrisc_sim: keep serial@90000000 as default

Joel Holdsworth (1):
  hw/openrisc: Fixed undercounting of TTCR in continuous mode

 hw/openrisc/cputimer.c     | 26 +++++++++++++++-----------
 hw/openrisc/openrisc_sim.c | 13 ++++++++-----
 2 files changed, 23 insertions(+), 16 deletions(-)

-- 
2.47.0



^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [PATCH 2/2] hw/openrisc: Fixed undercounting of TTCR in continuous mode
@ 2024-12-19 20:08 Joel Holdsworth
  2024-12-19 21:50 ` Stafford Horne
  0 siblings, 1 reply; 16+ messages in thread
From: Joel Holdsworth @ 2024-12-19 20:08 UTC (permalink / raw)
  To: Stafford Horne, Richard Henderson; +Cc: qemu-devel@nongnu.org

> > > > +        /* Zero the count by applying a negative offset to the counter */
> > > > +        or1k_timer->ttcr_offset += UINT32_MAX - (cpu->env.ttmr & TTMR_TP);
> > >
> > > Since UINT32_MAX is -1 in this context, this appears to be off-by-one.
> > > I think -(ttmr & mask) alone is correct.
> > 
> > Thanks, I did send a mail to Joel asking about this bit.  He didn't respond for 2
> > weeks to I just sent the patch as is as it appears to work.  As I understand,
> > yes UINT32_MAX is just -1.  But why the -1?  I guess it's because after
> > ttcr_offset is updated we call cpu_openrisc_timer_update() which calls
> > cpu_openrisc_count_update() to update ttcr.  Since a few _ns would have passed
> > and we are rounding up it will update ttcr to 0.
> >
> > But maybe I am reading too much into it.
>
> I think you're reading too much into it -- I just think it's a bug which isn't particularly noticeable because the clock is only off by 1ns.

Richard is correct. It should be:

or1k_timer->ttcr_offset += -(cpu->env.ttmr & TTMR_TP);

Stafford: sorry for not being responsive. I've been very busy lately, and it's been several months since I touched anything OpenRISC-related. Are you able to push this the rest of the way through the acceptance process? I had understood that you were looking for a more elaborate overhaul of the OpenRISC timer design which I haven't had time to work on. But if the patch can go forward in its current form, I think the improvement is worth having even it doesn't address other design issues.

Joel

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-12-19 21:51 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-23 10:38 [PATCH 0/2] Misc OpenRISC fixes for 9.2.0 Stafford Horne
2024-11-23 10:38 ` [PATCH 1/2] hw/openrisc/openrisc_sim: keep serial@90000000 as default Stafford Horne
2024-11-25 14:02   ` Peter Maydell
2024-12-01  6:44     ` Stafford Horne
2024-12-01  6:57       ` Stafford Horne
2024-12-02 10:54         ` Peter Maydell
2024-11-23 10:38 ` [PATCH 2/2] hw/openrisc: Fixed undercounting of TTCR in continuous mode Stafford Horne
2024-11-23 13:39   ` Richard Henderson
2024-11-23 17:11     ` Stafford Horne
2024-11-23 21:11       ` Richard Henderson
2024-11-23 12:12 ` [PATCH 0/2] Misc OpenRISC fixes for 9.2.0 Michael Tokarev
2024-11-23 17:01   ` Stafford Horne
2024-11-24  5:03     ` Michael Tokarev
2024-11-24  7:39       ` Stafford Horne
  -- strict thread matches above, loose matches on Subject: below --
2024-12-19 20:08 [PATCH 2/2] hw/openrisc: Fixed undercounting of TTCR in continuous mode Joel Holdsworth
2024-12-19 21:50 ` Stafford Horne

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.