From patchwork Fri Jan 29 16:53:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 8164961 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 09C979F440 for ; Fri, 29 Jan 2016 16:54:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3FE8820395 for ; Fri, 29 Jan 2016 16:54:16 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 96727200C1 for ; Fri, 29 Jan 2016 16:54:15 +0000 (UTC) Received: from localhost ([::1]:35292 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPCJL-0001jf-3G for patchwork-qemu-devel@patchwork.kernel.org; Fri, 29 Jan 2016 11:54:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPCJ9-0001iE-R8 for qemu-devel@nongnu.org; Fri, 29 Jan 2016 11:54:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aPCJ8-0003w8-Tb for qemu-devel@nongnu.org; Fri, 29 Jan 2016 11:54:03 -0500 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:35194) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPCJ8-0003vt-NB for qemu-devel@nongnu.org; Fri, 29 Jan 2016 11:54:02 -0500 Received: by mail-wm0-x22b.google.com with SMTP id r129so76808079wmr.0 for ; Fri, 29 Jan 2016 08:54:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WX5OJfPGqkhLdjQ7ro/MH10LR+szMfEX9t+xmMaa47U=; b=c/utg90nU2HJlFXkRUiuFz3SRNwivf+2WYvxRrvsIw8C9fBZVeWC9u0vVR1tG7efER +EmYBJ8qf/R4Nt8SFKp4dSasRIl1lcuS3tAYfgWINeCfLBHOZpZDcYvgo91xggQWqTPQ 4NHh1l16fy2X0tZEExOgEhbwLDlTL12xr38CA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WX5OJfPGqkhLdjQ7ro/MH10LR+szMfEX9t+xmMaa47U=; b=ge5w2TOdjvQouTaSzsy03nGRvOeu5NOTVzISRzjbR4LhweMfW6rs8CllgiN5KYfzMI /yTglJVgMnZYTzuhCkUOCVQmeT7V4Vfs1zXBPvYgh3rzC+OyCcWlzmM0pL07wRlVduRF 0UFSWnT5ze37MpRPmmQLobDwu+8J0gVZZS0Is/UUUPugixXj0oRn93ffPU11k9VcCj2g tXJmXQ2e/jjfNvhhGQ2enj+bWH/AGgz25Ys5HBMVnfEBRMUqmqm5AjS9BQURn6FQbJ4Y rtvPS0hvbWGUeLh5MO+vOeWLPs59iDofcpN4avAz/HSbqqGTlTHLyfchA2n/gPF2FeeV yNqA== X-Gm-Message-State: AG10YOQCzBFhiBINM2VSS4WSxdvX1Jkkwhefowj4tjAqJFECE21PvrIxkvNm/XCrRGANt+TV X-Received: by 10.28.137.135 with SMTP id l129mr9546055wmd.38.1454086441995; Fri, 29 Jan 2016 08:54:01 -0800 (PST) Received: from new-host-12.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id ei9sm16415530wjd.40.2016.01.29.08.53.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Jan 2016 08:54:00 -0800 (PST) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, alex.williamson@redhat.com, pranav.sawargaonkar@gmail.com, p.fedin@samsung.com, pbonzini@redhat.com, agraf@suse.de Date: Fri, 29 Jan 2016 16:53:43 +0000 Message-Id: <1454086429-4373-3-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454086429-4373-1-git-send-email-eric.auger@linaro.org> References: <1454086429-4373-1-git-send-email-eric.auger@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22b Cc: Bharat.Bhushan@freescale.com, suravee.suthikulpanit@amd.com, christoffer.dall@linaro.org Subject: [Qemu-devel] [RFC v2 2/8] Add a function to determine interrupt number for INTx routing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a PCI bus specific function pointer "route_intx_to_irq" for GPEX. This is used in detemining PCI INTx number from pin. Signed-off-by: Pranavkumar Sawargaonkar Signed-off-by: Tushar Jagad --- hw/pci-host/gpex.c | 12 ++++++++++++ include/hw/pci-host/gpex.h | 1 + 2 files changed, 13 insertions(+) diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c index 9d8fb5a..d0d1250 100644 --- a/hw/pci-host/gpex.c +++ b/hw/pci-host/gpex.c @@ -42,6 +42,17 @@ static void gpex_set_irq(void *opaque, int irq_num, int level) qemu_set_irq(s->irq[irq_num], level); } +static PCIINTxRoute gpex_route_intx_pin_to_irq(void *opaque, int pin) +{ + PCIINTxRoute route; + GPEXHost *s = opaque; + + route.mode = PCI_INTX_ENABLED; + route.irq = (int)s->irq_num[pin]; + + return route; +} + static void gpex_host_realize(DeviceState *dev, Error **errp) { PCIHostState *pci = PCI_HOST_BRIDGE(dev); @@ -66,6 +77,7 @@ static void gpex_host_realize(DeviceState *dev, Error **errp) &s->io_ioport, 0, 4, TYPE_PCIE_BUS); qdev_set_parent_bus(DEVICE(&s->gpex_root), BUS(pci->bus)); + pci_bus_set_route_irq_fn(pci->bus, gpex_route_intx_pin_to_irq); qdev_init_nofail(DEVICE(&s->gpex_root)); } diff --git a/include/hw/pci-host/gpex.h b/include/hw/pci-host/gpex.h index 68c9348..7df1c16 100644 --- a/include/hw/pci-host/gpex.h +++ b/include/hw/pci-host/gpex.h @@ -51,6 +51,7 @@ typedef struct GPEXHost { MemoryRegion io_ioport; MemoryRegion io_mmio; qemu_irq irq[GPEX_NUM_IRQS]; + uint32_t irq_num[GPEX_NUM_IRQS]; } GPEXHost; #endif /* HW_GPEX_H */