From patchwork Thu Jan 5 23:11:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Pisa X-Patchwork-Id: 9499773 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3112E606E0 for ; Thu, 5 Jan 2017 23:20:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0413A28422 for ; Thu, 5 Jan 2017 23:20:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ECE2E2848C; Thu, 5 Jan 2017 23:20:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9DBEF28422 for ; Thu, 5 Jan 2017 23:20:15 +0000 (UTC) Received: from localhost ([::1]:49196 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cPHKQ-0005VV-5N for patchwork-qemu-devel@patchwork.kernel.org; Thu, 05 Jan 2017 18:20:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cPHGF-0002AY-VT for qemu-devel@nongnu.org; Thu, 05 Jan 2017 18:15:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cPHGE-0007ao-9G for qemu-devel@nongnu.org; Thu, 05 Jan 2017 18:15:55 -0500 Received: from smtp7.web4u.cz ([81.91.87.87]:57171 helo=mx-8.mail.web4u.cz) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cPHGE-0007aO-2W for qemu-devel@nongnu.org; Thu, 05 Jan 2017 18:15:54 -0500 Received: from baree.pikron.com (unknown [89.102.27.124]) (Authenticated sender: ppisa@pikron.com) by mx-8.mail.web4u.cz (Postfix) with ESMTPA id E54501FF5EF; Fri, 6 Jan 2017 00:15:52 +0100 (CET) From: pisa@cmp.felk.cvut.cz To: qemu-devel@nongnu.org Date: Fri, 6 Jan 2017 00:11:26 +0100 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: X-W4U-Auth: 49945d5c7a5d0997b6d1094e5d894df23dfa6d38 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 81.91.87.87 Subject: [Qemu-devel] [PATCH 4/6] Fixed IRQ problem for CAN device can_pcm3680_pci. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Hajnoczi , Deniz Eren , Oliver Hartkopp , Konrad Frederic Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Deniz Eren --- hw/can/can_pcm3680_pci.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/can/can_pcm3680_pci.c b/hw/can/can_pcm3680_pci.c index 6e5c9f2..9d8d3f7 100644 --- a/hw/can/can_pcm3680_pci.c +++ b/hw/can/can_pcm3680_pci.c @@ -61,6 +61,7 @@ typedef struct Pcm3680iPCIState { MemoryRegion sja_io[2]; CanSJA1000State sja_state[2]; + qemu_irq irq; char *model; /* The model that support, only SJA1000 now. */ char *canbus[2]; @@ -69,10 +70,16 @@ typedef struct Pcm3680iPCIState { static void pcm3680i_pci_irq_raise(void *opaque) { + Pcm3680iPCIState *d = (Pcm3680iPCIState *)opaque; + + qemu_irq_raise(d->irq); } static void pcm3680i_pci_irq_lower(void *opaque) { + Pcm3680iPCIState *d = (Pcm3680iPCIState *)opaque; + + qemu_irq_lower(d->irq); } static void @@ -202,6 +209,8 @@ static int pcm3680i_pci_init(PCIDevice *pci_dev) pci_conf = pci_dev->config; pci_conf[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin A */ + d->irq = pci_allocate_irq(&d->dev); + can_sja_init(s1, pcm3680i_pci_irq_raise, pcm3680i_pci_irq_lower, d); can_sja_init(s2, pcm3680i_pci_irq_raise, pcm3680i_pci_irq_lower, d); @@ -248,6 +257,8 @@ static void pcm3680i_pci_exit(PCIDevice *pci_dev) can_sja_exit(s1); can_sja_exit(s2); + + qemu_free_irq(d->irq); } static const VMStateDescription vmstate_pcm3680i_pci = {