From: David Gibson <david@gibson.dropbear.id.au>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Sebastian Bauer <mail@sebastianbauer.info>,
Alexander Graf <agraf@suse.de>, qemu-ppc <qemu-ppc@nongnu.org>,
QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] sam460ex: Fix PCI interrupt connections
Date: Tue, 31 Jul 2018 10:18:47 +1000 [thread overview]
Message-ID: <20180731001847.GF2708@umbus.fritz.box> (raw)
In-Reply-To: <alpine.BSF.2.21.1807310111280.24147@zero.eik.bme.hu>
[-- Attachment #1: Type: text/plain, Size: 4017 bytes --]
On Tue, Jul 31, 2018 at 01:31:46AM +0200, BALATON Zoltan wrote:
> On Tue, 31 Jul 2018, Peter Maydell wrote:
> > On 30 July 2018 at 23:37, BALATON Zoltan <balaton@eik.bme.hu> wrote:
> > QEMU's implementation of qemu_irq signal lines is that the destination
> > end provides the qemu_irq, which under the hood is a pointer to a
> > struct containing a pointer to the function in the destination device
> > which gets called when the source end says "the line level has changed".
> > This means that there won't be a compile time or runtime error if you
> > pass that qemu_irq to multiple sources (ie device outputs) simultaneously.
> > But the behaviour will be wrong, because the destination will see all
> > the "level is 0", "level is 1" calls from all the sources intermingled, eg
> >
> > device A output: ____|^^^^^^^^^^^^^|______
> >
> > device B output: _______|^^^^^|___________
> >
> > destination sees: ____|^^^^^^^^|___________
> >
> > (because the destination gets the "level now 0" call when B's output
> > goes to zero). To get the desired behaviour:
> >
> > logical OR: ____|^^^^^^^^^^^^^|_____
> >
> > you need an OR gate. (I'm assuming wired-OR because that's the
> > usual thing when several devices share an interrupt.)
> >
> > If your testing involves a setup which doesn't happen to assert
> > several of the interrupt lines simultaneously you won't notice this
> > problem.
>
> I think the testing with SATA and USB mouse on a PCI card is likely to
> assert several interrupts simultanelously (eg. when moving the mouse while
> loading stuff from disk) but the OS might have some ways to still recover
> from this so maybe we won't notice it anyway. As this is now confirmed that
> using the same irq multiple times is wrong I think we need a better fix.
>
> David, can you please drop this patch, we'll come up with a different fix.
Done. Should have looked at that patch a bit closer.
> > > Probably we can just change the map function in ppc440_pcix.c to always
> > > return the first line then what's specified for other lines should not
> > > matter and the above problem is avoided. We could even get rid of those
> > > additional irqs by changing ppc440_pcix.c to only model a single line but
> > > I'd need someone with better understanding of this to confirm that I got
> > > this right.
> >
> > I think that would also fix the bug. The logically preferable
> > approach would depend rather on what the actual hardware does:
> > is there a PCI controller chip with 4 interrupt outputs which
> > the board wires together to a single interrupt controller line,
> > or does the PCI controller chip itself have just one output
> > and do the merging of the different PCI interrupts itself?
>
> Hmm, don't really know. The PCI controller is part of the SoC but we don't
> have the manual of this SoC. The physical board itself also has a single PCI
> slot so however it's wired internally it's only using one irq for that. Not
> sure what other internal PCI devices are there. A comment in U-Boot sources
> says this (it lists PCIB twice but maybe that's meant to be PCID?):
>
> // IRQ2 = PCI_INT (PCIA, PCIB, PCIC, PCIB)
>
> So that suggests probably there are 4 PCI irqs that are wired together but
> probably this is inside the SoC. It could also be read as there's only a
> single PCI_INT that delivers all four PCI interrupts. So if we go from that
> either adding an OR gate to sam460ex.c that ORs together the PCI lines and
> connects it to uic[1][0] would work, or changing ppc440_pcix.c to provide a
> single PCI interrupt? We don't really have definitive info other than this
> comment so whatever Sebastian prefers and you approve is fine with me.
>
> Thank you,
> BALATON Zoltan
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-07-31 0:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-30 4:39 [Qemu-devel] [PATCH] sam460ex: Fix PCI interrupt connections Sebastian Bauer
2018-07-30 4:49 ` David Gibson
2018-07-30 11:06 ` BALATON Zoltan
2018-07-30 12:04 ` Sebastian Bauer
2018-07-30 22:37 ` BALATON Zoltan
2018-07-30 23:00 ` Peter Maydell
2018-07-30 23:31 ` BALATON Zoltan
2018-07-31 0:18 ` David Gibson [this message]
2018-07-31 4:57 ` Sebastian Bauer
2018-07-31 6:06 ` David Gibson
2018-07-31 9:50 ` BALATON Zoltan
2018-07-31 10:32 ` Sebastian Bauer
2018-07-31 11:24 ` [Qemu-devel] [Qemu-ppc] " BALATON Zoltan
2018-07-30 22:47 ` [Qemu-devel] " Peter Maydell
2018-07-30 23:00 ` BALATON Zoltan
2018-07-30 23:15 ` Peter Maydell
2018-07-31 5:09 ` Sebastian Bauer
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=20180731001847.GF2708@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=balaton@eik.bme.hu \
--cc=mail@sebastianbauer.info \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.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).