From patchwork Tue Apr 28 16:51:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 47696 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D1D4A20553 for ; Tue, 28 Apr 2015 16:51:49 +0000 (UTC) Received: by wicmx19 with SMTP id mx19sf7677732wic.3 for ; Tue, 28 Apr 2015 09:51:49 -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=tOu+zM8R/u7cUoR+jZclgCzbtGWcXGTdS+PmeaCbTV4=; b=jquFctQckbrL1bLsxeJMfWMcpr1PrsZl8ZYD73wdkycPDrGY/ZgX2kYZwoNzSfMzcW 0EnQs20A6ZI41/WEIqVePdqvxw5OLCrqSt0uZ9JYlhJXFgoLtN+2XpBt9CViXgpsliTI JMinIZHQACPy6oL7TBHjBI6M1BWdxVuKwa8gLXzIhCHys6rIaSqFD6gE4Kljr6cddNDE iEb7//k2reKN2nlHufA13pvxrvhiDB5cjiFyCNCj0tDcb/24lCZMHabReX70yTlDtQ01 NMM3nEWOsmceHiBEELxAV19wsKicAxll04FAwZoZ9JOVKzySrb4ksDlNrL3n8cTfL76p gPGQ== X-Gm-Message-State: ALoCoQkFWEHCvZY/ulCHwkmLszvJvLiAL+Va/A4AnhR7vAgChOA7UG8Osj9bD4vxOY8c5TuBI+K6 X-Received: by 10.152.26.134 with SMTP id l6mr10779607lag.10.1430239909064; Tue, 28 Apr 2015 09:51:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.101 with SMTP id r5ls50810lar.78.gmail; Tue, 28 Apr 2015 09:51:48 -0700 (PDT) X-Received: by 10.112.140.231 with SMTP id rj7mr14993723lbb.76.1430239908955; Tue, 28 Apr 2015 09:51:48 -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 ug12si17453622lac.47.2015.04.28.09.51.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2015 09:51:48 -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 laat2 with SMTP id t2so577601laa.1 for ; Tue, 28 Apr 2015 09:51:48 -0700 (PDT) X-Received: by 10.152.9.66 with SMTP id x2mr15279205laa.36.1430239908878; Tue, 28 Apr 2015 09:51:48 -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 l1csp2002346lbt; Tue, 28 Apr 2015 09:51:48 -0700 (PDT) X-Received: by 10.180.96.138 with SMTP id ds10mr30425766wib.95.1430239896079; Tue, 28 Apr 2015 09:51:36 -0700 (PDT) Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com. [74.125.82.41]) by mx.google.com with ESMTPS id pu9si39408562wjc.56.2015.04.28.09.51.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2015 09:51:36 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 74.125.82.41 as permitted sender) client-ip=74.125.82.41; Received: by wgso17 with SMTP id o17so851049wgs.1 for ; Tue, 28 Apr 2015 09:51:35 -0700 (PDT) X-Received: by 10.195.17.196 with SMTP id gg4mr14739255wjd.109.1430239895835; Tue, 28 Apr 2015 09:51:35 -0700 (PDT) Received: from midway01-04-00.lavalab ([81.128.185.50]) by mx.google.com with ESMTPSA id gs7sm17255958wib.10.2015.04.28.09.51.34 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Apr 2015 09:51:34 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, qemu-devel@nongnu.org, alex.williamson@redhat.com, agraf@suse.de, pbonzini@redhat.com, peter.crosthwaite@xilinx.com Cc: christoffer.dall@linaro.org, kvmarm@lists.cs.columbia.edu, patches@linaro.org, peter.maydell@linaro.org, alex.bennee@linaro.org, kim.phillips@freescale.com, b.reynal@virtualopensystems.com, Bharat.Bhushan@freescale.com, vikrams@codeaurora.org Subject: [PATCH v13 11/12] sysbus: add irq_set_hook Date: Tue, 28 Apr 2015 17:51:12 +0100 Message-Id: <1430239873-31950-12-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1430239873-31950-1-git-send-email-eric.auger@linaro.org> References: <1430239873-31950-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.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 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 --- v1 -> v2: - use new LinkPropertySetter type --- hw/core/sysbus.c | 7 ++++++- include/hw/sysbus.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 1bcb64d..ee573b4 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -159,8 +159,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) { + SysBusDeviceClass *sbc = SYS_BUS_DEVICE_GET_CLASS(dev); + qdev_init_gpio_out_named(DEVICE(dev), p, SYSBUS_DEVICE_GPIO_IRQ, 1, - object_property_allow_set_link); + sbc->irq_set_hook); } /* Pass IRQs from a target device. */ @@ -311,8 +313,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 d1f3f00..b8dde79 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -41,6 +41,7 @@ typedef struct SysBusDeviceClass { /*< public >*/ int (*init)(SysBusDevice *dev); + LinkPropertySetter irq_set_hook; } SysBusDeviceClass; struct SysBusDevice {