All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Jason Thorpe <thorpej@me.com>,
	Richard Henderson <richard.henderson@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH 1/4] mc146818rtc: Make PF independent of PIE
Date: Sat, 19 Jun 2021 17:56:23 +0200	[thread overview]
Message-ID: <72b9ed14-3af0-8284-9baf-f1a552e61b5f@amsat.org> (raw)
In-Reply-To: <39CACE5E-7CCD-400C-A983-689474D42EC5@me.com>

Hi Jason,

On 6/16/21 7:34 PM, Jason Thorpe wrote:
> 
>> On Jun 14, 2021, at 9:17 PM, Richard Henderson <richard.henderson@linaro.org> wrote:
>>
>> Cc: paolo and mst
>>
>> On 6/13/21 2:15 PM, Jason Thorpe wrote:
>>> Make the PF flag behave like real hardware by always running the
>>> periodic timer without regard to the setting of the PIE bit, so
>>> that the PF will be set when the period expires even if an interrupt
>>> will not be raised.  This behavior is documented on page 16 of the
>>> MC146818A advance information datasheet.
>>> Signed-off-by: Jason Thorpe <thorpej@me.com>
>>> ---
>>>  hw/rtc/mc146818rtc.c | 4 ----
>>>  1 file changed, 4 deletions(-)
>>> diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c
>>> index 4fbafddb22..366b8f13de 100644
>>> --- a/hw/rtc/mc146818rtc.c
>>> +++ b/hw/rtc/mc146818rtc.c
>>> @@ -155,10 +155,6 @@ static uint32_t rtc_periodic_clock_ticks(RTCState *s)
>>>  {
>>>      int period_code;
>>>  -    if (!(s->cmos_data[RTC_REG_B] & REG_B_PIE)) {
>>> -        return 0;
>>> -     }
>>
>> This looks correct, but I don't know enough about this device.
> 
> Quoting the data sheet here, for context:
> 
> <quote>
> PF - The periodic interrupt flag (PF) is a read-only bit which is set to a "1" when a particular edge is detected on the selected tap of the divider chain.  The RS3 to RS0 bits establish the periodic rate.  PF is set to "1" independent of the state of the PIE bit.  PF initiates an ~IRQ signal and sets the IRQF bit when PIE is also a "1".  The PF bit is cleared by a ~RESET or a software read of Register C.
> </quote>
> 
> This is why my patch always runs the timer, and does not suppress it if PF is already set; real hardware will always latch PF at regular intervals irrespective of when software reads Register C.

Do you mind reposting this single patch including the DS quote
in the description?

Regards,

Phil.


  reply	other threads:[~2021-06-19 15:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-13 21:15 [PATCH 0/4] Emulator fixes to enable running NetBSD/alpha Jason Thorpe
2021-06-13 21:15 ` [PATCH 1/4] mc146818rtc: Make PF independent of PIE Jason Thorpe
2021-06-15  4:17   ` Richard Henderson
2021-06-16 17:34     ` Jason Thorpe
2021-06-19 15:56       ` Philippe Mathieu-Daudé [this message]
2021-06-19 16:25         ` Jason Thorpe
2021-06-13 21:15 ` [PATCH 2/4] alpha: Set minimum PCI device ID to 1 to match Clipper IRQ mappings Jason Thorpe
2021-06-15  4:03   ` Richard Henderson
2021-06-13 21:15 ` [PATCH 3/4] alpha: Provide a PCI-ISA bridge device node for guest OS's that expect it Jason Thorpe
2021-06-15  4:20   ` Richard Henderson
2021-06-15  4:24     ` Jason Thorpe
2021-06-16 13:53       ` Jason Thorpe
2021-06-16 16:55         ` Richard Henderson
2021-06-13 21:15 ` [PATCH 4/4] alpha: Provide console information to the PALcode at start-up Jason Thorpe
2021-06-15  4:08   ` Richard Henderson
2021-06-14 22:09 ` [PATCH 0/4] Emulator fixes to enable running NetBSD/alpha no-reply

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=72b9ed14-3af0-8284-9baf-f1a552e61b5f@amsat.org \
    --to=f4bug@amsat.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thorpej@me.com \
    /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 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.