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: Auger Eric X-Patchwork-Id: 47451 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A7E5F2121F for ; Thu, 23 Apr 2015 08:55:42 +0000 (UTC) Received: by wiun10 with SMTP id n10sf17672411wiu.1 for ; Thu, 23 Apr 2015 01:55:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=SqIyVCEck93jJbReI2wHduOTpYcThzJM+EaPDH+4sLQ=; b=ZWj389D3JQcG6FL4ARG1adtwZ49HOcOMv8Y7XFXJrPjjVkH8spiAlmqiabcHRhUjn9 JLD+HOyDl3f7BhATxxTfZqepfh7Kz3YzzIUI/Inml6PZ8UrmSN8JEixzZtqtknvaVxGX DJGa9yaAtAoM2rhwqmMowZoHG8DTHhidFA6dvKKRelwUbjaYXta0wMxUW65nnnVAoOmB 5m66Zt8c2SBGYiDyyecuR5khUxS74lCXSMlNUFwxv8ENgd1TNhG4TeTLf6c3d73H/Ly6 K/HYScX8RBnq/4V9pxMHJEbEwEG6DUF5EajodnLoSHvb5AtFCizP1NBjGYuaY151VcqI ObaQ== X-Gm-Message-State: ALoCoQlP52+uL0Bfn155PFT0zT1zexWq+e2e+RfS/wZPYFXeTyLDJSnBNWg/4QSWsyPUutGUK9PZ X-Received: by 10.194.236.230 with SMTP id ux6mr898095wjc.5.1429779341999; Thu, 23 Apr 2015 01:55:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.65 with SMTP id c1ls283392lae.46.gmail; Thu, 23 Apr 2015 01:55:41 -0700 (PDT) X-Received: by 10.112.199.1 with SMTP id jg1mr1554956lbc.59.1429779341836; Thu, 23 Apr 2015 01:55:41 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id wk8si5532787lbb.96.2015.04.23.01.55.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Apr 2015 01:55:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by labbd9 with SMTP id bd9so7878914lab.2 for ; Thu, 23 Apr 2015 01:55:41 -0700 (PDT) X-Received: by 10.152.29.161 with SMTP id l1mr1521099lah.76.1429779341553; Thu, 23 Apr 2015 01:55:41 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.67.65 with SMTP id l1csp437773lbt; Thu, 23 Apr 2015 01:55:41 -0700 (PDT) X-Received: by 10.194.81.169 with SMTP id b9mr3331331wjy.126.1429779340958; Thu, 23 Apr 2015 01:55:40 -0700 (PDT) Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com. [209.85.212.171]) by mx.google.com with ESMTPS id bz5si13241772wib.38.2015.04.23.01.55.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Apr 2015 01:55:40 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.171 as permitted sender) client-ip=209.85.212.171; Received: by wizk4 with SMTP id k4so207620728wiz.1 for ; Thu, 23 Apr 2015 01:55:40 -0700 (PDT) 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 Cc: christoffer.dall@linaro.org, kvmarm@lists.cs.columbia.edu, patches@linaro.org, alex.williamson@redhat.com Subject: [PATCH] sysbus: add irq_routing_notifier 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 */