From patchwork Tue Apr 28 09:18:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 47657 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0EC8820553 for ; Tue, 28 Apr 2015 09:18:17 +0000 (UTC) Received: by lbbqq2 with SMTP id qq2sf31226326lbb.0 for ; Tue, 28 Apr 2015 02:18:16 -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:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=6zKqMSuqWg9E2pnupaX3oTPrYY3YBk6HVAxSa4TVeeQ=; b=GaPYJjV5/bSypU7FAy8KZ/six77JAo2fgS9f4g5Ig3gqKIrjCD7RqFQ/vE1gWoQPqK cGfXWOdOxr9z3ThiNrK3PDx6MuwTheXJobPLztshgdu/slY0QhAfIoZDNNLXN0+m6xGi isaZkz3LOEU/YOLhFQxYbNl284AFlX6YfmxClYivL/XfVg7Jsools+skpfHeTI+sUJtP OQ16vEn47RZ0PpvnbWj2TLcn/aaFNbMXA3uHSas1/c1NwJMhZABCA6MVZ/NxmHKhgUHK YFR297zZmjRSQnZnmluT4s+EK6u1pJc2PI1DM7cmQSCIC0ZlQuFUhe8Z2mSU29k8ncT2 reAg== X-Gm-Message-State: ALoCoQnh9gqOKrevFPrLvhybRwGzaiuXzYeU3djybXinbjRMCx5YE6i1ZDvXZk7ZUhFKnaIyhh/Z X-Received: by 10.112.189.131 with SMTP id gi3mr9811643lbc.6.1430212696010; Tue, 28 Apr 2015 02:18:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.169 with SMTP id r9ls42558laj.86.gmail; Tue, 28 Apr 2015 02:18:15 -0700 (PDT) X-Received: by 10.152.2.227 with SMTP id 3mr7415598lax.73.1430212695872; Tue, 28 Apr 2015 02:18:15 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id ok4si16631062lbb.110.2015.04.28.02.18.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2015 02:18:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbuc2 with SMTP id uc2so102166903lbb.2 for ; Tue, 28 Apr 2015 02:18:15 -0700 (PDT) X-Received: by 10.112.204.6 with SMTP id ku6mr13545396lbc.73.1430212695788; Tue, 28 Apr 2015 02:18:15 -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 l1csp1764929lbt; Tue, 28 Apr 2015 02:18:15 -0700 (PDT) X-Received: by 10.194.193.66 with SMTP id hm2mr6082968wjc.111.1430212692548; Tue, 28 Apr 2015 02:18:12 -0700 (PDT) Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com. [209.85.212.179]) by mx.google.com with ESMTPS id ee9si37485348wjd.119.2015.04.28.02.18.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2015 02:18:12 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.179 as permitted sender) client-ip=209.85.212.179; Received: by wicmx19 with SMTP id mx19so103154438wic.1 for ; Tue, 28 Apr 2015 02:18:12 -0700 (PDT) X-Received: by 10.180.96.200 with SMTP id du8mr28759282wib.54.1430212692204; Tue, 28 Apr 2015 02:18:12 -0700 (PDT) Received: from midway01-04-00.lavalab ([81.128.185.50]) by mx.google.com with ESMTPSA id em18sm9518708wjd.19.2015.04.28.02.18.11 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Apr 2015 02:18:11 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, qemu-devel@nongnu.org, pbonzini@redhat.com, peter.crosthwaite@xilinx.com Cc: christoffer.dall@linaro.org, kvmarm@lists.cs.columbia.edu, patches@linaro.org, alex.williamson@redhat.com Subject: [PATCH 3/3] sysbus: add irq_set_hook Date: Tue, 28 Apr 2015 10:18:03 +0100 Message-Id: <1430212683-10984-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1430212683-10984-1-git-send-email-eric.auger@linaro.org> References: <1430212683-10984-1-git-send-email-eric.auger@linaro.org> 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.217.169 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 callback in the SysBusDeviceClass. This callback now can be overriden by devices inheriting from sysbus. By default the callback is set to the dummy object_property_allow_set_link callback. Signed-off-by: Eric Auger --- hw/core/sysbus.c | 8 +++++++- include/hw/sysbus.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 8553a6f..e2c4899 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -165,7 +165,10 @@ void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr, /* Request an IRQ source. The actual IRQ object may be populated later. */ void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p) { - qdev_init_gpio_out_named(DEVICE(dev), p, SYSBUS_DEVICE_GPIO_IRQ, 1); + SysBusDeviceClass *sbc = SYS_BUS_DEVICE_GET_CLASS(dev); + + qdev_init_gpio_out_named(DEVICE(dev), p, SYSBUS_DEVICE_GPIO_IRQ, 1, + sbc->irq_set_hook); } /* Pass IRQs from a target device. */ @@ -316,8 +319,11 @@ MemoryRegion *sysbus_address_space(SysBusDevice *dev) static void sysbus_device_class_init(ObjectClass *klass, void *data) { DeviceClass *k = DEVICE_CLASS(klass); + SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass); + k->init = sysbus_device_init; k->bus_type = TYPE_SYSTEM_BUS; + sbc->irq_set_hook = object_property_allow_set_link; } static const TypeInfo sysbus_device_type_info = { diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index dbf3f0f..26ffb2e 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -42,6 +42,7 @@ typedef struct SysBusDeviceClass { int (*init)(SysBusDevice *dev); void (*irq_routing_notifier)(SysBusDevice *dev, qemu_irq irq); + object_property_set_link_t irq_set_hook; } SysBusDeviceClass; struct SysBusDevice {