linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mian Yousaf Kaukab <ykaukab@suse.de>
To: Bruno Thomsen <bruno.thomsen@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	linux-rtc@vger.kernel.org,
	open list <linux-kernel@vger.kernel.org>,
	biwen.li@nxp.com
Subject: Re: [PATCH RESEND v4] rtc: pcf2127: handle timestamp interrupts
Date: Thu, 24 Jun 2021 12:14:52 +0200	[thread overview]
Message-ID: <20210624101452.GC81946@suse.de> (raw)
In-Reply-To: <CAH+2xPAL0w4Urjpxopu8g-kGveTxLXAm8EVUc8s8xpX=fb7NeQ@mail.gmail.com>

On Thu, Jun 24, 2021 at 08:31:00AM +0200, Bruno Thomsen wrote:
> Hi Mian,
> 
> Den ons. 2. jun. 2021 kl. 17.19 skrev Mian Yousaf Kaukab <ykaukab@suse.de>:
> >
> > commit 03623b4b041c ("rtc: pcf2127: add tamper detection support")
> > added support for timestamp interrupts. However they are not being
> > handled in the irq handler. If a timestamp interrupt occurs it
> > results in kernel disabling the interrupt and displaying the call
> > trace:
> >
> > [  121.145580] irq 78: nobody cared (try booting with the "irqpoll" option)
> > ...
> > [  121.238087] [<00000000c4d69393>] irq_default_primary_handler threaded [<000000000a90d25b>] pcf2127_rtc_irq [rtc_pcf2127]
> > [  121.248971] Disabling IRQ #78
> 
> This must have been introduced when alarm IRQ was added, as
> I always thought that tamper IRQ should be handled in user space
> with gpiomon. [...]
Correct.
> I can see that it looks like I only added a cover letter
> to the first 2 versions of patch series[1] and not the 3rd that got applied[2].
> It contains a link to how the tamper timestamp feature was tested[3].
> The script is a simple version of what is running in the product, but
> missing D-Bus call with busctl and hardware init when booted for the
> first time.
With the addition of alarm IRQ a IRQ handler (pcf2127_rtc_irq) has
been added in the driver. This handler must handle the tamper
interrupt when alarm IRQ is configured. Otherwise an IRQ storm happens
as described above.
> 
> I have just tested your patch with an upstream device tree[4] that uses
> the tamper feature, and that does not work. Probably caused by the
> fact that it does not use RTC alarm IRQ.
Make sense.
> 
> What device tree did you see the error on? If it's not upstream can you
> share how you configured the pcf2127 chip?
https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts#L75
> 
> I am not against changing how the tamper feature works, but I would like
> to see the upstream device tree[4] work before merging this patch.
If you agree to handle tamper detection via an interrupt, I can send
another revision to move initialization of tamper detection within
'if (alarm_irq > 0)'. tamper.sh can then just poll timestamp0 and check
return value. Rest of this patch stays the same.

Second option is to provide support for both cases. Let me know what
do you prefer.
> 
> /Bruno
> 
> [1] https://patchwork.ozlabs.org/project/rtc-linux/cover/20190813153600.12406-1-bruno.thomsen@gmail.com/
> [2] https://patchwork.ozlabs.org/project/rtc-linux/patch/20190822131936.18772-5-bruno.thomsen@gmail.com/
> [3] https://github.com/baxeno/linux-emc-test/blob/master/tamper/tamper.sh
> [4] https://elixir.bootlin.com/linux/latest/source/arch/arm/boot/dts/imx7d-flex-concentrator.dts

BR,
Yousaf

  reply	other threads:[~2021-06-24 10:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 10:49 [PATCH RESEND v4] rtc: pcf2127: handle timestamp interrupts Mian Yousaf Kaukab
2021-06-24  6:31 ` Bruno Thomsen
2021-06-24 10:14   ` Mian Yousaf Kaukab [this message]
2021-06-24 15:22     ` Mian Yousaf Kaukab

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=20210624101452.GC81946@suse.de \
    --to=ykaukab@suse.de \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=biwen.li@nxp.com \
    --cc=bruno.thomsen@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.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).