Linux Documentation
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: "jenswi@kernel.org" <jenswi@kernel.org>,
	linux-rt-devel@lists.linux.dev, linux-doc@vger.kernel.org,
	linux-efi@vger.kernel.org, op-tee@lists.trustedfirmware.org,
	Ard Biesheuvel <ardb@kernel.org>,
	Clark Williams <clrkwllms@kernel.org>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	John Ogness <john.ogness@linutronix.de>
Subject: Re: [PATCH] Documentation: Extend the real-time hardware bits with some firmware bits
Date: Fri, 10 Jul 2026 09:31:47 +0200	[thread overview]
Message-ID: <20260710073147.XJAJbIwc@linutronix.de> (raw)
In-Reply-To: <CAC_iWj+xDErhPeKGtsLK=nvPB7P8cQE3g9XCkaWf-d_j85FxCQ@mail.gmail.com>

On 2026-07-10 09:29:55 [+0300], Ilias Apalodimas wrote:
> Hi Sebastian!
Hi Ilias,

> > +++ b/Documentation/core-api/real-time/hardware.rst
> > @@ -130,3 +130,95 @@ https://github.com/Linutronix/RTC-Testbench.
> 
> [...]
> 
> > +
> > +OP-TEE (ARM)
> > +~~~~~~~~~~~~
> 
> That's RISC-V as well nowadays

I did not find much here. Their architecture isn't the same as on ARM is
it? But the overall concept is the same, right?

> > +
> > +OP‑TEE uses a global serialization mechanism (the "big lock"), ensuring that on
> > +each core only one OP‑TEE thread executes secure‑world code at a time.
> > +
> > +Execution flows from the normal world (Linux) into the secure world (OP‑TEE)
> > +through the secure monitor at EL3. Linux and OP‑TEE cannot disable or mask each
> > +other’s interrupts because both run at EL1 in different security states.
> 
> That's not always true. It depends on a combination of OP-TEE and TF-A
> configs iirc.
> The most common though is that IRQs and FIQs are directly delivered to
> S-EL1, in which case OP-TEE can mask IRQs.
> There's also a difference between GICv2 and GICv3 in the way
> interrupts are delivered.

You are saying that OP-TEE can mask Linux' interrupts or if OP-TEE
instructs TF-A to do so (via config)?

> > +
> > +Architecturally, the secure monitor can mask or reroute normal‑world interrupts
> > +before entering the secure world. In a correct OP‑TEE/ TF‑A implementation, it
> > +does not do this for the duration of secure calls. Normal‑world interrupts
> > +remain deliverable, and a normal‑world IRQ will preempt OP‑TEE via EL3 and
> > +return control to Linux.
> 
> The 'sane' case is indeed where IRQs are delivered to OP-TEE which
> exits back to Linux immediately.
> 
> > +
> > +Secure‑world interrupts (FIQs) are possible if the SoC routes a device's
> > +interrupt as secure. Such a secure FIQ will preempt Linux immediately, trap
> > +into EL3, and transfer control to OP‑TEE's secure interrupt handler. Linux
> > +cannot mask or preempt this. Secure FIQ handlers must therefore be extremely
> > +short to avoid introducing noticeable latency.
> 
> There are also 'fast SMCs', which run with IRQs disabled for their
> entire duration.

can their be distinguished somehow from normal SMC invocations or is
just a consequence that the secure monitor does not enable interrupts
during transition for some of the "functions"?

> > +
> > +The transition from normal world -> secure monitor -> OP‑TEE and back introduces
> > +additional latency due to world switching and context save/ restore. This
> > +overhead is typically a few microseconds and usually remains in the noise
> > +floor.
> 
> That's correct.
> 
> > +
> > +If the secure monitor masks normal‑world interrupts during OP‑TEE invocations,
> > +or if OP‑TEE uses long‑running secure FIQ handlers, then OP‑TEE can introduce
> > +measurable latency spikes.
> > --
> > 2.53.0
> >
> 
> Overall I think this is worth documenting, but infortunately there's a
> wider range of configs and corner cases we have to describe.

Okay.

> Cheers
> /Ilias

Sebastian

  reply	other threads:[~2026-07-10  7:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01  9:12 [PATCH] Documentation: Extend the real-time hardware bits with some firmware bits Sebastian Andrzej Siewior
2026-07-09 17:03 ` Ilias Apalodimas
2026-07-10  6:29 ` Ilias Apalodimas
2026-07-10  7:31   ` Sebastian Andrzej Siewior [this message]
2026-07-10  7:53     ` Ilias Apalodimas
2026-07-10  8:05       ` Jens Wiklander

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=20260710073147.XJAJbIwc@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=ardb@kernel.org \
    --cc=clrkwllms@kernel.org \
    --cc=corbet@lwn.net \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jan.kiszka@siemens.com \
    --cc=jenswi@kernel.org \
    --cc=john.ogness@linutronix.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=op-tee@lists.trustedfirmware.org \
    --cc=rostedt@goodmis.org \
    --cc=skhan@linuxfoundation.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