Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5AED3CCD195 for ; Wed, 22 Oct 2025 10:15:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBVrY-0000TD-JI; Wed, 22 Oct 2025 06:14:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBVrV-0000Sc-Pd for qemu-devel@nongnu.org; Wed, 22 Oct 2025 06:14:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBVrS-0000NB-8T for qemu-devel@nongnu.org; Wed, 22 Oct 2025 06:14:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761128069; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HE1TvwewyDrdHtzvkatS97V25+LHqy98C9ssz/Lcwoo=; b=VBWlCJe/kPr8MIJeBRBde5wU15QJmVhTUNkMfvr55JRc/GK5cNXvh5P2zu7jZDa8vO8zFE 0D913QjEAh31wGC01SC/BEOKADTbBnrBNrL1HLQJg7HnRvOZb+2n3pCYMKKhK9zQW2YErn XUMH2s8y3whR/yIIwdQeDZPKS89K1OM= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-378-GGN5FxHaPlCqD_4S384amA-1; Wed, 22 Oct 2025 06:14:25 -0400 X-MC-Unique: GGN5FxHaPlCqD_4S384amA-1 X-Mimecast-MFC-AGG-ID: GGN5FxHaPlCqD_4S384amA_1761128064 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2ECF4180AEBE; Wed, 22 Oct 2025 10:14:24 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.45.242.19]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9E5CB1953984; Wed, 22 Oct 2025 10:14:23 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 777A421E6925; Wed, 22 Oct 2025 12:14:20 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Cc: marcandre.lureau@redhat.com, pbonzini@redhat.com, berrange@redhat.com, eduardo@habkost.net, philmd@linaro.org Subject: [PATCH 2/3] qdev: Fix "info qtree" to show links Date: Wed, 22 Oct 2025 12:14:19 +0200 Message-ID: <20251022101420.36059-3-armbru@redhat.com> In-Reply-To: <20251022101420.36059-1-armbru@redhat.com> References: <20251022101420.36059-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org qdev_print_props() retrieves a property's value from its legacy property if it exists. A legacy property is created by qdev_class_add_legacy_property() when the property has a print() method or does not have a get() method. If it has a print() method, the legacy property's value is obtained from the property's print() method. This is used to format PCI addresses nicely, i.e. like 01.3 instead of 11. Else, if doesn't have a get() method, the legacy property is unreadable. "info qtree" silently skips unreadable properties. Link properties don't have a get() method, and are therefore skipped. This is wrong, because the underlying QOM property *is* readable. Change qdev_print_props() to simply use a print() method directly if it exists, else get the value via QOM. "info qtree" now shows links fine. For instance, machine "pc" onboard device "PIIX4_PM" property "bus" is now visible. Signed-off-by: Markus Armbruster --- system/qdev-monitor.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 2ac92d0a07..850f0c6606 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -745,19 +745,18 @@ static void qdev_print_props(Monitor *mon, DeviceState *dev, DeviceClass *dc, for (int i = 0, n = dc->props_count_; i < n; ++i) { const Property *prop = &dc->props_[i]; char *value; - char *legacy_name = g_strdup_printf("legacy-%s", prop->name); - if (object_property_get_type(OBJECT(dev), legacy_name, NULL)) { - value = object_property_get_str(OBJECT(dev), legacy_name, NULL); + if (prop->info->print) { + value = prop->info->print(OBJECT(dev), prop); } else { value = object_property_print(OBJECT(dev), prop->name, true, NULL); } - g_free(legacy_name); if (!value) { continue; } + qdev_printf("%s = %s\n", prop->name, *value ? value : ""); g_free(value); -- 2.49.0