From nobody Sun Jun 7 22:18:44 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1780614778; cv=none; d=zohomail.com; s=zohoarc; b=IQrxf2D1VtLHerU4bygT6A5xNOdMuFsL+ZP1Psbw4wdv1XJyp1jrd6ZssL8IfUsUlM+UGFfczCBuEeKRjxW1SbxmNlDhrJH4rfoBNkq7Joya7bJUuVX3aYq+xGj7a0TqQglRwEMeok92/8cLHRZZiY4udNZiKsSov9i0IvghyBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780614778; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jh4FKDkkZ9fI3XwVHCClBi0qhOegTlBzdvQBSit/whg=; b=OT9aI21hZ3YBCVSaSeMXk0rYiSCVXkmRoxF1uJsnPrZrvBm7hfiG88cf73WR9fAKyO4H+3He4A8kT0QWlDCharH5YpRwJ7p3Fes5Q7uGBmMOwkxJzrsXR1XzxWI/I7AvfIGA1PKX2x4GY0IWxviMsRYUDn3jkBFKl/g2qDaiNkE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1780614777995367.62878699630255; Thu, 4 Jun 2026 16:12:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wVHDr-0007FY-KO; Thu, 04 Jun 2026 19:11:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wVHDq-0007FJ-JE for qemu-devel@nongnu.org; Thu, 04 Jun 2026 19:11:34 -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 1wVHDo-0006LB-SV for qemu-devel@nongnu.org; Thu, 04 Jun 2026 19:11:34 -0400 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-520-PLaxo61COVyrJUrep4fITA-1; Thu, 04 Jun 2026 19:11:29 -0400 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-9157f1be04aso35697185a.3 for ; Thu, 04 Jun 2026 16:11:29 -0700 (PDT) Received: from x1.com ([142.189.10.167]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9158a37cab6sm707617285a.22.2026.06.04.16.11.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 16:11:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780614690; 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=jh4FKDkkZ9fI3XwVHCClBi0qhOegTlBzdvQBSit/whg=; b=WNx5EazuJRQEePuYGfBkeOWVPY0ySF3y5tRv6DQ5wLsZXZYz0daoxaK5mMmwEczASo/iLl qKF08nVyuVdcDNrSE1evp3L42eqTXiqnoUwaFxYDtmNOkTuRwkEjHI0Wc6qknaFTAJlm07 pho1+7YgmAJVAZUJT1LcDG3syIuCogo= X-MC-Unique: PLaxo61COVyrJUrep4fITA-1 X-Mimecast-MFC-AGG-ID: PLaxo61COVyrJUrep4fITA_1780614689 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1780614689; x=1781219489; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jh4FKDkkZ9fI3XwVHCClBi0qhOegTlBzdvQBSit/whg=; b=Kd2X0/gsn2JlekC+JI0W2kVPhht5oODYYEzKkZn7MAYDztw1sm2ZphWEcKP2aVX7UU 1znYjaNlodhL//i8D+69huqGezxBEGOTfYFhrUGKj5NPjcmncVJPtLJnquXc4GT3+cn5 7tu4mf/ldUNGhlwDxuzcDxjfhLdqgTflAKJXhghKjrOk6/z2M26XxlulRIRXcn/hnqIX VApirxIF91IlJAPEH6Z603JGdpphEh8t1mUYBr6JWnxzJ1ywOKxXlH/GgoeapceAk+vj BQHD7FBj/+1A5Uez7pbuCLtWP6DhWqWS80fQcl2HfFK0ekraxwBwFPqE9iuGUGNozDom l/nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780614689; x=1781219489; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=jh4FKDkkZ9fI3XwVHCClBi0qhOegTlBzdvQBSit/whg=; b=awigZ7KorL5McZjEPzZHReqpqB+2KgRGz9S7CCvPQQZhtNwENGKQs/p3ibfaA1iVW5 gXwI5NFEXGk64B+0HpMLzaCnFLEDnmUIJXm5RtbsELyEsZGFzTeX+gNBCnZtGNi9n71q Sbd4Vl9l53JOJ+K4cceFq1enePoNiBGG1Mtz7CWID/9Gu3PQo+gEyEg7Lvzv7By/pxRA egWJwuksKoDW8JBPf+XGHYoC+226O2dwNKewCdnQG5YrRO98ZvO3v4QiLyb0w0CSwUh9 WoLpeYgfIXQ3tYR/UV3O5S2ODcElsJKOHhi/gSNrv4d7he/THmHo5bxaUWa0N7OSWpDr rGSA== X-Gm-Message-State: AOJu0YxZ8ckURN0xt2S2H1syqMkcqVHiHrfkhfkeQHekwNL4RBpwX8V6 tbtRshf635W9dolRY1vKr2K0akEQIcMDJ61aFWC5/pHH7fsrjS2lrvzhoinbfm6X+BcDe9GxT/p ajz+sn6VhZnMt6rcIcbW7si/U4MtWDpG9Is1Fw8y5rCVgoLG2lomexB9dkhiZFOj9zC44gHEDQY dy8Dtbvs7KS4pANPo+hXOnnlqzmYlprPAHBF1E/w== X-Gm-Gg: Acq92OHnPjsSP5b1NmpjFFbnrWxK9YHnuaGgGpTjsXhF2v0JCZkw6yFVk6ob8mHzE7y t4FppeFOU45hLllbSinPiYWkNuwJLSeqYy08xj7UULuc0nt4bikq+Z9EiDl+Qv+h0ee8hHgDr4I h2Ak+26RBexuO6tPZOJJe3R01ObStBbRpZz+dDlf5yAFqUCIUTpwNqxWtv4/zQ+IZJtXU3G6s59 JRhxSQCwgZsh+Htk2O48d6zQEOENB0DJ1haEXl17n7KwYoQg6j4EYAsNFsu5q8ij2+OyC1wVqXW RAd4gQ5YkZp0EKTOEdap3DFMj60iQxO1LWPIpNS7Hz1jvOs/3KxthMD2OZRmgWR9ILLN9+LE7nP fGrBuwa2+yPN/Tflzf4PMT+E= X-Received: by 2002:a05:620a:2a05:b0:915:9125:e634 with SMTP id af79cd13be357-915a9db4ce4mr216936685a.42.1780614688466; Thu, 04 Jun 2026 16:11:28 -0700 (PDT) X-Received: by 2002:a05:620a:2a05:b0:915:9125:e634 with SMTP id af79cd13be357-915a9db4ce4mr216926285a.42.1780614687779; Thu, 04 Jun 2026 16:11:27 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fabiano Rosas , Juraj Marcin , Vladimir Sementsov-Ogievskiy , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Sana Sharma , Eric Blake , Markus Armbruster , Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , Akihiko Odaki , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , "Dr . David Alan Gilbert" Subject: [PATCH 1/4] qdev: Pave way for exporting Property to be used in non-qdev Date: Thu, 4 Jun 2026 19:11:15 -0400 Message-ID: <20260604231118.1584889-2-peterx@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260604231118.1584889-1-peterx@redhat.com> References: <20260604231118.1584889-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, 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_H5=0.001, RCVD_IN_MSPIKE_WL=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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1780614781009154100 Content-Type: text/plain; charset="utf-8" Property itself is a well defined interface to either support smooth conversions to Object's properties, or supports global properties. However currently it's tied to DeviceClass, aka, qdev. So non-qdev cannot use Property list. My current observation shows Property is almost ready to be used as a separated exported interface, except two small things that may need touch up internally: qdev_prop_allow_set qdev_prop_check_globals The 1st one currently checks against realize state (which is part of qdev attributes only). The 2nd one checks for all global property being used in all non-pluggable qdevs. We can loose the check in both spots, keep the check if the driver is a qdev, otherwise we can safely whitelist non-qdev use cases of Property. Signed-off-by: Peter Xu --- hw/core/qdev-properties.c | 24 ++++++++++++++++++++---- tests/unit/test-qdev-global-props.c | 6 +++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 34d7b26a73..8f870c85fc 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -31,8 +31,14 @@ void qdev_prop_set_after_realize(DeviceState *dev, const= char *name, static bool qdev_prop_allow_set(Object *obj, const char *name, const PropertyInfo *info, Error **errp) { - DeviceState *dev =3D DEVICE(obj); + DeviceState *dev; + + if (!object_dynamic_cast(obj, TYPE_DEVICE)) { + /* Currently, non-qdev can always set Property anytime */ + return true; + } =20 + dev =3D DEVICE(obj); if (dev->realized && !info->realized_set_allowed) { qdev_prop_set_after_realize(dev, name, errp); return false; @@ -997,6 +1003,7 @@ int qdev_prop_check_globals(void) =20 for (i =3D 0; i < global_props()->len; i++) { GlobalProperty *prop; + bool hotpluggable; ObjectClass *oc; DeviceClass *dc; =20 @@ -1005,15 +1012,24 @@ int qdev_prop_check_globals(void) continue; } oc =3D object_class_by_name(prop->driver); - oc =3D object_class_dynamic_cast(oc, TYPE_DEVICE); if (!oc) { warn_report("global %s.%s has invalid class name", prop->driver, prop->property); ret =3D 1; continue; } - dc =3D DEVICE_CLASS(oc); - if (!dc->hotpluggable && !prop->used) { + oc =3D object_class_dynamic_cast(oc, TYPE_DEVICE); + if (oc) { + dc =3D DEVICE_CLASS(oc); + hotpluggable =3D dc->hotpluggable; + } else { + /* + * Currently, to be strict to assume all non-qdev are not + * hotpluggable (whoever will use -global). + */ + hotpluggable =3D false; + } + if (!hotpluggable && !prop->used) { warn_report("global %s.%s=3D%s not used", prop->driver, prop->property, prop->value); ret =3D 1; diff --git a/tests/unit/test-qdev-global-props.c b/tests/unit/test-qdev-glo= bal-props.c index 8ea362cbb9..86bb1458d9 100644 --- a/tests/unit/test-qdev-global-props.c +++ b/tests/unit/test-qdev-global-props.c @@ -275,8 +275,12 @@ static void test_dynamic_globalprop(void) g_test_trap_assert_stderr_unmatched("*prop4*"); g_test_trap_assert_stderr( "*warning: global nohotplug-type.prop5=3D105 not used*"); + /* + * TYPE_OBJECT can opt-in for global properties, so the error is "not + * used" too for nondevice-type. + */ g_test_trap_assert_stderr( - "*warning: global nondevice-type.prop6 has invalid class name*"); + "*warning: global nondevice-type.prop6=3D106 not used*"); g_test_trap_assert_stdout(""); } =20 --=20 2.53.0 From nobody Sun Jun 7 22:18:44 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1780614741; cv=none; d=zohomail.com; s=zohoarc; b=lRoxPKkqO2lZQBWFpwN9Nmka4iLoinlaFwrBLTEGWMDE9ncJnMCBCatoSx8kENBBiHXawjR7+HuBKWDvkPaY6yBiM5qDvRfUOhv3k1S50+52goX4YwnnJd4Wjqf+53km5xLshHwe4OwRkPDyY24QM8wvItkSyyecO99/a3hVnTA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780614741; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4AJ2lM9BNCEoaE5QIbvpYTcvEcCw4/TXdXr1P6/G5f4=; b=AzIuWeKSYuSuak+r5Jncw3aUf+1GeMGTuu0QNYpNJW6CHq1OdQqt91z6NxirxxH4yEWakXad70B3JhSBF9l2cCM7bdJtqK7lwQis1iYiKxRs5uZHleeWf3U4OycQFcZr+KlYowGP2y2ikQGgxuFONXxWoz2TTZLYLJUCQ0kY+A8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1780614741751240.40343966692137; Thu, 4 Jun 2026 16:12:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wVHDv-0007GM-6y; Thu, 04 Jun 2026 19:11:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wVHDt-0007GD-Pl for qemu-devel@nongnu.org; Thu, 04 Jun 2026 19:11:37 -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 1wVHDs-0006Lk-71 for qemu-devel@nongnu.org; Thu, 04 Jun 2026 19:11:37 -0400 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-612-C7UL9CyUPZS02J-PMPc92w-1; Thu, 04 Jun 2026 19:11:34 -0400 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-9157b94a014so111074985a.3 for ; Thu, 04 Jun 2026 16:11:34 -0700 (PDT) Received: from x1.com ([142.189.10.167]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9158a37cab6sm707617285a.22.2026.06.04.16.11.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 16:11:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780614695; 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=4AJ2lM9BNCEoaE5QIbvpYTcvEcCw4/TXdXr1P6/G5f4=; b=LI6ahxZGFYzRbkcRnhT6G/U0zdOSU+mAveWnEvY3OhrU+u1gaNQPDmuupS+/C2Bex0ApAW uK53o6VZ62pm4YNfXU2KUFqhAmvwdGtycoXJeN1+UWHh4cY0oMvY0fyt3cYuyPpwg8NZvE Duj/VH+UgTJHxV7bzGHUX2mdHpYsm74= X-MC-Unique: C7UL9CyUPZS02J-PMPc92w-1 X-Mimecast-MFC-AGG-ID: C7UL9CyUPZS02J-PMPc92w_1780614693 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1780614693; x=1781219493; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4AJ2lM9BNCEoaE5QIbvpYTcvEcCw4/TXdXr1P6/G5f4=; b=s6HCdkU4veQCmhtiw44HXdQ7jqUqqqAUnXTy5bmgAn+Rv6jtkyn97xXUWOVA/zkl81 DmI6eyykojMsb9dNzxhkzgz20fft2iRIp9OnK/R7FOz00r0VRRcfeyb1F7/jLIPs6+Nu ykCCrHzCh+uGdNvrkPX+H8J8WuykfS4Jj5q2E5hlpso6O4+M5iq2cMzdRica5ejDCIFJ 8exwBE8LvPCrwwaM6zn8JDfnULpDIglYgPCiLtV5Yo1EgOiCxppd6MKNycZK55LRMN42 g7Tpwj5osIMNKcjjuCvcy57TdGuS/82ChRbJ1ubhcyTpavYBHIMpWGgUIy3/sQBij210 nwvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780614693; x=1781219493; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=4AJ2lM9BNCEoaE5QIbvpYTcvEcCw4/TXdXr1P6/G5f4=; b=IUMtqkzrpw+4mUwuPeY4q7GxVyMhoo7jpT9NPk/5Ewz8f2+KKgf1Y1+TX4XXeVe8u3 1avqvmJJAJRgzSci+sWxk0zvcB9Foc19Q+95lWh7IFB6F8Io9wNb7IQPBU39vCGJPWFi rIrg2S0Y+LGNepibc7mNXjg40/N84neB18f/4z8SQE+hymc0N7ZuAKJDnYBkTvK5KajI sPbDf6Y7TnVwftNkWmiOQ6McThJHb2mgsyIC4D6sCPeT5XkVvimdzttHdurAefKA0y7E FuLSEkEU+9/KbWGmhUcqhUyjPahBgam1+R4Ahx1lTj4PLBPZnFWxyhao8A0vP79lgJU6 hkDg== X-Gm-Message-State: AOJu0YyzzzeSS9Xcz1wwGUr3DLx6gMWPxrjptwikMgIaAGlvsPsDWzbk aNO8JTpiuIWYt7U76xHEla6WubBTjnl4dS5PJBDOn2CB/vMvfMNcjeW57h8IJTsDc2jelDLd/M0 +FFlmV+iNi1HoqDTa+BXSzWjhuPejAY6hoqMGQK2AGMlBHahhaxVxD+oUkO5J9YlqPAhQY1zXXD iJ9zruRb4yetKKKqLu54OI5BmrOgNfZN3A3mfjBQ== X-Gm-Gg: Acq92OGc/KfeqTybN2j/8dOHBI9pXsWvF3ArSH2VcvuIN7PxaJmrmQ0AT1VtdNPIIq8 Pta0ZOzQn6LU6uQw3YaRacluY/cZwXy0N82oMRrKSs13AYlZm/tXexHRF2xfdqgmpuGkmDSoulX yN1x3fe9HJg//9Gn8SO4o8rYTs+IrzsGIPhtoc1RUb3Kvd4WhSiYEn1OGMHeNS2zX+oM8pfZyrs BxB9aVvsCqUj4aFTn5Z7OesSQzf+qUauQn75c3mrsfKD3Gcqh/umKeCe+t5PpiHWE7CSbnVUHU4 vEAw6oZ8dbnqL+Btlt2MRewW+NVbbrUqQ069MHS2jA86ZSXJiyZewD7emjM+mDIs+lQXd4PZtAn KNWMu+pWKS8qFo/jOOYd6IyY= X-Received: by 2002:a05:620a:1a1e:b0:915:80e8:67d1 with SMTP id af79cd13be357-915a9df5a98mr228326085a.56.1780614693470; Thu, 04 Jun 2026 16:11:33 -0700 (PDT) X-Received: by 2002:a05:620a:1a1e:b0:915:80e8:67d1 with SMTP id af79cd13be357-915a9df5a98mr228311885a.56.1780614692780; Thu, 04 Jun 2026 16:11:32 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fabiano Rosas , Juraj Marcin , Vladimir Sementsov-Ogievskiy , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Sana Sharma , Eric Blake , Markus Armbruster , Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , Akihiko Odaki , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , "Dr . David Alan Gilbert" Subject: [PATCH 2/4] qdev: Introduce helper object_apply_globals() Date: Thu, 4 Jun 2026 19:11:16 -0400 Message-ID: <20260604231118.1584889-3-peterx@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260604231118.1584889-1-peterx@redhat.com> References: <20260604231118.1584889-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, 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_H5=0.001, RCVD_IN_MSPIKE_WL=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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1780614744006154100 Content-Type: text/plain; charset="utf-8" The helper allows one object to apply anything from -global command lines to an object. Signed-off-by: Peter Xu --- include/hw/core/qdev-properties.h | 1 + hw/core/qdev-properties.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/hw/core/qdev-properties.h b/include/hw/core/qdev-prope= rties.h index eba5436e53..779acb31b6 100644 --- a/include/hw/core/qdev-properties.h +++ b/include/hw/core/qdev-properties.h @@ -268,6 +268,7 @@ const GlobalProperty *qdev_find_global_prop(Object *obj, const char *name); int qdev_prop_check_globals(void); void qdev_prop_set_globals(DeviceState *dev); +void object_apply_globals(Object *obj); void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj, const char *name, const char *value); =20 diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 8f870c85fc..a91c2ad101 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1045,6 +1045,11 @@ void qdev_prop_set_globals(DeviceState *dev) dev->hotplugged ? NULL : &error_fatal); } =20 +void object_apply_globals(Object *obj) +{ + object_apply_global_props(obj, global_props(), &error_fatal); +} + /* --- 64bit unsigned int 'size' type --- */ =20 static void get_size(Object *obj, Visitor *v, const char *name, void *opaq= ue, --=20 2.53.0 From nobody Sun Jun 7 22:18:44 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1780614738; cv=none; d=zohomail.com; s=zohoarc; b=MQcvbj9TuaWjfIawzKK5u/C9KQwYgqRxo8iJhDHCImEJq+RFDFQtkq6u5HALf/fTiDWnXBQtLUhXuZGED9LI7A8gvBZvvY89bTzxZCdequ+acHk4FrM/flSH11cfd5XveFbvz7yMGSxPjjCUhPz39SjpE+1DmY7KO5vP3aiHSfU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780614738; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=R4A39g0spLiznd90/Jk/6It+g1eygjhYpKlTbFN6CEk=; b=ibPRc6s/m89Nw1IHFE6eKancjX/2FMrSHN0fX2ZBRs621FzeGEVMZSP+sf9blnxHdvSBgpnnLEGBxuijPC7KWAfuiRFTSNsiatWkSrsoxrtTKqdZkUpN+Ay+YoHl07nFtXEd0nmLD6mCEuW09V+DHpkVeAl6BmHLMEP8tay7UXo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1780614738235775.315355041029; Thu, 4 Jun 2026 16:12:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wVHDz-0007HC-2W; Thu, 04 Jun 2026 19:11:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wVHDx-0007Gz-GJ for qemu-devel@nongnu.org; Thu, 04 Jun 2026 19:11:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wVHDw-0006Mg-1C for qemu-devel@nongnu.org; Thu, 04 Jun 2026 19:11:41 -0400 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-655-nMtt85VUPZy4j5thQ2C9vQ-1; Thu, 04 Jun 2026 19:11:35 -0400 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-91574ad6871so263662485a.0 for ; Thu, 04 Jun 2026 16:11:35 -0700 (PDT) Received: from x1.com ([142.189.10.167]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9158a37cab6sm707617285a.22.2026.06.04.16.11.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 16:11:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780614699; 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=R4A39g0spLiznd90/Jk/6It+g1eygjhYpKlTbFN6CEk=; b=g3ENMcg4zPIRlpnwP4JFpnQ6x+UFVW7ovjvfUG6Dpow0rUlIK/60BT8UISeG3xHF+ISwPm VIkIcr5sxcKUovWyIqkG8nJ2MEVs8a/dFkuY5qJygE8/aVN4wy5mcQtSCFPjKRTQXmpBQI WSZ4orvl1zEjmTFPjXOMlaBpGmoaCQY= X-MC-Unique: nMtt85VUPZy4j5thQ2C9vQ-1 X-Mimecast-MFC-AGG-ID: nMtt85VUPZy4j5thQ2C9vQ_1780614695 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1780614695; x=1781219495; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R4A39g0spLiznd90/Jk/6It+g1eygjhYpKlTbFN6CEk=; b=HKjuDturlpxhAtyX91MtGRT3ndvKCOgnP3edfCmd60JE13Fje8tEn100cBBGQmvtu9 XoAO4dcJGi0h0vahMJZjXUTh7tnCZfuMedvR8Dd7UQvL10B/2RNESkrznjbX6ggUt3Hi 3o4x6RrzSKTyqvUgK9bMd4stF67RkazBD9YM1jD1FNnLciOnvW91eYHD6TkHmvK0rwCU K5ZG2fpjQ6whBWzxDu3TizqpuusezVv9qZ0tk/f0IVLB9qcb7CxQ7TatsPaa/vGdq57M rYtTdJq25/LDydWA1xeFxSYzIK9Q34tum2IIESeGlxoVT4EpcK3USM5A19C1EBd0NntL BtvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780614695; x=1781219495; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=R4A39g0spLiznd90/Jk/6It+g1eygjhYpKlTbFN6CEk=; b=AEdJrCpS7VGYsNlGKq1ENEZgJj9+8rcff5Rbbp9+qv4Yew/M8W6+jKMD2fjuNwX46g MGMx8Tr0fvcU90m/sRyAJCEXqAQ7wF9R/Hf6vaScRddpLjcE/9Zmff8Ryn6jPUefxyIg ZC7qkuQS7zWqJmxH/Dwi9Mvq0wzvzKOhvdXtdd0jiW4O5sxF4aGCKLk7YZ1K/0Slmifh faqeJNGfzng+MtZUPDv1oHbTNfXJmCn028yCO+QfMp1AbDQQl+zDCXNeya7PgpX5UqSH xP0ze0Vrouhwp0catA5Nm4vqut8d3UclVrHCXahLuHUnWX9Nsjz9d+wfS1wrSjlDeGAS OgAA== X-Gm-Message-State: AOJu0YwtVWkWYPrmBGs5EmTjjxC4Th5QgFqk/IELMDqAka4OV1BTTnrD HzgmGL1CZAjEGPzwCNe4HVB0eV0k2iJ7588P2EADBBqJJDiR5iKtpgJyHFVlE7E8BHcLedPzHqR ipIbeo2aSOCxkgxKpf3a5msytRS8fkHrifqd5l7Q1Q/y9LVFyhFDYtj78RE/eN+/diKpKbQIHsU U2WgEkimbf/mnnStRsJrBCZubWp+KCCfYvg7RLpg== X-Gm-Gg: Acq92OGJWUPN0kVB8KHPldVFHWdK/Ia/weRNSb+yeZIjcFLmkxRUY2xDB30iVRmKeHG QFDK/WTOD7xIVZf3PI4g2L0VJ6IeTE56KSGieBlVgCK07FIAUrH/5xjI5PeKWrNaEGrp8Q9PO8f RPrW5L21FehSxmkl/9g/xGrneMbIEIS09rAYGy5b6+flVdWVy10H6ygFeNxbuRpUd9n0QU2RjDu Gn3V2aVQLtwPe00V26syRa+N4K6m8elisg2mAcbbMnCrvwXri4KZKtQa/TGB/Zncq8WJTfgwo/H teuQy16dUi/ZYjyzJl2eNEP0CpHkMw4VTMQyTmcrP1esKQCTEKxmRKIHI5Ix5bFUpr+AHl/1pVD qi5ZBdY+rs8mAVkQWWOOzctY= X-Received: by 2002:a05:620a:17a2:b0:915:7f7d:e61c with SMTP id af79cd13be357-915a9e16842mr228276985a.53.1780614695112; Thu, 04 Jun 2026 16:11:35 -0700 (PDT) X-Received: by 2002:a05:620a:17a2:b0:915:7f7d:e61c with SMTP id af79cd13be357-915a9e16842mr228267385a.53.1780614694466; Thu, 04 Jun 2026 16:11:34 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fabiano Rosas , Juraj Marcin , Vladimir Sementsov-Ogievskiy , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Sana Sharma , Eric Blake , Markus Armbruster , Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , Akihiko Odaki , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , "Dr . David Alan Gilbert" Subject: [PATCH 3/4] qdev: Refactor and rename of qdev_class_add_property() Date: Thu, 4 Jun 2026 19:11:17 -0400 Message-ID: <20260604231118.1584889-4-peterx@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260604231118.1584889-1-peterx@redhat.com> References: <20260604231118.1584889-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, 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, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1780614740251158500 Content-Type: text/plain; charset="utf-8" Firstly, qdev_class_add_property() function almost has nothing to do with DeviceClass, it's a bridge between Property and object properties. Change the 1st parameter of it, so that it can be used without DeviceClass context at all. When at it, remove the "name" field because it's always prop->name. Export it for non-qdev use cases. Signed-off-by: Peter Xu --- include/hw/core/qdev-properties.h | 10 ++++++++++ hw/core/qdev-properties.c | 7 +++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/hw/core/qdev-properties.h b/include/hw/core/qdev-prope= rties.h index 779acb31b6..fec2aaac4d 100644 --- a/include/hw/core/qdev-properties.h +++ b/include/hw/core/qdev-properties.h @@ -283,6 +283,16 @@ void error_set_from_qdev_prop_error(Error **errp, int = ret, Object *obj, */ void qdev_property_add_static(DeviceState *dev, const Property *prop); =20 +/** + * object_class_add_property: + * @oc: Object class to operate on. + * @prop: The qdev property definition. + * + * Add a Property to @oc. This is the bridge to convert a Property into + * an object class property (as in ObjectClass.properties). + */ +void object_class_add_property(ObjectClass *oc, const Property *prop); + /** * qdev_alias_all_properties: Create aliases on source for all target prop= erties * @target: Device which has properties to be aliased diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index a91c2ad101..ab828bb612 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1188,10 +1188,9 @@ void qdev_property_add_static(DeviceState *dev, cons= t Property *prop) } } =20 -static void qdev_class_add_property(DeviceClass *klass, const char *name, - const Property *prop) +void object_class_add_property(ObjectClass *oc, const Property *prop) { - ObjectClass *oc =3D OBJECT_CLASS(klass); + const char *name =3D prop->name; ObjectProperty *op; =20 if (prop->info->create) { @@ -1222,7 +1221,7 @@ void device_class_set_props_n(DeviceClass *dc, const = Property *props, size_t n) for (size_t i =3D 0; i < n; ++i) { const Property *prop =3D &props[i]; assert(prop->name); - qdev_class_add_property(dc, prop->name, prop); + object_class_add_property(OBJECT_CLASS(dc), prop); } } =20 --=20 2.53.0 From nobody Sun Jun 7 22:18:44 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1780614769; cv=none; d=zohomail.com; s=zohoarc; b=AcMIC9RgRC1B657bVeq57OzEHOD9t/zD7YUa5TZYaHheSuoYbLbQHZvpigFO+mVH6q8PCRyUnfPbCqxchGan/Bw12r5Oy6/yJgZ2T4oTvut/RW7W8mwoy6fPw0nA/wGmO61R/qOOxI+Dll24Y1J42RC4kLUNyMWIOUFGwlVn41g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780614769; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=53eCSdM5/9myqcXLcdEsBbfYriv+6smkrhaDwhp6cx4=; b=AC1egbx9rs23qcK+uADLNf3CZAoc59ZvhefmGHzx27gjAN7THmeQYps7VgpKYezCUWQH97UDh4PBGStMASMwLFb679fTDJeJTdY7Y0UMoBQDVgj+to9r/UqK5C9s/a9mkHZ3M+Kq+2fT5mcZB6RYUTeaxC20DqazrfxMncRwego= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1780614769792531.526037987973; Thu, 4 Jun 2026 16:12:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wVHE4-0007I3-PV; Thu, 04 Jun 2026 19:11:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wVHE2-0007Hf-93 for qemu-devel@nongnu.org; Thu, 04 Jun 2026 19:11:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wVHE0-0006Na-Mf for qemu-devel@nongnu.org; Thu, 04 Jun 2026 19:11:46 -0400 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-335-70nB35rLMd2pGQ88wNCJaw-1; Thu, 04 Jun 2026 19:11:37 -0400 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-9157929bf8fso131842185a.0 for ; Thu, 04 Jun 2026 16:11:37 -0700 (PDT) Received: from x1.com ([142.189.10.167]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9158a37cab6sm707617285a.22.2026.06.04.16.11.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 16:11:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780614703; 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=53eCSdM5/9myqcXLcdEsBbfYriv+6smkrhaDwhp6cx4=; b=RU9TLzJ0POYxJA4bY2/pYbTMte/yQVK6QxZc2hDPBcaMCuXXEdHpK9Ehsfyzxw1hUWhWyw 52F79sOAvNeG626A56KJoEgUpTkaBCG51xkHPBF6jmN17RsXgV+li2VIeWpxgWfdScNaEJ m3ffF7Si+j3FnlcYyUtphIbwZrgfMys= X-MC-Unique: 70nB35rLMd2pGQ88wNCJaw-1 X-Mimecast-MFC-AGG-ID: 70nB35rLMd2pGQ88wNCJaw_1780614697 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1780614697; x=1781219497; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=53eCSdM5/9myqcXLcdEsBbfYriv+6smkrhaDwhp6cx4=; b=pgrIO7lPV63WSCxG6ZVhORNiMUxI8SFTjWtxD4lc6G+wBNa8wrQtMd6uBM0lb8Jtyg adn0CdDvvBhcTpmBPMP0rICH4/xkwC82hzo/AZr4Jltf48ZaMHEDhIfQg3R7bw83Ckv4 YyXQDkIg8y/kYVAm+8kfymvE0na1A1La3uIcWiTLpolFZvgslWr0LF9ljT1l9YnRC/Ka I03A3JZSiiV0dDi78+O7eJtuQlp0h+3D9jBfIv9AR5hcgXVSTBGwoC2ErBqB9cgvC3eA c0oeZezb/eWrB+9uPNDlztzw5af0+Y8CL6WzOfTYB2E8HLqpfn3bzMqxdTeFg1Tfz/2I ErMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780614697; x=1781219497; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=53eCSdM5/9myqcXLcdEsBbfYriv+6smkrhaDwhp6cx4=; b=LvIhHyXsMZkaxxSMbpdd0tQDrYZ+vJPU+VsMrwrq5qMezxw6TFVRyYmQ6FCfPnUiej A5R9W/HeX18/qbh5D5lNqvmnqmJBr4FMpywVvm038Ge7yQlMIXtQXen+dxgWJiqpjtaT PBk6liq6kSXieT5kjsl2b1v3kFLTXkaMAsGoal3ctpWLKysxcV2famDdo6h7aGfR9Aki C8wgJK7NQrfu+0bnlBR+vqcVYgPIA3GKrfN2YUIY0s8Vi8enVW2z6D7A7DNyK05E9t5z H8wUcc7euHcRymv+H1miGRqy3AEhni3CvO/1Dfif1T2jEYbfCoFbVt5qYgK1u/FWbNYm 6ekA== X-Gm-Message-State: AOJu0YxJwWGhcqneM62FYacDzJf/FySGTJF9cwLx372BY1BqnsBa4isa 8rP4puEx3KvKovew7D4NtNHBrlCjy9XbPA+wgX2X6MsJ9KTb0iaiw1Bh/W29Ru02X9Hd+y+gMXF Ndkyngni8ZwfHNSf2HVIKiod5H8LvEuQc/VXV0SExX7RkHkaqBod/Mn9OJvG34Yw2xdimf5LBcH D9BYwNhd1TqM85wo9vb9+8pdd8/9jXUdYOcQhTdw== X-Gm-Gg: Acq92OEHaERyV4Ufn+TsBSr9UpEOBsmLyYw6BQvFzRO4pnV6P4tS/F6kEPfVIMjMQsp TK3gsx2OsKZOjCyJkzQtxpJVDDlOdDHG+yz1XC//i3YMXMKVP7VW59+ipLWzZ9mYncXsG3XnClS vOWMcljQPB9kkwFk0E8uqaEYTjj46OKs/VQd+XgiaWcX04nc+b2xF77khnuLpN3ihIE3J3xjdfe TuWX1ocKqgukhZtWB7GGu2KcJLg+9PF7xeL5K26YuYPSQFaI/NnuLsB6IORuqeEP3NjlCicE608 OiRfOFPIxCqSe12blXVUCu+QdsmpfBmW2yrynyfmN9MeSqdQG2bppocyQSRmrQADznyoIHyy596 i2XcPYKG4W9U2aNmLh8aYPtA= X-Received: by 2002:a05:620a:690d:b0:915:9f87:eae6 with SMTP id af79cd13be357-915a9da5824mr228195685a.42.1780614696964; Thu, 04 Jun 2026 16:11:36 -0700 (PDT) X-Received: by 2002:a05:620a:690d:b0:915:9f87:eae6 with SMTP id af79cd13be357-915a9da5824mr228182985a.42.1780614696173; Thu, 04 Jun 2026 16:11:36 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fabiano Rosas , Juraj Marcin , Vladimir Sementsov-Ogievskiy , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Sana Sharma , Eric Blake , Markus Armbruster , Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , Akihiko Odaki , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , "Dr . David Alan Gilbert" Subject: [PATCH 4/4] migration: Remove dependency to TYPE_DEVICE Date: Thu, 4 Jun 2026 19:11:18 -0400 Message-ID: <20260604231118.1584889-5-peterx@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260604231118.1584889-1-peterx@redhat.com> References: <20260604231118.1584889-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, 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, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1780614771766158500 Content-Type: text/plain; charset="utf-8" While doing that, we still want to keep the Property list that migration object used to use. Apply them directly to ObjectClass instead of setting them with a DeviceClass. Manually apply the two extra properties (compat properties, global settings) in an instance_post_init() hook, just like most of the rest users, see callers of object_apply_compat_props(). Signed-off-by: Peter Xu --- migration/migration.h | 2 +- migration/migration.c | 33 +++++++++++++++++++-------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 841f49b215..8bdb8e8e6b 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -274,7 +274,7 @@ struct MigrationClass { =20 struct MigrationState { /*< private >*/ - DeviceState parent_obj; + Object parent_obj; =20 /*< public >*/ QemuThread thread; diff --git a/migration/migration.c b/migration/migration.c index 074d3f2c69..f9f102e78a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3966,11 +3966,9 @@ fail: =20 static void migration_class_init(ObjectClass *klass, const void *data) { - DeviceClass *dc =3D DEVICE_CLASS(klass); - - dc->user_creatable =3D false; - device_class_set_props_n(dc, migration_properties, - migration_properties_count); + for (int i =3D 0; i < migration_properties_count; i++) { + object_class_add_property(klass, &migration_properties[i]); + } } =20 static void migration_instance_finalize(Object *obj) @@ -4028,21 +4026,28 @@ static bool migration_object_check(MigrationState *= ms, Error **errp) return migrate_caps_check(old_caps, ms->capabilities, errp); } =20 -static const TypeInfo migration_type =3D { - .name =3D TYPE_MIGRATION, +static void migration_instance_post_init(Object *obj) +{ /* - * NOTE: TYPE_MIGRATION is not really a device, as the object is - * not created using qdev_new(), it is not attached to the qdev - * device tree, and it is never realized. + * Apply these properties on top of default values: * - * TODO: Make this TYPE_OBJECT once QOM provides something like - * TYPE_DEVICE's "-global" properties. + * (1) machine compat properties + * (2) -global settings in cmdlines + * + * Need to be applied in order so (2) takes precedence over (1). */ - .parent =3D TYPE_DEVICE, + object_apply_compat_props(obj); + object_apply_globals(obj); +} + +static const TypeInfo migration_type =3D { + .name =3D TYPE_MIGRATION, + .parent =3D TYPE_OBJECT, .class_init =3D migration_class_init, - .class_size =3D sizeof(MigrationClass), + .class_size =3D sizeof(ObjectClass), .instance_size =3D sizeof(MigrationState), .instance_init =3D migration_instance_init, + .instance_post_init =3D migration_instance_post_init, .instance_finalize =3D migration_instance_finalize, }; =20 --=20 2.53.0