qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ppc: Make uninorth interrupt swizzling identical to Grackle
@ 2016-11-20 14:12 BALATON Zoltan
  2016-11-21 10:06 ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
  2016-11-21 23:05 ` David Gibson
  0 siblings, 2 replies; 7+ messages in thread
From: BALATON Zoltan @ 2016-11-20 14:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, Alexander Graf, Benjamin Herrenschmidt

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

It's currently broken as it uses an incorrect shift, it tries
to use the slot number but uses the top bits of the bus number
instead.

Note: Neither implementation matches what OpenBIOS ends up putting
in the device-tree either, which will have to be fixed separately.

This is not quite correct for modelling a real Mac since Apple
tend to tie all 4 interrupt lines of a slot together and have
separate interrupts for every slot and every motherboard devices
going straight to the PIC but we'll sort that out later.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 hw/pci-host/uninorth.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

This needs a corresponding fix in OpenBIOS but this has to be
committed first for that. As this is already broken making this change
should not make things worse as they are now. Could we get this in now
as a bugfix commit?

diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
index 7aac4d6..df342ac 100644
--- a/hw/pci-host/uninorth.c
+++ b/hw/pci-host/uninorth.c
@@ -62,9 +62,7 @@ typedef struct UNINState {
 
 static int pci_unin_map_irq(PCIDevice *pci_dev, int irq_num)
 {
-    int devfn = pci_dev->devfn & 0x00FFFFFF;
-
-    return (((devfn >> 11) & 0x1F) + irq_num) & 3;
+    return (irq_num + (pci_dev->devfn >> 3)) & 3;
 }
 
 static void pci_unin_set_irq(void *opaque, int irq_num, int level)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread
[parent not found: <mailman.20732.1479800734.22740.qemu-devel@nongnu.org>]

end of thread, other threads:[~2016-11-22 14:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-20 14:12 [Qemu-devel] [PATCH] ppc: Make uninorth interrupt swizzling identical to Grackle BALATON Zoltan
2016-11-21 10:06 ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
2016-11-21 23:05 ` David Gibson
2016-11-22  0:12   ` Mark Cave-Ayland
2016-11-22  1:34     ` BALATON Zoltan
2016-11-22  2:50       ` Benjamin Herrenschmidt
     [not found] <mailman.20732.1479800734.22740.qemu-devel@nongnu.org>
2016-11-22 14:49 ` G 3

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).