From nobody Mon Feb 9 01:49:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1640818338; cv=none; d=zohomail.com; s=zohoarc; b=bbRP6cQ0mInGGKzFN/dOnle+w4RoIArlY9v0D3TqRtR8mz5AYbVWm1TmwhMzLx7KANcGlFaV8WyiUFURDxTS5qshvoP8fUYAMF4HvAAirGATNxCM9Y//+XExs7sdJJ/gi8CCr5+6/gJ14ffqM+UpGJZXMYdp6avli/OAqF/Ue0g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640818338; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=e5+ddy+WSkN1x0e4CgeIS+1g9hRe1FYGtrRjE7UXe3I=; b=CcEO4GHf5zK6/Z1fzFo3CqXQnTkmgYP/O4qK/HAcEL1eLAtYiKT9EnCYbhQWa386/R3V3ZvnDdkeLT24K54NZhNAljoXmvFQo0+XqRqh4IBOvVSxiqp7hbx1mmyd8oir/FvUparTZQ6fq6EUPbd60NM8Tek3pD3j/gd6eaTcNOI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 16408183387791008.3794291157058; Wed, 29 Dec 2021 14:52:18 -0800 (PST) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-638-yvbbriWAPci5Nm2adXv_Ig-1; Wed, 29 Dec 2021 17:52:14 -0500 Received: by mail-wr1-f69.google.com with SMTP id c16-20020adfa310000000b001a2349890e1so5396558wrb.0 for ; Wed, 29 Dec 2021 14:52:14 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (26.red-83-50-86.dynamicip.rima-tde.net. [83.50.86.26]) by smtp.gmail.com with ESMTPSA id y3sm21962630wrq.12.2021.12.29.14.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Dec 2021 14:52:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640818338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e5+ddy+WSkN1x0e4CgeIS+1g9hRe1FYGtrRjE7UXe3I=; b=NDDuBarhGk5VFmmHnOELeLPw21OTK6LHSxYrB9ribHqY9KtBmAb9DOeSscGF9v03460PWv ZIdYBovbRwacLghE+sfmaxCYtiJSzxacoOijvu2FUdAl4t9Gkq2gLU5ODmYsoJP9fTEHCJ fXxKR7IBOLIpftLiA8wHLcwVu0HaNPI= X-MC-Unique: yvbbriWAPci5Nm2adXv_Ig-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e5+ddy+WSkN1x0e4CgeIS+1g9hRe1FYGtrRjE7UXe3I=; b=j6IUFf0pltKeeKCmoAywpgyS6F9R2XcTyuZYyAoY6ji0m+I4fIJPKx0V6nfaklDhm0 /AXwyQsa97g67/oQTBPXM52Dbk5TTdO41p68C444vrVhW2QUa89TcNfURS4Gh2ERpEbC QWVOcN0xhWOL5DaZ6GiKmlqANgNfbkhyz8VTR6jnZ/k5kQIMXV7PNrfan/LNMlL+s2C9 xv7vUMJVtKpE6dkOtCBVz8JotPXeyYjtGgAh8dM5N9KZ8BnoPmCJZqt05UWOL+CYiFYc rtAfvga0WW92QDbmV2NMcilGovQT/pXo5Wc6DRq2skO6lCnX4fIF2HQjfX5wWI9WH6n3 6snw== X-Gm-Message-State: AOAM533vNVuiyDzh6Sf8TRnh3tx7wL7cpWRJcuyg+SbVFl5NvO90aLpr v40EcAaw5hIM2/f6vlz5SROFVlEWG+o8D3N+jIUM1dzfXk86GSYb0xN+tlqcsUTZWvLsTkExMTh baUbj5f9uy7F6Gw== X-Received: by 2002:a7b:c30e:: with SMTP id k14mr23423866wmj.156.1640818333480; Wed, 29 Dec 2021 14:52:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGgAj5wI9V2CIC5uSc/9zp/z8ESmizqvkVWkzXGtpfuURnXDCNlDWP97EWJdLWZ6dxdSjIfg== X-Received: by 2002:a7b:c30e:: with SMTP id k14mr23423858wmj.156.1640818333323; Wed, 29 Dec 2021 14:52:13 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yanan Wang , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Peter Maydell , Richard Henderson , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 1/3] hw/qdev: Restrict qdev_get_gpio_out_connector() to qdev-internal.h Date: Wed, 29 Dec 2021 23:52:04 +0100 Message-Id: <20211229225206.171882-2-philmd@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211229225206.171882-1-philmd@redhat.com> References: <20211229225206.171882-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1640818339898000001 qdev_get_gpio_out_connector() is called by sysbus_get_connected_irq() which is only used by platform-bus.c; restrict it to hw/core/ by adding a local "qdev-internal.h" header. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Yanan Wang --- hw/core/qdev-internal.h | 15 +++++++++++++++ include/hw/qdev-core.h | 18 ------------------ hw/core/gpio.c | 1 + hw/core/sysbus.c | 1 + 4 files changed, 17 insertions(+), 18 deletions(-) create mode 100644 hw/core/qdev-internal.h diff --git a/hw/core/qdev-internal.h b/hw/core/qdev-internal.h new file mode 100644 index 00000000000..6ec17d0ea70 --- /dev/null +++ b/hw/core/qdev-internal.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * qdev internal helpers + * + * Copyright (c) 2009-2021 QEMU contributors + */ +#ifndef HW_CORE_QDEV_INTERNAL_H +#define HW_CORE_QDEV_INTERNAL_H + +#include "hw/qdev-core.h" + +/* Following functions are only used by the platform-bus subsystem */ +qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, i= nt n); + +#endif /* HW_CORE_QDEV_INTERNAL_H */ diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index d19c9417520..655899654bb 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -532,24 +532,6 @@ void qdev_connect_gpio_out(DeviceState *dev, int n, qe= mu_irq pin); void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n, qemu_irq input_pin); =20 -/** - * qdev_get_gpio_out_connector: Get the qemu_irq connected to an output GP= IO - * @dev: Device whose output GPIO we are interested in - * @name: Name of the output GPIO array - * @n: Number of the output GPIO line within that array - * - * Returns whatever qemu_irq is currently connected to the specified - * output GPIO line of @dev. This will be NULL if the output GPIO line - * has never been wired up to the anything. Note that the qemu_irq - * returned does not belong to @dev -- it will be the input GPIO or - * IRQ of whichever device the board code has connected up to @dev's - * output GPIO. - * - * You probably don't need to use this function -- it is used only - * by the platform-bus subsystem. - */ -qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, i= nt n); - /** * qdev_intercept_gpio_out: Intercept an existing GPIO connection * @dev: Device to intercept the outbound GPIO line from diff --git a/hw/core/gpio.c b/hw/core/gpio.c index 80d07a6ec99..513ccbd1062 100644 --- a/hw/core/gpio.c +++ b/hw/core/gpio.c @@ -21,6 +21,7 @@ #include "hw/qdev-core.h" #include "hw/irq.h" #include "qapi/error.h" +#include "qdev-internal.h" =20 static NamedGPIOList *qdev_get_named_gpio_list(DeviceState *dev, const char *name) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 05c1da3d311..0e6773c8df7 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -23,6 +23,7 @@ #include "hw/sysbus.h" #include "monitor/monitor.h" #include "exec/address-spaces.h" +#include "qdev-internal.h" =20 static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent); static char *sysbus_get_fw_dev_path(DeviceState *dev); --=20 2.33.1 From nobody Mon Feb 9 01:49:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1640818341; cv=none; d=zohomail.com; s=zohoarc; b=dKVpc91G1CTBQENChjmzDHv3KjCHXKy+a/C0zi0Is6QTw2vItmQdGWYUqQY6cl5WuW90HGfu92e85B5AB8L+pgy21Tti1DAHx/kURvDJx7Gif+r5IBuLttRBEgfbb/W78tCX4dCEWr2dlLPjOYyg0QxcQLLA+pT136+kSLiXhUc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640818341; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=QoRpcBVSaExXmb7fG4VqILyo3dvxz3orNpgQdbWBHqE=; b=JBEP+AbLnLWHU5WunXFdhiEOMdi8pXhxSOsQCjj1NDdMrShHmd2OJd2W/NK82wKHM337K9t4KWIbpuh8cidsziZhc/l1CKPdRKEJVgaAOPODyooay4khBn/ItW9MaS7VpJo05sHQBvdAwqoToP3ZvevFKSSkmmTxlEc0sgWdaNc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1640818341835586.8806968892585; Wed, 29 Dec 2021 14:52:21 -0800 (PST) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-558-_WCHzHugMxSxPL5CQggSLw-1; Wed, 29 Dec 2021 17:52:20 -0500 Received: by mail-wm1-f69.google.com with SMTP id j11-20020a05600c410b00b00345812649ddso1327256wmi.8 for ; Wed, 29 Dec 2021 14:52:19 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (26.red-83-50-86.dynamicip.rima-tde.net. [83.50.86.26]) by smtp.gmail.com with ESMTPSA id n9sm27898232wmq.37.2021.12.29.14.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Dec 2021 14:52:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640818341; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QoRpcBVSaExXmb7fG4VqILyo3dvxz3orNpgQdbWBHqE=; b=QsVde0gxvY3GqRT4LVklU1XYFA9Kgxe8to/N7F0ZO6STQu04kM8nptx9WOMAO56bSTan3i FO53nSpzwZWHeTMsjr8U5eM6J6/YffvgWlAhFD2sYlx8GG8vX1plcaSej4JzFKU1uQ19qD s3bMRXbYZcCt9sc1tVkYXtk/3MKoe0A= X-MC-Unique: _WCHzHugMxSxPL5CQggSLw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QoRpcBVSaExXmb7fG4VqILyo3dvxz3orNpgQdbWBHqE=; b=Bbzh3WGKLbDrLw/244dE7Vf02YvZgWDld6A8xLOrwrKsZZVj20iVuk6dv6folRPzz0 xgwiAv1dqH6tiZFFyhCPxQqieEmuvQaIlwiP+nL4InaqIizhuSt+FPCy9OkSVM2f0bjh lpGY4sEAXQkmQEoJ7uiNHuT/27/yDybx/QsMHeu/Uj8i+YOTCstJx004Lx21F5ENb45h BvyegudQGYGASjZkyRIuiRmC5WboiAGsPD3CaCurcpIpfwFNv1CxEofWb1h9KpJT6Gd4 bQl4fUijDkiR+nMppSvZ31cnhcKy1rPveJOZD7acjVKsw3i8cVAsm6oZs6B9Xu9L98JD PdYQ== X-Gm-Message-State: AOAM531kZyXIi6jplOlNpuIlLQWtrO0561U8z03jWohMHZHMEfMT09Uh R/qHbEdzAjKtMfcNqGbvNVqop9oeVdB9sZx07jdKJnQOzR8vDIDgP3BVLBlr3NcP4d84xreTI5/ qiooyrl9mc0YEog== X-Received: by 2002:a05:600c:204d:: with SMTP id p13mr24293395wmg.102.1640818338846; Wed, 29 Dec 2021 14:52:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJzPE5b8DuLYePT6Y64gnwlRrsxQC6MembPp94mt7rHfJzJ5kIt/jQTJNtbRZIKLfHzQvWr+qg== X-Received: by 2002:a05:600c:204d:: with SMTP id p13mr24293379wmg.102.1640818338702; Wed, 29 Dec 2021 14:52:18 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yanan Wang , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Peter Maydell , Richard Henderson , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 2/3] hw/sysbus: Restrict sysbus_get_connected_irq() to sysbus-internal.h Date: Wed, 29 Dec 2021 23:52:05 +0100 Message-Id: <20211229225206.171882-3-philmd@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211229225206.171882-1-philmd@redhat.com> References: <20211229225206.171882-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1640818342128000001 sysbus_get_connected_irq() and sysbus_is_irq_connected() are only used by platform-bus.c; restrict them to hw/core/ by adding a local "sysbus-internal.h" header. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Yanan Wang --- hw/core/sysbus-internal.h | 16 ++++++++++++++++ include/hw/sysbus.h | 2 -- hw/core/platform-bus.c | 2 +- hw/core/sysbus.c | 1 + 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 hw/core/sysbus-internal.h diff --git a/hw/core/sysbus-internal.h b/hw/core/sysbus-internal.h new file mode 100644 index 00000000000..991b3e3159c --- /dev/null +++ b/hw/core/sysbus-internal.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * SysBus internal helpers + * + * Copyright (c) 2021 QEMU contributors + */ +#ifndef HW_CORE_SYSBUS_INTERNAL_H +#define HW_CORE_SYSBUS_INTERNAL_H + +#include "hw/sysbus.h" + +/* Following functions are only used by the platform-bus subsystem */ +qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n); +bool sysbus_is_irq_connected(SysBusDevice *dev, int n); + +#endif /* HW_CORE_SYSBUS_INTERNAL_H */ diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 3564b7b6a22..24645ee7996 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -77,8 +77,6 @@ void sysbus_init_ioports(SysBusDevice *dev, uint32_t iopo= rt, uint32_t size); bool sysbus_has_irq(SysBusDevice *dev, int n); bool sysbus_has_mmio(SysBusDevice *dev, unsigned int n); void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq); -bool sysbus_is_irq_connected(SysBusDevice *dev, int n); -qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n); void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr); void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr, int priority); diff --git a/hw/core/platform-bus.c b/hw/core/platform-bus.c index b8487b26b67..016fb71eba1 100644 --- a/hw/core/platform-bus.c +++ b/hw/core/platform-bus.c @@ -25,7 +25,7 @@ #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/module.h" - +#include "sysbus-internal.h" =20 /* * Returns the PlatformBus IRQ number for a SysBusDevice irq number or -1 = if diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 0e6773c8df7..dcd7beda184 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -24,6 +24,7 @@ #include "monitor/monitor.h" #include "exec/address-spaces.h" #include "qdev-internal.h" +#include "sysbus-internal.h" =20 static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent); static char *sysbus_get_fw_dev_path(DeviceState *dev); --=20 2.33.1 From nobody Mon Feb 9 01:49:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1640818346; cv=none; d=zohomail.com; s=zohoarc; b=PIWwYRXyeZXlvyLbybiHG9xXhmAhoMJzKbwprGRfm4XZdWdM479sZUG15hcudwkAqyZKtTUaawUxorTIcgIruNZqaZkYVfshsmNyvI+7HK1C2f1E7R1a30MhuN9w0Iqt3U7iJbtRzKpltaeTzfQXZ+w1JTBfuO+xAsvQ607Q+Zw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640818346; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=uqL8vZZPvn+NdNRr9VNi7rmG13LdpKOsdG9YYXl47e0=; b=dxbSNqhqeiuNaaOKx7axv6ysjZ8Ecg4kAYlNyZ1u0WB+zSXEWS9fkCa3UCcy+e/GI0EVvNA2OZXfddw3ItEp9KrMBIcbBw4SmIJIGHI1gq4Vvr2dQA6JSSmdPfpyI7DcaCTldWxGFjetBG25ZCvPZE3w/BTsclBW61swYWI8VG8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 164081834653383.33594282002014; Wed, 29 Dec 2021 14:52:26 -0800 (PST) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-407-26DScZW8Mv6Dw5vax1SoGg-1; Wed, 29 Dec 2021 17:52:24 -0500 Received: by mail-wr1-f69.google.com with SMTP id x20-20020adfbb54000000b001a0d044e20fso5446669wrg.11 for ; Wed, 29 Dec 2021 14:52:24 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (26.red-83-50-86.dynamicip.rima-tde.net. [83.50.86.26]) by smtp.gmail.com with ESMTPSA id e5sm25289236wrq.116.2021.12.29.14.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Dec 2021 14:52:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640818345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uqL8vZZPvn+NdNRr9VNi7rmG13LdpKOsdG9YYXl47e0=; b=NknRLXjCkjZrB4iVDObXU1KBrOBGyogUY/itqO6AjiOZXnbXWGRkSS5KafpYiuwWbtjaG0 KKssJigIodFjaRT166ZA0+DVYk9wwZeTV+/NYXwfVcCW467W+/imAXc2KKdtBNCcw+VR5f F+5eEoUqFZkFblw2HQrC2s5DVn2ng3k= X-MC-Unique: 26DScZW8Mv6Dw5vax1SoGg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uqL8vZZPvn+NdNRr9VNi7rmG13LdpKOsdG9YYXl47e0=; b=IeYqu45ga+dBLxxmv7PiXepsqC1Q6QvxH90FQWcvgq0blnb0fFLAK2l4MKVrjRR0oh Cfn9hHwfAJQAc4xQ2AnPOlWGULpJeTuEQjc1ZWXsanVfBf6nX07ig41B/KCNSoW5/U7t lvcwUqu0KuP3k9NIVd12kvRQDSv/wLLPzxjqpCkO3BuQDqPFUp2zvrTXJvOfz9JPzymj /mzoOW/3BAeG8GMw1RuSQ1vT46aQPoZouZFBu4NfrDLwDJ115/wiLDL+1P7ogQg+/jeB qX798ruvjTwUMRE1c9Fjh2JBRfzyRLmdjzgTLg39tZColB0Rj2ZF+R8ARY+LdGjywIsf c3Aw== X-Gm-Message-State: AOAM530thxCWr/6K4onMe/nxFXBaYzchr2ACfRGG1nKu+R7nMNlfWFGz q9iKWKkehagB7paQ3PeJYbs1M7lVE8GtMhMk7jV6iY/cSNHs9XTJJuHwLWB9UZSnnkKa9x0+r2w ORz7lJ2YqOew9Dg== X-Received: by 2002:a05:600c:1d8f:: with SMTP id p15mr23685437wms.102.1640818343403; Wed, 29 Dec 2021 14:52:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJw1+hlMZ/ltqE4Tzud7R7Rd6xQgmcqVKrh37e2H+5JTXkTd/vc993T+03P96RWNnah8R1JRig== X-Received: by 2002:a05:600c:1d8f:: with SMTP id p15mr23685432wms.102.1640818343242; Wed, 29 Dec 2021 14:52:23 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yanan Wang , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Peter Maydell , Richard Henderson , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 3/3] hw/sysbus: Document GPIO related functions Date: Wed, 29 Dec 2021 23:52:06 +0100 Message-Id: <20211229225206.171882-4-philmd@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211229225206.171882-1-philmd@redhat.com> References: <20211229225206.171882-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1640818348528000001 Similarly to cd07d7f9f51 ("qdev: Document GPIO related functions"), add documentation comments for the various sysbus functions related to creating and connecting GPIO lines. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/sysbus.h | 67 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 24645ee7996..7b2b7c7faaa 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -69,14 +69,75 @@ typedef void FindSysbusDeviceFunc(SysBusDevice *sbdev, = void *opaque); =20 void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory); MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n); -void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p); -void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target); -void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size= ); =20 +/** + * sysbus_init_irq: Create an output GPIO line + * @dev: Sysbus device to create output GPIO for + * @irq: Pointer to qemu_irq for the GPIO lines + * + * Sysbus devices should use this function in their instance_init + * or realize methods to create any output GPIO lines they need. + * + * The @irq argument should be a pointer to either a "qemu_irq" in + * the device's state structure. The device implementation can then raise + * and lower the GPIO line by calling qemu_set_irq(). (If anything is + * connected to the other end of the GPIO this will cause the handler + * function for that input GPIO to be called.) + * + * See sysbus_connect_irq() for how code that uses such a device can + * connect to one of its output GPIO lines. + * + * There is no need to release the @pins allocated array because it + * will be automatically released when @dev calls its instance_finalize() + * handler. + */ +void sysbus_init_irq(SysBusDevice *dev, qemu_irq *irq); + +/** + * sysbus_pass_irq: Create GPIO lines on container which pass through + * to a target device + * @dev: Device which needs to expose GPIO lines + * @target: Device which has GPIO lines + * + * This function allows a container device to create GPIO arrays on itself + * which simply pass through to a GPIO array of another device. It is + * useful when modelling complex devices such system-on-chip, where a + * sysbus device contains other sysbus devices. + * + * It is not possible to pass a subset of the GPIO lines with this functio= n. + * + * To users of the container sysbus device, the GPIO array created on @dev + * behaves exactly like any other. + */ +void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target); + +void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size= ); =20 bool sysbus_has_irq(SysBusDevice *dev, int n); bool sysbus_has_mmio(SysBusDevice *dev, unsigned int n); + +/** + * sysbus_connect_irq: Connect a sysbus device output GPIO line + * @dev: sysbus device whose GPIO to connect + * @n: Number of the output GPIO line (which must be in range) + * @pin: qemu_irq to connect the output line to + * + * This function connects an output GPIO line on a sysbus device + * up to an arbitrary qemu_irq, so that when the device asserts that + * output GPIO line, the qemu_irq's callback is invoked. + * The index @n of the GPIO line must be valid, otherwise this function + * will assert(). + * + * Outbound GPIO lines can be connected to any qemu_irq, but the common + * case is connecting them to another device's inbound GPIO line, using + * the qemu_irq returned by qdev_get_gpio_in() or qdev_get_gpio_in_named(). + * + * It is not valid to try to connect one outbound GPIO to multiple + * qemu_irqs at once, or to connect multiple outbound GPIOs to the + * same qemu_irq; see qdev_connect_gpio_out() for details. + */ void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq); + void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr); void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr, int priority); --=20 2.33.1