From patchwork Mon Aug 3 10:56:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 277185 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2751AC433E0 for ; Mon, 3 Aug 2020 10:58:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E783D2064B for ; Mon, 3 Aug 2020 10:58:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YDofVzda" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E783D2064B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k2YAf-0004FM-Sz for qemu-devel@archiver.kernel.org; Mon, 03 Aug 2020 06:58:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k2Y9K-0002WB-1u; Mon, 03 Aug 2020 06:56:58 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:52273) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k2Y9I-00027E-JG; Mon, 03 Aug 2020 06:56:57 -0400 Received: by mail-wm1-x343.google.com with SMTP id x5so13929680wmi.2; Mon, 03 Aug 2020 03:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QRLqvjPZM5QRNmLQDr+tXQzUft3WjflEMoWeAB3UDPs=; b=YDofVzda85ykr9fEJEFK62BXHj0/IjkOZ8OHZt2reET5+RD7ncQT8JApdFDmsKKlA5 4cq4MupOP+lV+rmLY0PNugvyCt1WxIhuN34XbBM9SDqT6fKXx8eRTZXyqO61SLErJpwo HnNZTNqvfmf9x0CGZs2KA17Txq8fxZeaWUue2Xm3Leb8AGzCDBuhuKtK+UDAK8uNGAwX MHfYZvZLLgnH+pun9QBdGEVT5AqSkN8su9TodvfBdRzB3ekTFu7K6TXS7ZMYREmTXyvf uXtTzPysqsvz7EzsfOMTY+qAFGGbEIaaGaNUa56BSz1sJIWoxTRsT6ZSmKI2w9SjDGr0 3h7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=QRLqvjPZM5QRNmLQDr+tXQzUft3WjflEMoWeAB3UDPs=; b=DCUV8I6H6frMMvqNA52j/zHQ40xgbfDPZCHkZO4wF6+ifM4aAU1dGzZcKfk/9g11e5 /FoIxq2O4EqT6tFJbP3OVK6u+D9tZ3/NOI668iQloxG6Hvc1jyGkJDsye8ZwanNrJY9H iCfb2EKG4r8UmpOpkanCzY6OfOUu0FGCLkWcC7YcNjtc1ZNJyAufILiweGPhYZmlRTou 6zlWIQiX/IBHLJydH8PiZcWeLWHP0G3CxbBMR165PcTwibKmGnhYlp7edkGZyNgOzTPU aTyXOmggyC37DNzzdelV3P0i/AgR4Qe9VK7jnfbSLUvZyCplvgzkiSNcXMyZQmiGlVPa XRYw== X-Gm-Message-State: AOAM530t/JPzkZi3xBPKdKf0hg1vt88zB27tG7lEb1l/0FdlGjEkwwJO ORWGSf9dof9Y3iKdXBWcUnR503d+ X-Google-Smtp-Source: ABdhPJx6zGQZar9ofhQ/mvLKknS+8r+z7D7iqFeYIjdk8JriGACujcinh18/aR3CtMeojPTuqs07mA== X-Received: by 2002:a7b:cc8e:: with SMTP id p14mr4931821wma.111.1596452214171; Mon, 03 Aug 2020 03:56:54 -0700 (PDT) Received: from localhost.localdomain (214.red-88-21-68.staticip.rima-tde.net. [88.21.68.214]) by smtp.gmail.com with ESMTPSA id z11sm23103477wrw.93.2020.08.03.03.56.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2020 03:56:53 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.1? 3/4] hw/qdev-clock: Uninline qdev_connect_clock_in() Date: Mon, 3 Aug 2020 12:56:46 +0200 Message-Id: <20200803105647.22223-4-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200803105647.22223-1-f4bug@amsat.org> References: <20200803105647.22223-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x343.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damien Hedde , Peter Maydell , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, "Edgar E. Iglesias" , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We want to assert the device is not realized. To avoid overloading this header including "hw/qdev-core.h", uninline the function first. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/qdev-clock.h | 6 +----- hw/core/qdev-clock.c | 5 +++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/hw/qdev-clock.h b/include/hw/qdev-clock.h index a340f65ff9..a897f7c9d0 100644 --- a/include/hw/qdev-clock.h +++ b/include/hw/qdev-clock.h @@ -71,11 +71,7 @@ Clock *qdev_get_clock_out(DeviceState *dev, const char *name); * Set the source clock of input clock @name of device @dev to @source. * @source period update will be propagated to @name clock. */ -static inline void qdev_connect_clock_in(DeviceState *dev, const char *name, - Clock *source) -{ - clock_set_source(qdev_get_clock_in(dev, name), source); -} +void qdev_connect_clock_in(DeviceState *dev, const char *name, Clock *source); /** * qdev_alias_clock: diff --git a/hw/core/qdev-clock.c b/hw/core/qdev-clock.c index 5cc1e82e51..f139b68b88 100644 --- a/hw/core/qdev-clock.c +++ b/hw/core/qdev-clock.c @@ -183,3 +183,8 @@ Clock *qdev_alias_clock(DeviceState *dev, const char *name, return ncl->clock; } + +void qdev_connect_clock_in(DeviceState *dev, const char *name, Clock *source) +{ + clock_set_source(qdev_get_clock_in(dev, name), source); +} From patchwork Mon Aug 3 10:56:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 277184 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C09CC433DF for ; Mon, 3 Aug 2020 10:59:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CEC602064B for ; Mon, 3 Aug 2020 10:59:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KkFjxpKU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CEC602064B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k2YBx-00076f-T2 for qemu-devel@archiver.kernel.org; Mon, 03 Aug 2020 06:59:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k2Y9K-0002Wk-SP; Mon, 03 Aug 2020 06:56:59 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:50652) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k2Y9J-00027R-ES; Mon, 03 Aug 2020 06:56:58 -0400 Received: by mail-wm1-x335.google.com with SMTP id c80so13926411wme.0; Mon, 03 Aug 2020 03:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XHiU5GmBcdXr23pohS4D4pPIDt+/4V6rIKN0OFbqJDw=; b=KkFjxpKUK0u3KIKvxKYk6uVXB55kQ0Q5bBCKz25HyoB/Wzw/Lv23RsHRiFe/pbVgDT zDNfHU1sCeMKtKmSwixabV4h2vdHRUTW7CbS7THkVN2UI5sJp/r2POpLhwH14K2JDHNC Hpzfc0AMJHjuNvWH2UiX+CjcExK0fSbpKmxRb2rudsM2oAe2i0W8WayXtg4Ik0+EDycf X3uSSMqtzSPtQzoVDT1PrMezuYmSLW7VM/BKnWGCoiBx+wZvxSm1f3UYv9PYRO06Vzgv hgYgijh0Ki/wbopCdwLwAUNuersh5bfoGMnksROGSd9pQ5YtAbqYcCbqaDwD6xAJqoQ8 MAXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=XHiU5GmBcdXr23pohS4D4pPIDt+/4V6rIKN0OFbqJDw=; b=evk1VG7ghFbmVB6gRZr9VhQgqpkIYJnb0BuMiWmAxK78hcWW7U75MaIM2fjof197kf dCxm88YlsX/mNhmObQGTlnK5gffjYGRb1P6ZtJRsrgXKHGhI+VKKhsbHgg8HL9xMg/HM yS7Rb5NknlsC3XNVSnMSYj16Kmk7cV6iyrkb5KeOhbPY8SsIpX8JhRDXsI0/WUTidgh8 EUKd9ZaFtpgg1OgMQFGaAInhbk8tjj8ModWDRXMrAQQalyEm1TsMlDM2JH2oMiQdFUuE /ou8fkxcS52vg3/nXlhYXHqmUUKA3DzI6w/FW2PJI6gYViuATbokuFjcBW1uoRZ264VI S6Jw== X-Gm-Message-State: AOAM530j5wV+tMuMpwcy/82iJ/MQyQezWrgbpir+KKGbbX9DUUV2xrF3 FJ9Xe95Fue9gimn41ui7JHDgfeNw X-Google-Smtp-Source: ABdhPJz8WY0kh6Ov2rDiyPr3pBQwj0/g2n8VvoQGND9N0Hu5mkNvHU2wB+LV8/74aTxNwiVj/nIbMQ== X-Received: by 2002:a1c:770c:: with SMTP id t12mr16440255wmi.65.1596452215388; Mon, 03 Aug 2020 03:56:55 -0700 (PDT) Received: from localhost.localdomain (214.red-88-21-68.staticip.rima-tde.net. [88.21.68.214]) by smtp.gmail.com with ESMTPSA id z11sm23103477wrw.93.2020.08.03.03.56.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2020 03:56:54 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.1? 4/4] hw/qdev-clock: Avoid calling qdev_connect_clock_in after DeviceRealize Date: Mon, 3 Aug 2020 12:56:47 +0200 Message-Id: <20200803105647.22223-5-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200803105647.22223-1-f4bug@amsat.org> References: <20200803105647.22223-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x335.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damien Hedde , Peter Maydell , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, "Edgar E. Iglesias" , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Clock canonical name is set in device_set_realized (see the block added to hw/core/qdev.c in commit 0e6934f264). If we connect a clock after the device is realized, this code is not executed. This is currently not a problem as this name is only used for trace events, however this disrupt tracing. Add a comment to document qdev_connect_clock_in() must be called before the device is realized, and assert this condition. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/qdev-clock.h | 2 ++ hw/core/qdev-clock.c | 1 + 2 files changed, 3 insertions(+) diff --git a/include/hw/qdev-clock.h b/include/hw/qdev-clock.h index a897f7c9d0..64ca4d266f 100644 --- a/include/hw/qdev-clock.h +++ b/include/hw/qdev-clock.h @@ -70,6 +70,8 @@ Clock *qdev_get_clock_out(DeviceState *dev, const char *name); * * Set the source clock of input clock @name of device @dev to @source. * @source period update will be propagated to @name clock. + * + * Must be called before @dev is realized. */ void qdev_connect_clock_in(DeviceState *dev, const char *name, Clock *source); diff --git a/hw/core/qdev-clock.c b/hw/core/qdev-clock.c index f139b68b88..47ecb5b4fa 100644 --- a/hw/core/qdev-clock.c +++ b/hw/core/qdev-clock.c @@ -186,5 +186,6 @@ Clock *qdev_alias_clock(DeviceState *dev, const char *name, void qdev_connect_clock_in(DeviceState *dev, const char *name, Clock *source) { + assert(!dev->realized); clock_set_source(qdev_get_clock_in(dev, name), source); }