From patchwork Fri Dec 30 15:21:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 89395 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp6495143qgi; Fri, 30 Dec 2016 07:47:49 -0800 (PST) X-Received: by 10.200.37.178 with SMTP id e47mr47918938qte.7.1483112869125; Fri, 30 Dec 2016 07:47:49 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v63si8502713qkb.318.2016.12.30.07.47.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 30 Dec 2016 07:47:49 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:40431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMzPI-0006Bd-Px for patch@linaro.org; Fri, 30 Dec 2016 10:47:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMz0Y-0002Rf-UX for qemu-devel@nongnu.org; Fri, 30 Dec 2016 10:22:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cMz0X-0000Jm-Pw for qemu-devel@nongnu.org; Fri, 30 Dec 2016 10:22:14 -0500 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:35177) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cMz0X-0000JN-L4 for qemu-devel@nongnu.org; Fri, 30 Dec 2016 10:22:13 -0500 Received: by mail-pf0-x241.google.com with SMTP id i88so22106866pfk.2 for ; Fri, 30 Dec 2016 07:22:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=baKU7gDQgGBVJAsXH1OylAapnh9dsU+g1S+HaC0fQX0=; b=PMLgQ9G+yimhTOQMxE62MqTtY5TEXkdSsrGKxhz4GoQVe/QxMgOeW8KL9LVyDjZ7mT /PwghDfWE1slyypyQJaqBolda5Qs+NI89By+vwuhGuAvfUhbuHzorvGd/vmmLD44wGj/ 89Ow5Fq4A5Y0smrtvtw9q/VZPk6PN7//0IFt6oRqvhsd2j4l2rqmWfDhDqviH9b8/tJr obcwSknZokps4kMztiRTrRJVOxCnnUBRlG2GcKYj9C3thvchLzuIYSLiLAnA6krpBpCy UhrajB4xM+Ase6hrUmOHdeNgMRqEbky2+2WTiHuZyPw94DGoMky1u/RBgRE13n3GAcaW 8Z+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=baKU7gDQgGBVJAsXH1OylAapnh9dsU+g1S+HaC0fQX0=; b=Aqq+ZCUFh3aYFFjSIajHmEdr2BZ48XaWuLBMuvtz31Rsh34qTMm8/GyvKwMjowRDEM yh0Dlgmy+WhXLOfW0qEU29UOfvEyJunWJ+FVGZ9WCP+2yLS7NJ/2EV3cW5DmD0wjP3UA SKxtI/Udp5ypTS46m1Hr7HOoJF6poMKQ/3EGF++xkiXQOA7uiSjS5RVaZQa0vI92F5Rq /sx+efm2kckoMts5A7qO5diddZWPjXymAvAOdWF3/dns6tpRW1kych37F43JiYBpAFc5 Puo8Hhi17tPfMLMT3uLRLcrkmTifDeycCXU3Aym0RSxZKxhekA7holiU8AkgAHwEW0Nu UePA== X-Gm-Message-State: AIkVDXIqeuLTRkqQ3u8wh51P0l6DVgszLHnsh+hh3b8f9cgM5CFpUGEC7rpjTcY0jA6qxQ== X-Received: by 10.99.185.73 with SMTP id v9mr83898554pgo.98.1483111332791; Fri, 30 Dec 2016 07:22:12 -0800 (PST) Received: from serve.minyard.net ([47.184.183.230]) by smtp.gmail.com with ESMTPSA id r68sm104138549pfk.85.2016.12.30.07.22.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Dec 2016 07:22:08 -0800 (PST) Received: from t430.minyard.net (unknown [IPv6:2001:470:b8f6:1b:3850:e313:ed7:8ae4]) by serve.minyard.net (Postfix) with ESMTPA id B402DA266; Fri, 30 Dec 2016 09:21:57 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id 7BDB1300094; Fri, 30 Dec 2016 09:21:54 -0600 (CST) From: minyard@acm.org To: qemu-devel@nongnu.org Date: Fri, 30 Dec 2016 09:21:46 -0600 Message-Id: <1483111310-24808-16-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483111310-24808-1-git-send-email-minyard@acm.org> References: <1483111310-24808-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::241 Subject: [Qemu-devel] [PATCH 15/19] hw: Add an IRQ interface 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: Corey Minyard , minyard@acm.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Corey Minyard This allows IRQs to be created that can be found by other devices so they can be used without having a direct tie to the irq. Signed-off-by: Corey Minyard --- hw/core/Makefile.objs | 1 + hw/core/irqif.c | 39 +++++++++++++++++++++++++++++++++++++++ include/hw/irqif.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 hw/core/irqif.c create mode 100644 include/hw/irqif.h -- 2.7.4 diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs index a4c94e5..764af1c 100644 --- a/hw/core/Makefile.objs +++ b/hw/core/Makefile.objs @@ -6,6 +6,7 @@ common-obj-y += fw-path-provider.o common-obj-y += irq.o common-obj-y += hotplug.o obj-y += nmi.o +common-obj-y += irqif.o common-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o common-obj-$(CONFIG_XILINX_AXI) += stream.o diff --git a/hw/core/irqif.c b/hw/core/irqif.c new file mode 100644 index 0000000..12449af --- /dev/null +++ b/hw/core/irqif.c @@ -0,0 +1,39 @@ +/* + * Interrupt Interface class + * + * Copyright (c) 2015,2016 Corey Minyard, MontaVista Software, LLC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include "hw/irqif.h" + +static TypeInfo irq_interface_type_info = { + .name = TYPE_IRQ_INTERFACE, + .parent = TYPE_INTERFACE, + .class_size = sizeof(IRQInterfaceClass), +}; + +static void ipmi_register_types(void) +{ + type_register_static(&irq_interface_type_info); +} + +type_init(ipmi_register_types) diff --git a/include/hw/irqif.h b/include/hw/irqif.h new file mode 100644 index 0000000..d733363 --- /dev/null +++ b/include/hw/irqif.h @@ -0,0 +1,49 @@ +/* + * Interrupt Interface class + * + * Copyright (c) 2015,2016 Corey Minyard, MontaVista Software, LLC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef HW_IRQIF_H +#define HW_IRQIF_H + +#include "hw/hw.h" +#include "hw/irq.h" + +#define TYPE_IRQ_INTERFACE "irq-interface" +#define IRQ_INTERFACE(obj) \ + INTERFACE_CHECK(IRQInterface, (obj), TYPE_IRQ_INTERFACE) +#define IRQ_INTERFACE_CLASS(class) \ + OBJECT_CLASS_CHECK(IRQInterfaceClass, (class), TYPE_IRQ_INTERFACE) +#define IRQ_INTERFACE_GET_CLASS(class) \ + OBJECT_GET_CLASS(IRQInterfaceClass, (class), TYPE_IRQ_INTERFACE) + +typedef struct IRQInterface { + Object parent; +} IRQInterface; + +typedef struct IRQInterfaceClass { + InterfaceClass parent; + + qemu_irq *(*get_irq)(struct IRQInterface *ii); +} IRQInterfaceClass; + +#endif /* HW_IRQIF_H */