qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org,
	 Beniamino Galvani <b.galvani@gmail.com>,
	Strahinja Jankovic <strahinja.p.jankovic@gmail.com>,
	 Guenter Roeck <linux@roeck-us.net>,
	qemu-stable@nongnu.org,  Michael Tokarev <mjt@tls.msk.ru>
Subject: Re: [PATCH 2/2] hw/sd/allwinner-sdhost: Don't send non-boolean IRQ line levels
Date: Tue, 6 Jun 2023 13:55:07 +0100	[thread overview]
Message-ID: <CAFEAcA9cObnb11cSS_StbSHdP0aB6sDeqSHfjb3-qRBfy7K9Kw@mail.gmail.com> (raw)
In-Reply-To: <635fdcd8-23fe-c0db-c912-3aa0517dd4b7@linaro.org>

On Tue, 6 Jun 2023 at 13:39, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Hi Peter,
>
> On 6/6/23 12:46, Peter Maydell wrote:
> > QEMU allows qemu_irq lines to transfer arbitrary integers.  However
> > the convention is that for a simple IRQ line the values transferred
> > are always 0 and 1.  The A10 SD controller device instead assumes a
> > 0-vs-non-0 convention, which happens to work with the interrupt
> > controller it is wired up to.
> >
> > Coerce the value to boolean to follow our usual convention.
>
> I remember once wanting to convert qemu_set_irq() to take a boolean
> argument but someone said using integer was more useful because ...?
> I searched a bit but can't find that in my mail archives, maybe this
> was on IRC. Any clue? (I find simpler to use a boolean rather than
> having a convention of using integers restricted to [0, 1] range).

We have a lot of use cases where we just want to transfer a boolean
value between two devices. We have a few use cases where we want to
transfer an arbitrary integer across the channel between two devices.
(For instance hw/intc/etraxfs_pic.c:pic_update() sends a vector
number to the CPU via a qemu_irq -- see commit f4f643882d9dc467.)

At the moment we use qemu_irq() for both. In theory we could
construct a parallel set of machinery for wiring up and setting
values for the "want an integer" case and restrict qemu_irq() to
bool only, but the lazy path is to use the same function for both.
(If we had machinery that made it easy to construct arbitrary
strongly-typed signal connections, that might perhaps be ideal.
But it's probably not very easy especially in C.)

thanks
-- PMM


  reply	other threads:[~2023-06-06 12:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06 10:46 [PATCH 0/2] allwinner-a10: Fix interrupt controller regression Peter Maydell
2023-06-06 10:46 ` [PATCH 1/2] hw/intc/allwinner-a10-pic: Handle IRQ levels other than 0 or 1 Peter Maydell
2023-06-06 14:14   ` Guenter Roeck
2023-06-06 10:46 ` [PATCH 2/2] hw/sd/allwinner-sdhost: Don't send non-boolean IRQ line levels Peter Maydell
2023-06-06 12:39   ` Philippe Mathieu-Daudé
2023-06-06 12:55     ` Peter Maydell [this message]
2023-06-06 13:13       ` Philippe Mathieu-Daudé
2023-06-06 14:14   ` Guenter Roeck
2023-06-06 12:36 ` [PATCH 0/2] allwinner-a10: Fix interrupt controller regression Philippe Mathieu-Daudé

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=CAFEAcA9cObnb11cSS_StbSHdP0aB6sDeqSHfjb3-qRBfy7K9Kw@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=b.galvani@gmail.com \
    --cc=linux@roeck-us.net \
    --cc=mjt@tls.msk.ru \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=strahinja.p.jankovic@gmail.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 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).