Re: [Qemu-devel] [PATCH v4 5/7] RTC:Add RTC update-ended interrupt support

2012-03-22 Thread Paolo Bonzini
Il 22/03/2012 11:29, Stefano Stabellini ha scritto: >> The purpose of using two timer is trying to keep the UF, AF and UIP >> synchronous. User can poll UIP to check UF and AF bit. If we use >> timer for UF/AF bit track and check UIP by another way, since the >> timer will be fired with delay, then

Re: [Qemu-devel] [PATCH v4 5/7] RTC:Add RTC update-ended interrupt support

2012-03-22 Thread Stefano Stabellini
On Wed, 21 Mar 2012, Paolo Bonzini wrote: > Il 21/03/2012 17:54, Stefano Stabellini ha scritto: > >> > > >> > No, you need to set UF in case the code observes it without actually > >> > enabling interrupt delivery on the ISA bus. > > > > Well, if it is just about updating UF, can we do it only w

Re: [Qemu-devel] [PATCH v4 5/7] RTC:Add RTC update-ended interrupt support

2012-03-22 Thread Stefano Stabellini
On Thu, 22 Mar 2012, Zhang, Yang Z wrote: > > -Original Message- > > From: Stefano Stabellini [mailto:stefano.stabell...@eu.citrix.com] > > Sent: Wednesday, March 21, 2012 2:04 AM > > > > On Mon, 19 Mar 2012, Zhang, Yang Z wrote: > > > Use a timer to emulate update cycle. When update cycle

Re: [Qemu-devel] [PATCH v4 5/7] RTC:Add RTC update-ended interrupt support

2012-03-21 Thread Zhang, Yang Z
> -Original Message- > From: Stefano Stabellini [mailto:stefano.stabell...@eu.citrix.com] > Sent: Wednesday, March 21, 2012 2:04 AM > > On Mon, 19 Mar 2012, Zhang, Yang Z wrote: > > Use a timer to emulate update cycle. When update cycle ended and UIE is > setting, then raise an interrupt.

Re: [Qemu-devel] [PATCH v4 5/7] RTC:Add RTC update-ended interrupt support

2012-03-21 Thread Paolo Bonzini
Il 21/03/2012 17:54, Stefano Stabellini ha scritto: >> > >> > No, you need to set UF in case the code observes it without actually >> > enabling interrupt delivery on the ISA bus. > > Well, if it is just about updating UF, can we do it only when the user > reads REG_C? Perhaps, but for AF it is

Re: [Qemu-devel] [PATCH v4 5/7] RTC:Add RTC update-ended interrupt support

2012-03-21 Thread Stefano Stabellini
On Wed, 21 Mar 2012, Paolo Bonzini wrote: > Il 20/03/2012 19:35, Stefano Stabellini ha scritto: > > This is the function that is used to figure out whether we need the > > timers or not, the condition seems to be: > > > > (Not (REG_C_UF | REG_C_AF)) And (Not (REG_B_SET)) > > > > Shouldn't actuall

Re: [Qemu-devel] [PATCH v4 5/7] RTC:Add RTC update-ended interrupt support

2012-03-21 Thread Paolo Bonzini
Il 20/03/2012 19:35, Stefano Stabellini ha scritto: > This is the function that is used to figure out whether we need the > timers or not, the condition seems to be: > > (Not (REG_C_UF | REG_C_AF)) And (Not (REG_B_SET)) > > Shouldn't actually check for UIE being enabled? No, you need to set UF i

Re: [Qemu-devel] [PATCH v4 5/7] RTC:Add RTC update-ended interrupt support

2012-03-20 Thread Stefano Stabellini
> +/* handle update-ended timer */ > +static void check_update_timer(RTCState *s) > +{ > +uint64_t next_update_time, expire_time; > +uint64_t guest_usec; > +qemu_del_timer(s->update_timer); > +qemu_del_timer(s->update_timer2); > + > +if (!((s->cmos_data[RTC_REG_C] & (REG_C_UF |

Re: [Qemu-devel] [PATCH v4 5/7] RTC:Add RTC update-ended interrupt support

2012-03-20 Thread Stefano Stabellini
On Mon, 19 Mar 2012, Zhang, Yang Z wrote: > Use a timer to emulate update cycle. When update cycle ended and UIE is > setting, then raise an interrupt. The timer runs only when UF or AF is > cleared. The idea is that if the user requests the update-ended interrupt (UIE) we setup a timer to injec

[Qemu-devel] [PATCH v4 5/7] RTC:Add RTC update-ended interrupt support

2012-03-19 Thread Zhang, Yang Z
Use a timer to emulate update cycle. When update cycle ended and UIE is setting, then raise an interrupt. The timer runs only when UF or AF is cleared. Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 86 ++ 1 files changed, 80 insertions(+)