From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9NdJ-0005Vk-KY for qemu-devel@nongnu.org; Tue, 22 Nov 2016 21:50:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9NdH-0001wq-8v for qemu-devel@nongnu.org; Tue, 22 Nov 2016 21:50:01 -0500 From: David Gibson Date: Wed, 23 Nov 2016 13:49:38 +1100 Message-Id: <1479869383-16162-7-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1479869383-16162-1-git-send-email-david@gibson.dropbear.id.au> References: <1479869383-16162-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PULL 06/11] ppc: Make uninorth interrupt swizzling identical to Grackle List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org, stefanha@redhat.com Cc: agraf@suse.de, mdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Benjamin Herrenschmidt , David Gibson From: Benjamin Herrenschmidt 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 Reviewed-by: Thomas Huth Signed-off-by: David Gibson --- hw/pci-host/uninorth.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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