From patchwork Thu Apr 23 08:55:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 463915 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DB4D71400A0 for ; Thu, 23 Apr 2015 18:56:03 +1000 (AEST) Received: from localhost ([::1]:38964 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlCvR-0001o7-Ni for incoming@patchwork.ozlabs.org; Thu, 23 Apr 2015 04:56:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49949) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlCvB-0001XV-7P for qemu-devel@nongnu.org; Thu, 23 Apr 2015 04:55:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YlCv7-0004f1-Mr for qemu-devel@nongnu.org; Thu, 23 Apr 2015 04:55:45 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:35682) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlCv7-0004er-CH for qemu-devel@nongnu.org; Thu, 23 Apr 2015 04:55:41 -0400 Received: by widdi4 with SMTP id di4so207418554wid.0 for ; Thu, 23 Apr 2015 01:55:40 -0700 (PDT) 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; bh=SqIyVCEck93jJbReI2wHduOTpYcThzJM+EaPDH+4sLQ=; b=Hl097EWWra5Z0jbpLjp1NymGohRgpLr6RaduzhTFVvibjo/a0El7jOJXV11EExX+v0 dJDU4IV3u2lnDrLJNcpTw9e/ef7UlDN4iJLPoTpVWT9auPEELEi7ll/CvKRyTCDuVYTy 19WgZSLCrn3nsq9ppF46bLTNKtK9rPR1MDR+JGGhxAIARm8sb08yVwdcdpevsp78c/2p zcUqDCI9ZoABZ7RyvYonr/PI1p6hue+lceNwRO0zn72/VvbCJMb4CwhHxk1IZ4Sty42T IcpFFqWne1HRvSQt00SCLnDBZ9d9VScmCrFOgqFqm1htFGVqD4leMC5tudugGDRdzOa+ asAw== X-Gm-Message-State: ALoCoQl6uA5eI2RVGKwA7VNf2Vi3WU303hrhx0Ofalt5EyWhVT4kNgi2LKB7YrHZxFo0TI7l/LSX X-Received: by 10.180.211.102 with SMTP id nb6mr3941590wic.32.1429779340708; Thu, 23 Apr 2015 01:55:40 -0700 (PDT) Received: from midway01-04-00.lavalab ([81.128.185.50]) by mx.google.com with ESMTPSA id e2sm11071023wjy.46.2015.04.23.01.55.39 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Apr 2015 01:55:39 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, qemu-devel@nongnu.org, peter.maydell@linaro.org, agraf@suse.de, pbonzini@redhat.com Date: Thu, 23 Apr 2015 09:55:18 +0100 Message-Id: <1429779318-1810-1-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.212.176 Cc: alex.williamson@redhat.com, kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, patches@linaro.org Subject: [Qemu-devel] [PATCH] sysbus: add irq_routing_notifier 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add a new irq_routing_notifier notifier and its setter. This notifier is called on sysbus_connect_irq. The same notifier is used for all interrupts. Signed-off-by: Eric Auger --- hw/core/sysbus.c | 9 +++++++++ include/hw/sysbus.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index b53c351..26579f1 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -110,6 +110,9 @@ qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n) void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq) { qdev_connect_gpio_out_named(DEVICE(dev), SYSBUS_DEVICE_GPIO_IRQ, n, irq); + if (dev->irq_routing_notifier) { + dev->irq_routing_notifier(dev, irq); + } } /* Check whether an MMIO region exists */ @@ -307,6 +310,12 @@ MemoryRegion *sysbus_address_space(SysBusDevice *dev) return get_system_memory(); } +void sysbus_set_irq_routing_notifier(SysBusDevice *dev, + IRQRoutingNotifier notifier) +{ + dev->irq_routing_notifier = notifier; +} + static void sysbus_device_class_init(ObjectClass *klass, void *data) { DeviceClass *k = DEVICE_CLASS(klass); diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index d1f3f00..84166d9 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -13,6 +13,7 @@ #define SYSTEM_BUS(obj) OBJECT_CHECK(BusState, (obj), TYPE_SYSTEM_BUS) typedef struct SysBusDevice SysBusDevice; +typedef void (*IRQRoutingNotifier)(SysBusDevice *dev, qemu_irq irq); #define TYPE_SYS_BUS_DEVICE "sys-bus-device" #define SYS_BUS_DEVICE(obj) \ @@ -55,6 +56,8 @@ struct SysBusDevice { } mmio[QDEV_MAX_MMIO]; int num_pio; pio_addr_t pio[QDEV_MAX_PIO]; + + IRQRoutingNotifier irq_routing_notifier; }; typedef int FindSysbusDeviceFunc(SysBusDevice *sbdev, void *opaque); @@ -100,4 +103,7 @@ static inline DeviceState *sysbus_try_create_simple(const char *name, return sysbus_try_create_varargs(name, addr, irq, NULL); } +void sysbus_set_irq_routing_notifier(SysBusDevice *dev, + IRQRoutingNotifier notifier); + #endif /* !HW_SYSBUS_H */