From nobody Mon Feb 9 08:12:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591632081; cv=none; d=zohomail.com; s=zohoarc; b=hHFCXHTa53oeUNlZJ1Q9wASvGCv6WuBXmoF9gn73n5bmIvoTQ1jSAVYGWWRiYYI9f8JDnLs2G4t/zfF8hTnORDQwhD13lHrZzh5rDs+9/dhq+gjH+Vzphrgz0PlAnz9XrYhtparWttCy5lET3AtjTGUxhEHHhXUYcDY+mEDD58w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591632081; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5qtqeym41wYPVUNcQP0hBuZd3ZN8CptiJr597zGfRw0=; b=JVfNQ9EP9ftTi/lqXJyBXcqDioOQ/JhOXvYVtuNfPhw0sJut+eX2uQhdo94ABhUiZ/+s4M1neUpzmiWXJJanRTkOO6CJx2yWFifxFC1m+3/bv5pLcO1aV3JckGd50GnhxeMzLNgZps20gvJnVgX6PErGv7v/x8y9wnfsPSMc4dw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1591632081746604.5331895828884; Mon, 8 Jun 2020 09:01:21 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jiKCt-0003dK-LZ; Mon, 08 Jun 2020 16:01:03 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jiKCs-0003dF-Pj for xen-devel@lists.xenproject.org; Mon, 08 Jun 2020 16:01:03 +0000 Received: from us-smtp-1.mimecast.com (unknown [205.139.110.61]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 40430748-a9a1-11ea-b292-12813bfff9fa; Mon, 08 Jun 2020 16:01:02 +0000 (UTC) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-10-C-IMLKm3NzqOEfEVx2yPtQ-1; Mon, 08 Jun 2020 12:01:00 -0400 Received: by mail-wm1-f72.google.com with SMTP id u15so5404wmm.5 for ; Mon, 08 Jun 2020 09:01:00 -0700 (PDT) Received: from localhost.localdomain (181.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.181]) by smtp.gmail.com with ESMTPSA id z12sm227313wrg.9.2020.06.08.09.00.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 09:00:58 -0700 (PDT) X-Inumbo-ID: 40430748-a9a1-11ea-b292-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591632062; 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=5qtqeym41wYPVUNcQP0hBuZd3ZN8CptiJr597zGfRw0=; b=ZJ1bmmLC8MzdFyhdJ/AYRnrDCyOMjqlp8Q3RNPHP7aw673+RFfO7MAjat4egBPWFlRoMh5 KlHhjiLzfymReJojXx53IxMXyUGhDC0Q6sYBvyofF8yCZCYEuoHuDCuVigj6NumCRljMpS QBJbsDReAANM/DWECAyami/OuifkIMs= X-MC-Unique: C-IMLKm3NzqOEfEVx2yPtQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5qtqeym41wYPVUNcQP0hBuZd3ZN8CptiJr597zGfRw0=; b=T/CW8MhPLSTsSekEBE7TOoMqN2r8RLgDznvRKxD5Gn+lBgqSd+7f4s846wxkuScrmH 5ghQoXHzNUtx0t6pAutF8m6ZnKtZlYpnchEBeuXd68H079NZ8tDcZ9L+IINj4qeoqNnH DpR/NW9KKd/8P2kbCbms/IylTTcwD9v2VhlLlE1F565m2z3EJWK5iJVKu1XwgDOQ3lxT OU8IcUxgzHoFSJt2gWSl0NPByO5RoS7/jfx7ZdYQCyvmgSWherHScZjdZhtoQK2JgsBD 1VK10V1OjiTcr0ahfRB4FRNlML4yUwS1MY76dUYDTo0Icfr02wumoS4UFjVDrTSCNGOf NBug== X-Gm-Message-State: AOAM532O2A1NqDkp5rSc6oevguzjV6OtQiTWa6qKFehDQ1KyB4EgU0e0 uLNs8IBUtE7Wq5sKgq7uJAOEQeTlsxC1RFYt2rdrCZ2rZCWNCzze8o6Vs7blkWRubjpzyi61mQA dcEc9NWxaq2r2ZgBNEcBiG08wrxU= X-Received: by 2002:adf:de0b:: with SMTP id b11mr24236310wrm.346.1591632059271; Mon, 08 Jun 2020 09:00:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCLkZjArfyp0BDfLlr7paJJyNdZb8aPEICM5cLMV+w6rNjL53A+D/YIALTIycqApB88KkdKg== X-Received: by 2002:adf:de0b:: with SMTP id b11mr24236267wrm.346.1591632059025; Mon, 08 Jun 2020 09:00:59 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 02/35] hw/core/qdev: Add qdev_warn_deprecated_function_used() helper Date: Mon, 8 Jun 2020 18:00:11 +0200 Message-Id: <20200608160044.15531-3-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200608160044.15531-1-philmd@redhat.com> References: <20200608160044.15531-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Sagar Karandikar , "Michael S. Tsirkin" , Mark Cave-Ayland , Max Filippov , Alistair Francis , Gerd Hoffmann , "Edgar E. Iglesias" , Stefano Stabellini , Paul Durrant , Magnus Damm , Markus Armbruster , Marcel Apfelbaum , Anthony Perard , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Gibson , Andrzej Zaborowski , Eduardo Habkost , Alistair Francis , qemu-arm@nongnu.org, xen-devel@lists.xenproject.org, qemu-riscv@nongnu.org, Stafford Horne , Palmer Dabbelt , Richard Henderson , "Daniel P . Berrange" , Thomas Huth , Bastian Koppelmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Walle , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) When built with --enable-qdev-deprecation-warning, calling qdev_warn_deprecated_function_used() will emit a warning such: $ qemu-system-arm -M verdex ... qemu-system-arm: warning: use of deprecated non-qdev/non-qom code in pxa2= xx_lcdc_init() qemu-system-arm: warning: use of deprecated non-qdev/non-qom code in pxa2= xx_i2s_init() qemu-system-arm: warning: use of deprecated non-qdev/non-qom code in pxa2= 7x_keypad_init() Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- configure | 8 ++++++++ include/hw/qdev-deprecated.h | 26 ++++++++++++++++++++++++++ hw/core/qdev.c | 8 ++++++++ 3 files changed, 42 insertions(+) create mode 100644 include/hw/qdev-deprecated.h diff --git a/configure b/configure index 597e909b53..9b7a8927c6 100755 --- a/configure +++ b/configure @@ -434,6 +434,7 @@ edk2_blobs=3D"no" pkgversion=3D"" pie=3D"" qom_cast_debug=3D"yes" +qdev_deprecation_warning=3D"no" trace_backends=3D"log" trace_file=3D"trace" spice=3D"" @@ -1114,6 +1115,8 @@ for opt do ;; --enable-qom-cast-debug) qom_cast_debug=3D"yes" ;; + --enable-qdev-deprecation-warning) qdev_deprecation_warning=3D"yes" + ;; --disable-virtfs) virtfs=3D"no" ;; --enable-virtfs) virtfs=3D"yes" @@ -1882,6 +1885,7 @@ disabled with --disable-FEATURE, default is enabled i= f available: virglrenderer virgl rendering support xfsctl xfsctl support qom-cast-debug cast debugging support + qdev-deprecation-warning display qdev deprecation warnings tools build qemu-io, qemu-nbd and qemu-img tools vxhs Veritas HyperScale vDisk backend support bochs bochs image format support @@ -6723,6 +6727,7 @@ echo "gcov enabled $gcov" echo "TPM support $tpm" echo "libssh support $libssh" echo "QOM debugging $qom_cast_debug" +echo "QDEV deprecation warnings $qdev_deprecation_warning" echo "Live block migration $live_block_migration" echo "lzo support $lzo" echo "snappy support $snappy" @@ -7345,6 +7350,9 @@ fi if test "$qom_cast_debug" =3D "yes" ; then echo "CONFIG_QOM_CAST_DEBUG=3Dy" >> $config_host_mak fi +if test "$qdev_deprecation_warning" =3D "yes" ; then + echo "CONFIG_QDEV_DEPRECATION_WARNING=3Dy" >> $config_host_mak +fi if test "$rbd" =3D "yes" ; then echo "CONFIG_RBD=3Dm" >> $config_host_mak echo "RBD_CFLAGS=3D$rbd_cflags" >> $config_host_mak diff --git a/include/hw/qdev-deprecated.h b/include/hw/qdev-deprecated.h new file mode 100644 index 0000000000..b815f62dae --- /dev/null +++ b/include/hw/qdev-deprecated.h @@ -0,0 +1,26 @@ +/* + * QEMU QOM qdev deprecation helpers + * + * Copyright (c) 2020 Red Hat, Inc. + * + * Author: + * Philippe Mathieu-Daud=C3=A9 + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ +#ifndef HW_QDEV_DEPRECATED_H +#define HW_QDEV_DEPRECATED_H + +/** + * qdev_warn_deprecated_function_used: + * + * Display a warning that deprecated code is used. + */ +#define qdev_warn_deprecated_function_used() \ + qdev_warn_deprecated_function(__func__) +void qdev_warn_deprecated_function(const char *function); + +#endif diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 9e5538aeae..901fa93657 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -35,6 +35,7 @@ #include "hw/hotplug.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-deprecated.h" #include "hw/boards.h" #include "hw/sysbus.h" #include "hw/qdev-clock.h" @@ -819,6 +820,13 @@ void qdev_alias_all_properties(DeviceState *target, Ob= ject *source) } while (class !=3D object_class_by_name(TYPE_DEVICE)); } =20 +void qdev_warn_deprecated_function(const char *function) +{ +#ifdef CONFIG_QDEV_DEPRECATION_WARNING + warn_report("use of deprecated non-qdev/non-qom code in %s()", functio= n); +#endif +} + static bool device_get_realized(Object *obj, Error **errp) { DeviceState *dev =3D DEVICE(obj); --=20 2.21.3