On Tue, Feb 17, 2026 at 11:06 AM Peter Maydell <[email protected]> wrote:
>
> On Tue, 17 Feb 2026 at 09:42, Paolo Bonzini <[email protected]> wrote:
> > The problem is that "-audio none" uses a silent backend but still keeps
> > all the audio/ code around.  If you prefer to keep the Arm boards
> > around, the solution would be to disable the audio code in the
> > individual pl041 devices with "#ifdef CONFIG_AUDIO", so that the
> > "depends on AUDIO" for pl041 can be removed too.
>
> This seems weird, though -- why would we put in a lot of ifdefs
> in every single audio device, when we could instead say "if you
> disable audio at build time what you get is something that presents
> the same API as the existing audio backends but does nothing" ?

Audio is special, it requires real time operation that is non-trivial
to setup and consumes CPU time (and takes the BQL, introducing jitter
in MMIO too). For pcspk for example the callback runs every 0.05
seconds (18 times a second) approximately.

The code to setup this is in audio/audio.c and is independent of the
backend. It is triggered by AUD_set_active_out (which causes
audio_is_timer_needed to return true), meaning that "-audio none" runs
a lot more code than just audio/noaudio.c.

In addition, this real time operation is reflected into the pl041's
interrupts, so you could have guest code that synchronizes itself on
audio interrupts and a hobbled pl041 might not work at all. Unlikely
for Linux guests, but bare metal code might do it.

> Also, I think we should be consistent here, not put ifdefs in
> some devices we think are "important" but skip it in others.

pcspk is indeed "important", but (especially) it has no interrupts so
there's no risk of breaking guests by removing audio output.

Paolo


Reply via email to