From nobody Sat Sep 26 20:01:29 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=1789144621; cv=none; d=zohomail.com; s=zohoarc; b=IdP+VftHeIbb/4GZkGeqXrZXD5aytLL7XsEvD6qzNcUUU8cx75GkNMS3swbARKMaDHVBJ3OGqwXrvdkIqrjuxR2Z6UlPlJIHUR4FmtJPa5prHm1/J080rr9TUf3lVsWdxhU0mpBif/yhFWq3qpPxRYsCpLeAQgPGKbo4GFwCz5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144621; h=Content-Type: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=bju+Alt5sUw9QZekzakUTE0AiCJbl2KRBiOCR/TgBYM=; b=JCQe4MsP7ti47tBxIkysHDmm/kMvE0803E7bnoQQw39FEtZzLPK7z/T7coG+cgg7Vggcw47CHPecsUKx0DcSQ3oo5fgnXfZaooVqG1dMnBcynl+JKcRA+WgPMVFtgRSRFI6EkVIbdCYGUe+ofaZ90bQlZ9mv32oGyqqrWL4psQg= 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 1789144621861359.9250393975925; Fri, 11 Sep 2026 09:37:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Dx-0004Ac-Cf; Fri, 11 Sep 2026 12:35: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 1x54Dk-00049N-Ou for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:35:25 -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 1x54Di-0005Ir-RR for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:35:24 -0400 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-536-AqWhwR0VMEGQIK8Tp_WDYw-1; Fri, 11 Sep 2026 12:35:18 -0400 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 5DC42180214D; Fri, 11 Sep 2026 16:35:16 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 558A41956095; Fri, 11 Sep 2026 16:35:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144521; 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=bju+Alt5sUw9QZekzakUTE0AiCJbl2KRBiOCR/TgBYM=; b=aeKaSmyuPajo0Az4uV9wZPAix0T6MKgW13PcA1mSoEI4RNx+yu/BrMDN8qsjpRPYdBe+xf 8zQ36f2wjpaAGF8zT55M/8+RxlDkLDqBt5LM2VmxvHqTikzZ0ZD6r4ehvcNTXgDqmOE8uC pDGenh3TnJVxCOxGCw6gpUEnZAUo/p0= X-MC-Unique: AqWhwR0VMEGQIK8Tp_WDYw-1 X-Mimecast-MFC-AGG-ID: AqWhwR0VMEGQIK8Tp_WDYw_1789144517 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:35 +0400 Subject: [PATCH v5 01/62] qapi: add QAPITypeInfo struct definition MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-1-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1774; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=yL3f/NSxuSM+UijvILEdHZ3mnbL0LBQAa9ftHif0VEk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC21Ltzns7Tdw2OyhoIxm3hWINT4IU2ZVdGna x//5f3ZgiyJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttQAKCRDa6OEJdZac 5VPCD/wISk+WiLv2JQuNtSyxyZKVWHQi4BLbh4zQFJcg4Fwfc6iF/tPOQO1Gki48r5h9wX/nSYv RQWyyOwZUC4bEeAl+t41wQd/OUyf+oSvcDB79eDlIYRBnqGDHHnda8L1rI+rKUJRVBM0z54FdSI Ix7y3zLbPrkSR6LRnmY4H7FowucYik1FqCRfO2fWgW64Q2eyNrWrYYU0DHv+47ZbpBpJbiiOyTL 7wpPCLBIjzU0WygOHllgl6xnFHcQOMXNaYG2XxTG54z/r4M5pXlhHcysXJGowZEClcv7HIrZ0p/ fX74vdqPY+73CvkHPCtL81+j9PXiH5uLqEdmZibd8vm2/yvrxTRdn+EF+/JULT+WuRd9hlC6sct uZ+1P/QDWM7D75ja1Dt00qU3MvtWZspxMn8MVCw4wGwtO4LCpZtGVS7EOjOWj5rchjpeBCz0Sa6 egx+knp6IMmxXcMFbKl2/NXuoIcFrfntMHeTAmnwnWPirE23VXKAwfwv/E/DTGtA2RD7MTrICOW owJs/VEtqb5pAijdWCgG5t9yJWHKW0rg8h+U0xchp2QS5kPlT3v8huGcWdRTGvvVsuF/ERmkjFo /Y5FzbuAQk/NzzL8j0OGXtXMhY37pAbRk4KMqyufOVtZw0ehNOhbxvmD/wzRqYSzWBmkb2cJWb7 CuO6OZrHzYrfpSQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=marcandre.lureau@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, 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: 1789144623519158500 Introduce a minimal struct that pairs a QAPI type's internal name with its "masked" introspection name. Generated constants of this type will let QOM property registration carry a reliable reference to the QAPI schema and possibly other associated data. The fields are populated in following commits. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/qapi/qapi-type-info.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/include/qapi/qapi-type-info.h b/include/qapi/qapi-type-info.h new file mode 100644 index 000000000000..6a6355568325 --- /dev/null +++ b/include/qapi/qapi-type-info.h @@ -0,0 +1,31 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef QAPI_TYPE_INFO_H +#define QAPI_TYPE_INFO_H + +#include "qapi/util.h" + +/** + * QAPITypeInfo - QAPI type metadata + * + * @name: QAPI type name (e.g. "str", "OnOffAuto", "int32List"). + * QOM uses this as the property type string. + * @masked_name: Name of the type in the QAPI introspection schema, assign= ed by + * scripts/qapi code generator (e.g. "368"). + * @lookup: QEnumLookup for this type, or NULL for non-enum types. + * visit_type_enum(), qapi_enum_parse(), and qapi_enum_lookup() + * all rely on it. + * @list: The list-type counterpart, or NULL if none exists. + * str_type_info.list points to strList_type_info. qdev array + * properties follow this to find the list type for their element. + */ +typedef struct QAPITypeInfo { + const char *name; + const char *masked_name; + const QEnumLookup *lookup; + const struct QAPITypeInfo *list; +} QAPITypeInfo; + +#endif /* QAPI_TYPE_INFO_H */ --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144587; cv=none; d=zohomail.com; s=zohoarc; b=YWznRuFijvgo9eHmw6ek2Ps7cpuy0AXiMhkFCjz9tE50QsuX/rtJ5SEvWj3p3602TIH4TCYdZdO3YVm62HfEUpzwFga2vfy/dphL8gJZkzd24q8h4hDd2yClv8fe/xXMd6eb56K6VgOui0E7D30H9ILxeAPtrSnMgoYqN0rp9r8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144587; h=Content-Type: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=sRnXKZYrzbjyn4A8hYpuDdRC4OzW1AM3O5ymYNZ3gBk=; b=YX+PvhYF71w1KPsgWCkk0+5NHnGDAtt3r9WRMvyQQxx76AiK4eNNg0H7QkcSpBnhXyABaoo63FOWPD+pFKZXsKf7SuoQq+ZusYCWIPpFkeOZgZiViED9CNfUCYkNS8vE7T5b9yLGlD74JwGxFVLnezI/48uRk06TeQRckJAV2cE= 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 1789144587291909.0917274940622; Fri, 11 Sep 2026 09:36:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Dz-0004BJ-Hu; Fri, 11 Sep 2026 12:35: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 1x54Dn-00049a-OO for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:35:28 -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 1x54Dm-0005Lw-6P for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:35:27 -0400 Received: from mx-prod-mc-08.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-1-azchH7nCO6Wx3kOEoLnLGw-1; Fri, 11 Sep 2026 12:35:21 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9F84318015C2; Fri, 11 Sep 2026 16:35:20 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 328C8195608F; Fri, 11 Sep 2026 16:35:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144525; 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=sRnXKZYrzbjyn4A8hYpuDdRC4OzW1AM3O5ymYNZ3gBk=; b=cgpZt0EEmP+s1XjlH2Y1dg1ZJSY1ClXOuXNVS+G8hTY1EqZxZyAYT6rN6MnIFNVCO2Xkg+ hQRXaT27xSHkr1JERg+CLk9omrlCoDz5Fp9BZkqXFARjPGs1szyla2ycd2l7KAfLpAhi0a 6hcxOxuIQyxo6VC9TP6jYO43xzEL0Cs= X-MC-Unique: azchH7nCO6Wx3kOEoLnLGw-1 X-Mimecast-MFC-AGG-ID: azchH7nCO6Wx3kOEoLnLGw_1789144520 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:36 +0400 Subject: [PATCH v5 02/62] qapi/gen: fix _module_basename for multi-dash 'what' parameters MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-2-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1081; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=8qQ5+NhKhFTbUvRZ8NDUWUg42L5+gNHRkxrEPEB9zC8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC22nl7ZF3UnpA4ZseWcBupEpQBTZDCGFU+TG HOgvnSiFiiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttgAKCRDa6OEJdZac 5fLfD/4lcrJa2/Cw/kuk1CJUXzA5UC+peql6NaNQXmAR8iDnCLUPH6f8FpUEypkW+TGMVZ5FGOk PhO6X063dKJzUuxw70TIz5OVUsNOyKwO+BsgVsucDqyjZkF3BFpl5WUwlZx6GIWJA4pSy3C78vj E+X8hpvq2TbJhNPZJNdkA4ayqmB8VD1RFM7qDSb+/fN16hLg4NBZ6xwVJdnJq0NHyeF1r4Ij+pc zCr88drL2XNFf0yjPBLvxJ1ovtRlU4KDkHsvAsIgNxoRGl4MI7UPrMx94l8/pMpFmeQPqUpJwlI 0TICMdy4AFbmkZlZQaFjm9TjWX9esQnDsbSKVBnuZNb3GONHEK5Y8Jm0D6jmVwz8m1QoM4G6vs2 eQE1Ru+GY8sJwqnSSjSH5h8BiobmPMIYRxLTxr5t1gJgB9hwI83oVFO7ymPt5X4jPjC6gr8SddU jOnWAR1++oNUf+ZFQvdym+LzDKRTFc2UB1RjXZboVBXwh3RfYjnI97PztsKfajWMMe7LW4dmcXQ IBA94Z8eO3sp6SVVgwMZ1/t+gY6K406NmZFY+6MhsdbGs8Qnwpt64LpCdw/Rgez9ZNURYTb0mX0 COBRt32KA7vRsjEnNKpXVg8L2XO6XUERxTKYnoAAcUDS7X729KBUbDi4TZsom87HwjxE9hbU8Ml +GcHdPzpQ8wcRYw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=marcandre.lureau@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_H2=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: 1789144589599158500 The re.sub() call replaces every hyphen in 'what' with the system module infix. This produces broken filenames for multi-hyphen names (e.g. 'qapi-type-infos' becomes 'qapi-builtin-type-builtin-infos'). Add count=3D1 so only the first hyphen is replaced. Reviewed-by: Markus Armbruster Signed-off-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi/gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index 0c9b8db3b024..690187d4280d 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -300,7 +300,7 @@ def _module_basename(self, what: str, name: str) -> str: ret +=3D '-' + os.path.splitext(basename)[0] else: assert QAPISchemaModule.is_system_module(name) - ret +=3D re.sub(r'-', '-' + name[2:] + '-', what) + ret +=3D re.sub(r'-', '-' + name[2:] + '-', what, count=3D1) return ret =20 def _module_filename(self, what: str, name: str) -> str: --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144587; cv=none; d=zohomail.com; s=zohoarc; b=gWbsHTC5eEPyXTdqOPj5uNSwUouK+axEZ4eGSbQi9bhUnmj7wmj52IVwnALLsANuftA71Th0BuF0N3l/7GGtOxic9U055Nd9cqZGMOA6g4WzsIKyGA/UsTI2xvum7rmFQhOIKKfUOH7FGetZTS8sfnkAmGflmiLVCTAV9WG8klk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144587; h=Content-Type: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=uq6APq6t/1d9rTIg3lVBOJODUS1h8CQ0Sr2s8CDld4w=; b=K31TyUZFb2nb15lVGObRxrvmcc8+EvjzdBVKBxpnVX2G+Lc7bU1Us9r/Mp1bxP3LLpjCXPDgYHkwtkg7CQU8/3eH+93Tqy/rtKT7E9JZuPdFDjYxJdjSA8oYuLqYB+nUdXsblOAVXWGMfAlVt4jEqYJP2oaDB2tLheQHW0vLdnM= 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 1789144587085330.2246970789664; Fri, 11 Sep 2026 09:36:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54E5-0004CO-6o; Fri, 11 Sep 2026 12:35:45 -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 1x54Dp-0004AD-Nm for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:35:33 -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 1x54Dn-0005N6-51 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:35:29 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-323-PHeW-hXyOiaZ3CLMWEbkkw-1; Fri, 11 Sep 2026 12:35:25 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D88091953965; Fri, 11 Sep 2026 16:35:23 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DD004195608F; Fri, 11 Sep 2026 16:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144526; 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=uq6APq6t/1d9rTIg3lVBOJODUS1h8CQ0Sr2s8CDld4w=; b=Dw/zeZ2IT7F10AcKASZr3+1sr3Ej7frM/pNFdNE11IdK9MesOmB8Sh3ztcL3bKaLrTawZN d3NVtWrWCYdYIo9pIRU/hRR1lGjK+zL8ckjA74sJUXhVkcC8MuEi/Um67xhHJ6JMDncVgh iV4fWnA8YkmcLFY0cY39J6SwZCrOooE= X-MC-Unique: PHeW-hXyOiaZ3CLMWEbkkw-1 X-Mimecast-MFC-AGG-ID: PHeW-hXyOiaZ3CLMWEbkkw_1789144524 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:37 +0400 Subject: [PATCH v5 03/62] qapi: factor out QAPISchemaUsedTypes from introspect visitor MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-3-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=17542; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=kwKugzupKyie3BZKBeFbOihTnwXtq0u3W4I9cusN/iM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC22eKMegJtlUklR5BhmcFqtJ6XYirM6Hf/lE Hh+KcIEbOOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttgAKCRDa6OEJdZac 5biSEACGgmc4k32b8/7+lwBj1R1ymri08Fl3ubG60fTgKkhF/iGTx7P7MlY3vzSpeRBAkotVApA pJBFoYDTRSIUhTldigisXNb/1umL2xRJr7NBhDLsihPXIhtbsR532GbyiXvi7w5yZK4BJuJ5h2g XEq3fnoAQCjt3AJMT/18imhDzlMZYjjZN6tbTFezZsvZFbz73W0lnuvfE6QSHv4dMd+4PVdM4HG RQZFKEbXr40GEruHIjmagwDDyzyuyrxvaHOwoSQL9g41VudU6nOWzAG1Lyfn3BqJ1Pj/r1XfgOL rRtiBXAdEH8yyTCR6iGdI6jvJdeQmw2BF3XkLONq0goKSGiR4pWxT0rw5D3NIOhXWdj75goz4bt cWTchCWr+fbebpHkp2QT05VdVpI+BIxPpAwhMHwI3TZ9txCbF+l//sNu1MYmXFX1lzpd5sk17bD VakD/hOQiQ1vfSokt94JVpw0xpfnMhHXN3+MxW6jNrJ5o4aXg5uW2eO5wtfwG3hPVQqBfLYKTf5 Ka2GN8WR6oL4pDhxLS4hsHUwV64WetexW0RdMUOFKrfZaND8cucHoZ8h0L97Rv/fn3fPlUPXGkj RAP9QuaOaJqRKLvDIt9CWdv4KAHQjW1Xk/rb3bvO14A3Pll6aQZQUuiFlpwwkR7ElmXeWgxcBB0 jAi1bs0kgzKEHnQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144589688158500 Move QMP-reachable type tracking and name masking out of the introspect visitor into a standalone QAPISchemaUsedTypes visitor in a new schema_analysis module. Run the analysis pass in QAPICBackend.generate() in preparation for other generators. While at it, refactor a bit the code to make it easier to read, and optimize using _used_type_set for O(1) lookups. Signed-off-by: Marc-Andr=C3=A9 Lureau --- meson.build | 1 + scripts/qapi/backend.py | 7 +- scripts/qapi/introspect.py | 78 +++++-------------- scripts/qapi/schema_analysis.py | 164 ++++++++++++++++++++++++++++++++++++= ++++ 4 files changed, 191 insertions(+), 59 deletions(-) diff --git a/meson.build b/meson.build index 2a12071cf08f..96df1ce81eaf 100644 --- a/meson.build +++ b/meson.build @@ -3504,6 +3504,7 @@ qapi_gen_depends =3D [ meson.current_source_dir() / '= scripts/qapi/__init__.py', meson.current_source_dir() / 'scripts/qapi/main.py', meson.current_source_dir() / 'scripts/qapi/parser.py', meson.current_source_dir() / 'scripts/qapi/schema.py', + meson.current_source_dir() / 'scripts/qapi/schema_ana= lysis.py', meson.current_source_dir() / 'scripts/qapi/source.py', meson.current_source_dir() / 'scripts/qapi/types.py', meson.current_source_dir() / 'scripts/qapi/visit.py', diff --git a/scripts/qapi/backend.py b/scripts/qapi/backend.py index 49ae6ecdd33e..59329965890f 100644 --- a/scripts/qapi/backend.py +++ b/scripts/qapi/backend.py @@ -8,6 +8,7 @@ from .features import gen_features from .introspect import gen_introspect from .schema import QAPISchema +from .schema_analysis import QAPISchemaUsedTypes from .types import gen_types from .visit import gen_visit =20 @@ -49,7 +50,7 @@ def generate(self, """ Generate C code for the given schema into the target directory. =20 - :param schema_file: The primary QAPI schema file. + :param schema: The primary QAPI schema file. :param output_dir: The output directory to store generated code. :param prefix: Optional C-code prefix for symbol names. :param unmask: Expose non-ABI names through introspection? @@ -57,9 +58,11 @@ def generate(self, =20 :raise QAPIError: On failures. """ + schema_types =3D QAPISchemaUsedTypes(unmask) + schema.visit(schema_types) gen_types(schema, output_dir, prefix, builtins) gen_features(schema, output_dir, prefix) gen_visit(schema, output_dir, prefix, builtins) gen_commands(schema, output_dir, prefix, gen_tracing) gen_events(schema, output_dir, prefix) - gen_introspect(schema, output_dir, prefix, unmask) + gen_introspect(schema, output_dir, prefix, schema_types) diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index 7e28de2279ad..9e76e3aa38a9 100644 --- a/scripts/qapi/introspect.py +++ b/scripts/qapi/introspect.py @@ -28,9 +28,7 @@ from .schema import ( QAPISchema, QAPISchemaAlternatives, - QAPISchemaArrayType, QAPISchemaBranches, - QAPISchemaBuiltinType, QAPISchemaEntity, QAPISchemaEnumMember, QAPISchemaFeature, @@ -40,6 +38,7 @@ QAPISchemaType, QAPISchemaVariant, ) +from .schema_analysis import QAPISchemaUsedTypes from .source import QAPISourceInfo =20 =20 @@ -169,15 +168,13 @@ def to_c_string(string: str) -> str: =20 class QAPISchemaGenIntrospectVisitor(QAPISchemaMonolithicCVisitor): =20 - def __init__(self, prefix: str, unmask: bool): + def __init__(self, prefix: str, schema_types: QAPISchemaUsedTypes): super().__init__( prefix, 'qapi-introspect', ' * QAPI/QMP schema introspection', __doc__) - self._unmask =3D unmask + self._schema_types =3D schema_types self._schema: Optional[QAPISchema] =3D None self._trees: List[Annotated[SchemaInfo]] =3D [] - self._used_types: List[QAPISchemaType] =3D [] - self._name_map: Dict[str, str] =3D {} self._genc.add(mcgen(''' #include "qemu/osdep.h" #include "%(prefix)sqapi-introspect.h" @@ -190,7 +187,7 @@ def visit_begin(self, schema: QAPISchema) -> None: =20 def visit_end(self) -> None: # visit the types that are actually used - for typ in self._used_types: + for typ in self._schema_types.used_types(): typ.visit(self) # generate C name =3D c_name(self._prefix, protect=3DFalse) + 'qmp_schema_qlit' @@ -207,45 +204,11 @@ def visit_end(self) -> None: c_string=3D_tree_to_qlit(self._trees))) self._schema =3D None self._trees =3D [] - self._used_types =3D [] - self._name_map =3D {} =20 def visit_needed(self, entity: QAPISchemaEntity) -> bool: # Ignore types on first pass; visit_end() will pick up used types return not isinstance(entity, QAPISchemaType) =20 - def _name(self, name: str) -> str: - if self._unmask: - return name - if name not in self._name_map: - self._name_map[name] =3D '%d' % len(self._name_map) - return self._name_map[name] - - def _use_type(self, typ: QAPISchemaType) -> str: - assert self._schema is not None - - # Map the various integer types to plain int - if typ.json_type() =3D=3D 'int': - type_int =3D self._schema.lookup_type('int') - assert type_int - typ =3D type_int - elif (isinstance(typ, QAPISchemaArrayType) and - typ.element_type.json_type() =3D=3D 'int'): - type_intlist =3D self._schema.lookup_type('intList') - assert type_intlist - typ =3D type_intlist - # Add type to work queue if new - if typ not in self._used_types: - self._used_types.append(typ) - # Clients should examine commands and events, not types. Hide - # type names as integers to reduce the temptation. Also, it - # saves a few characters on the wire. - if isinstance(typ, QAPISchemaBuiltinType): - return typ.name - if isinstance(typ, QAPISchemaArrayType): - return '[' + self._use_type(typ.element_type) + ']' - return self._name(typ.name) - @staticmethod def _gen_features(features: Sequence[QAPISchemaFeature] ) -> List[Annotated[str]]: @@ -267,11 +230,10 @@ def _gen_tree(self, name: str, mtype: str, obj: Dict[= str, object], """ comment: Optional[str] =3D None if mtype not in ('command', 'event', 'builtin', 'array'): - if not self._unmask: - # Output a comment to make it easy to map masked names - # back to the source when reading the generated output. - comment =3D f'"{self._name(name)}" =3D {name}' - name =3D self._name(name) + masked =3D self._schema_types.masked_name(name) + if masked !=3D name: + comment =3D f'"{masked}" =3D {name}' + name =3D masked obj['name'] =3D name obj['meta-type'] =3D mtype if features: @@ -291,7 +253,7 @@ def _gen_object_member(self, member: QAPISchemaObjectTy= peMember ) -> Annotated[SchemaInfoObjectMember]: obj: SchemaInfoObjectMember =3D { 'name': member.name, - 'type': self._use_type(member.type) + 'type': self._schema_types.introspection_name(member.type) } if member.optional: obj['default'] =3D None @@ -303,7 +265,7 @@ def _gen_variant(self, variant: QAPISchemaVariant ) -> Annotated[SchemaInfoObjectVariant]: obj: SchemaInfoObjectVariant =3D { 'case': variant.name, - 'type': self._use_type(variant.type) + 'type': self._schema_types.introspection_name(variant.type) } return Annotated(obj, variant.ifcond) =20 @@ -326,7 +288,7 @@ def visit_enum_type(self, name: str, info: Optional[QAP= ISourceInfo], def visit_array_type(self, name: str, info: Optional[QAPISourceInfo], ifcond: QAPISchemaIfCond, element_type: QAPISchemaType) -> None: - element =3D self._use_type(element_type) + element =3D self._schema_types.introspection_name(element_type) self._gen_tree('[' + element + ']', 'array', {'element-type': elem= ent}, ifcond) =20 @@ -349,8 +311,9 @@ def visit_alternate_type(self, name: str, info: Optiona= l[QAPISourceInfo], alternatives: QAPISchemaAlternatives) -> None: self._gen_tree( name, 'alternate', - {'members': [Annotated({'type': self._use_type(m.type)}, - m.ifcond) + {'members': [Annotated({ + 'type': self._schema_types.introspection_name(m.type) + }, m.ifcond) for m in alternatives.variants]}, ifcond, features ) @@ -367,8 +330,8 @@ def visit_command(self, name: str, info: Optional[QAPIS= ourceInfo], arg_type =3D arg_type or self._schema.the_empty_object_type ret_type =3D ret_type or self._schema.the_empty_object_type obj: SchemaInfoCommand =3D { - 'arg-type': self._use_type(arg_type), - 'ret-type': self._use_type(ret_type) + 'arg-type': self._schema_types.introspection_name(arg_type), + 'ret-type': self._schema_types.introspection_name(ret_type) } if allow_oob: obj['allow-oob'] =3D allow_oob @@ -382,12 +345,13 @@ def visit_event(self, name: str, info: Optional[QAPIS= ourceInfo], assert self._schema is not None =20 arg_type =3D arg_type or self._schema.the_empty_object_type - self._gen_tree(name, 'event', {'arg-type': self._use_type(arg_type= )}, - ifcond, features) + self._gen_tree(name, 'event', { + 'arg-type': self._schema_types.introspection_name(arg_type) + }, ifcond, features) =20 =20 def gen_introspect(schema: QAPISchema, output_dir: str, prefix: str, - opt_unmask: bool) -> None: - vis =3D QAPISchemaGenIntrospectVisitor(prefix, opt_unmask) + schema_types: QAPISchemaUsedTypes) -> None: + vis =3D QAPISchemaGenIntrospectVisitor(prefix, schema_types) schema.visit(vis) vis.write(output_dir) diff --git a/scripts/qapi/schema_analysis.py b/scripts/qapi/schema_analysis= .py new file mode 100644 index 000000000000..7e42abbc14e1 --- /dev/null +++ b/scripts/qapi/schema_analysis.py @@ -0,0 +1,164 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +""" +Collect introspectable types from a QAPI schema and assign masked names. + +Copyright (C) 2015-2026 Red Hat, Inc. + +Authors: + Markus Armbruster + John Snow + Marc-Andr=C3=A9 Lureau +""" + +from typing import ( + Dict, + List, + Optional, + Sequence, + Set, +) + +from .schema import ( + QAPISchema, + QAPISchemaAlternatives, + QAPISchemaArrayType, + QAPISchemaBranches, + QAPISchemaBuiltinType, + QAPISchemaEntity, + QAPISchemaFeature, + QAPISchemaIfCond, + QAPISchemaObjectType, + QAPISchemaObjectTypeMember, + QAPISchemaType, + QAPISchemaVisitor, +) +from .source import QAPISourceInfo + + +class QAPISchemaUsedTypes(QAPISchemaVisitor): + """Collect the set of QMP-reachable types from a schema. + + Types are discovered transitively starting from commands and events. + Each type is also given a masked introspection name (an integer + string). + """ + + def __init__(self, unmask: bool): + self._unmask =3D unmask + self._schema: Optional[QAPISchema] =3D None + # Ordered list + set: insert during iteration + O(1) check + self._used_types: List[QAPISchemaType] =3D [] + self._used_types_set: Set[QAPISchemaType] =3D set() + self._name_map: Dict[str, str] =3D {} + + def visit_begin(self, schema: QAPISchema) -> None: + self._schema =3D schema + self._used_types =3D [] + self._used_types_set =3D set() + self._name_map =3D {} + + def visit_end(self) -> None: + assert self._schema is not None + # Discover transitively-used types; the list grows as + # visiting each type registers the types it references. + for typ in self._used_types: + typ.visit(self) + # Assign stable masked names now that all types are known + counter =3D 0 + for typ in self._used_types: + if isinstance(typ, (QAPISchemaBuiltinType, QAPISchemaArrayType= )): + continue + self._name_map[typ.name] =3D ( + typ.name if self._unmask else str(counter)) + counter +=3D 1 + + def visit_needed(self, entity: QAPISchemaEntity) -> bool: + # Skip types during main traversal; visit_end() handles them + return not isinstance(entity, QAPISchemaType) + + def visit_command(self, name: str, info: Optional[QAPISourceInfo], + ifcond: QAPISchemaIfCond, + features: List[QAPISchemaFeature], + arg_type: Optional[QAPISchemaObjectType], + ret_type: Optional[QAPISchemaType], gen: bool, + success_response: bool, boxed: bool, allow_oob: bool, + allow_preconfig: bool, coroutine: bool) -> None: + assert self._schema is not None + self._register_type(arg_type or self._schema.the_empty_object_type) + self._register_type(ret_type or self._schema.the_empty_object_type) + + def visit_event(self, name: str, info: Optional[QAPISourceInfo], + ifcond: QAPISchemaIfCond, + features: List[QAPISchemaFeature], + arg_type: Optional[QAPISchemaObjectType], + boxed: bool) -> None: + assert self._schema is not None + self._register_type(arg_type or self._schema.the_empty_object_type) + + def visit_object_type_flat( + self, name: str, info: Optional[QAPISourceInfo], + ifcond: QAPISchemaIfCond, + features: List[QAPISchemaFeature], + members: List[QAPISchemaObjectTypeMember], + branches: Optional[QAPISchemaBranches]) -> None: + for m in members: + self._register_type(m.type) + if branches: + for v in branches.variants: + self._register_type(v.type) + + def visit_array_type(self, name: str, info: Optional[QAPISourceInfo], + ifcond: QAPISchemaIfCond, + element_type: QAPISchemaType) -> None: + self._register_type(element_type) + + def visit_alternate_type( + self, name: str, info: Optional[QAPISourceInfo], + ifcond: QAPISchemaIfCond, + features: List[QAPISchemaFeature], + alternatives: QAPISchemaAlternatives) -> None: + for m in alternatives.variants: + self._register_type(m.type) + + def _register_type(self, typ: QAPISchemaType) -> None: + """Record a type as QMP-reachable (idempotent).""" + typ =3D self._canonicalize_type(typ) + if typ not in self._used_types_set: + self._used_types.append(typ) + self._used_types_set.add(typ) + if isinstance(typ, QAPISchemaArrayType): + self._register_type(typ.element_type) + + def _canonicalize_type(self, typ: QAPISchemaType) -> QAPISchemaType: + """Canonicalize integer types to plain int.""" + assert self._schema is not None + if typ.json_type() =3D=3D 'int': + type_int =3D self._schema.lookup_type('int') + assert type_int + return type_int + if (isinstance(typ, QAPISchemaArrayType) and + typ.element_type.json_type() =3D=3D 'int'): + type_intlist =3D self._schema.lookup_type('intList') + assert type_intlist + return type_intlist + return typ + + def masked_name(self, name: str) -> str: + """Return the masked name for a non-builtin, non-array type.""" + assert name in self._name_map, \ + f"type '{name}' was not registered or is builtin/array" + return self._name_map[name] + + def introspection_name(self, typ: QAPISchemaType) -> str: + """Return the introspection name for a type.""" + typ =3D self._canonicalize_type(typ) + if isinstance(typ, QAPISchemaBuiltinType): + return typ.name + if isinstance(typ, QAPISchemaArrayType): + return '[' + self.introspection_name(typ.element_type) + ']' + assert typ in self._used_types_set + return self.masked_name(typ.name) + + def used_types(self) -> Sequence[QAPISchemaType]: + """Return the types to include in QAPI introspection.""" + return self._used_types --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144587; cv=none; d=zohomail.com; s=zohoarc; b=ZtsOvRJVn7bV2ltm4deFD8pC0zG7ohl+Et6fni2NiGD0n/FnbvPZIWdRxQ4D89wl6p5TP+8ywjMUUV3uswazmS/WAy8UaFdIAwhC6vntBBga/lmwqV2nt9xlwN2ldDixQ7DyG9Rqnk4+hIhDE9HsEzJ5rDBMFTjgI0kYecHoO3E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144587; h=Content-Type: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=vHAZvWnDkaEgy5jJqkCVU1np+fpxqT8xx9A/oEGQ+h8=; b=b9Henq3o7DJcnXbWs6Y1LSBj6He+gIxCdOlGuukuvJExyFE0yRiySRvj+x1+9mm6z5Nx35yshm8zQZeIiLj4zlmft6xd2SMJTuxolvj6Arxdkd6jQiXOZfYDNKGBhkyDyQlum5BYHrtbq1yzE0wGn3zXDKd7ZruSbNCKkwGCcq0= 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 1789144587592192.03364167340135; Fri, 11 Sep 2026 09:36:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54EF-0004Dy-9s; Fri, 11 Sep 2026 12:35:57 -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 1x54Dw-0004AT-1w for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:35: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 1x54Ds-0005P3-EK for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:35:34 -0400 Received: from mx-prod-mc-08.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-490-qHbKOwI7PbirKJYhnKgFYQ-1; Fri, 11 Sep 2026 12:35:28 -0400 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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 61B46180134A; Fri, 11 Sep 2026 16:35:27 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8D0F31955F19; Fri, 11 Sep 2026 16:35:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144531; 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=vHAZvWnDkaEgy5jJqkCVU1np+fpxqT8xx9A/oEGQ+h8=; b=LPr5XK9LBFswPQ70m3CogmnYfWuRFnDFnpgR5KuIEEgTeSzIzKOEyvxqG4r6CbAV1KjNN9 oFIVCw/JCzkJNC6CAWNXLfKR79pGoZBl+8+WezGm09+Tr2tqqPTSX7e1WiGc2cZVYFPmO0 VFI7fY15CHlGofSwhBAilY9pSmgWGSA= X-MC-Unique: qHbKOwI7PbirKJYhnKgFYQ-1 X-Mimecast-MFC-AGG-ID: qHbKOwI7PbirKJYhnKgFYQ_1789144527 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:38 +0400 Subject: [PATCH v5 04/62] qapi: register all introspectable types, not just QMP-reachable ones MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-4-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=8961; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=/lvciO5mWv92Alj0+IzaiSviM/JWfN2CoE/S8bIr2y0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC22vPUUNQdQMRaczUvkuMSi7pYZKwiIisd5S lf5BT0jcEWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttgAKCRDa6OEJdZac 5WcMD/wNta0VIcUOiBuAdpdDXNJDbOHaV6u0XIFRI+Q5Z88eKj9lyeTfQm6zBp2P1Fv5UC6zuAQ +PbFRXodraG7n15E5ehxMDS++jjNyZlOW7AD4Aqu2RtwQ9EJ5vIKwiH++akmqFkj+xOtTDbN3dW NceXvtlYL6QpWHXbc59LgGaSbdhcUrVaEovPzjGcwStyykZJu9b8nCBjH81eO4s9AIQ2A3p4gY6 9iJ16WUWgx6emOgr6Wn7UL+r4lg+5+a7/+dpgcz3c1rDccgxM4LwuJZhRX6+qMGJDl1TmRojgaM 4DzTqsvRbM8JS7fAt7R/qBigCn4qM7Adyvg7GzGwgdY/ihfEevWdaE2/qWb9oFqFBNur/c/AxXp 8aSb/Z5vCDx/KaExSozAaVvEBMblrg3RmGw67OmMoCuYz/m0wBsyHH3agivkQtQ0naMB6wAJwJD ijXsaLtfGuLn7v5iVvgHI1sPXDH97JrhOw/wnT0DxpcHSRE6SYPy9V2zeQ+8GhmNbJAx84V0Pps ig0beU07mvtgG1PgmQFn7pLxlMO71qHV+YBgMf+GBDtXL4qS6l9kT2VEqnjuSseq0jQfaWHuhSa aaLNm4e9j6Ec/eHnEkm3oUKg0QW0W5y2yjh7KSGFwOmb86fbA+L3UmveAConq4gOGAndrsoUauE atOCyMlS7dR8kwA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=marcandre.lureau@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, 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: 1789144589590158500 Rename QAPISchemaUsedTypes to QAPISchemaTypeAnalysis and broaden type collection: instead of discovering types transitively from commands and events, register every non-implicit type upfront in visit_needed() and let visit_end() resolve their dependencies. This is needed so that QOM property types that are defined in the QAPI schema but not referenced by any command or event still appear in query-qmp-schema output, making them introspectable by management tools. Commands and events still register their (often implicit) argument and return types, which visit_needed() intentionally skips. This makes the x86-64 query-qmp-schema grow from 244K to 265K. Signed-off-by: Marc-Andr=C3=A9 Lureau --- docs/devel/qapi-code-gen.rst | 3 ++- scripts/qapi/backend.py | 4 +-- scripts/qapi/introspect.py | 8 +++--- scripts/qapi/schema_analysis.py | 55 +++++++++++++++++++++----------------= ---- 4 files changed, 36 insertions(+), 34 deletions(-) diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst index b1cc5b5f0db1..b697aab930d1 100644 --- a/docs/devel/qapi-code-gen.rst +++ b/docs/devel/qapi-code-gen.rst @@ -1250,7 +1250,8 @@ JSON array of strings. To examine a type, start with a command or event using it, then follow references by name. =20 -QAPI schema definitions not reachable that way are omitted. +.. TODO document QOM introspection (qom-list, qom-list-properties, + qom-get) and how it relates to QAPI type information. =20 The SchemaInfo for a command has meta-type "command", and variant members "arg-type", "ret-type" and "allow-oob". On the wire, the diff --git a/scripts/qapi/backend.py b/scripts/qapi/backend.py index 59329965890f..24717be48c3c 100644 --- a/scripts/qapi/backend.py +++ b/scripts/qapi/backend.py @@ -8,7 +8,7 @@ from .features import gen_features from .introspect import gen_introspect from .schema import QAPISchema -from .schema_analysis import QAPISchemaUsedTypes +from .schema_analysis import QAPISchemaTypeAnalysis from .types import gen_types from .visit import gen_visit =20 @@ -58,7 +58,7 @@ def generate(self, =20 :raise QAPIError: On failures. """ - schema_types =3D QAPISchemaUsedTypes(unmask) + schema_types =3D QAPISchemaTypeAnalysis(unmask) schema.visit(schema_types) gen_types(schema, output_dir, prefix, builtins) gen_features(schema, output_dir, prefix) diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index 9e76e3aa38a9..ce37ce787567 100644 --- a/scripts/qapi/introspect.py +++ b/scripts/qapi/introspect.py @@ -38,7 +38,7 @@ QAPISchemaType, QAPISchemaVariant, ) -from .schema_analysis import QAPISchemaUsedTypes +from .schema_analysis import QAPISchemaTypeAnalysis from .source import QAPISourceInfo =20 =20 @@ -168,7 +168,7 @@ def to_c_string(string: str) -> str: =20 class QAPISchemaGenIntrospectVisitor(QAPISchemaMonolithicCVisitor): =20 - def __init__(self, prefix: str, schema_types: QAPISchemaUsedTypes): + def __init__(self, prefix: str, schema_types: QAPISchemaTypeAnalysis): super().__init__( prefix, 'qapi-introspect', ' * QAPI/QMP schema introspection', __doc__) @@ -187,7 +187,7 @@ def visit_begin(self, schema: QAPISchema) -> None: =20 def visit_end(self) -> None: # visit the types that are actually used - for typ in self._schema_types.used_types(): + for typ in self._schema_types.types(): typ.visit(self) # generate C name =3D c_name(self._prefix, protect=3DFalse) + 'qmp_schema_qlit' @@ -351,7 +351,7 @@ def visit_event(self, name: str, info: Optional[QAPISou= rceInfo], =20 =20 def gen_introspect(schema: QAPISchema, output_dir: str, prefix: str, - schema_types: QAPISchemaUsedTypes) -> None: + schema_types: QAPISchemaTypeAnalysis) -> None: vis =3D QAPISchemaGenIntrospectVisitor(prefix, schema_types) schema.visit(vis) vis.write(output_dir) diff --git a/scripts/qapi/schema_analysis.py b/scripts/qapi/schema_analysis= .py index 7e42abbc14e1..1d12306f61e2 100644 --- a/scripts/qapi/schema_analysis.py +++ b/scripts/qapi/schema_analysis.py @@ -35,37 +35,37 @@ from .source import QAPISourceInfo =20 =20 -class QAPISchemaUsedTypes(QAPISchemaVisitor): - """Collect the set of QMP-reachable types from a schema. +class QAPISchemaTypeAnalysis(QAPISchemaVisitor): + """Analyze types from a QAPI schema. =20 - Types are discovered transitively starting from commands and events. - Each type is also given a masked introspection name (an integer - string). + Every non-builtin, non-array type is given a masked introspection + name (an integer string). """ =20 def __init__(self, unmask: bool): self._unmask =3D unmask self._schema: Optional[QAPISchema] =3D None # Ordered list + set: insert during iteration + O(1) check - self._used_types: List[QAPISchemaType] =3D [] - self._used_types_set: Set[QAPISchemaType] =3D set() + self._types: List[QAPISchemaType] =3D [] + self._types_set: Set[QAPISchemaType] =3D set() self._name_map: Dict[str, str] =3D {} =20 def visit_begin(self, schema: QAPISchema) -> None: self._schema =3D schema - self._used_types =3D [] - self._used_types_set =3D set() + self._types =3D [] + self._types_set =3D set() self._name_map =3D {} =20 def visit_end(self) -> None: assert self._schema is not None - # Discover transitively-used types; the list grows as + # Discover type dependencies; the list grows as # visiting each type registers the types it references. - for typ in self._used_types: + for typ in self._types: typ.visit(self) - # Assign stable masked names now that all types are known + + # Assign masked names now that all introspected types are known. counter =3D 0 - for typ in self._used_types: + for typ in self._types: if isinstance(typ, (QAPISchemaBuiltinType, QAPISchemaArrayType= )): continue self._name_map[typ.name] =3D ( @@ -73,8 +73,14 @@ def visit_end(self) -> None: counter +=3D 1 =20 def visit_needed(self, entity: QAPISchemaEntity) -> bool: - # Skip types during main traversal; visit_end() handles them - return not isinstance(entity, QAPISchemaType) + # Side effect: register all introspectable types now, so that + # visit_end() can traverse them to discover type dependencies. + if isinstance(entity, QAPISchemaType): + if (not entity.is_implicit() or + isinstance(entity, QAPISchemaArrayType)): + self._register_type(entity) + return False + return True =20 def visit_command(self, name: str, info: Optional[QAPISourceInfo], ifcond: QAPISchemaIfCond, @@ -107,11 +113,6 @@ def visit_object_type_flat( for v in branches.variants: self._register_type(v.type) =20 - def visit_array_type(self, name: str, info: Optional[QAPISourceInfo], - ifcond: QAPISchemaIfCond, - element_type: QAPISchemaType) -> None: - self._register_type(element_type) - def visit_alternate_type( self, name: str, info: Optional[QAPISourceInfo], ifcond: QAPISchemaIfCond, @@ -121,11 +122,11 @@ def visit_alternate_type( self._register_type(m.type) =20 def _register_type(self, typ: QAPISchemaType) -> None: - """Record a type as QMP-reachable (idempotent).""" + """Record a type for introspection (idempotent).""" typ =3D self._canonicalize_type(typ) - if typ not in self._used_types_set: - self._used_types.append(typ) - self._used_types_set.add(typ) + if typ not in self._types_set: + self._types.append(typ) + self._types_set.add(typ) if isinstance(typ, QAPISchemaArrayType): self._register_type(typ.element_type) =20 @@ -156,9 +157,9 @@ def introspection_name(self, typ: QAPISchemaType) -> st= r: return typ.name if isinstance(typ, QAPISchemaArrayType): return '[' + self.introspection_name(typ.element_type) + ']' - assert typ in self._used_types_set + assert typ in self._types_set return self.masked_name(typ.name) =20 - def used_types(self) -> Sequence[QAPISchemaType]: + def types(self) -> Sequence[QAPISchemaType]: """Return the types to include in QAPI introspection.""" - return self._used_types + return self._types --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144684; cv=none; d=zohomail.com; s=zohoarc; b=j6dhdBC52zK88mP3lDHktGew7cBPT1QpdrHovX+V1YGTeSuz5c5+RiBWzkMgEnhPj9Q1aBAjFVCdWff84Lo7iRGlmP7Va8TFZkiWAOGu5Hl44biq+2E1cMnodYirgSvzo8WFNBqW0ew/gwuLrguGdN1M3HnHZ2ScmX4+YAsgufE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144684; h=Content-Type: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=Ij86l8MjfFX4qhLLc01Pqlp0PoB08w95fScQeyXRmbw=; b=DZ2ffXbcvH0NnFAcpLfW4dIlNfF7imhCneZc+WqWQ72JfcPLOkFKYETInzRbt7HoorIh1yqtp6Q9MG3qGY5b+A3AdKGJg70F7HIzUcgrCcghfyzIs99dX8gc9E4wpujWx2j0YPzPHTGI5Cm/6XF6fm5apZZ/xjvuNGS6cbRHmZ8= 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 1789144684542632.2948628725565; Fri, 11 Sep 2026 09:38:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54GF-0005Jh-AA; Fri, 11 Sep 2026 12:37:59 -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 1x54Fw-00053u-CH for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:42 -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 1x54Fk-0005zv-Um for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:34 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-146-DrOqzToCNWu3t5bIbrSRQw-1; Fri, 11 Sep 2026 12:37:19 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0B8DF1964CC2; Fri, 11 Sep 2026 16:37:17 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B708A1800351; Fri, 11 Sep 2026 16:35:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144642; 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=Ij86l8MjfFX4qhLLc01Pqlp0PoB08w95fScQeyXRmbw=; b=FLZO3kXA7wPulVhmFDor3kaYmBiNUTKPe+2WljZiI3dpT7IpO7UrJV9PvGHMpVRlmWnTru IsqmB/PpLe+aeO4bxXjusNdD+4x7OqKjf8ssL+iAdGz+RseswlJUoKjq6QQ+A7SW9itR0P T1bs766V/Z08G6YX3241OYS7w66c348= X-MC-Unique: DrOqzToCNWu3t5bIbrSRQw-1 X-Mimecast-MFC-AGG-ID: DrOqzToCNWu3t5bIbrSRQw_1789144638 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:39 +0400 Subject: [PATCH v5 05/62] qapi: add type-infos generator MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-5-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=12498; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=i8vmR5kDAF7dSqThQ8cXVRSNBrSLWVt5r+whL8RWnfg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC22BBv3wuZOvyAGWuzUYDElekH15CB4UOzBQ T6+0r7NOkeJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttgAKCRDa6OEJdZac 5TkWD/0SpDpAIOHmIE68/TYW3Aj+J3tXw5+tQ8fS31yZBwGX6VCGhACNiW6ga0azADUd02ebD9C GIqJE8hbDm3wh+iHySkK8x/MMW6fQu2gHwdgjC2TzdFIsRANn7xlqFyKCnQLhEhN5safWBKq0nQ AMvCX3p1tftv2kSbTo7RPeFBIDDR1+2Q6fPDl0OSIFBG8nkKlq31H5l2KBMoXxIxnQFeCKDuc9Y hoMYkHimhoMlCSU2T0v1sbfQNI4ist0fAQGEqkOcSCR50d7+hgbAnOxiMAoqYCetWZ4mPB9MSm9 OhElMYgtOjk63BeVFAIf3wC4AuLHsr38SEq4NvFs2wat4dONOg7wVtTtPNlw1ONRQHFkr8Cxnnk t1HDW3gaxl+wb8uBt4l+urI+CM0wv9HZmD4tY5JaF5yv6GuzmhE7jsQsLcosgKd0hasbkw3sXW2 PjjDxn/sVrJQn1b/J8X0hnXAiDthPZIS5+mx8XilyKMF5+Cq0OT1YRBYOoai0E6RTPe8xXuMTo+ bRTWr1Jf7yBHA/bGY39gG46TtASfnCev73wd7ERAVm4rTADTFFjJqo5b8rvY90WhPEBrLFv/+U6 clmkEMbfZbs+qcubzdWqFDBAeiTUCdLwRRvkse1w1MSMliUIpt8P4AE/Uuw5cw9q+Kcpmzz076U j8SVot8z8VP957Q== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144686203158500 New QAPISchemaGenTypeInfoVisitor produces per-module qapi-type-infos-*.h/c files. Each file declares QAPITypeInfo constants pairing the QAPI type name with its masked introspection name. Signed-off-by: Marc-Andr=C3=A9 Lureau --- docs/devel/qapi-code-gen.rst | 92 +++++++++++++++++++++++ meson.build | 1 + scripts/qapi/backend.py | 2 + scripts/qapi/type_infos.py | 175 +++++++++++++++++++++++++++++++++++++++= ++++ 4 files changed, 270 insertions(+) diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst index b697aab930d1..69d5c4af9874 100644 --- a/docs/devel/qapi-code-gen.rst +++ b/docs/devel/qapi-code-gen.rst @@ -1250,6 +1250,9 @@ JSON array of strings. To examine a type, start with a command or event using it, then follow references by name. =20 +.. TODO document QOM introspection (qom-list, qom-list-properties, + qom-get) and how it relates to QAPI type information. + .. TODO document QOM introspection (qom-list, qom-list-properties, qom-get) and how it relates to QAPI type information. =20 @@ -2102,3 +2105,92 @@ Example:: })); =20 [Uninteresting stuff omitted...] + + +Code generated for type information +----------------------------------- + +Type information is generated for user-defined types and their array +types. With option --builtins, it is also generated for the built-in +types. + +The following files are created: + + ``$(prefix)qapi-type-infos.c`` + A ``QAPITypeInfo`` instance for each type listed above, providing + a mapping between the QAPI type name and the masked name used by + introspection, along with optional enum lookup table and array + type pointers. + + ``$(prefix)qapi-type-infos.h`` + Declarations for the above type info instances + +Each ``QAPITypeInfo`` struct has the following fields: + +``name`` + The QAPI type name (e.g. ``"UserDefOne"``). + +``masked_name`` + The masked name used in ``query-qmp-schema`` output. + +``lookup`` + For enum types, a pointer to the corresponding ``QEnumLookup`` + table. ``NULL`` for non-enum types. + +``list`` + For types that have an array variant, a pointer to the array type's + ``QAPITypeInfo``. ``NULL`` when no array type exists. + +These type info instances are used by QOM property registration +functions (``object_property_add_qapi()``, +``object_class_property_add_qapi_enum()``, etc.) to associate each +property with its QAPI type. The ``qom-list`` and +``device-list-properties`` QMP commands then expose the ``qapi-type`` +field, giving management tools a formal type reference they can look +up in the introspection schema. + +Example:: + + $ cat qapi-generated/example-qapi-type-infos.h + [Uninteresting stuff omitted...] + + #ifndef EXAMPLE_QAPI_TYPE_INFOS_H + #define EXAMPLE_QAPI_TYPE_INFOS_H + + #include "qapi/qapi-builtin-type-infos.h" + + extern const QAPITypeInfo UserDefOne_type_info; + + extern const QAPITypeInfo UserDefOneList_type_info; + + #endif /* EXAMPLE_QAPI_TYPE_INFOS_H */ + $ cat qapi-generated/example-qapi-type-infos.c + [Uninteresting stuff omitted...] + + const QAPITypeInfo UserDefOne_type_info =3D { + .name =3D "UserDefOne", + .masked_name =3D "1", + .list =3D &UserDefOneList_type_info, + }; + + const QAPITypeInfo UserDefOneList_type_info =3D { + .name =3D "UserDefOneList", + .masked_name =3D "[1]", + }; + + [Uninteresting stuff omitted...] + +For a modular QAPI schema (see section `Include directives`_), code for +each sub-module SUBDIR/SUBMODULE.json is actually generated into :: + + SUBDIR/$(prefix)qapi-type-infos-SUBMODULE.h + SUBDIR/$(prefix)qapi-type-infos-SUBMODULE.c + +If qapi-gen.py is run with option --builtins, additional files are +created: + + ``qapi-builtin-type-infos.h`` + Type info instances for built-in types + + ``qapi-builtin-type-infos.c`` + Definitions for the above type info instances diff --git a/meson.build b/meson.build index 96df1ce81eaf..175d7c2a225b 100644 --- a/meson.build +++ b/meson.build @@ -3506,6 +3506,7 @@ qapi_gen_depends =3D [ meson.current_source_dir() / '= scripts/qapi/__init__.py', meson.current_source_dir() / 'scripts/qapi/schema.py', meson.current_source_dir() / 'scripts/qapi/schema_ana= lysis.py', meson.current_source_dir() / 'scripts/qapi/source.py', + meson.current_source_dir() / 'scripts/qapi/type_infos= .py', meson.current_source_dir() / 'scripts/qapi/types.py', meson.current_source_dir() / 'scripts/qapi/visit.py', meson.current_source_dir() / 'scripts/qapi-gen.py' diff --git a/scripts/qapi/backend.py b/scripts/qapi/backend.py index 24717be48c3c..7c2b47a41ae6 100644 --- a/scripts/qapi/backend.py +++ b/scripts/qapi/backend.py @@ -9,6 +9,7 @@ from .introspect import gen_introspect from .schema import QAPISchema from .schema_analysis import QAPISchemaTypeAnalysis +from .type_infos import gen_type_infos from .types import gen_types from .visit import gen_visit =20 @@ -66,3 +67,4 @@ def generate(self, gen_commands(schema, output_dir, prefix, gen_tracing) gen_events(schema, output_dir, prefix) gen_introspect(schema, output_dir, prefix, schema_types) + gen_type_infos(schema, output_dir, prefix, builtins, schema_types) diff --git a/scripts/qapi/type_infos.py b/scripts/qapi/type_infos.py new file mode 100644 index 000000000000..cbdfb5f9919a --- /dev/null +++ b/scripts/qapi/type_infos.py @@ -0,0 +1,175 @@ +""" +QAPI type info generator + +SPDX-License-Identifier: GPL-2.0-or-later +""" + +from typing import List, Optional + +from .common import c_name, mcgen +from .gen import QAPISchemaModularCVisitor, ifcontext +from .schema import ( + QAPISchema, + QAPISchemaAlternatives, + QAPISchemaBranches, + QAPISchemaEnumMember, + QAPISchemaFeature, + QAPISchemaIfCond, + QAPISchemaObjectType, + QAPISchemaObjectTypeMember, + QAPISchemaType, +) +from .schema_analysis import QAPISchemaTypeAnalysis +from .source import QAPISourceInfo + + +class QAPISchemaGenTypeInfoVisitor(QAPISchemaModularCVisitor): + + def __init__(self, prefix: str, schema_types: QAPISchemaTypeAnalysis): + super().__init__( + prefix, 'qapi-type-infos', + ' * Schema-defined QAPI type info', + ' * Built-in QAPI type info', __doc__) + self._schema_types =3D schema_types + self._schema: Optional[QAPISchema] =3D None + + def visit_begin(self, schema: QAPISchema) -> None: + super().visit_begin(schema) + self._schema =3D schema + + def _begin_builtin_module(self) -> None: + self._genc.preamble_add(mcgen(''' +#include "qemu/osdep.h" +#include "qapi/qapi-builtin-types.h" +#include "qapi/qapi-builtin-type-infos.h" +''')) + self._genh.preamble_add(mcgen(''' +#include "qapi/qapi-type-info.h" +''')) + + def _begin_user_module(self, name: str) -> None: + type_infos =3D self._module_basename('qapi-type-infos', name) + types =3D self._module_basename('qapi-types', name) + self._genc.preamble_add(mcgen(''' +#include "qemu/osdep.h" +#include "%(types)s.h" +#include "%(type_infos)s.h" +''', + types=3Dtypes, + type_infos=3Dtype_infos)) + self._genh.preamble_add(mcgen(''' +#include "qapi/qapi-builtin-type-infos.h" +''')) + + def _gen_type_info(self, name: str, + masked_name: str, + ifcond: Optional[QAPISchemaIfCond] =3D None, + with_lookup: bool =3D False, + with_list: bool =3D False) -> None: + c_id =3D c_name(name + '_type_info') + masked_name_str =3D '"%s"' % masked_name + with ifcontext(ifcond or QAPISchemaIfCond(), + self._genh, self._genc): + self._genh.add(mcgen(''' + +extern const QAPITypeInfo %(c_id)s; +''', + c_id=3Dc_id)) + self._genc.add(mcgen(''' + +const QAPITypeInfo %(c_id)s =3D { + .name =3D "%(name)s", + .masked_name =3D %(masked_name)s, +''', + c_id=3Dc_id, name=3Dname, + masked_name=3Dmasked_name_str)) + if with_lookup: + self._genc.add(mcgen(''' + .lookup =3D &%(c_name)s_lookup, +''', + c_name=3Dc_name(name))) + if with_list: + self._genc.add(mcgen(''' + .list =3D &%(list_id)s, +''', + list_id=3Dc_name(name + 'List_type_in= fo'))) + self._genc.add(mcgen(''' +}; +''')) + + def _has_list(self, name: str) -> bool: + assert self._schema is not None + return self._schema.lookup_type(name + 'List') is not None + + def _masked_name(self, name: str) -> str: + return self._schema_types.masked_name(name) + + def visit_builtin_type(self, + name: str, + info: Optional[QAPISourceInfo], + json_type: str) -> None: + assert self._schema is not None + typ =3D self._schema.lookup_type(name) + assert typ is not None + masked_name =3D self._schema_types.introspection_name(typ) + self._gen_type_info(name, masked_name, + with_list=3Dself._has_list(name)) + + def visit_enum_type(self, + name: str, + info: Optional[QAPISourceInfo], + ifcond: QAPISchemaIfCond, + features: List[QAPISchemaFeature], + members: List[QAPISchemaEnumMember], + prefix: Optional[str]) -> None: + assert self._schema is not None + typ =3D self._schema.lookup_type(name) + assert typ is not None + if typ.is_implicit(): + masked_name =3D name + else: + masked_name =3D self._masked_name(name) + self._gen_type_info(name, masked_name, ifcond, + with_lookup=3DTrue, + with_list=3Dself._has_list(name)) + + def visit_object_type(self, + name: str, + info: Optional[QAPISourceInfo], + ifcond: QAPISchemaIfCond, + features: List[QAPISchemaFeature], + base: Optional[QAPISchemaObjectType], + members: List[QAPISchemaObjectTypeMember], + branches: Optional[QAPISchemaBranches]) -> None: + if name.startswith('q_'): + return + self._gen_type_info(name, self._masked_name(name), ifcond, + with_list=3Dself._has_list(name)) + + def visit_array_type(self, + name: str, + info: Optional[QAPISourceInfo], + ifcond: QAPISchemaIfCond, + element_type: QAPISchemaType) -> None: + elem_schema =3D self._schema_types.introspection_name(element_type) + masked_name =3D '[' + elem_schema + ']' + self._gen_type_info(name, masked_name, ifcond) + + def visit_alternate_type(self, + name: str, + info: Optional[QAPISourceInfo], + ifcond: QAPISchemaIfCond, + features: List[QAPISchemaFeature], + alternatives: QAPISchemaAlternatives) -> None: + self._gen_type_info(name, self._masked_name(name), ifcond, + with_list=3Dself._has_list(name)) + + +def gen_type_infos(schema: QAPISchema, + output_dir: str, + prefix: str, + opt_builtins: bool, + schema_types: QAPISchemaTypeAnalysis) -> None: + vis =3D QAPISchemaGenTypeInfoVisitor(prefix, schema_types) + schema.visit(vis) + vis.write(output_dir, opt_builtins) --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144686; cv=none; d=zohomail.com; s=zohoarc; b=Ti+bnuHd4kCPuPRx5Ema2av6DRqgD1Ufn9ETXE/WmxB8VQa+SQ9C3Zu/NZ4hwwny373HFy3/sYA12Nu/zd25DClp02oZgPP+ygV8QiTjPvGRtbuZbY0x1vw/SaddmBcsrEMSoDLqUg5nthjNd5K5PvTMdJbkrDvG7KHrr4W/H/k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144686; h=Content-Type: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=nUAQQ20GJPnsOIyfktfkVkeFLvomMY3BbjU35Mz+xc0=; b=nRTCqbMxLw9neZglqIYPjeqYhuoC/KKWCRUHRGyNx2gRAHDS0v96dqUx56iUMApDrQTNJ5y9RO8DFe7tCST2WjEt8m6yLezH2/1RXC07haokWm4XV3096WNbpfQjWGtgc0oWdLg4RSZnGDpU67mnGEFV7X2VqLiEaGbix5eQUFg= 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 1789144686158206.2438489186835; Fri, 11 Sep 2026 09:38:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54GF-0005J9-8V; Fri, 11 Sep 2026 12:37:59 -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 1x54G3-000585-VJ for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:51 -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 1x54Fo-00061c-I0 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:36 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-610-GjtAfMsONuCHKnl7i7-fMQ-1; Fri, 11 Sep 2026 12:37:24 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1E19E195DE14; Fri, 11 Sep 2026 16:37:21 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0519C3000239; Fri, 11 Sep 2026 16:37:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144647; 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=nUAQQ20GJPnsOIyfktfkVkeFLvomMY3BbjU35Mz+xc0=; b=iXi73aUVtBXvlwr33SLMrpDC/5LmPvuCl6S+hSzNhey96stM8KRUrRWsXmComQwK/WYsrn xPq3XrbrHbWCGTBOc2NynebKruTuv0f46mkbnmFXTjb+hgLr+2QqeEy1qBHK7fwVcgYMbK jP64KEPky2PQtJKqsKK8JYosoDkQeJE= X-MC-Unique: GjtAfMsONuCHKnl7i7-fMQ-1 X-Mimecast-MFC-AGG-ID: GjtAfMsONuCHKnl7i7-fMQ_1789144643 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:40 +0400 Subject: [PATCH v5 06/62] meson: add qapi-type-infos-*.c/h to build MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-6-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Kostiantyn Kostiuk , Kostiantyn Kostiuk X-Developer-Signature: v=1; a=openpgp-sha256; l=3972; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=xKEt5adrhT9ELgMnF6xyNH3mijmW95pQJ38orcy0Zm0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC22KWa53B/EMEQoQOHTnT40hRD3uMrbET8Pa 65/Ek8Q0BSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttgAKCRDa6OEJdZac 5RZmD/0eLNjZjGlnSSAZjrZ9BUOC9siESiCQC1bAOtDbrCXI/BQvboF/LvLgiEVuwXIklrTFvTP kQgbD3hAR3uvSF36DE9TdcbUisJQLGTgx3XLcOlk46YQQVI3/SHEwx5pJQLnI/IzqvnHnn+0ZNj gRMIh0SQn7oJO3XhDY66dYkoK0zuNh+ybL0KN00FD7Ss754bl9d0EZGTxpZUuQ4v0oOcAzcHSlw HyR/Yv+weV+gTLyaVXn+UNOkknqWtggtE+acKM81mdhdgC9noOmrNv2NVpkvsE+PZTHNn1cGbH0 +gd665ekrT7+PdeL431ke0TGgAljJnG7gd8EGCPuWgqTNjYpKxqf+CoPe+oJfUVmYQDhjZuEUVz 40jVBA23Zeg4uE4xL1XBWFjwMFKA8tTheXZ/vLP2DgDjyPN1yri279BzF8BfClHKrIY8QZ2oFNT LfS40uoO0DELByujFCbCD+4zNIaOJJBhZyykeCvIg/WmoBiCY3kZlu6qAKSWNXRRhnecpmgS0r3 i47+vzm8HcV94yv0jxbffoN+Htf9uamsq3W1GvDoT8/iYLXhl4kYNTENrwhA4adrZ1Ewk64DR8p fvO75mOMJpBoFHCmjWQOKs7bfhnL6m9t/8hhCvh9Itl4q1KmYNWDwNy/U2dcp4GgAkEdlEqqHar Hps21+odyEtr8jA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144687720158500 Add the per-module type-infos output files so they are compiled into the build. Reviewed-by: Kostiantyn Kostiuk Signed-off-by: Marc-Andr=C3=A9 Lureau --- qapi/meson.build | 4 ++++ qga/meson.build | 2 ++ tests/include/meson.build | 2 ++ tests/meson.build | 6 ++++++ tests/qapi-schema/meson.build | 1 + 5 files changed, 15 insertions(+) diff --git a/qapi/meson.build b/qapi/meson.build index a46269b5a0c9..7477953492ad 100644 --- a/qapi/meson.build +++ b/qapi/meson.build @@ -79,6 +79,7 @@ endif =20 qapi_nonmodule_outputs =3D [ 'qapi-introspect.c', 'qapi-introspect.h', + 'qapi-type-infos.c', 'qapi-type-infos.h', 'qapi-types.c', 'qapi-types.h', 'qapi-visit.h', 'qapi-visit.c', 'qapi-commands.h', 'qapi-commands.c', @@ -88,6 +89,7 @@ qapi_nonmodule_outputs =3D [ ] =20 qapi_outputs =3D qapi_nonmodule_outputs + [ + 'qapi-builtin-type-infos.c', 'qapi-builtin-type-infos.h', 'qapi-builtin-types.c', 'qapi-builtin-visit.c', 'qapi-builtin-types.h', 'qapi-builtin-visit.h', ] @@ -96,6 +98,8 @@ qapi_inputs =3D [] foreach module : qapi_all_modules qapi_inputs +=3D [ files(module + '.json') ] qapi_module_outputs =3D [ + 'qapi-type-infos-@0@.c'.format(module), + 'qapi-type-infos-@0@.h'.format(module), 'qapi-types-@0@.c'.format(module), 'qapi-types-@0@.h'.format(module), 'qapi-visit-@0@.c'.format(module), diff --git a/qga/meson.build b/qga/meson.build index cfa2157efb23..79163b7d8e93 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -39,6 +39,8 @@ qga_qapi_outputs =3D [ 'qga-qapi-init-commands.h', 'qga-qapi-introspect.c', 'qga-qapi-introspect.h', + 'qga-qapi-type-infos.c', + 'qga-qapi-type-infos.h', 'qga-qapi-types.c', 'qga-qapi-types.h', 'qga-qapi-visit.c', diff --git a/tests/include/meson.build b/tests/include/meson.build index 8e8d1ec4e692..026480d96851 100644 --- a/tests/include/meson.build +++ b/tests/include/meson.build @@ -4,6 +4,8 @@ test_qapi_outputs_extra =3D [ 'test-qapi-commands-sub-module.h', 'test-qapi-events-sub-module.c', 'test-qapi-events-sub-module.h', + 'test-qapi-type-infos-sub-module.c', + 'test-qapi-type-infos-sub-module.h', 'test-qapi-types-sub-module.c', 'test-qapi-types-sub-module.h', 'test-qapi-visit-sub-module.c', diff --git a/tests/meson.build b/tests/meson.build index 5877d2f60b12..6769a1e7812f 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -2,6 +2,8 @@ subdir('bench') subdir('qemu-iotests') =20 test_qapi_outputs =3D [ + 'qapi-builtin-type-infos.c', + 'qapi-builtin-type-infos.h', 'qapi-builtin-types.c', 'qapi-builtin-types.h', 'qapi-builtin-visit.c', @@ -22,6 +24,10 @@ test_qapi_outputs =3D [ 'test-qapi-init-commands.h', 'test-qapi-introspect.c', 'test-qapi-introspect.h', + 'test-qapi-type-infos-sub-sub-module.c', + 'test-qapi-type-infos-sub-sub-module.h', + 'test-qapi-type-infos.c', + 'test-qapi-type-infos.h', 'test-qapi-types-sub-sub-module.c', 'test-qapi-types-sub-sub-module.h', 'test-qapi-types.c', diff --git a/tests/qapi-schema/meson.build b/tests/qapi-schema/meson.build index debff633ac17..392b59d8dccd 100644 --- a/tests/qapi-schema/meson.build +++ b/tests/qapi-schema/meson.build @@ -231,6 +231,7 @@ custom_target('QAPI doc', 'doc-good-qapi-events.c', 'doc-good-qapi-events.h', 'doc-good-qapi-init-commands.c', 'doc-good-qapi-ini= t-commands.h', 'doc-good-qapi-introspect.c', 'doc-good-qapi-intros= pect.h', + 'doc-good-qapi-type-infos.c', 'doc-good-qapi-type-i= nfos.h', 'doc-good-qapi-types.c', 'doc-good-qapi-types.h', 'doc-good-qapi-visit.c', 'doc-good-qapi-visit.h' ], input: files('doc-good.json'), --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144693; cv=none; d=zohomail.com; s=zohoarc; b=INgC6Ph2hXQklSDQxkMS5mc9nlf5LzntZD2OnRXDTDK70EnosAtzOMkkLVwCBlE7rWNjFc3hgPo6MsK5vz2NYIkDrq7JrA4Cl1zIG1m96hfefgbGRzVhOwoH8QmrpEnBjIgxzxcE+W/vXvHW97+iUet8DS0fOunfmX+LybT58m0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144693; h=Content-Type: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=wA5ZYh8MpPrdHBifS5Sy8EfpUvGUk61xfShZ6xpVkIk=; b=Xl5cldUqiCu7QvHjQ5WEChzPcRy5YxQX7CKYey7nC/3ATrt0GVHAsrfPu9U7Q+vqnMpidQCmSaHlMVS9ohGJioLTPsTIeYoTt+gnFTzFWLbC59j5eNmhKdK0/Yv56RMxnAkzby8NA6MQBhG8ie+Q2mERtPUVLbzfWqCIXbWDNnw= 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 1789144693106137.39418457087243; Fri, 11 Sep 2026 09:38:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54GJ-0005YL-Ik; Fri, 11 Sep 2026 12:38:03 -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 1x54GC-0005Ed-0e for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:57 -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 1x54G4-00061x-KP for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:55 -0400 Received: from mx-prod-mc-08.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-258-y0Yyrv1gOFecPOwqkR-pUA-1; Fri, 11 Sep 2026 12:37:26 -0400 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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D3F5D1801372; Fri, 11 Sep 2026 16:37:24 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AE9751956042; Fri, 11 Sep 2026 16:37:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144649; 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=wA5ZYh8MpPrdHBifS5Sy8EfpUvGUk61xfShZ6xpVkIk=; b=WP6VKgwFOxR8GyBYtLL0+Ks1iA39UUnkb8KNqBTShJcC180uAQ9m270lasQsdO5TIMRXAc x3I6UIOCywH1F6e/iAT+dF/eMs0AbsUh882FVaJClmpFfL5nX6GW8UdahK66T/cOtaMJKV mCZFB0U378J85J7w0Yq+W5d6PMX/wkI= X-MC-Unique: y0Yyrv1gOFecPOwqkR-pUA-1 X-Mimecast-MFC-AGG-ID: y0Yyrv1gOFecPOwqkR-pUA_1789144644 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:41 +0400 Subject: [PATCH v5 07/62] qom: add qapi_type field to ObjectProperty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-7-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1476; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=rBD21kRNCndFYKRVvLYoL4BXy2V04K02YlZGAo0wzbo=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC229InmEFQ3M9fjUJJEOmY2qyk+DaobYfC+W nalf5qwf82JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttgAKCRDa6OEJdZac 5f+eD/0YPTVPpBCeYQ+mTESOG+a81qEUPD7jNJ6WHsoNsbQW6sun5F/7ydJDZ3oMRKxo/wqdLCY B5XQ2YzpcbtEezHTB8PJMhirjCUTbsar7xy1McC3kUbbsk8V56c83q6WlJNfhsmqlrtWciU1Kcd YqyvbYk4KeKPiBdeu/MqjbwPcLs3czQvKBdfj6XC4B7r33MvQsFdyCW6XDFx5viO3q5WvLiGMJ+ XcNvPIAWxWc3+bF1WUGznHxBALD8VVn35vmW1Mj8+teNsQGRPz74gVGVXHRRXGqVz0uLg9r1OIg tc4Oi26TiAuP91pK14gGIVgFekoKSQ7PIpY2t+BHqYWhNLEcRXR4nq48/gmWPvbZwHm7O8KDXHf XXeWKCIpJ0F4olxu1udFmNm+eVQ2czmj3BNo7C+0y+EzTznurKmxfY2hfni2hsDKzOTM3UmeMVp f3MHFn7Be4GqUm8wEKwGGYDVnCs0+X1Kkq4wLhzLTtOu1lX1YKxRKN7msAWbwNPT3oYIuBvGDd7 0Q88GadU83p1oddi4pBVl2jP3qtpW5qFC/SIoF53CTPbSh++uewaaZAt8x+qOxJ9JnbFfeWMGnb dZapLJzPMZiWPMcW0Dwh2vYEeNPt4mPCweg/8VeuSnw/GgbNcxSmNQSiD5a2iMUhR+v7KZ+A5/p trGEzICYiJpYUJQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=marcandre.lureau@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, 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: 1789144693932158500 Add a const pointer to QAPITypeInfo in ObjectProperty. NULL for now, but future patches will add means to make it non-null. The QAPITypeInfo will then be used by QOM introspection to tie the property to a QAPI type. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/qom/object.h | 2 ++ qom/object.c | 1 + 2 files changed, 3 insertions(+) diff --git a/include/qom/object.h b/include/qom/object.h index 7ecd0f210fb6..7c7e69a2a1bb 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -15,6 +15,7 @@ #define QEMU_OBJECT_H =20 #include "qapi/qapi-builtin-types.h" +#include "qapi/qapi-type-info.h" #include "qemu/module.h" =20 struct TypeImpl; @@ -91,6 +92,7 @@ struct ObjectProperty char *name; char *type; char *description; + const QAPITypeInfo *qapi_type; ObjectPropertyAccessor *get; ObjectPropertyAccessor *set; ObjectPropertyResolve *resolve; diff --git a/qom/object.c b/qom/object.c index b1834a57cc9b..f782e21f1a30 100644 --- a/qom/object.c +++ b/qom/object.c @@ -3112,6 +3112,7 @@ object_property_add_alias(Object *obj, const char *na= me, property_release_alias, prop); op->resolve =3D property_resolve_alias; + op->qapi_type =3D target_prop->qapi_type; if (target_prop->defval) { op->defval =3D qobject_ref(target_prop->defval); } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144709; cv=none; d=zohomail.com; s=zohoarc; b=FPeAO6e1bJa7UVvUiURtbGYP5LnQ0PrwMpBA4AB/Vw2XE3L7XuMx3ti3FptGYyAAvJ33bxUfNlN6dWXpIYCJvnJMkVFC7ifiu+8/HJOnNf1ewoJ7mmF3Ssy+fnczWxPcad6f81Abi31TXCdsvtETP1RXGdieC0KOPi32QikQ62I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144709; h=Content-Type: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=8UjKcKZjfqNOztaNAGUvCYkUFXm/hViMltfmNYS5qu0=; b=EHj+W+TdYR7xC+PicC2tgPItvfZdlu/xege3O/W4i8U4mOJxU8+kruoKwY+uuWKWdgWiALzefaJQdgiNRZIr8znPkexlf9Yq7N4W6ek0JP94GBlAy29xin8TgWAFq5t5zXui9sBtZlAwNoRq2vIeUTCxlCUViyKzdZOV74VUWBA= 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 1789144709446424.5041877629675; Fri, 11 Sep 2026 09:38:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54GL-0005ix-TW; Fri, 11 Sep 2026 12:38:06 -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 1x54G9-0005CF-T9 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:55 -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 1x54G4-00062n-EL for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:52 -0400 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-332-7r5-_at7MmiAxtuZ8MMwcQ-1; Fri, 11 Sep 2026 12:37:29 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 7C9A818009CC; Fri, 11 Sep 2026 16:37:28 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7E28F180029C; Fri, 11 Sep 2026 16:37:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144653; 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=8UjKcKZjfqNOztaNAGUvCYkUFXm/hViMltfmNYS5qu0=; b=M0CUmwkEJQ0fE68mbHGRpGPYEAnzqc/jhDP7//JuSQiERDrlnQISJemQw0nGzkqqytBCH3 tsb4SCSVO+6LcEqPbYEyEPutvLwxh5GJuruYZlEj3KsOXbkNoWqbEEAEKwHPalvyw6pEYQ OVxrcvo2nZJgzh1HylZAZz8vYRKJVrk= X-MC-Unique: 7r5-_at7MmiAxtuZ8MMwcQ-1 X-Mimecast-MFC-AGG-ID: 7r5-_at7MmiAxtuZ8MMwcQ_1789144648 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:42 +0400 Subject: [PATCH v5 08/62] qapi/qom: add qapi-type field to ObjectPropertyInfo MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-8-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eric Blake X-Developer-Signature: v=1; a=openpgp-sha256; l=1815; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=RzrWcye6kOLM0FYws/ink7WuC4CDlZtTRGBMe3pAJb4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC22vY1NTuNn8xf4Y2N4WnLaDZAee/91RI8n9 xWssgxyd2CJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttgAKCRDa6OEJdZac 5Q4/D/9UJEGdgHDpdj6zOHnBJ05UOg+DQH5luoJV/LmyIBZiQ787g6SbvI4l7n1mwnk9ffFi0AN AlAgnEkd/tYkspnXnSJ/Kj6IJPPLy/WOcpHSJqAG2Shzui07drD8f+nXfkHvWq5ni8sqi8tXlGC 34qA+tRslPaPFjSpCve8Hp8eiF/y5QQI6obqHHzuvbOEkRYbBs3IaxN4dcfHwibdVn3tnH//HNM zPsxJtUw+mjDlXq7S3CPKzqD5eJZBQixOvTlAJPk2lmjqHxbVmIKbvdQHcu38YZmHV8KAQgNkQO Lm5VlPwjg6dnxKUwwndpPO7jwGskbD1Uih2ql+0SkHhDaT0Tv5VFtA8mNhP8YESwevZtMobmBjV zunQ3Q0SELm16vSl35oAd7i9YeZ1szYoOBCMXnNgl194dKjYLW+1Feoh3yCdGPRMVca1RYVehZL NvyVrhO1jm2SmU7sv/PwdbJ1560Dys/RexKHUiJ2OiEZ624y6y52mzoLQbhAvHyPTTQ2gctbpLU uSgsJFrDCGzru4ITZ6qEcdHQcxn82WNcsYkn100OrHoEGHrpD32M/dxn9mH7lEJjvJPXE5WKxpk unwed5NtWdg5RSgGSqSKh45F57ebnpc/yr5sNV2iYgPORFLCqSleihMe0UYNaU1V0pJliMS6N93 Zts57bEVJZN/m7A== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=marcandre.lureau@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, 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: 1789144711899158500 Add an optional 'qapi-type' field to ObjectPropertyInfo and ObjectPropertyValue. When present, it contains the masked type name that can be looked up in query-qmp-schema output. Absent for properties without a QAPI type association. Always absent for now, populated in the following changes. Signed-off-by: Marc-Andr=C3=A9 Lureau --- qapi/qom.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qapi/qom.json b/qapi/qom.json index 4a9b7f908844..06add228151b 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -35,6 +35,10 @@ # qdev device type name. Link properties form the device model # graph. # +# @qapi-type: the name of the property's type as it appears in the +# output of ``query-qmp-schema``. Absent if the type does not +# occur there. (since 11.2) +# # @description: if specified, the description of the property. # # @default-value: the default value, if any (since 5.0) @@ -44,6 +48,7 @@ { 'struct': 'ObjectPropertyInfo', 'data': { 'name': 'str', 'type': 'str', + '*qapi-type': 'str', '*description': 'str', '*default-value': 'any' } } =20 @@ -55,6 +60,10 @@ # @type: the type of the property, as described in # `ObjectPropertyInfo`. # +# @qapi-type: the name of the property's type as it appears in the +# output of ``query-qmp-schema``. Absent if the type does not +# occur there. (since 11.2) +# # @value: the value of the property. Absent when the property cannot # be read. # @@ -63,6 +72,7 @@ { 'struct': 'ObjectPropertyValue', 'data': { 'name': 'str', 'type': 'str', + '*qapi-type': 'str', '*value': 'any' } } =20 ## --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144703; cv=none; d=zohomail.com; s=zohoarc; b=RLkSTymupIuU4DEsIgZ23dx1PkZQzYIXuwLI2hst57KXnXzCIKgR/AG9oTf4QDUz6eMAwleegqQd9fOUN6ADcKvOlWKVUBY4KTZa8q00DvtMpvWmyJPBZl8h6P62wGArEtiBm4nBiWgNc5vXHB9+Nb36YmxKWCTV6snIVlMrHAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144703; h=Content-Type: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=6TUSEu0sEClPNHL4vv4gsE23cIAhHKsqbEk0UMlAaEM=; b=HFpx7AeKTWksW9i4jajwS2sZp2pahX1oHCJZy8+EJLMIZIEfhgXm6GG6UV8DMUKMbky1O09twU2gyiUNaeci9pmAGUE5cfN/S1R4YS6PUYUSIBrDBvra7tFZuef+rfGEM8VrSXAX0abugDPcHZTD+FBDNtxXLqQTqiBDHL5+Gh0= 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 1789144703242209.85263070462338; Fri, 11 Sep 2026 09:38:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54GO-0005wT-69; Fri, 11 Sep 2026 12:38:08 -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 1x54G9-0005CA-Qn for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:55 -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 1x54G4-00063e-4O for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:52 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-329-m6bSb6KKOvO9IvRgy6OD2g-1; Fri, 11 Sep 2026 12:37:33 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BC2E4195D032; Fri, 11 Sep 2026 16:37:31 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EB14030002E1; Fri, 11 Sep 2026 16:37:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144654; 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=6TUSEu0sEClPNHL4vv4gsE23cIAhHKsqbEk0UMlAaEM=; b=O6JCXFNOXrMtyJ3BfZl9YO7MaqvcBWRJTw5Sh6e0DhmF7YyXpwAOU8/xwFhhr2P7IVwLJ5 KZeHbx7+UB4YDyuTJahMUxcdEvlV44ukfkU9ozq2lcAy8Fdt07tKSpNZnOGGkOAAhTxwmq Ty65iAjuQPDqEpvBn3gFeTVGTp2M138= X-MC-Unique: m6bSb6KKOvO9IvRgy6OD2g-1 X-Mimecast-MFC-AGG-ID: m6bSb6KKOvO9IvRgy6OD2g_1789144652 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:43 +0400 Subject: [PATCH v5 09/62] qom/qmp: populate qapi-type in QMP handlers MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-9-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=3481; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=V0JgLpw7o5TuWzU0v6BSi8BNq0lnGgg+9WVC1tJYi8Y=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC22vXDs6273oi9chS56vMq1HlyTc0H5lwGR9 b9CXn+9g7uJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttgAKCRDa6OEJdZac 5SFQD/wJQfuh59o7MuYQyYzmfZ+R2E6XflyYbWYoz4rCD4yn0Od7JXY13R0MvnCTt9nb2obNvcF 3/2BgyopIKNBX2l3bTwj3ZAQ7a2MZZ2Bs9oVJvb3M/UBRGVamU/jTGbI+zxOb8WL4pY+iFfMivG mD0v819sbwUg9LKxot+4fDsD753Jk4Z1BcDeyB8DvCcAvIwPxv5WKY0X86GPRjV5zfEgFEnX8sE Gu9R9BdpArOprYkr5VUOfxi0IqNUS2bHgueGVt+AsqIzPR6YRxMKpxqGxjsrYbiv27fBZqvBeKX bV4lZuBkFXqnhfefhenl80xaLi+LLT4rwO0VKGvLFkNmH0pauV62XSRkkp3WlS5If9aXBa2Pq7E Q97Kmnagf1K/2FdVfI48CXQVC7t757diVwzz3SOG2cZa6iAZNth1lL1bs0BkxkfvWqfXy4eyheE NiqhB2LPh1mVEuA64eA8AkqvFuGn/gallX8vRXojikPnXSzB/KWF+qrmcyrHwZsj7qBV6FgFXKS aOC/wIkVvGkw56vKWduJ4V64UBbh5vqTyPRrN+9a5MG0/Bnh+4lWpnIke6gVDQaKNztFHe+ZBi/ WfwaMaUf2w7S3c9mzZo/k9wLFthLQ/0ais4gX76eFQWt1vzzTsM2XJHTWEN0UM25r2Egqyhr5Hz GR5NHfyo+NuLIVg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144703939158501 Wire up the new qapi-type field in all four QMP handlers that return ObjectPropertyInfo or ObjectPropertyValue: qom-list, qom-list-get, device-list-properties, and qom-list-properties. When an ObjectProperty has a qapi_type set, the masked QAPI type name is copied into the response, allowing clients to cross-reference with query-qmp-schema. No property has it yet, the following changes will populate it. Reviewed-by: Markus Armbruster Signed-off-by: Marc-Andr=C3=A9 Lureau --- qom/qom-qmp-cmds.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c index 330895361d47..500930da14cb 100644 --- a/qom/qom-qmp-cmds.c +++ b/qom/qom-qmp-cmds.c @@ -25,9 +25,23 @@ #include "qapi/qobject-input-visitor.h" #include "qapi/qobject-output-visitor.h" #include "qemu/cutils.h" +#include "qapi/qapi-type-info.h" #include "qom/object_interfaces.h" #include "qom/qom-qobject.h" =20 +static ObjectPropertyInfo *qom_property_info(ObjectProperty *prop) +{ + ObjectPropertyInfo *info =3D g_new0(ObjectPropertyInfo, 1); + + info->name =3D g_strdup(prop->name); + info->type =3D g_strdup(prop->type); + if (prop->qapi_type) { + assert(prop->qapi_type->masked_name); + info->qapi_type =3D g_strdup(prop->qapi_type->masked_name); + } + return info; +} + static Object *qom_resolve_path(const char *path, Error **errp) { bool ambiguous =3D false; @@ -58,12 +72,7 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, E= rror **errp) =20 object_property_iter_init(&iter, obj); while ((prop =3D object_property_iter_next(&iter))) { - ObjectPropertyInfo *value =3D g_new0(ObjectPropertyInfo, 1); - - QAPI_LIST_PREPEND(props, value); - - value->name =3D g_strdup(prop->name); - value->type =3D g_strdup(prop->type); + QAPI_LIST_PREPEND(props, qom_property_info(prop)); } =20 return props; @@ -78,6 +87,10 @@ static void qom_list_add_property_value(Object *obj, Obj= ectProperty *prop, =20 item->name =3D g_strdup(prop->name); item->type =3D g_strdup(prop->type); + if (prop->qapi_type) { + assert(prop->qapi_type->masked_name); + item->qapi_type =3D g_strdup(prop->qapi_type->masked_name); + } item->value =3D object_property_get_qobject(obj, prop->name, NULL); } =20 @@ -218,9 +231,7 @@ ObjectPropertyInfoList *qmp_device_list_properties(cons= t char *typename, continue; } =20 - info =3D g_new0(ObjectPropertyInfo, 1); - info->name =3D g_strdup(prop->name); - info->type =3D g_strdup(prop->type); + info =3D qom_property_info(prop); info->description =3D g_strdup(prop->description); info->default_value =3D qobject_ref(prop->defval); =20 @@ -261,11 +272,8 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const = char *typename, object_property_iter_init(&iter, obj); } while ((prop =3D object_property_iter_next(&iter))) { - ObjectPropertyInfo *info; + ObjectPropertyInfo *info =3D qom_property_info(prop); =20 - info =3D g_malloc0(sizeof(*info)); - info->name =3D g_strdup(prop->name); - info->type =3D g_strdup(prop->type); info->description =3D g_strdup(prop->description); info->default_value =3D qobject_ref(prop->defval); =20 --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144714; cv=none; d=zohomail.com; s=zohoarc; b=k84z/VTxAl0Ap2DmaLBPJ7/UXT2LwJRiuuE5GDgyU0juSQlwlP/vCcxQFFMOsm6NO2DahCxongT3EwDdqngTlH1LvVJK0jcEDbQR+l4Q5PKgJxzf4jv/H4bLrIquMPBhbrenaxRF7Rj0XCfWtSEoX5zCq2BGEGn9Lq5nG5L4I4U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144714; h=Content-Type: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=GkTYx/29pXvG5zcNdkFguRYLLkRjW5IxZjj8tXCLuTE=; b=KOUs2Ed0sZPUchMdsSWnuXgMxH845q7JwrotqYiqp2AJ7wvYUKC0v+Mi5btcDlSxpPrJZNuF6CbtuuUt3PPUrYpg50NkxQp2Ca8aVdmQ6NcvYL4cHGK4EmolkDxtVzVX9kvxbHTnekfc2QoGsaWlxHNx0UqbcmZq6Xc6HUS5vB0= 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 17891447140207.919300872053782; Fri, 11 Sep 2026 09:38:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Ga-0006Lr-2w; Fri, 11 Sep 2026 12:38:21 -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 1x54GC-0005Eb-0D for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:57 -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 1x54G4-00064b-K4 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:55 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-364-f0fS8SN6NBGjEeHGEOD6jQ-1; Fri, 11 Sep 2026 12:37:36 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 81F7019539B0; Fri, 11 Sep 2026 16:37:35 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 845B81800351; Fri, 11 Sep 2026 16:37:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144658; 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=GkTYx/29pXvG5zcNdkFguRYLLkRjW5IxZjj8tXCLuTE=; b=FJos/WaPn+RPswe7rpj1SB+6JLvbURDIVb0lcUOH8ClryPjAlMS46a5A6OPOwxk/+kg5AY 1WXX0tSO/7sIGGejHmUfiiAyd8EkOh2nI00KtydQ34R498lvyDOdB9OTLooM2ySvIVyYJk bZrNKFY98IWKiYqLeTxmwxu3LI9EnPQ= X-MC-Unique: f0fS8SN6NBGjEeHGEOD6jQ-1 X-Mimecast-MFC-AGG-ID: f0fS8SN6NBGjEeHGEOD6jQ_1789144655 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:44 +0400 Subject: [PATCH v5 10/62] qom/qmp: populate description & default-value in qom_property_info() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-10-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=2431; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Qmx3fiGa/Y4SU5dXuf1JYyfVNHr2dqaFvQawEIv62yY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC23ufO1tALL4LpNKJcGzW7vWCA1i3IiiWhfJ qpYVOnW8FKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttwAKCRDa6OEJdZac 5QotD/9VXyhUL+tHQFyl4PYNB1NKNriKiTE0Dc/gbKIzEbDYwwcrf7PLnZxbK+aG9aHK3CP2SOX OLzqwaYnAG5eFIC86zrAPBEQeZINRuVVjVw6tlUTdbtVEZ5iLFKZGjDQm+iKyZl/e44cwaA5zWv 8AUnNXV9guLg0TeoXoi0c81DFRqTG66HpxmRcnNZ5N7vF+SgVEnA0MyQjyF5PjFAtFESooRUJjg 4UF9MAVx4Bc/heGnB/OxcQFpCpI/G/JMqHHDMATU/06cX46T31dKuF2Z6aUUxzT32up61Rw7xJv hfm9Cjdcf/oV+ROedzMZ7fmzYbJjlPGRakMm2O3CoIYi9QphPoycgPJy/cBO3bhFhc7E82yECXU B23Vp2OxnydeoGLenB8dsWs0qaRHQ3/p/3r1QKQ9AWxjGsvReP+ou5AxkGfSV52H4qNtUo/5LEk +6Zu4luek7BJDPQ92/u8HgG6ql8LZsMOiXnzsBFkrtavsmRtxEYJikrDrt5Mjn/cmHnSyhwMKpQ bmUI3WOO/yzAsuPsCgws7h4e+6zk6XS7n9K77ZY1rRa7VB4O02KW9EKqV7N319R4Pyx9BAu/Q8/ kcOlHjKtDto4fWL3SVIn2IgcUyaPdM7aNOZt8le5IBJbMOCc8cL9ax9jOUZ7IKgiMp28vIDIr3v DyKb92Y/U6XMqmQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144715932158500 Move description and default_value population from the individual QMP handlers into qom_property_info(), so all callers get them. This also adds description and default-value to qom-list responses, which previously only returned name and type. The handler doesn't care. Signed-off-by: Marc-Andr=C3=A9 Lureau --- qom/qom-qmp-cmds.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c index 500930da14cb..2516b9871d90 100644 --- a/qom/qom-qmp-cmds.c +++ b/qom/qom-qmp-cmds.c @@ -35,6 +35,8 @@ static ObjectPropertyInfo *qom_property_info(ObjectProper= ty *prop) =20 info->name =3D g_strdup(prop->name); info->type =3D g_strdup(prop->type); + info->description =3D g_strdup(prop->description); + info->default_value =3D qobject_ref(prop->defval); if (prop->qapi_type) { assert(prop->qapi_type->masked_name); info->qapi_type =3D g_strdup(prop->qapi_type->masked_name); @@ -220,8 +222,6 @@ ObjectPropertyInfoList *qmp_device_list_properties(cons= t char *typename, =20 object_property_iter_init(&iter, obj); while ((prop =3D object_property_iter_next(&iter))) { - ObjectPropertyInfo *info; - /* Skip Object and DeviceState properties */ if (strcmp(prop->name, "type") =3D=3D 0 || strcmp(prop->name, "realized") =3D=3D 0 || @@ -231,11 +231,7 @@ ObjectPropertyInfoList *qmp_device_list_properties(con= st char *typename, continue; } =20 - info =3D qom_property_info(prop); - info->description =3D g_strdup(prop->description); - info->default_value =3D qobject_ref(prop->defval); - - QAPI_LIST_PREPEND(prop_list, info); + QAPI_LIST_PREPEND(prop_list, qom_property_info(prop)); } =20 object_unref(obj); @@ -272,12 +268,7 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const = char *typename, object_property_iter_init(&iter, obj); } while ((prop =3D object_property_iter_next(&iter))) { - ObjectPropertyInfo *info =3D qom_property_info(prop); - - info->description =3D g_strdup(prop->description); - info->default_value =3D qobject_ref(prop->defval); - - QAPI_LIST_PREPEND(prop_list, info); + QAPI_LIST_PREPEND(prop_list, qom_property_info(prop)); } =20 object_unref(obj); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144727; cv=none; d=zohomail.com; s=zohoarc; b=cGO21bi5PyagAgHFea9yokyo3Yv67cm5hkgE2h8w+cFj2HZqJn18U4DnDhfvObgIT1wmGLZSd03t/2MStkypknys5Wb4UhpSNw1abLA8XE7tr2ROvRH309CUpBb337hOa0FkU4sboQiRJUb47b9zBdbbUkUZ80I8cA2xVCI+e14= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144727; h=Content-Type: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=R3oPXPM3fK4MsUH2z2qdPJuzr1xcfLEKwZWlP2JAH0E=; b=Q79aNos4YlJAFNnG1jj5laTgOfkzgXlgkF4FtIbKmmCWjHpXzyraZBj/8YVaapX7Y0+2USqX9hzTmxKORflhwIX6GXejgh33QZs15NUmTX+fVdD8O8rT0HvMqljQKKjRBvoaTiUU9ik9U/30wCo2n/1NvwuNZ2cvBLLBQTbOuf4= 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 1789144727493574.851623557131; Fri, 11 Sep 2026 09:38:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54GK-0005co-6I; Fri, 11 Sep 2026 12:38:04 -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 1x54GD-0005Fl-TN for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:57 -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 1x54G4-000665-Kh for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:56 -0400 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-542-Qzk6UMgoOw28PGh0MJl6gg-1; Fri, 11 Sep 2026 12:37:40 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 D0DD518009C6; Fri, 11 Sep 2026 16:37:38 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D5E531956095; Fri, 11 Sep 2026 16:37:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144663; 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=R3oPXPM3fK4MsUH2z2qdPJuzr1xcfLEKwZWlP2JAH0E=; b=cSIBcDmf7jBqIbClD4XgruBLY0z71DmimBIIxZHozKZhEEqJE3cgKudaC8hm5+/lARw7to VfrmUzWVaaK9XgASnhjLu4e/u9SEv5yZZp5n9rMh/rvG+h5YDPhDclLIA90N+EMeOn0+PS Anfmq2pVzE5aHW3ITqVjnuv/+6lG0jc= X-MC-Unique: Qzk6UMgoOw28PGh0MJl6gg-1 X-Mimecast-MFC-AGG-ID: Qzk6UMgoOw28PGh0MJl6gg_1789144658 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:45 +0400 Subject: [PATCH v5 11/62] qom: add object_property_set_default_enum() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-11-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1687; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=J24jPq7GnTAmrNH7CcrVSdskD3xIJdz1fXAotCO/yMI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC23T8CbP0g1fUsDz2SL4ic1c/hF8vsVbBQGO XtCBHkexW2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttwAKCRDa6OEJdZac 5Y1wD/0eEnUQ9fT9mtuiNxgHEifrhqL5XSgWOEpwMkGFhN0s2sTNtkN1DYiNKTpUa8Zzb/pKMRL lF7VsWA8ylou8jkFaLJyi220m7pDC/JgFZpXiwfMII7mEhoDLMuMGr16eAYxu8m5KO9XAngx72H EBJAfZshCTfQcNCUBKU+ifusMVYfCZ+t8RQV08BQhNtidu8bpS7sGqNkZNyge93oatOOyJPbJun /7kUe5qMQSX+71j7vIFA6WWd0IYyiU+2ttow6sJgQUywnqPJ26P1lM83c6HYe4PU46QsIBvxm2B AQrnzyDF4ZbaiRADfacs9GxXSgliJJr+gbB8IcPiPy5FgJ9U8bG/xuM+lp7XehNF0X0VFj+yMDF WuzKCFuV6h9mDpkNAu4gsPMm2V3ue+MZWxFWS3lRb77G5G11khmPBca7nDIBqo9Gl9qLuK/IxU2 rkkJY7GFZdDTezqhjV9tC3kuSHHKq5x1Ps3S8ZXm864jobHs6WAmKn3n4Bxu02ilMbT32YzbhSq Ne/FM52STAQclSVxeVsSMW4yVz8n9xBKhYpmqdEVHooCt2qhTD3ADRiZZWWpZtxRHgq5NfGUD5I 4DquPsoNRqIjZgFYMbirkODqo/NbkyAR2/v87gEBcz24ZdLO4qsOkxg7yYXK9bV7k7w5Rfi3N+4 mtmdgtZ+sKte6mQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=marcandre.lureau@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, 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: 1789144728022158500 A simple helper to set the default enum value from the integer value. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/qom/object.h | 9 +++++++++ qom/object.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/include/qom/object.h b/include/qom/object.h index 7c7e69a2a1bb..c9a5ea4a1bf8 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1226,6 +1226,15 @@ void object_property_set_default_bool(ObjectProperty= *prop, bool value); */ void object_property_set_default_str(ObjectProperty *prop, const char *val= ue); =20 +/** + * object_property_set_default_enum: + * @prop: the property to set + * @value: the value to be written to the property + * + * Set the property default value. + */ +void object_property_set_default_enum(ObjectProperty *prop, int value); + /** * object_property_set_default_list: * @prop: the property to set diff --git a/qom/object.c b/qom/object.c index f782e21f1a30..bf9664b53b78 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1709,6 +1709,15 @@ void object_property_set_default_str(ObjectProperty = *prop, const char *value) object_property_set_default(prop, QOBJECT(qstring_from_str(value))); } =20 +void object_property_set_default_enum(ObjectProperty *prop, int value) +{ + assert(prop && prop->qapi_type && prop->qapi_type->lookup); + + object_property_set_default(prop, QOBJECT(qstring_from_str( + qapi_enum_lookup(prop->qapi_type->lookup, value) + ))); +} + void object_property_set_default_list(ObjectProperty *prop) { object_property_set_default(prop, QOBJECT(qlist_new())); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144690; cv=none; d=zohomail.com; s=zohoarc; b=j55ylyEulozgQMJZaCWeTWcsORnnKyoqIFimxGEVxc4D1rrrahgQZWqIGdFPLhnJI7Ructq6SpdxsEJbImdrj8cFZFUcFOyVLvlKqKzyrsNNiF+QUBskIZr/+NPHjAjYrjqfAA6ZhGavCeZjqv5H/J3hEaZghzYBZk7VZczBbxk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144690; h=Content-Type: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=+dTCAe13s+/qe8OyKDq4J7CbBf2JbhGMcn6OfTOaJdM=; b=Hi8oGIBvphFfMq4QHiBq88z4tRmbERKfhBdb0Rm5bbQo1MQlPL+PhX9EZGuJIJG5eGH/fno65nmyFH7Rfm5Bv/jxbW0xW0X4Y74UF9kOxRSNXJWzWS87+ES4LMmvjGuISmvfgSFQH9YmgNbi9qmvS2WU6/U/MD2tWISHGpQrBrM= 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 1789144690795251.2127681150697; Fri, 11 Sep 2026 09:38:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54GJ-0005WZ-85; Fri, 11 Sep 2026 12:38:03 -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 1x54G7-0005Ae-Tq for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:53 -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 1x54G4-00066Q-3r for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:37:51 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-692-Jg7iwDDHMi2AWDZ-5sGNcg-1; Fri, 11 Sep 2026 12:37:43 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7B95319560BC; Fri, 11 Sep 2026 16:37:42 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 81744300022B; Fri, 11 Sep 2026 16:37:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144664; 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=+dTCAe13s+/qe8OyKDq4J7CbBf2JbhGMcn6OfTOaJdM=; b=WwB3I0NSH2l+3dZp5bJ/i3A3hMP9O+qlEP02ZvlrH/nlKjdEw1Nr3Xiu+N0wnYwN5LeCrF CN+atrour78N753bNEaKkSDYgXzEs579OEDSBpjI3eAiaAYfGrzTR9BxcPUjX/DIYerUFN HVcnGWoQ/ypy82L1am3tpB6vTEb8CCw= X-MC-Unique: Jg7iwDDHMi2AWDZ-5sGNcg-1 X-Mimecast-MFC-AGG-ID: Jg7iwDDHMi2AWDZ-5sGNcg_1789144662 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:46 +0400 Subject: [PATCH v5 12/62] qom: add object_{class_}property_add_qapi MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-12-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=4793; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=l0UXqFVCyU+WDYWA330MIVYIMH08NK/BziNQ4fJo2Po=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC23slmUeC5CJL7+IfjIoWwdeZd9grYT6kJdK pyhMnIFqJuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttwAKCRDa6OEJdZac 5eEcD/970fEFdyPh0/J55KNF5cNgTtbel7MRPztcJ0CqwtPF2JNZ81jM6l0Lz0WCOPOil2L2Nkz WluYbO3WNUsfmNY2/n2dqr1S0Lz0JBrplDF28wLo4ge3cfL4f3qfxca8bAcqddRUyxT2mF0lIyB h/tmo5wn01/hrKiddZB6dsZliegn8zZct3grZO0qu2PYa5VdmZN8ObfAZphM6huQFP4VCYldi5t sybj4Zhg/xyK/utJpz+tFxy/CdbvqLvKLh8xjxcvLWi+w3URdwlITPTewnfm02jR482iXezOu8H XzpvyrCjQn/lXKHfGAR4fmKhToNo+2HYkNcuGsp4WFRQsyPpr/Y5NRt4wbFqiY74m2gGxaWedmn lNqaY8ckvnC1N73TnTNv7ozQgjVqiGLjXj/Xu3sn9z/Or8vv/9JfHKsgeSb4Gn1c9Eb3rVrvFEL 4Q5Z+chba2Dwzj7M3+mVR8KkzCoP/X1iPT2X7dAAgiJCrwpqGJSt+XLUQ494R3s9UJKZkBsCN3K w9gVXofrAl1tmsWjQJEgdJNCGy6Pofykh5izGAKgS+5++BIjOT28uTHKda5Xq/o5YrJCeVrG2Vu n6J/L5FzORD+w/UevyGqjqrLpflgyLHpKOKTkIdxiOCYmYJI1JSbYIIS5UWQ/IF2ff4Ua2m5TSE RcoJbfV1aLJXYjg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144691901158500 Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/qom/object.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++++= ++++ qom/object.c | 32 ++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/include/qom/object.h b/include/qom/object.h index c9a5ea4a1bf8..083fe646c390 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1993,6 +1993,61 @@ ObjectProperty *object_class_property_add_enum(Objec= tClass *klass, int (*get)(Object *, Error **), void (*set)(Object *, int, Error **)); =20 +/** + * object_property_add_qapi: + * @obj: the object to add a property to + * @name: the name of the property + * @qapi_type: QAPI type info descriptor + * @get: The getter to be called to read a property. If this is NULL, then + * the property cannot be read. + * @set: the setter to be called to write a property. If this is NULL, + * then the property cannot be written. + * @release: called when the property is removed from the object. This is + * meant to allow a property to free its opaque upon object + * destruction. This may be NULL. + * @opaque: an opaque pointer to pass to the callbacks for the property + * + * Add a property with a QAPI type association. The property type name + * is derived from @qapi_type->name. + * + * Returns: The newly added property on success, or %NULL on failure. + */ +ObjectProperty * +object_property_add_qapi(Object *obj, const char *name, + const QAPITypeInfo *qapi_type, + ObjectPropertyAccessor *get, + ObjectPropertyAccessor *set, + ObjectPropertyRelease *release, + void *opaque); + +/** + * object_class_property_add_qapi: + * @klass: the object class to add a property to + * @name: the name of the property + * @qapi_type: QAPI type info descriptor + * @get: The getter to be called to read a property. If this is NULL, then + * the property cannot be read. + * @set: the setter to be called to write a property. If this is NULL, + * then the property cannot be written. + * @release: called when the property is removed from the object. This is + * meant to allow a property to free its opaque upon object + * destruction. This may be NULL. + * @opaque: an opaque pointer to pass to the callbacks for the property + * + * Add a property with a QAPI type association. The property type name + * is derived from @qapi_type->name. + * + * Returns: The newly added property on success, or %NULL on failure. + */ +ObjectProperty * +object_class_property_add_qapi(ObjectClass *klass, + const char *name, + const QAPITypeInfo *qapi_type, + ObjectPropertyAccessor *get, + ObjectPropertyAccessor *set, + ObjectPropertyRelease *release, + void *opaque); + /** * object_property_add_tm: * @obj: the object to add a property to diff --git a/qom/object.c b/qom/object.c index bf9664b53b78..7082bc1c0510 100644 --- a/qom/object.c +++ b/qom/object.c @@ -2599,6 +2599,38 @@ object_class_property_add_enum(ObjectClass *klass, c= onst char *name, prop); } =20 +ObjectProperty * +object_property_add_qapi(Object *obj, const char *name, + const QAPITypeInfo *qapi_type, + ObjectPropertyAccessor *get, + ObjectPropertyAccessor *set, + ObjectPropertyRelease *release, + void *opaque) +{ + ObjectProperty *prop; + + prop =3D object_property_add(obj, name, qapi_type->name, + get, set, release, opaque); + prop->qapi_type =3D qapi_type; + return prop; +} + +ObjectProperty * +object_class_property_add_qapi(ObjectClass *klass, const char *name, + const QAPITypeInfo *qapi_type, + ObjectPropertyAccessor *get, + ObjectPropertyAccessor *set, + ObjectPropertyRelease *release, + void *opaque) +{ + ObjectProperty *prop; + + prop =3D object_class_property_add(klass, name, qapi_type->name, + get, set, release, opaque); + prop->qapi_type =3D qapi_type; + return prop; +} + typedef struct TMProperty { void (*get)(Object *, struct tm *, Error **); } TMProperty; --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144727; cv=none; d=zohomail.com; s=zohoarc; b=d3T2kzMENemKZpvoUEP98GI8BQh7p7SncCnvHTNUYOAAeIsJRSgNXomPY2n+bWzECJgtwloD2Vt/tfvL7p/ACjWzqp73CN63tRSOZkoVguyK/834KhKi6LxL4ZC/SDysh0oXZgl2Rssn2Zz2XZjextWDZ0yr77su1/xwqn0YY58= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144727; h=Content-Type: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=yJMlo6mxcIkXEJsc7YS6atTu83kQpn233MrgN7DUEYM=; b=CIK1cvGgvo46uS1zTYyzQhhgaO2vjryb8TRm1CsoCZhJfkkiOJyNgZGA/X77baAcsVvsgBIGD+qmlNnAPyqsaqurNC6F79Aw5TeD/L8r1SbG9FkZPOPk1kCcMD1HmdRJ9A6fop60STlxFq8Y4k1svAalJzX0K5+fnk6qOjBXpRQ= 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 1789144726995382.1933050445822; Fri, 11 Sep 2026 09:38:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Gj-0006w2-Ix; Fri, 11 Sep 2026 12:38:29 -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 1x54Ga-0006YY-QJ for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:21 -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 1x54GY-0006ON-UU for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:20 -0400 Received: from mx-prod-mc-08.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-32-gvQF0subN2KUsQ9pXtMAiw-1; Fri, 11 Sep 2026 12:38:15 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 393511802671; Fri, 11 Sep 2026 16:38:14 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CF91C41B; Fri, 11 Sep 2026 16:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144696; 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=yJMlo6mxcIkXEJsc7YS6atTu83kQpn233MrgN7DUEYM=; b=c5BtTRmfFEZVNU6eT4RuW+7G/rrwxuEYa6dr9R6DMUUrYwvDXqynz0OQPDTb1ZCPO43Si5 IWDmZeO7egruhdLLaS+z/Vvp6kLEs/sgxQWpTnqbtc0/Q9QxpM0Tcmu8h5yrK6ezITFaJT GNT0+VpMUIQ/+k0JKQAJ+ygSh0YpZs0= X-MC-Unique: gvQF0subN2KUsQ9pXtMAiw-1 X-Mimecast-MFC-AGG-ID: gvQF0subN2KUsQ9pXtMAiw_1789144694 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:47 +0400 Subject: [PATCH v5 13/62] qom: add object_{class_}property_add_qapi_enum MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-13-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=7531; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=eXvKRfomXt/JyMlK7fno7quZI2V64Ljk8AMzmdqMY/M=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC23rLpwTI5qdvPf9f2qPXuPt/1TToEM9bcrO 0hojGZX/1KJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttwAKCRDa6OEJdZac 5auZD/4sog9xd4UZJz1O1qDOx03L3XCKUnN5NwJvT2V14G0yi9ooha036Fvo8fjBQjyKE049Wk9 1pP6vzeUYF+YsuUdW3LqZ1cjTZ/Sy/1PfLyNGVeTt3/7hsDYIXa8JyaDDdFgmQ1/IrcSh6niyds YduGTBDOWSN2vPgvGpZk06ylV62JcymEpo+WQkLoG74sRJOd87wnCU58jX3T9sxolVdUe5AQ8gH W5caQxa2r3eLC4BvPiwnmdCD104sNg+FUubu7Qk+UZWT1UcuSIsYXR55QIhfiWnDZFy+bcBd1dK PIF9rCy/RuEfem4zbES0fO+oEbc5rm+W01pk60J79mylZT4KM3HWpR6jF8O8xzmYXczkeA/R/QX /pU2yimHLXCSAGCCl8ZLzCqjAb71A3K+WdjHAfjb6UfXT3Ep3ebHQ/idreYUx2XbFN3WdPd1eKk s34S4ldHqn/ubikY/vLkgNg+fshOtYzjntBvwLGm3bDpIRF+Ju96DylGHwEyTiiFUgT5LQS3XEw liuJ2uryA+Ap7fgBdmTWMvQ3O4M5FLYSZ/Ltkqzh9Jl+Tl530fJ7SkPYAXUsvDAAtcNorrbP79H b9zD/WW5o+QM65oSO+6hAxqAtWgcs82Vpm2NZ3iQHRljKCr6nZvTKWvg6ZFtmnOFCezIauBZAtq LLKuuQyf/vLeTPA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=marcandre.lureau@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, 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: 1789144728094158500 Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/qom/object.h | 73 ++++++++++++++++++++++++++++++++++++++++++ qom/object.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++= +--- 2 files changed, 157 insertions(+), 5 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 083fe646c390..c9a5fe4934d0 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1993,6 +1993,79 @@ ObjectProperty *object_class_property_add_enum(Objec= tClass *klass, int (*get)(Object *, Error **), void (*set)(Object *, int, Error **)); =20 +/** + * struct QapiEnumProp - Descriptor for a QOM property backed by a QAPI en= um type + * + * Binds a QOM object property to a QAPI enum, providing automatic + * string<->int conversion through QAPI visitors and optional + * default-value initialization during object instance init. + * + * Use the QAPI_ENUM_PROP() macro to construct instances inline. + * + * @name: property name exposed on the QOM object + * @description: human-readable description (shown in ``-device help``, et= c.) + * @default_value: initial enum value applied via @set during instance ini= t, + * or -1 (the QAPI_ENUM_PROP default) to skip initializati= on + * @qapi_type: pointer to the generated QAPITypeInfo for the enum + * (provides the string<->int lookup table) + * @get: getter that returns the current enum value as int, or -1 on error + * @set: setter that receives the enum value as int; %NULL for read-only p= rops + */ +typedef struct QapiEnumProp { + const char *name; + const char *description; + const int default_value; + const QAPITypeInfo *qapi_type; + int (*get)(Object *, Error **); + void (*set)(Object *, int, Error **); +} QapiEnumProp; + +#define QAPI_ENUM_PROP(...) ({ \ + static const QapiEnumProp _prop =3D { = \ + .default_value =3D -1, __VA_ARGS__ = \ + }; \ + &_prop; }) + +/** + * object_property_add_qapi_enum: + * @obj: the object to add a property to + * @prop: property descriptor + * + * Add an enum property with QAPI type association. + * + * Returns: The newly added property on success, or %NULL on failure. + */ +ObjectProperty * +object_property_add_qapi_enum(Object *obj, const QapiEnumProp *prop); + +/** + * object_class_property_add_qapi_enum: + * @klass: the class object to add a property to + * @prop: property descriptor + * + * Add an enum property with QAPI type association. + * + * Use the QAPI_ENUM_PROP() macro to construct the property descriptor + * inline. If .default_value is not set, the property is not initialized + * (default_value is -1). Otherwise, the setter is called with + * default_value during object instance init. + * + * Example:: + * + * object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + * .name =3D "policy", + * .description =3D "Set the NUMA policy", + * .default_value =3D HOST_MEM_POLICY_DEFAULT, + * .qapi_type =3D &HostMemPolicy_type_info, + * .get =3D my_get_policy, + * .set =3D my_set_policy, + * )); + * + * Returns: The newly added property on success, or %NULL on failure. + */ +ObjectProperty * +object_class_property_add_qapi_enum(ObjectClass *klass, const QapiEnumProp= *prop); + /** * object_property_add_qapi: * @obj: the object to add a property to diff --git a/qom/object.c b/qom/object.c index 7082bc1c0510..2d3bd2ae327d 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1210,7 +1210,7 @@ static void object_class_foreach_tramp(gpointer key, = gpointer value, return; } =20 - if (data->implements_type &&=20 + if (data->implements_type && !object_class_dynamic_cast(k, data->implements_type)) { return; } @@ -1776,7 +1776,6 @@ int object_property_get_enum(Object *obj, const char = *name, char *str; int ret; ObjectProperty *prop =3D object_property_find_err(obj, name, errp); - EnumProperty *enumprop; =20 if (prop =3D=3D NULL) { return -1; @@ -1789,14 +1788,17 @@ int object_property_get_enum(Object *obj, const cha= r *name, return -1; } =20 - enumprop =3D prop->opaque; - str =3D object_property_get_str(obj, name, errp); if (!str) { return -1; } =20 - ret =3D qapi_enum_parse(enumprop->lookup, str, -1, errp); + if (prop->qapi_type) { + ret =3D qapi_enum_parse(prop->qapi_type->lookup, str, -1, errp); + } else { + EnumProperty *enumprop =3D prop->opaque; + ret =3D qapi_enum_parse(enumprop->lookup, str, -1, errp); + } g_free(str); =20 return ret; @@ -2599,6 +2601,83 @@ object_class_property_add_enum(ObjectClass *klass, c= onst char *name, prop); } =20 +static void get_qapi_enum(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + const QapiEnumProp *prop =3D opaque; + int value; + Error *err =3D NULL; + + value =3D prop->get(obj, &err); + if (err) { + error_propagate(errp, err); + return; + } + + visit_type_enum(v, name, &value, prop->qapi_type->lookup, errp); +} + +static void set_qapi_enum(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + const QapiEnumProp *prop =3D opaque; + int value; + + if (!visit_type_enum(v, name, &value, prop->qapi_type->lookup, errp)) { + return; + } + prop->set(obj, value, errp); +} + +static void init_qapi_enum(Object *obj, ObjectProperty *prop) +{ + const QapiEnumProp *e =3D prop->opaque; + + if (e->set && e->default_value >=3D 0) { + e->set(obj, e->default_value, &error_abort); + } +} + +ObjectProperty * +object_property_add_qapi_enum(Object *obj, const QapiEnumProp *e) +{ + ObjectProperty *prop; + + assert(e && e->qapi_type && e->qapi_type->lookup); + + prop =3D object_property_add_qapi(obj, e->name, e->qapi_type, + e->get ? get_qapi_enum : NULL, + e->set ? set_qapi_enum : NULL, + NULL, + (void *)e); + prop->description =3D g_strdup(e->description); + if (e->default_value >=3D 0) { + prop->init =3D init_qapi_enum; + } + + return prop; +} + +ObjectProperty * +object_class_property_add_qapi_enum(ObjectClass *klass, const QapiEnumProp= *e) +{ + ObjectProperty *prop; + + assert(e && e->qapi_type && e->qapi_type->lookup); + + prop =3D object_class_property_add_qapi(klass, e->name, e->qapi_type, + e->get ? get_qapi_enum : NULL, + e->set ? set_qapi_enum : NULL, + NULL, + (void *)e); + prop->description =3D g_strdup(e->description); + if (e->default_value >=3D 0) { + prop->init =3D init_qapi_enum; + } + + return prop; +} + ObjectProperty * object_property_add_qapi(Object *obj, const char *name, const QAPITypeInfo *qapi_type, --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144716; cv=none; d=zohomail.com; s=zohoarc; b=J31DnrDIwe8Oej+2lejitsVj4KQ6ZLpGFv090jT2XtljPeDQiKlVT9tprIhzdyipVmJf+Od8BD7Afulri2tJIS/fptICvjvL1j1ZwacfEipR7zAQLbbUVGci77lKyDxpZWewzuQp/vUCUL4OqvfZ9sReJp6xtiDsC4LvOnhn3vg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144716; h=Content-Type: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=zNYgOyjpFTHomWvYcWcSOyR0E+fcnEjS4LB5n8XH++I=; b=JYhze026bg+JhTE6BWrjb5fbynnWz6WZVhjkGPqn2KCDPDnYu80teKHjgOWgBge5hvhqnWnOxINYi73ke3NA4qUMdMqyfyp/w0+e3CHfF7SpQeZOMUTyGkzzrZ/g31buaP08m9NkTdYSNt7LEW/0VWaijCkeGp8B9G/VmQCMCA8= 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 178914471642186.31680540954801; Fri, 11 Sep 2026 09:38:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Gj-0006za-Mb; Fri, 11 Sep 2026 12:38:29 -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 1x54Gc-0006eB-BD for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:23 -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 1x54Ga-0006PE-N2 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:22 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-382-X6YvGMupO-azUUqWakI90g-1; Fri, 11 Sep 2026 12:38:18 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A01F91955BE1; Fri, 11 Sep 2026 16:38:17 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C80D35C0; Fri, 11 Sep 2026 16:38:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144700; 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=zNYgOyjpFTHomWvYcWcSOyR0E+fcnEjS4LB5n8XH++I=; b=MykAqdJK5oK/dcWWK+4DRpjrv+jNAiXF04DvkgthztTrIikFP0Rna6JFkTo+L0GnZNidrA vSo4I2TBVYgbuMne871qZfx8YEnXcexP2sKHVZ9Zc+GESuG3heZcoExiPiM+0lgVEdSOZk KEv+vFkh7I13QldMdFqGcIwZBWtADxo= X-MC-Unique: X6YvGMupO-azUUqWakI90g-1 X-Mimecast-MFC-AGG-ID: X6YvGMupO-azUUqWakI90g_1789144697 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:48 +0400 Subject: [PATCH v5 14/62] tests: update check-qom-proplist for QAPI-aware property registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-14-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=5370; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=q2n1PS8TB3xj4XT1NZQ4agWLWhftpKvEUnO0GIyvQS8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC230YyZO847+hvTlEmDb3f/rX7RzccXEQJ9U VKSkXcmdVmJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttwAKCRDa6OEJdZac 5Y/GEACV7P7KhTxv1m2Jj3ad81AI6xEFhbrkHgtDB22gZ4+5ogQlN3h9A7C1pF5lXPmTbRXjCbw ZhbjFavOHK+nQvnWkrbwiMYOM0ODAsuxiSMbkvzkIBTm3P4+aId9FGQJRVxa3n26RucjNVaguQW briHLVoxRT0EkVn5E2gF5UmfEY6fJi0pzXcGExneL5Ta7TN7JccuI2frWCqQ3IGJeHds7ihyiK/ +l4Jm6JYz8KzNmHWXMT/VGzK2yGWnK1KmcAJ6McTZEwri4PTK9pDGW56VWxv/SB77UemTHAkB32 xWlM4UmQdLINCH8Vap/HkgHn3doRc7UNb57NihyV9lr2VC8FK9Co/FcHE8LuOWbIszKqyUqw9kG +9fXNeKcmo6GjVaI6Lj1O7XBDnGlWBVJMr8ckEj3nLiKGk1q6WFqjSli2gh0WqNnJCBjVrEwtB/ /TiFYgE4Gv9A22qBPvhdEp4+uFNpJFY+1Q6Vkv0iEIV66JzGLD99wLA4DvlFtIldnb5XEjt67Vv kQhYTFjKZfHlbqo6teLNYC3+RuxUETtK1DatazjoOBSvoSjnn/+mLPZjQ0moTZLUgLoYriQLzHL mRdlhcIvtd2C+wUbKMgeAx/5QwOeY9HDtFezsNyQpSdsVAG9iGJUwvyOKGdCOfYt5W0ZY8S4KbV 9Q61onqthYxdV1g== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144717979158500 Migrate the dummy object's string and enum properties from the legacy object_class_property_add_str/enum() helpers to the new QAPI-aware object_class_property_add_qapi/qapi_enum() registration. Add test cases verifying that the qapi_type metadata is correctly populated on properties registered through the new API, and that it remains NULL for properties using the old-style registration. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/unit/check-qom-proplist.c | 93 ++++++++++++++++++++++++++++++++++---= ---- 1 file changed, 77 insertions(+), 16 deletions(-) diff --git a/tests/unit/check-qom-proplist.c b/tests/unit/check-qom-proplis= t.c index 89de92b7d91f..69155e720751 100644 --- a/tests/unit/check-qom-proplist.c +++ b/tests/unit/check-qom-proplist.c @@ -108,22 +108,21 @@ static int dummy_get_av(Object *obj, } =20 =20 -static void dummy_set_sv(Object *obj, - const char *value, - Error **errp) +static void dummy_set_sv(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { DummyObject *dobj =3D DUMMY_OBJECT(obj); =20 - g_free(dobj->sv); - dobj->sv =3D g_strdup(value); + g_clear_pointer(&dobj->sv, g_free); + visit_type_str(v, name, &dobj->sv, errp); } =20 -static char *dummy_get_sv(Object *obj, - Error **errp) +static void dummy_get_sv(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { DummyObject *dobj =3D DUMMY_OBJECT(obj); =20 - return g_strdup(dobj->sv); + visit_type_str(v, name, &dobj->sv, errp); } =20 =20 @@ -135,16 +134,28 @@ static void dummy_init(Object *obj) } =20 =20 +static const QAPITypeInfo dummy_animal_qapi_type_info =3D { + .name =3D "DummyAnimal", + .masked_name =3D "DummyAnimalSchema", + .lookup =3D &dummy_animal_map, +}; + +static const QAPITypeInfo dummy_str_qapi_type_info =3D { + .name =3D "str", + .masked_name =3D "StrSchema", +}; + static void dummy_class_init(ObjectClass *cls, const void *data) { - object_class_property_add_str(cls, "sv", - dummy_get_sv, - dummy_set_sv); - object_class_property_add_enum(cls, "av", - "DummyAnimal", - &dummy_animal_map, - dummy_get_av, - dummy_set_av); + object_class_property_add_qapi(cls, "sv", &dummy_str_qapi_type_info, + dummy_get_sv, dummy_set_sv, + NULL, NULL); + object_class_property_add_qapi_enum(cls, QAPI_ENUM_PROP( + .name =3D "av", + .qapi_type =3D &dummy_animal_qapi_type_info, + .get =3D dummy_get_av, + .set =3D dummy_set_av, + )); } =20 =20 @@ -703,6 +714,54 @@ static void test_qom_partial_path(void) object_unparent(cont1); } =20 +static void test_dummy_qapi_enum(void) +{ + ObjectProperty *prop; + Object *parent =3D object_get_objects_root(); + DummyObject *dobj =3D DUMMY_OBJECT( + object_new_with_props(TYPE_DUMMY, + parent, + "dummy0", + &error_abort, + "av", "platypus", + NULL)); + + g_assert(dobj->av =3D=3D DUMMY_PLATYPUS); + + prop =3D object_property_find(OBJECT(dobj), "av"); + g_assert(prop); + g_assert(prop->qapi_type =3D=3D &dummy_animal_qapi_type_info); + g_assert_cmpstr(prop->qapi_type->name, =3D=3D, "DummyAnimal"); + g_assert_cmpstr(prop->qapi_type->masked_name, =3D=3D, "DummyAnimalSche= ma"); + g_assert(prop->qapi_type->lookup =3D=3D &dummy_animal_map); + + object_unparent(OBJECT(dobj)); +} + +static void test_dummy_qapi_prop(void) +{ + ObjectProperty *prop; + Object *parent =3D object_get_objects_root(); + DummyObject *dobj =3D DUMMY_OBJECT( + object_new_with_props(TYPE_DUMMY, + parent, + "dummy0", + &error_abort, + "sv", "hello", + NULL)); + + g_assert_cmpstr(dobj->sv, =3D=3D, "hello"); + + prop =3D object_property_find(OBJECT(dobj), "sv"); + g_assert(prop); + g_assert(prop->qapi_type =3D=3D &dummy_str_qapi_type_info); + g_assert_cmpstr(prop->qapi_type->name, =3D=3D, "str"); + g_assert_cmpstr(prop->qapi_type->masked_name, =3D=3D, "StrSchema"); + g_assert(prop->qapi_type->lookup =3D=3D NULL); + + object_unparent(OBJECT(dobj)); +} + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); @@ -727,6 +786,8 @@ int main(int argc, char **argv) g_test_add_func("/qom/proplist/iterator", test_dummy_iterator); g_test_add_func("/qom/proplist/class_iterator", test_dummy_class_itera= tor); g_test_add_func("/qom/proplist/delchild", test_dummy_delchild); + g_test_add_func("/qom/proplist/qapi_enum", test_dummy_qapi_enum); + g_test_add_func("/qom/proplist/qapi_prop", test_dummy_qapi_prop); g_test_add_func("/qom/resolve/partial", test_qom_partial_path); =20 return g_test_run(); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144728; cv=none; d=zohomail.com; s=zohoarc; b=iyWn/AR0tPHp59wigllMK29aeO9iyq6DUIzUv8DRZE1VJXvRKLtFTu5hYMgktRc3F2i5d5hO8syl6wW//Wk7vlbNdyQN2/GKoZIZujgPQqGV/bQZOEgOxKTs2Nu3TPRo5npn1aYuN7ZXYVBfHXr/xLpWt2FBrkFSD3rHzOnUr+M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144728; h=Content-Type: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=WC0Wm5us0KyPDyOA2aYgOaslfhOUTH1hwYCv02iPcyA=; b=XO7H7WXRTUu6mQK5uyqO9Yms7/uPHQ4vkgEVN/XpvouH7OhhFm3z6or0CY5TFACkOW1jMwOFPO2eaJp8R6QHcGL4Lpo8zIcnlqI7gs29Ig87+Le2eEMEI0TF6GBVn2zk3e3vL3hvOH1yJ0Tw3sqLbm1q0JvI/O364dCwL8aEhFQ= 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 1789144728491869.547901600629; Fri, 11 Sep 2026 09:38:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Go-0007ZH-0i; Fri, 11 Sep 2026 12:38:34 -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 1x54Gk-0007Dd-RS for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:31 -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 1x54Gi-0006R2-3L for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:30 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-569-OiWitY_qOAOKT84Mek3bYQ-1; Fri, 11 Sep 2026 12:38:23 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6E11719344FF; Fri, 11 Sep 2026 16:38:21 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3E13D180029C; Fri, 11 Sep 2026 16:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144707; 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=WC0Wm5us0KyPDyOA2aYgOaslfhOUTH1hwYCv02iPcyA=; b=ZXBIBKLi5mi9tGMKUsGcXkypNBHV1Z1ZBHWPuJ+/vt3ZAg5A6XoomUHUeRxSM0jz3ktRU7 ugWoyVbbwlqbP1uj0cNb450m3SrwgWKyRsMFxEHo8xx6HgvmwXnUNzdJGnwcYwHgRvJ6cE 1sXf5PlcJH/Pdu3rkLmD/OSJ+CJaZKU= X-MC-Unique: OiWitY_qOAOKT84Mek3bYQ-1 X-Mimecast-MFC-AGG-ID: OiWitY_qOAOKT84Mek3bYQ_1789144702 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:49 +0400 Subject: [PATCH v5 15/62] qom: convert enum properties to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-15-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Hildenbrand , Igor Mammedov , "Michael S. Tsirkin" , Richard Henderson , "Edgar E. Iglesias" , Jason Wang , Marcelo Tosatti , kvm@vger.kernel.org X-Developer-Signature: v=1; a=openpgp-sha256; l=19408; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=TFv4IyodekvZn3DOiB0DTGWMS1k5F/tECObImm04HFk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC23nZSwNf8asBMF9M8O1oyi4kuzfCm3aCFRt NtdzNiguk+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttwAKCRDa6OEJdZac 5eLLD/9mcW3TdjeP4mQiebE3i9DzdaV8fMd6ZgdSMZ3JF6adQsjy4qKwMdk4WmuD3OzC54KrVbj aMuwvNXrU6z4UVPx3noVXRQlTgVd0OOKP1kYV3nvjHyzhwdrXDiCkeaoQ+FOMy9frCSEVEMzpFG 0Wc3U5A/dzVNLA4KfTK7xNte2pkItvWZSm2NaQN0iWmCFpBUyMr86yLetaY+AmZQ971eJ4uQI/0 NpsTw44TKVJB//pN4Fiw2OLvCcUnsjbE5iWehLFineTnq/2sWL27QnmJVPuRRfKJ3Q5byMTperu CtEcI272hh79/9oDJ55pEgutas6F1FoJ5XfOuKZJqiB5U8DTy7cDBRWHBO3IxJ5UdIHHbyKSOsX wjZUxVklZKA4gszrvtr83DDYf45gqu8SZy5JHnqaGIQgayxANcrz1T8kdFkvceEoqG504MPGxKj FoTm1z7czfHMfLbSF9ic02oRh75izGvd2JqZvd9NI68aM2qLK+rTmKesYgjmNio1QbBMYgkSD7W tP3kkJlHO91Q37RpCbnLB3eN1Aoy6Rbwu+VxWmcbqpYL+5akV/XgKSLp67W8JE1aYXF3lUgjjHK wXlasIf9luN+QhtPVkSlN9pCSiAbKL6uePljd3JjFgv+2BMWZaCN2YmiTe4fJKirKIYxKiTRyf1 rMYOwGn0UVistZg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144730132158500 Convert all callers of object_class_property_add_enum() to use the new object_class_property_add_qapi_enum() with the QAPI_ENUM_PROP() macro, which provides type information via QAPITypeInfo instead of raw lookup tables and string type names. This enables QMP introspection to report accurate QAPI type names for enum properties. Where a separate set_description call was used, the description is now embedded in the QAPI_ENUM_PROP initializer. Signed-off-by: Marc-Andr=C3=A9 Lureau --- authz/list.c | 12 +++++++----- backends/hostmem.c | 14 ++++++++------ crypto/secret_common.c | 12 +++++++----- crypto/tlscreds.c | 12 +++++++----- hw/i386/pc_piix.c | 18 ++++++++++++------ hw/microblaze/petalogix_s3adsp1800_mmu.c | 19 +++++++++++-------- include/chardev/char.h | 8 -------- monitor/qmp.c | 12 +++++++----- net/filter.c | 10 +++++++--- target/i386/kvm/kvm.c | 30 +++++++++++++++++-----------= -- ui/console-vc.c | 8 +++++++- ui/dbus.c | 18 ++++++++++++++---- ui/input-linux.c | 11 +++++++---- 13 files changed, 111 insertions(+), 73 deletions(-) diff --git a/authz/list.c b/authz/list.c index 17aa0efd80e8..363b2ee12c98 100644 --- a/authz/list.c +++ b/authz/list.c @@ -22,6 +22,7 @@ #include "authz/list.h" #include "trace.h" #include "qom/object_interfaces.h" +#include "qapi/qapi-type-infos-authz.h" #include "qapi/qapi-visit-authz.h" #include "qemu/module.h" =20 @@ -120,11 +121,12 @@ qauthz_list_class_init(ObjectClass *oc, const void *d= ata) { QAuthZClass *authz =3D QAUTHZ_CLASS(oc); =20 - object_class_property_add_enum(oc, "policy", - "QAuthZListPolicy", - &QAuthZListPolicy_lookup, - qauthz_list_prop_get_policy, - qauthz_list_prop_set_policy); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "policy", + .qapi_type =3D &QAuthZListPolicy_type_info, + .get =3D qauthz_list_prop_get_policy, + .set =3D qauthz_list_prop_set_policy, + )); =20 object_class_property_add(oc, "rules", "QAuthZListRule", qauthz_list_prop_get_rules, diff --git a/backends/hostmem.c b/backends/hostmem.c index 02846b597d31..e7f9b436a459 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -16,6 +16,7 @@ #include "hw/core/boards.h" #include "qapi/error.h" #include "qapi/qapi-builtin-visit.h" +#include "qapi/qapi-type-infos-common.h" #include "qapi/visitor.h" #include "qemu/config-file.h" #include "qom/compat-properties.h" @@ -551,12 +552,13 @@ host_memory_backend_class_init(ObjectClass *oc, const= void *data) NULL, NULL); object_class_property_set_description(oc, "host-nodes", "Binds memory to the list of NUMA host nodes"); - object_class_property_add_enum(oc, "policy", "HostMemPolicy", - &HostMemPolicy_lookup, - host_memory_backend_get_policy, - host_memory_backend_set_policy); - object_class_property_set_description(oc, "policy", - "Set the NUMA policy"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "policy", + .description =3D "Set the NUMA policy", + .qapi_type =3D &HostMemPolicy_type_info, + .get =3D host_memory_backend_get_policy, + .set =3D host_memory_backend_set_policy, + )); object_class_property_add_bool(oc, "share", host_memory_backend_get_share, host_memory_backend_set_share); object_class_property_set_description(oc, "share", diff --git a/crypto/secret_common.c b/crypto/secret_common.c index a5ecb876aeba..381d23ecc8e0 100644 --- a/crypto/secret_common.c +++ b/crypto/secret_common.c @@ -22,6 +22,7 @@ #include "crypto/secret_common.h" #include "crypto/cipher.h" #include "qapi/error.h" +#include "qapi/qapi-type-infos-crypto.h" #include "qom/object_interfaces.h" #include "qemu/base64.h" #include "qemu/module.h" @@ -269,11 +270,12 @@ qcrypto_secret_class_init(ObjectClass *oc, const void= *data) =20 ucc->complete =3D qcrypto_secret_complete; =20 - object_class_property_add_enum(oc, "format", - "QCryptoSecretFormat", - &QCryptoSecretFormat_lookup, - qcrypto_secret_prop_get_format, - qcrypto_secret_prop_set_format); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "format", + .qapi_type =3D &QCryptoSecretFormat_type_info, + .get =3D qcrypto_secret_prop_get_format, + .set =3D qcrypto_secret_prop_set_format, + )); object_class_property_add_str(oc, "keyid", qcrypto_secret_prop_get_keyid, qcrypto_secret_prop_set_keyid); diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c index fb09e295a65c..54859720bf74 100644 --- a/crypto/tlscreds.c +++ b/crypto/tlscreds.c @@ -20,6 +20,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-type-infos-crypto.h" #include "qapi-types-crypto.h" #include "qemu/module.h" #include "qemu/error-report.h" @@ -221,11 +222,12 @@ qcrypto_tls_creds_class_init(ObjectClass *oc, const v= oid *data) object_class_property_add_str(oc, "dir", qcrypto_tls_creds_prop_get_dir, qcrypto_tls_creds_prop_set_dir); - object_class_property_add_enum(oc, "endpoint", - "QCryptoTLSCredsEndpoint", - &QCryptoTLSCredsEndpoint_lookup, - qcrypto_tls_creds_prop_get_endpoint, - qcrypto_tls_creds_prop_set_endpoint); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "endpoint", + .qapi_type =3D &QCryptoTLSCredsEndpoint_type_info, + .get =3D qcrypto_tls_creds_prop_get_endpoint, + .set =3D qcrypto_tls_creds_prop_set_endpoint, + )); object_class_property_add_str(oc, "priority", qcrypto_tls_creds_prop_get_priority, qcrypto_tls_creds_prop_set_priority); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index a929cc4decd6..dac2bee88a2e 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -336,6 +336,11 @@ static const QEnumLookup PCSouthBridgeOption_lookup = =3D { .size =3D PC_SOUTH_BRIDGE_OPTION_MAX }; =20 +static const QAPITypeInfo PCSouthBridgeOption_type_info =3D { + .name =3D "PCSouthBridgeOption", + .lookup =3D &PCSouthBridgeOption_lookup, +}; + static int pc_get_south_bridge(Object *obj, Error **errp) { PCMachineState *pcms =3D PC_MACHINE(obj); @@ -418,12 +423,13 @@ static void pc_i440fx_machine_options(MachineClass *m) machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE); machine_class_allow_dynamic_sysbus_dev(m, TYPE_UEFI_VARS_X64); =20 - object_class_property_add_enum(oc, "x-south-bridge", "PCSouthBridgeOpt= ion", - &PCSouthBridgeOption_lookup, - pc_get_south_bridge, - pc_set_south_bridge); - object_class_property_set_description(oc, "x-south-bridge", - "Use a different south bridge than PI= IX3"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "x-south-bridge", + .description =3D "Use a different south bridge than PIIX3", + .qapi_type =3D &PCSouthBridgeOption_type_info, + .get =3D pc_get_south_bridge, + .set =3D pc_set_south_bridge, + )); compat_props_add(m->compat_props, pc_piix_compat_defaults, pc_piix_compat_defaults_len); } diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petal= ogix_s3adsp1800_mmu.c index c5f64319009b..9a8fcc667812 100644 --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c @@ -27,6 +27,7 @@ #include "qemu/target-info.h" #include "qemu/units.h" #include "qapi/error.h" +#include "qapi/qapi-type-infos-common.h" #include "target/microblaze/cpu.h" #include "hw/core/sysbus.h" #include "net/net.h" @@ -174,14 +175,16 @@ static void petalogix_s3adsp1800_machine_class_init(O= bjectClass *oc, mc->init =3D petalogix_s3adsp1800_init; mc->is_default =3D true; =20 - prop =3D object_class_property_add_enum(oc, "endianness", "EndianMode", - &EndianMode_lookup, - machine_get_endianness, - machine_set_endianness); - object_property_set_default_str(prop, target_big_endian() ? "big" - : "little"); - object_class_property_set_description(oc, "endianness", - "Defines whether the machine runs in big or little endian mode= "); + prop =3D object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "endianness", + .description =3D + "Defines whether the machine runs in big or little endian mode= ", + .qapi_type =3D &EndianMode_type_info, + .get =3D machine_get_endianness, + .set =3D machine_set_endianness, + )); + object_property_set_default_enum(prop, + target_big_endian() ? ENDIAN_MODE_BIG : ENDIAN_MODE_LITTLE); } =20 static const TypeInfo petalogix_s3adsp1800_machine_types[] =3D { diff --git a/include/chardev/char.h b/include/chardev/char.h index 7377d8e60a08..f5e53b3867a3 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -343,12 +343,4 @@ static void set_encoding(Object *obj, int value, Error= **errp) \ cast_func(obj)->encoding =3D value; \ } =20 -static inline void chardev_vc_add_encoding_prop(ObjectClass *oc, - int (*get)(Object *, Error **), - void (*set)(Object *, int, Error **)) -{ - object_class_property_add_enum(oc, "encoding", "ChardevVCEncoding", - &ChardevVCEncoding_lookup, get, set); -} - #endif diff --git a/monitor/qmp.c b/monitor/qmp.c index aec03157750c..728a58bfd5e9 100644 --- a/monitor/qmp.c +++ b/monitor/qmp.c @@ -30,6 +30,7 @@ #include "qapi/error.h" #include "qapi/qapi-commands-control.h" #include "qapi/qapi-commands-char.h" +#include "qapi/qapi-type-infos-qom.h" #include "qobject/qdict.h" #include "qobject/qjson.h" #include "qobject/qlist.h" @@ -133,11 +134,12 @@ static void monitor_qmp_class_init(ObjectClass *cls, = const void *data) object_class_property_add_bool(cls, "pretty", monitor_qmp_get_pretty, monitor_qmp_set_pretty); - object_class_property_add_enum(cls, "close-action", - "MonitorQMPCloseAction", - &MonitorQMPCloseAction_lookup, - monitor_qmp_get_close_action, - monitor_qmp_set_close_action); + object_class_property_add_qapi_enum(cls, QAPI_ENUM_PROP( + .name =3D "close-action", + .qapi_type =3D &MonitorQMPCloseAction_type_info, + .get =3D monitor_qmp_get_close_action, + .set =3D monitor_qmp_set_close_action, + )); =20 moncls->emit_event =3D monitor_qmp_emit_event; moncls->requires_iothread =3D monitor_qmp_requires_iothread; diff --git a/net/filter.c b/net/filter.c index 389f3b0bfefb..79883af22a54 100644 --- a/net/filter.c +++ b/net/filter.c @@ -8,6 +8,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-type-infos-common.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" =20 @@ -342,9 +343,12 @@ static void netfilter_class_init(ObjectClass *oc, cons= t void *data) =20 object_class_property_add_str(oc, "netdev", netfilter_get_netdev_id, netfilter_set_n= etdev_id); - object_class_property_add_enum(oc, "queue", "NetFilterDirection", - &NetFilterDirection_lookup, - netfilter_get_direction, netfilter_set_= direction); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "queue", + .qapi_type =3D &NetFilterDirection_type_info, + .get =3D netfilter_get_direction, + .set =3D netfilter_set_direction, + )); object_class_property_add_str(oc, "status", netfilter_get_status, netfilter_set_stat= us); object_class_property_add_str(oc, "position", diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 1eeadb99adac..9f65419a2c1a 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -14,6 +14,8 @@ =20 #include "qemu/osdep.h" #include "qapi/qapi-events-run-state.h" +#include "qapi/qapi-type-infos-common.h" +#include "qapi/qapi-type-infos-run-state.h" #include "qapi/error.h" #include "qapi/visitor.h" #include @@ -7089,12 +7091,13 @@ static void kvm_arch_set_honor_guest_pat(Object *ob= j, int value, Error **errp) =20 void kvm_arch_accel_class_init(ObjectClass *oc) { - object_class_property_add_enum(oc, "notify-vmexit", "NotifyVMexitOptio= n", - &NotifyVmexitOption_lookup, - kvm_arch_get_notify_vmexit, - kvm_arch_set_notify_vmexit); - object_class_property_set_description(oc, "notify-vmexit", - "Enable notify VM exit"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "notify-vmexit", + .description =3D "Enable notify VM exit", + .qapi_type =3D &NotifyVmexitOption_type_info, + .get =3D kvm_arch_get_notify_vmexit, + .set =3D kvm_arch_set_notify_vmexit, + )); =20 object_class_property_add(oc, "notify-window", "uint32", kvm_arch_get_notify_window, @@ -7127,13 +7130,14 @@ void kvm_arch_accel_class_init(ObjectClass *oc) object_class_property_set_description(oc, "xen-evtchn-max-pirq", "Maximum number of Xen PIRQs"); =20 - object_class_property_add_enum(oc, "honor-guest-pat", "OnOffAuto", - &OnOffAuto_lookup, - kvm_arch_get_honor_guest_pat, - kvm_arch_set_honor_guest_pat); - object_class_property_set_description(oc, "honor-guest-pat", - "Disable KVM quirk that ignores = guest PAT " - "memory type settings (default: = auto)"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "honor-guest-pat", + .description =3D "Disable KVM quirk that ignores guest PAT " + "memory type settings (default: auto)", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D kvm_arch_get_honor_guest_pat, + .set =3D kvm_arch_set_honor_guest_pat, + )); } =20 void kvm_set_max_apic_id(uint32_t max_apic_id) diff --git a/ui/console-vc.c b/ui/console-vc.c index 53d9e9d39b36..1e46eceeded2 100644 --- a/ui/console-vc.c +++ b/ui/console-vc.c @@ -6,6 +6,7 @@ =20 #include "chardev/char.h" #include "qapi/error.h" +#include "qapi/qapi-type-infos-char.h" #include "qemu/option.h" #include "qemu/queue.h" #include "qom/compat-properties.h" @@ -318,7 +319,12 @@ static void char_vc_class_init(ObjectClass *oc, const = void *data) cc->supports_size_opts =3D true; cc->supports_encoding_opts =3D true; =20 - chardev_vc_add_encoding_prop(oc, get_encoding, set_encoding); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "encoding", + .qapi_type =3D &ChardevVCEncoding_type_info, + .get =3D get_encoding, + .set =3D set_encoding, + )); } =20 static void char_vc_init(Object *obj) diff --git a/ui/dbus.c b/ui/dbus.c index 7be0f8e26119..afc321514c68 100644 --- a/ui/dbus.c +++ b/ui/dbus.c @@ -38,6 +38,8 @@ #include "qemu/audio.h" #include "audio/audio_int.h" /* FIXME: use QOM dynamic cast instead of drv= ->name */ #include "qapi/error.h" +#include "qapi/qapi-type-infos-char.h" +#include "qapi/qapi-type-infos-ui.h" #include "trace.h" =20 #include "dbus.h" @@ -508,9 +510,12 @@ dbus_display_class_init(ObjectClass *oc, const void *d= ata) object_class_property_add_bool(oc, "p2p", get_dbus_p2p, set_dbus_p2p); object_class_property_add_str(oc, "addr", get_dbus_addr, set_dbus_addr= ); object_class_property_add_str(oc, "audiodev", get_audiodev, set_audiod= ev); - object_class_property_add_enum(oc, "gl-mode", - "DisplayGLMode", &DisplayGLMode_lookup, - get_gl_mode, set_gl_mode); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "gl-mode", + .qapi_type =3D &DisplayGLMode_type_info, + .get =3D get_gl_mode, + .set =3D set_gl_mode, + )); } =20 #define TYPE_CHARDEV_VC "chardev-vc" @@ -602,7 +607,12 @@ dbus_vc_class_init(ObjectClass *oc, const void *data) cc->chr_open =3D dbus_vc_open; cc->supports_encoding_opts =3D true; =20 - chardev_vc_add_encoding_prop(oc, get_encoding, set_encoding); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "encoding", + .qapi_type =3D &ChardevVCEncoding_type_info, + .get =3D get_encoding, + .set =3D set_encoding, + )); } =20 static void diff --git a/ui/input-linux.c b/ui/input-linux.c index f4eee1ffd7ec..715d1f589297 100644 --- a/ui/input-linux.c +++ b/ui/input-linux.c @@ -6,6 +6,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-type-infos-common.h" #include "qemu/config-file.h" #include "qemu/main-loop.h" #include "qemu/module.h" @@ -506,10 +507,12 @@ static void input_linux_class_init(ObjectClass *oc, c= onst void *data) object_class_property_add_bool(oc, "repeat", input_linux_get_repeat, input_linux_set_repeat); - object_class_property_add_enum(oc, "grab-toggle", "GrabToggleKeys", - &GrabToggleKeys_lookup, - input_linux_get_grab_toggle, - input_linux_set_grab_toggle); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "grab-toggle", + .qapi_type =3D &GrabToggleKeys_type_info, + .get =3D input_linux_get_grab_toggle, + .set =3D input_linux_set_grab_toggle, + )); } =20 static const TypeInfo input_linux_info =3D { --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144722; cv=none; d=zohomail.com; s=zohoarc; b=hYLPVG+oOThgmoT6d1Ii8vIbDXid0rchf/HrFAFUtdvSf+jJQLj2/m8RooA8kb56L0IyL26vh/GwSMW+5hazTg2Vc7mK0Hn3xSZ9qXlrq/Kh4nYOW52okbJB69VYEOy0Hy2OEl/fRqfrL2fTUtZyvak3QogtdImPpU6rKbpD2uA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144722; h=Content-Type: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=girJTupFSeQuIQp5Q8w9m8sFCIToXcJFLfuB706GG7E=; b=RwDIgeufLVr42FCcYGuEAZiiQQpx2otuZCYFP6o5/VzIDXIi+x/puKB1sODDG3FNstBMZZhKN3tQgMxEivLoBZFrcGEzEpjEy4XnYc1eMGCooS2wbpMLZp3wdR6qBQBvivTx+JYFiG78UWyZWAroTH93WpFUkONLfuQ29+DiyFQ= 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 1789144722400727.5764822760624; Fri, 11 Sep 2026 09:38:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Gq-0007w5-7Y; Fri, 11 Sep 2026 12:38:36 -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 1x54Gm-0007S7-AL for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:32 -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 1x54Gk-0006RY-4T for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:32 -0400 Received: from mx-prod-mc-08.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-468-byi2ymW_MYqk5gXI4gYRhg-1; Fri, 11 Sep 2026 12:38:26 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 09F79180136D; Fri, 11 Sep 2026 16:38:25 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0E872195608F; Fri, 11 Sep 2026 16:38:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144709; 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=girJTupFSeQuIQp5Q8w9m8sFCIToXcJFLfuB706GG7E=; b=LSpRSTZFZhwN8Razb2upcZ4844wpth5zs/LWW6SDxWlzyEOJ+JQN5dnMFQ0gOMZ6cF9iCh Fx/Zy/Do5OteOdA6/pnlcQNe3yaBjSGFCKR11axRkSoB8dCo3qTok3a00kOD5eP11FDE0E /iOv0dmHCjpGVwF55gjoKVF593SUmq0= X-MC-Unique: byi2ymW_MYqk5gXI4gYRhg-1 X-Mimecast-MFC-AGG-ID: byi2ymW_MYqk5gXI4gYRhg_1789144705 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:50 +0400 Subject: [PATCH v5 16/62] qom: remove old enum property registration API MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-16-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=7293; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=u/jtz0VEJPO7qFKfQaHWT67kjziwn5hqQAMBuiinxLc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC235NXrVI5PFtuw3fyzZHuoBD+xNcmd7gRmN HjtMdkouhKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttwAKCRDa6OEJdZac 5WhCD/9laL7Zsu0rOfdc4C3/AeTKE/BIONjPzdtIgh5WGY0Jf7atKmgxuTuquSIGjP+UO5htxFN cS9Pyezk53fMiiQm9srUBAccsHBdWYy9EFWJH++Ful72LXmhOx156A/jNvd5puVX6Znp6M9hGti UpiapstNL5gyDO+sRWL+hY+oZLBtjAkHeXlzX/OE47nr/I3L8EMRsJu/yCLbAcOfc9iDC9ve2d0 YBsNMVP5ECkIo0eoL9BOXswkQ0Dx9zQgk99wyrmSLVN5THMFiULDtnfRuox6ThLLd899NnW+8o3 xTGd7PgxzToyrExnUfkRrpwTfhEcjs1MvHGzgonK3dJbd+I8eQPJ9YnFpdwsRgQfdv4/iDwR3u3 o0Zy2BfWHK1wGZ0AP6KrfatLOzTcw/+1L2q8C2iudOizfzFbarhGZwis/FVkiXtHFGlh/nZ1ike K7jIA+zS/s074M9SFg9mk0bUY9bUkU9KjyBSXum4UCkOATteL3Oh111ogvq5nQ4IFWzPdVQJx2Z U6d8Fk1nKQMlnUtYdtbCWVgHeyzS/62Yc801lP9agEBzUP2/wAdDZFeFKC2lcDxo830+NhHnVNh Z6m44WSMGEotPFXt16rKpOqjALfQEekWSffuIld9tQsluGezDZKq4ViKbW7N/dlyaQtOkM4Nrc3 5i2UdH3jr2BuW3g== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=marcandre.lureau@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, 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: 1789144724040158500 Now that all callers use object_class_property_add_qapi_enum(), remove the legacy object_property_add_enum() and object_class_property_add_enum() functions along with their EnumProperty struct and property_get_enum / property_set_enum helpers. Simplify object_property_get_enum() to assert on qapi_type rather than falling back to the old EnumProperty opaque data. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/qom/object.h | 45 ++-------------------------- qom/object.c | 82 ++----------------------------------------------= ---- 2 files changed, 4 insertions(+), 123 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index c9a5fe4934d0..6d84bbb25bb5 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1663,12 +1663,12 @@ char *object_get_canonical_path(const Object *obj); * because it was ambiguous, or %NULL. Set to %false on success. * * There are two types of supported paths--absolute paths and partial path= s. - *=20 + * * Absolute paths are derived from the root object and can follow child<> = or * link<> properties. Since they can follow link<> properties, they can be * arbitrarily long. Absolute paths look like absolute filenames and are * prefixed with a leading slash. - *=20 + * * Partial paths look like relative filenames. They do not begin with a * prefix. The matching rules for partial paths are subtle but designed t= o make * specifying objects easy. At each level of the composition tree, the pa= rtial @@ -1952,47 +1952,6 @@ ObjectProperty *object_class_property_add_bool(Objec= tClass *klass, bool (*get)(Object *, Error **), void (*set)(Object *, bool, Error **)); =20 -/** - * object_property_add_enum: - * @obj: the object to add a property to - * @name: the name of the property - * @typename: the name of the enum data type - * @lookup: enum value namelookup table - * @get: the getter or %NULL if the property is write-only. - * @set: the setter or %NULL if the property is read-only - * - * Add an enum property using getters/setters. This function will add a - * property of type '@typename'. - * - * Returns: The newly added property on success, or %NULL on failure. - */ -ObjectProperty *object_property_add_enum(Object *obj, const char *name, - const char *typename, - const QEnumLookup *lookup, - int (*get)(Object *, Error **), - void (*set)(Object *, int, Error **)); - -/** - * object_class_property_add_enum: - * @klass: the object class to add a property to - * @name: the name of the property - * @typename: the name of the enum data type - * @lookup: enum value namelookup table - * @get: the getter or %NULL if the property is write-only. - * @set: the setter or %NULL if the property is read-only - * - * Add an enum property using getters/setters. This function will add a - * property of type '@typename'. - * - * Returns: The newly added property on success, or %NULL on failure. - */ -ObjectProperty *object_class_property_add_enum(ObjectClass *klass, - const char *name, - const char *typename, - const QEnumLookup *lookup, - int (*get)(Object *, Error **), - void (*set)(Object *, int, Error **)); - /** * struct QapiEnumProp - Descriptor for a QOM property backed by a QAPI en= um type * diff --git a/qom/object.c b/qom/object.c index 2d3bd2ae327d..8e6ca25dc49d 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1764,12 +1764,6 @@ uint64_t object_property_get_uint(Object *obj, const= char *name, return retval; } =20 -typedef struct EnumProperty { - const QEnumLookup *lookup; - int (*get)(Object *, Error **); - void (*set)(Object *, int, Error **); -} EnumProperty; - int object_property_get_enum(Object *obj, const char *name, const char *typename, Error **errp) { @@ -1793,12 +1787,8 @@ int object_property_get_enum(Object *obj, const char= *name, return -1; } =20 - if (prop->qapi_type) { - ret =3D qapi_enum_parse(prop->qapi_type->lookup, str, -1, errp); - } else { - EnumProperty *enumprop =3D prop->opaque; - ret =3D qapi_enum_parse(enumprop->lookup, str, -1, errp); - } + assert(prop->qapi_type); + ret =3D qapi_enum_parse(prop->qapi_type->lookup, str, -1, errp); g_free(str); =20 return ret; @@ -2533,74 +2523,6 @@ object_class_property_add_bool(ObjectClass *klass, c= onst char *name, prop); } =20 -static void property_get_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - EnumProperty *prop =3D opaque; - int value; - Error *err =3D NULL; - - value =3D prop->get(obj, &err); - if (err) { - error_propagate(errp, err); - return; - } - - visit_type_enum(v, name, &value, prop->lookup, errp); -} - -static void property_set_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - EnumProperty *prop =3D opaque; - int value; - - if (!visit_type_enum(v, name, &value, prop->lookup, errp)) { - return; - } - prop->set(obj, value, errp); -} - -ObjectProperty * -object_property_add_enum(Object *obj, const char *name, - const char *typename, - const QEnumLookup *lookup, - int (*get)(Object *, Error **), - void (*set)(Object *, int, Error **)) -{ - EnumProperty *prop =3D g_malloc(sizeof(*prop)); - - prop->lookup =3D lookup; - prop->get =3D get; - prop->set =3D set; - - return object_property_add(obj, name, typename, - get ? property_get_enum : NULL, - set ? property_set_enum : NULL, - property_release_data, - prop); -} - -ObjectProperty * -object_class_property_add_enum(ObjectClass *klass, const char *name, - const char *typename, - const QEnumLookup *lookup, - int (*get)(Object *, Error **), - void (*set)(Object *, int, Error **)) -{ - EnumProperty *prop =3D g_malloc(sizeof(*prop)); - - prop->lookup =3D lookup; - prop->get =3D get; - prop->set =3D set; - - return object_class_property_add(klass, name, typename, - get ? property_get_enum : NULL, - set ? property_set_enum : NULL, - NULL, - prop); -} - static void get_qapi_enum(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144743; cv=none; d=zohomail.com; s=zohoarc; b=J/biK/X2P2asSDGz/+zXiTS5y5b3B2E5QRWxyCUV33aodcJeBHvyK7kpLKDfvpBBCAeS4fGJTgBMRijsmyVmBMEIScbWWU/Nl5YAsssd7iQ06MQUn0gn7jyIq1BBqH0s1hf8mEpSmmpawHYAP6QOQg3hOLDp9KQl9AUzKVZr8uo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144743; h=Content-Type: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=mtwSICJg9+cDAEasG3vzdTmKCwdrbuwjVE9MBQQeXTA=; b=mfa4kFjHHuS4srUx5xc/kroVu2Xunh1uwGUdBVz56vuG4c89kYoongPWGoqbNMExlq45vA/q+F5LOai76+2L+fhVLCRwx8c+cGmv0mYavmVQDoDC3+bFPKRGjcAXp9qq8pAJZZa1rxbkqtiYWYHtGtMWzsdGdYeO8vro+KTljKo= 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 1789144743533975.0583336243448; Fri, 11 Sep 2026 09:39:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54H1-0001B5-KP; Fri, 11 Sep 2026 12:38:47 -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 1x54Gz-0000rz-6w for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:45 -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 1x54Gt-0006TY-6T for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:44 -0400 Received: from mx-prod-mc-08.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-106-chq4FmQJM22kX0IIjtzvmw-1; Fri, 11 Sep 2026 12:38:33 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 76EBE1801370; Fri, 11 Sep 2026 16:38:29 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 743F1195608F; Fri, 11 Sep 2026 16:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144718; 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=mtwSICJg9+cDAEasG3vzdTmKCwdrbuwjVE9MBQQeXTA=; b=CXKfp0ewVE6SMAcQufLtQuqdxicAFaC/USd0KpdnDN67KKhQnCrwTcdwXs+8uOauj4trXt nf98bnHResgEQRSS0fvvt8ebUksV2gqmYwx7r6bhUs4l3TjGo9fSQnboVCYmlea8+KM9CH PaOaux7ruY2UdKV+o4Aj/jPNov419cA= X-MC-Unique: chq4FmQJM22kX0IIjtzvmw-1 X-Mimecast-MFC-AGG-ID: chq4FmQJM22kX0IIjtzvmw_1789144709 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:51 +0400 Subject: [PATCH v5 17/62] qom: convert struct properties to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-17-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alberto Garcia , Kevin Wolf , Hanna Reitz , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Zhao Liu , Jonathan Cameron , Elena Ufimtseva , Jagannathan Raman , John Levon , Thanos Makatos , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Marcelo Tosatti , Richard Henderson , Ilya Leoshkevich , David Hildenbrand , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-block@nongnu.org, linux-cxl@vger.kernel.org, kvm@vger.kernel.org, qemu-s390x@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=12033; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=zDs3mYA1CjjAKW6DXXZ4BUSALxYOReSAAgRmYspCM9U=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC234H9LEM68cOkj8j3h0ZtizEeGZuEJOUO+C cF/qcAjFrCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQttwAKCRDa6OEJdZac 5T0AD/9pRcXSt22YICNBu9hG9zHDpB62cFFSpLG+v4D5NnIiWAxyUXHCFpus4WhwEgxfonbsTJI M8tnT4RWe2kd8rfZRJmznrju+QKNufOhrh1v1VnjH9YlmwOhrP+JuIQnsmFw2F/KhVvbmPb7Wjp RXaMN7kKL4FmTHSc/2St+TzMND2qabiIz4sgdGrbu1kj4p5mZTyWSc57wfkI2Mn6H7seFnN/Njb xRUKiETvbuGndzQC10eKbvfdBivak5+A/QWIV9F8SMvZhddiMi91yfG68wnJg6DJwWWEtg3ioo1 s7XB71+JlXk7XrCf6KajCRbDSCsyydXmcJGCgGqVRd19Aa1u3G6mZXzXj2UQbHqLpB4HceC284q P5lQq7e7+H6KJ9F4y/0XygEgZ2w6ujilRCb208/Wd/tHNh5OaUK+E/Mv9l9Qcf/qb+XLDipEfTg dy4zGxYIoe9LMGAwO/Ea6KfaIT0hjDnkAn51ACbGBVsZqQgHFsikd9hSUoGCBVb+X5mACTOxwcS rBuWuyU4bhfUhie9JRBQZ1HevC4gVyMaO5sMBa0UgVrK7lr+CQZUu//GmuJzn+4MkXeRwkl0v0j fZJn4QHlFefZBbfats+zp0KUgKgkjjJ2rXahu9B0/d6ET+u9fQhLoEJpdxNJfEy659xB95AFbhi 1xwPf35vhDrj6lg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=marcandre.lureau@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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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: 1789144744472158500 Convert all callers of object_property_add() and object_class_property_add() that register struct-typed properties with QAPI visitor-based getters/setters to use object_property_add_qapi() and object_class_property_add_qapi() instead. This replaces the manual string type name with a reference to the generated QAPITypeInfo constant, enabling QMP introspection to report accurate QAPI type information for struct properties. Existing getters/setters are preserved unchanged. The cxl-fmw property type is corrected from "CXLFixedMemoryWindow" (not a real QAPI type) to "CXLFixedMemoryWindowOptions". Signed-off-by: Marc-Andr=C3=A9 Lureau --- authz/list.c | 2 +- block/throttle-groups.c | 5 +++-- chardev/char-socket.c | 3 ++- hw/core/machine.c | 11 +++++++---- hw/cxl/cxl-host.c | 4 +++- hw/remote/vfio-user-obj.c | 5 +++-- hw/vfio-user/pci.c | 5 +++-- target/i386/cpu.c | 11 ++++++++--- target/i386/kvm/tdx.c | 4 +++- target/s390x/cpu-system.c | 4 +++- 10 files changed, 36 insertions(+), 18 deletions(-) diff --git a/authz/list.c b/authz/list.c index 363b2ee12c98..ed3d346004c2 100644 --- a/authz/list.c +++ b/authz/list.c @@ -128,7 +128,7 @@ qauthz_list_class_init(ObjectClass *oc, const void *dat= a) .set =3D qauthz_list_prop_set_policy, )); =20 - object_class_property_add(oc, "rules", "QAuthZListRule", + object_class_property_add_qapi(oc, "rules", &QAuthZListRule_type_info, qauthz_list_prop_get_rules, qauthz_list_prop_set_rules, NULL, NULL); diff --git a/block/throttle-groups.c b/block/throttle-groups.c index 2dfd9d62aacd..6312157802da 100644 --- a/block/throttle-groups.c +++ b/block/throttle-groups.c @@ -31,6 +31,7 @@ #include "qemu/thread.h" #include "system/qtest.h" #include "qapi/error.h" +#include "qapi/qapi-type-infos-block-core.h" #include "qapi/qapi-visit-block-core.h" #include "qom/object.h" #include "qom/object_interfaces.h" @@ -991,8 +992,8 @@ static void throttle_group_obj_class_init(ObjectClass *= klass, } =20 /* ThrottleLimits */ - object_class_property_add(klass, - "limits", "ThrottleLimits", + object_class_property_add_qapi(klass, + "limits", &ThrottleLimits_type_info, throttle_group_get_limits, throttle_group_set_limits, NULL, NULL); diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 81bac42a1587..8e0e5d4343aa 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -31,6 +31,7 @@ #include "qemu/option.h" #include "qapi/error.h" #include "qapi/clone-visitor.h" +#include "qapi/qapi-type-infos-sockets.h" #include "qapi/qapi-visit-sockets.h" #include "qemu/yank.h" #include "trace.h" @@ -1568,7 +1569,7 @@ static void char_socket_class_init(ObjectClass *oc, c= onst void *data) cc->chr_listener_cleanup =3D tcp_chr_listener_cleanup; cc->chr_get_filename =3D tcp_chr_get_filename; =20 - object_class_property_add(oc, "addr", "SocketAddress", + object_class_property_add_qapi(oc, "addr", &SocketAddress_type_info, char_socket_get_addr, NULL, NULL, NULL); =20 diff --git a/hw/core/machine.c b/hw/core/machine.c index 8939ae16666c..530fbaeb0b28 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -18,6 +18,7 @@ #include "hw/core/loader.h" #include "qemu/error-report.h" #include "qapi/error.h" +#include "qapi/qapi-type-infos-machine.h" #include "qapi/qapi-visit-machine.h" #include "qapi/qapi-commands-machine.h" #include "qemu/madvise.h" @@ -1114,19 +1115,20 @@ static void machine_class_init(ObjectClass *oc, con= st void *data) object_class_property_set_description(oc, "dumpdtb", "Dump current dtb to a file and quit"); =20 - object_class_property_add(oc, "boot", "BootConfiguration", + object_class_property_add_qapi(oc, "boot", &BootConfiguration_type_inf= o, machine_get_boot, machine_set_boot, NULL, NULL); object_class_property_set_description(oc, "boot", "Boot configuration"); =20 - object_class_property_add(oc, "smp", "SMPConfiguration", + object_class_property_add_qapi(oc, "smp", &SMPConfiguration_type_info, machine_get_smp, machine_set_smp, NULL, NULL); object_class_property_set_description(oc, "smp", "CPU topology"); =20 - object_class_property_add(oc, "smp-cache", "SmpCachePropertiesWrapper", + object_class_property_add_qapi(oc, "smp-cache", + &SmpCachePropertiesWrapper_type_info, machine_get_smp_cache, machine_set_smp_cache, NULL, NULL); object_class_property_set_description(oc, "smp-cache", "Cache properties list for SMP machine"); @@ -1208,7 +1210,8 @@ static void machine_class_init(ObjectClass *oc, const= void *data) "Set RAM backend" "Valid value is ID of hostmem ba= sed backend"); =20 - object_class_property_add(oc, "memory", "MemorySizeConfiguration", + object_class_property_add_qapi(oc, "memory", + &MemorySizeConfiguration_type_info, machine_get_mem, machine_set_mem, NULL, NULL); object_class_property_set_description(oc, "memory", diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c index eba13c9e7cba..7592c4ac6c7b 100644 --- a/hw/cxl/cxl-host.c +++ b/hw/cxl/cxl-host.c @@ -13,6 +13,7 @@ #include "system/qtest.h" #include "hw/core/boards.h" =20 +#include "qapi/qapi-type-infos-machine.h" #include "qapi/qapi-visit-machine.h" #include "hw/cxl/cxl.h" #include "hw/cxl/cxl_host.h" @@ -570,7 +571,8 @@ void cxl_machine_init(Object *obj, CXLState *state) "Set on/off to enable/disable " "CXL instantiation"); =20 - object_property_add(obj, "cxl-fmw", "CXLFixedMemoryWindow", + object_property_add_qapi(obj, "cxl-fmw", + &CXLFixedMemoryWindowOptions_type_info, machine_get_cfmw, machine_set_cfmw, NULL, state); object_property_set_description(obj, "cxl-fmw", diff --git a/hw/remote/vfio-user-obj.c b/hw/remote/vfio-user-obj.c index a0498d218faf..7e6819f670b5 100644 --- a/hw/remote/vfio-user-obj.c +++ b/hw/remote/vfio-user-obj.c @@ -47,6 +47,7 @@ #include "hw/core/boards.h" #include "hw/remote/machine.h" #include "qapi/error.h" +#include "qapi/qapi-type-infos-sockets.h" #include "qapi/qapi-visit-sockets.h" #include "qapi/qapi-events-misc.h" #include "qemu/notify.h" @@ -931,8 +932,8 @@ static void vfu_object_class_init(ObjectClass *klass, c= onst void *data) =20 k->nr_devs =3D 0; =20 - object_class_property_add(klass, "socket", "SocketAddress", NULL, - vfu_object_set_socket, NULL, NULL); + object_class_property_add_qapi(klass, "socket", &SocketAddress_type_in= fo, + NULL, vfu_object_set_socket, NULL, NULL); object_class_property_set_description(klass, "socket", "SocketAddress " "(ex: type=3Dunix,path=3D/tmp/so= ck). " diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c index e7573d4a9f08..246bd5a90925 100644 --- a/hw/vfio-user/pci.c +++ b/hw/vfio-user/pci.c @@ -8,6 +8,7 @@ =20 #include "qemu/osdep.h" #include +#include "qapi/qapi-type-infos-sockets.h" #include "qapi-visit-sockets.h" #include "qemu/error-report.h" =20 @@ -466,8 +467,8 @@ static void vfio_user_pci_class_init(ObjectClass *klass= , const void *data) device_class_set_legacy_reset(dc, vfio_user_pci_reset); device_class_set_props(dc, vfio_user_pci_properties); =20 - object_class_property_add(klass, "socket", "SocketAddress", NULL, - vfio_user_pci_set_socket, NULL, NULL); + object_class_property_add_qapi(klass, "socket", &SocketAddress_type_in= fo, + NULL, vfio_user_pci_set_socket, NULL, NULL); object_class_property_set_description(klass, "socket", "SocketAddress (UNIX sockets onl= y)"); =20 diff --git a/target/i386/cpu.c b/target/i386/cpu.c index b97f144aea5a..8650ff6caecc 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -35,6 +35,8 @@ #include "sev.h" #include "qapi/error.h" #include "qemu/error-report.h" +#include "qapi/qapi-type-infos-machine.h" +#include "qapi/qapi-type-infos-run-state.h" #include "qapi/qapi-visit-machine.h" #include "standard-headers/asm-x86/kvm_para.h" #include "hw/core/qdev-properties.h" @@ -10514,10 +10516,12 @@ static void x86_cpu_initfn(Object *obj) =20 x86_cpu_init_default_topo(cpu); =20 - object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo", + object_property_add_qapi(obj, "feature-words", + &X86CPUFeatureWordInfo_type_info, x86_cpu_get_feature_words, NULL, NULL, (void *)env->features); - object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo", + object_property_add_qapi(obj, "filtered-features", + &X86CPUFeatureWordInfo_type_info, x86_cpu_get_feature_words, NULL, NULL, (void *)cpu->filtered_features); =20 @@ -10980,7 +10984,8 @@ static void x86_cpu_common_class_init(ObjectClass *= oc, const void *data) NULL, NULL); =20 #if !defined(CONFIG_USER_ONLY) - object_class_property_add(oc, "crash-information", "GuestPanicInformat= ion", + object_class_property_add_qapi(oc, "crash-information", + &GuestPanicInformation_type_info, x86_cpu_get_crash_info_qom, NULL, NULL, NULL= ); #endif =20 diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c index 8294dbde3aa8..81c5ba3a1b54 100644 --- a/target/i386/kvm/tdx.c +++ b/target/i386/kvm/tdx.c @@ -14,6 +14,7 @@ #include "qemu/base64.h" #include "qemu/mmap-alloc.h" #include "qapi/error.h" +#include "qapi/qapi-type-infos-sockets.h" #include "qapi/qapi-visit-sockets.h" #include "qom/object_interfaces.h" #include "crypto/hash.h" @@ -1586,7 +1587,8 @@ static void tdx_guest_init(Object *obj) tdx_guest_get_mrownerconfig, tdx_guest_set_mrownerconfig); =20 - object_property_add(obj, "quote-generation-socket", "SocketAddress", + object_property_add_qapi(obj, "quote-generation-socket", + &SocketAddress_type_info, tdx_guest_get_qgs, tdx_guest_set_qgs, NULL, NULL); diff --git a/target/s390x/cpu-system.c b/target/s390x/cpu-system.c index cc9685221ae8..4c2a91d0ff51 100644 --- a/target/s390x/cpu-system.c +++ b/target/s390x/cpu-system.c @@ -30,6 +30,7 @@ #include "system/reset.h" #include "qemu/timer.h" #include "trace.h" +#include "qapi/qapi-type-infos-run-state.h" #include "qapi/qapi-visit-run-state.h" #include "system/hw_accel.h" =20 @@ -130,7 +131,8 @@ void s390_cpu_system_init(Object *obj) S390CPU *cpu =3D S390_CPU(obj); =20 cs->start_powered_off =3D true; - object_property_add(obj, "crash-information", "GuestPanicInformation", + object_property_add_qapi(obj, "crash-information", + &GuestPanicInformation_type_info, s390_cpu_get_crash_info_qom, NULL, NULL, NULL); cpu->env.tod_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_tod_timer, cpu); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144738; cv=none; d=zohomail.com; s=zohoarc; b=hGVwbekrcBpMBnj54EplFjzmmZfljoytrp37bG0pf3Y1ihjj2kkfYFSPZK2+iILR6wyBQhCO6Y4wkdM/Mvfas/GZfy/T827EoZV+jxAsI3nQhW01pgyXMLrBMazAalEr8wr8XqLCbmi2nEN7a+oZGGNln5g2SN+xRmZM/vl0l2U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144738; h=Content-Type: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=VscR/iIW0mIAkyA8JHrPI5JG+q0xz3TzuUhYEBv6Obk=; b=XshGtvf4JfheCG8DudmthHd33Lr0S3grjIDeCik6XR8SgbadRiylM+etoQ3quXLX5u/fyW9RWjYdtktIQMaQ7YC5+smL5xQT1AJT1R8NxoblCJ6wfoTlOy0zvQVCRo3b3VfaUYleTugmat+5uLXJ3VWS3jmiSzaq9VzWozXaiqA= 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 1789144738757239.4008850678755; Fri, 11 Sep 2026 09:38:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Gx-0000aw-2g; Fri, 11 Sep 2026 12:38: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 1x54Gu-0000NC-RN for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38: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 1x54Gs-0006TT-Ke for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:40 -0400 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-295-qcojQokdPtm0Y-7ohxqW0Q-1; Fri, 11 Sep 2026 12:38:34 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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 6075418009E6; Fri, 11 Sep 2026 16:38:33 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2BBDD433; Fri, 11 Sep 2026 16:38:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144717; 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=VscR/iIW0mIAkyA8JHrPI5JG+q0xz3TzuUhYEBv6Obk=; b=bWwX/8/Q/YatblxAnAYPtngluwvr+ihcd4HlCaQLJ1r1CEuWyTl48FfZW/yTwHlOgLcr92 VS7j+H0cxsrnJTiNedHiH2Fg76ziw3lupp5tuF3j0nE79TsZlhQsg2fYfX0YlKvD5Uz8OT FvvEod28JSQXp0ITYX0vIWE8Hf3Qpvo= X-MC-Unique: qcojQokdPtm0Y-7ohxqW0Q-1 X-Mimecast-MFC-AGG-ID: qcojQokdPtm0Y-7ohxqW0Q_1789144713 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:52 +0400 Subject: [PATCH v5 18/62] x86: convert OnOffAuto properties to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-18-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , "Michael S. Tsirkin" X-Developer-Signature: v=1; a=openpgp-sha256; l=6518; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=SgZyvSyb89GMp5FbVLfodHDTHOL+fqH6tT2LZO1GJws=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC24fByX476DO+jMZRNdIWiImtaqsDYwAVFLZ /B+GO3Y5U+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuAAKCRDa6OEJdZac 5WYcD/9bFR0IWM4mYpaJcY9+zeLUdPwy6Hyp/PbEcEptgk9YyqwcbyMTS8Tr2i4VQbE3LuLmJDD i3mLrkqg3zWxakjETupL9wqdrBiU09B2kjYwhzwXdiFPrDq7JgZ4mq+FXCsAbdNrCmqR2z3KdWB IbpakrKyaSQpp46hmYj3cJP5qBz7qWIfnTNr9eocHx4UTUFvk0+IJZn9t0YIU5eQD3U2bK8ddPA cb9WZEA6Tmw6GSwFT4/ok+r2H3IRBzHKmLbTpHLJxPJGxBxcMtJ1n9UQO1EUWon37xoT/Q3WrmL Z6RZb+AhWC72XkazbfRo2UrrWvDz4CHWdgvnNhsAigAXJbNftiRj2zXN2ij1+LIxO15r+PUgngj DtNns1yFway1ILmiEVpL6H4QrsrBGkcKvU4baYMAjzJfqHBIGTV7IMw43+CgEA3OjLnZaYNfZcr DzeeP2Sw/njovcA8/cKHRroTIn4KbPXRZSiH3+12VnT3nwT/1qgP5Mnd5g+Pf5Br+t+NRIUsVs6 z9rjrga7yj9qiyk7W23G/5A+Yy0njvgfIV/P3y/ix//qDpqLlaLG2bNNojs/eMmdHmS27CKnPhn FMyhJmOhkaAvmGJpFRPDa7VYG1NDiAv8v6Rr4oJLzABIVlUc/2ltEmXMx0PJMK6u117CoqJMIs8 QWLaJhmvPR048xw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=marcandre.lureau@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_H2=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: 1789144740029158500 Convert the smm, acpi, pit, and pic OnOffAuto properties from manual visitor-based callbacks to property_add_qapi_enum(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/i386/x86.c | 104 +++++++++++++++++++++++++-----------------------------= ---- 1 file changed, 45 insertions(+), 59 deletions(-) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index f8ba3244e221..63f297a10532 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -24,7 +24,7 @@ #include "qemu/error-report.h" #include "qemu/units.h" #include "qapi/error.h" -#include "qapi/qapi-visit-common.h" +#include "qapi/qapi-type-infos-common.h" #include "qapi/qapi-visit-machine.h" #include "qapi/visitor.h" #include "system/qtest.h" @@ -188,21 +188,16 @@ bool x86_machine_is_smm_enabled(const X86MachineState= *x86ms) return false; } =20 -static void x86_machine_get_smm(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static int x86_machine_get_smm(Object *obj, Error **errp) { X86MachineState *x86ms =3D X86_MACHINE(obj); - OnOffAuto smm =3D x86ms->smm; - - visit_type_OnOffAuto(v, name, &smm, errp); + return x86ms->smm; } =20 -static void x86_machine_set_smm(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void x86_machine_set_smm(Object *obj, int value, Error **errp) { X86MachineState *x86ms =3D X86_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &x86ms->smm, errp); + x86ms->smm =3D value; } =20 bool x86_machine_is_acpi_enabled(const X86MachineState *x86ms) @@ -213,55 +208,40 @@ bool x86_machine_is_acpi_enabled(const X86MachineStat= e *x86ms) return true; } =20 -static void x86_machine_get_acpi(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static int x86_machine_get_acpi(Object *obj, Error **errp) { X86MachineState *x86ms =3D X86_MACHINE(obj); - OnOffAuto acpi =3D x86ms->acpi; - - visit_type_OnOffAuto(v, name, &acpi, errp); + return x86ms->acpi; } =20 -static void x86_machine_set_acpi(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void x86_machine_set_acpi(Object *obj, int value, Error **errp) { X86MachineState *x86ms =3D X86_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &x86ms->acpi, errp); + x86ms->acpi =3D value; } =20 -static void x86_machine_get_pit(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static int x86_machine_get_pit(Object *obj, Error **errp) { X86MachineState *x86ms =3D X86_MACHINE(obj); - OnOffAuto pit =3D x86ms->pit; - - visit_type_OnOffAuto(v, name, &pit, errp); + return x86ms->pit; } =20 -static void x86_machine_set_pit(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void x86_machine_set_pit(Object *obj, int value, Error **errp) { X86MachineState *x86ms =3D X86_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &x86ms->pit, errp); + x86ms->pit =3D value; } =20 -static void x86_machine_get_pic(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static int x86_machine_get_pic(Object *obj, Error **errp) { X86MachineState *x86ms =3D X86_MACHINE(obj); - OnOffAuto pic =3D x86ms->pic; - - visit_type_OnOffAuto(v, name, &pic, errp); + return x86ms->pic; } =20 -static void x86_machine_set_pic(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void x86_machine_set_pic(Object *obj, int value, Error **errp) { X86MachineState *x86ms =3D X86_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &x86ms->pic, errp); + x86ms->pic =3D value; } =20 static char *x86_machine_get_oem_id(Object *obj, Error **errp) @@ -391,31 +371,37 @@ static void x86_machine_class_init(ObjectClass *oc, c= onst void *data) mc->kvm_type =3D x86_kvm_type; nc->raise_nmi =3D x86_nmi; =20 - object_class_property_add(oc, X86_MACHINE_SMM, "OnOffAuto", - x86_machine_get_smm, x86_machine_set_smm, - NULL, NULL); - object_class_property_set_description(oc, X86_MACHINE_SMM, - "Enable SMM"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D X86_MACHINE_SMM, + .description =3D "Enable SMM", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D x86_machine_get_smm, + .set =3D x86_machine_set_smm, + )); =20 - object_class_property_add(oc, X86_MACHINE_ACPI, "OnOffAuto", - x86_machine_get_acpi, x86_machine_set_acpi, - NULL, NULL); - object_class_property_set_description(oc, X86_MACHINE_ACPI, - "Enable ACPI"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D X86_MACHINE_ACPI, + .description =3D "Enable ACPI", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D x86_machine_get_acpi, + .set =3D x86_machine_set_acpi, + )); =20 - object_class_property_add(oc, X86_MACHINE_PIT, "OnOffAuto", - x86_machine_get_pit, - x86_machine_set_pit, - NULL, NULL); - object_class_property_set_description(oc, X86_MACHINE_PIT, - "Enable i8254 PIT"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D X86_MACHINE_PIT, + .description =3D "Enable i8254 PIT", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D x86_machine_get_pit, + .set =3D x86_machine_set_pit, + )); =20 - object_class_property_add(oc, X86_MACHINE_PIC, "OnOffAuto", - x86_machine_get_pic, - x86_machine_set_pic, - NULL, NULL); - object_class_property_set_description(oc, X86_MACHINE_PIC, - "Enable i8259 PIC"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D X86_MACHINE_PIC, + .description =3D "Enable i8259 PIC", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D x86_machine_get_pic, + .set =3D x86_machine_set_pic, + )); =20 object_class_property_add_str(oc, X86_MACHINE_OEM_ID, x86_machine_get_oem_id, --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144731; cv=none; d=zohomail.com; s=zohoarc; b=kxTv3ygcIvrhsiYfQUCcgSUGNqGEelxXNQAuvpWqTYz3J6b/rWc3w7p5ulHYzNruWjICacRmfqoQvyegjXzOb4qSCEsfyE2Fjp/PwD8U89jNq6t3zavM2Cc8Ec+EMnUoeI9gV1hgesd3qf34cJQtAzKrZ5re2QWzYRSVAjRC77Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144731; h=Content-Type: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=giWvSJES9Am74xj7Gxo9BvxGBNVPmhOKyYmXMRbmmxg=; b=DrxfCK6viN+M5uvjbL7/5xMwaQIzhteqQI3DK8kUpjCV1MHNMY6DYM0fCE1toMJ+KQ7ldzTPYuPXdxbiWMzLjy1g2da1KBws4sickahZUQQ/Ss0nqHtCKU8oiVDCREsASFXaSjMcrfr6Qz48pdewVv27dJSbLDQ1tGvdR1yKv7I= 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 1789144731010783.7168942384174; Fri, 11 Sep 2026 09:38:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54H0-00011n-Gu; Fri, 11 Sep 2026 12:38:46 -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 1x54Gx-0000hw-RV for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:43 -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 1x54Gw-0006UF-2f for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:43 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-584-NaiUyuNMOx-W-oSMfMAgng-1; Fri, 11 Sep 2026 12:38:38 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1513D195E932; Fri, 11 Sep 2026 16:38:37 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E0D0B195608F; Fri, 11 Sep 2026 16:38:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144721; 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=giWvSJES9Am74xj7Gxo9BvxGBNVPmhOKyYmXMRbmmxg=; b=aVqeB2diw2rzAOnDSFsQ0FNt3+kWMp8ueOBcqIYgt2PQunzna2wrKk/e2miFxfubJ1hO1I DKdaj48x2YVpJcstcZSpdR70+u+A1jmavGtSV2iLmYblUrRmVp30RAYEnWjMBwb1cmipL4 HAwF7Uxh+7+WVKAXmB6SmOS6XADf6gs= X-MC-Unique: NaiUyuNMOx-W-oSMfMAgng-1 X-Mimecast-MFC-AGG-ID: NaiUyuNMOx-W-oSMfMAgng_1789144717 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:53 +0400 Subject: [PATCH v5 19/62] microvm: convert OnOffAuto properties to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-19-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Sergio Lopez , Richard Henderson , "Michael S. Tsirkin" X-Developer-Signature: v=1; a=openpgp-sha256; l=5502; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=SY82PLEWc9Gc3m055Lm7iyiVVRaR86gDnyc0DsDmtbo=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC24WftGCp2T4gKr2VIY9phdtk9Ofhdyvc1VL c/Ek0BsnmCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuAAKCRDa6OEJdZac 5fWzD/45/E5brGeVdcIfctfrMjO1GCp1aVJThD5UhMGVHPl18bv+otp8ZrI3VXxSRZvf7mo6Dx5 6uP7dbX2Nkp7FcpplfNW3ozlw7dPFt4dhI6QYQkjAOJeV6BQ/Oxn2W9vhxSPnN4/67NLknepLM/ SujBkTx9IsIsS42j8uzLrdONvCjggK9cVrOsQxe3uj2u3fqIaBw5Ze1aPekMl6vCYNIRPpSUnrj 8aYlyAeb0x0qFpKaSUcLNYUQKpBhF7GUuDewp3NKbCzV3mik9/yYNIs6M1e5CDnC3vLrTPsLajj e/4LgNYlDOCLTcj/b3xEk/XlNoI+7YiE6E8WyHtZKCobIi1eB1THom8LVrkUWWJpOhojt1CQwO4 DsKF42W0ohvo+nM6LgKopoP9/N3OFNUwSC8aChkOHU7N0ms2sHPGLGNJTO5DPV4kjiIUsjffych 6UuPAny1Q2Mj4K9ZgWaM6ZNUE3xl+x0yJr3m5VIG0XRPiGPm6eFDqMfoNsmXOx5KK22UL2DptJN ipNJy3oe6va08z4QURPcBmqf2iS3lAJGirNz/RTaUqIg4KFB/RvXWKRPHq86Y9jK2S6qBsWJBod 3sggAwB20jNYvAwKsrLrlkaSQbrRFyGk6KBvfcApn5EuduA+uPmiBnNjUvU5fzn4rsOMSAaLHPz svFiUzFi7F/RmvA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144731992158500 Convert the rtc, pcie, and ioapic2 OnOffAuto properties from manual visitor-based callbacks to property_add_qapi_enum(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/i386/microvm.c | 80 +++++++++++++++++++++++----------------------------= ---- 1 file changed, 34 insertions(+), 46 deletions(-) diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index e7adab7d2ef7..3366f3b933f8 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -21,7 +21,7 @@ #include "qemu/units.h" #include "qapi/error.h" #include "qapi/visitor.h" -#include "qapi/qapi-visit-common.h" +#include "qapi/qapi-type-infos-common.h" #include "system/system.h" #include "system/cpus.h" #include "system/numa.h" @@ -519,55 +519,40 @@ static void microvm_machine_reset(MachineState *machi= ne, ResetType type) } } =20 -static void microvm_machine_get_rtc(Object *obj, Visitor *v, const char *n= ame, - void *opaque, Error **errp) +static int microvm_machine_get_rtc(Object *obj, Error **errp) { MicrovmMachineState *mms =3D MICROVM_MACHINE(obj); - OnOffAuto rtc =3D mms->rtc; - - visit_type_OnOffAuto(v, name, &rtc, errp); + return mms->rtc; } =20 -static void microvm_machine_set_rtc(Object *obj, Visitor *v, const char *n= ame, - void *opaque, Error **errp) +static void microvm_machine_set_rtc(Object *obj, int value, Error **errp) { MicrovmMachineState *mms =3D MICROVM_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &mms->rtc, errp); + mms->rtc =3D value; } =20 -static void microvm_machine_get_pcie(Object *obj, Visitor *v, const char *= name, - void *opaque, Error **errp) +static int microvm_machine_get_pcie(Object *obj, Error **errp) { MicrovmMachineState *mms =3D MICROVM_MACHINE(obj); - OnOffAuto pcie =3D mms->pcie; - - visit_type_OnOffAuto(v, name, &pcie, errp); + return mms->pcie; } =20 -static void microvm_machine_set_pcie(Object *obj, Visitor *v, const char *= name, - void *opaque, Error **errp) +static void microvm_machine_set_pcie(Object *obj, int value, Error **errp) { MicrovmMachineState *mms =3D MICROVM_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &mms->pcie, errp); + mms->pcie =3D value; } =20 -static void microvm_machine_get_ioapic2(Object *obj, Visitor *v, const cha= r *name, - void *opaque, Error **errp) +static int microvm_machine_get_ioapic2(Object *obj, Error **errp) { MicrovmMachineState *mms =3D MICROVM_MACHINE(obj); - OnOffAuto ioapic2 =3D mms->ioapic2; - - visit_type_OnOffAuto(v, name, &ioapic2, errp); + return mms->ioapic2; } =20 -static void microvm_machine_set_ioapic2(Object *obj, Visitor *v, const cha= r *name, - void *opaque, Error **errp) +static void microvm_machine_set_ioapic2(Object *obj, int value, Error **er= rp) { MicrovmMachineState *mms =3D MICROVM_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &mms->ioapic2, errp); + mms->ioapic2 =3D value; } =20 static bool microvm_machine_get_isa_serial(Object *obj, Error **errp) @@ -673,26 +658,29 @@ static void microvm_class_init(ObjectClass *oc, const= void *data) hc->unplug_request =3D microvm_device_unplug_request_cb; hc->unplug =3D microvm_device_unplug_cb; =20 - object_class_property_add(oc, MICROVM_MACHINE_RTC, "OnOffAuto", - microvm_machine_get_rtc, - microvm_machine_set_rtc, - NULL, NULL); - object_class_property_set_description(oc, MICROVM_MACHINE_RTC, - "Enable MC146818 RTC"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D MICROVM_MACHINE_RTC, + .description =3D "Enable MC146818 RTC", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D microvm_machine_get_rtc, + .set =3D microvm_machine_set_rtc, + )); =20 - object_class_property_add(oc, MICROVM_MACHINE_PCIE, "OnOffAuto", - microvm_machine_get_pcie, - microvm_machine_set_pcie, - NULL, NULL); - object_class_property_set_description(oc, MICROVM_MACHINE_PCIE, - "Enable PCIe"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D MICROVM_MACHINE_PCIE, + .description =3D "Enable PCIe", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D microvm_machine_get_pcie, + .set =3D microvm_machine_set_pcie, + )); =20 - object_class_property_add(oc, MICROVM_MACHINE_IOAPIC2, "OnOffAuto", - microvm_machine_get_ioapic2, - microvm_machine_set_ioapic2, - NULL, NULL); - object_class_property_set_description(oc, MICROVM_MACHINE_IOAPIC2, - "Enable second IO-APIC"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D MICROVM_MACHINE_IOAPIC2, + .description =3D "Enable second IO-APIC", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D microvm_machine_get_ioapic2, + .set =3D microvm_machine_set_ioapic2, + )); =20 object_class_property_add_bool(oc, MICROVM_MACHINE_ISA_SERIAL, microvm_machine_get_isa_serial, --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144738; cv=none; d=zohomail.com; s=zohoarc; b=NRyESPhX9xyL4wKT0Eii4qdazX6QWUp41t0i/Uyu6mA3BYmmA5TQgeKHTHak8SRt3roq5SmRU6cJhBkr4i3gxdT3NkxASqpxhjqO6WIBxXJv/ekWi6xP60Nd/HzK5xafNI0izIy5tJzkvWDOWrS5ieyH9JalmVn8P8Qd92z3l/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144738; h=Content-Type: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=Jpy8BYiyeQ1/xM+bCFKZLs5qW5++vmmopKZQaqcqzvg=; b=bcF3gC7Bi8x8+Vi1Npgs+59Ro5twb4ZJdTynSk3oMa1u9AEt1ylBuJmHchkoWjvp/GMEidCbGt4rQsMLcAhOX5vYr2ubq4fMTU70LR1NIjgU8vf83gcNIIb089HAKGhPcWUiPBOsZpxEQ4ALqOi9PSQwBh+ekz3xRkPEIQPzwLg= 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 178914473849146.268774901526626; Fri, 11 Sep 2026 09:38:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54H3-0001Hw-Uh; Fri, 11 Sep 2026 12:38:49 -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 1x54H0-000164-Rf for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38: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 1x54Gz-0006VE-6k for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:46 -0400 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-179-5-u1OkZRPTqCAwNjmv2y4Q-1; Fri, 11 Sep 2026 12:38:42 -0400 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 2D35318007F4; Fri, 11 Sep 2026 16:38:41 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B83F41956095; Fri, 11 Sep 2026 16:38:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144724; 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=Jpy8BYiyeQ1/xM+bCFKZLs5qW5++vmmopKZQaqcqzvg=; b=f4A5S4b9UNvv2gWoSqg4JPEaxwsPvooDYvunLPnWoABN1FhpwW1xvlnt1ElghzzW0AWfxN B8+FdjXWrRYat/auBljSmYJlKAi4B8t59MV65xki9A2M1XKqU3iTSK2MQw0raiY9/7UXFP 0OEOBzl6FGU7Q5CzhvccpGQuhjyv/QY= X-MC-Unique: 5-u1OkZRPTqCAwNjmv2y4Q-1 X-Mimecast-MFC-AGG-ID: 5-u1OkZRPTqCAwNjmv2y4Q_1789144721 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:54 +0400 Subject: [PATCH v5 20/62] pc: convert OnOffAuto vmport property to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-20-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , "Michael S. Tsirkin" X-Developer-Signature: v=1; a=openpgp-sha256; l=2492; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=p6+EX45jD1DvPE7aHMiqR5ww7Y9deovLVheC6sjhUUY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC24BubBhpx4Q8croGaAvJMAghvvcto1PwpMI xLEzn+Q9HKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuAAKCRDa6OEJdZac 5T2oD/9BPE+QDUckALYBEz22fkUTogTDZfUDU8xynnRmnTrFFLvFbRDOLJD7OLIe2tTfQESdzNM jTfMJ8bOsyTqeRth8NqoRlFptmNs+Qdk6qy8gtKaZHfOigvnEvqPuUBSP/GkxPJ1IrbU8MD+wFV c3dXSd9+V/Tuk5mCs8BMnZbj/BvH2I8+YvMaivLSwLINXJOfpkSjmu1dqnzRsTIRmRL9mVDedJM QlBxHWHyL2U5r+d4zS0C1bINIJTNBYjVtiU+nPBpKldDqIH4sQjOAIZDf6NS876Qj1tYVMyt1wJ Ty6kTHZmcUFPdGeLB/hXZYtzz50OuexDS2cVmpZphaFPAoyfyHuXblJLQnmOaPGExgKJbFU7Gbe FiRw6lYVreAi+N3S0/xmK+7jx95KHzzCC+hHsYudMgNXMelFncJojXLdiw1Bnv9IO0UBkgkHFE5 NvlV4ktHhpAEjPwK0ZeYxVPnt0Oss9t8s8REoZ8u/nKOhbu7dC1kun9DMonHmfabOws3YaXWQRy aWeJv+jIxShZCkVfdRjMY7dHcQ8iJOHDEfcoF56lqxqoXbNqHJir6Y/u9cxBsCcftuNIqVh6hg6 zRqFBNnshL276pW8l2xqmAz5xgXyHzSZeXOjJhrOCC7U+9MVkT4UrIpIS9jzXKILIP+VT06/+NP 3F+SNxX49hgxidg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=marcandre.lureau@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_H2=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: 1789144740057158500 Convert the vmport OnOffAuto property from manual visitor-based callbacks to property_add_qapi_enum(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/i386/pc.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index e9e4fc262b83..18b5dc169ab7 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -46,6 +46,7 @@ #include "kvm/kvm_i386.h" #include "kvm/tdx.h" #include "hw/xen/xen.h" +#include "qapi/qapi-type-infos-common.h" #include "qobject/qlist.h" #include "qemu/error-report.h" #include "hw/acpi/acpi.h" @@ -1419,21 +1420,16 @@ static HotplugHandler *pc_get_hotplug_handler(Machi= neState *machine, return NULL; } =20 -static void pc_machine_get_vmport(Object *obj, Visitor *v, const char *nam= e, - void *opaque, Error **errp) +static int pc_machine_get_vmport(Object *obj, Error **errp) { PCMachineState *pcms =3D PC_MACHINE(obj); - OnOffAuto vmport =3D pcms->vmport; - - visit_type_OnOffAuto(v, name, &vmport, errp); + return pcms->vmport; } =20 -static void pc_machine_set_vmport(Object *obj, Visitor *v, const char *nam= e, - void *opaque, Error **errp) +static void pc_machine_set_vmport(Object *obj, int value, Error **errp) { PCMachineState *pcms =3D PC_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &pcms->vmport, errp); + pcms->vmport =3D value; } =20 static bool pc_machine_get_fd_bootchk(Object *obj, Error **errp) @@ -1730,11 +1726,13 @@ static void pc_machine_class_init(ObjectClass *oc, = const void *data) object_class_property_set_description(oc, PC_MACHINE_MAX_RAM_BELOW_4G, "Maximum ram below the 4G boundary (32bit boundary)"); =20 - object_class_property_add(oc, PC_MACHINE_VMPORT, "OnOffAuto", - pc_machine_get_vmport, pc_machine_set_vmport, - NULL, NULL); - object_class_property_set_description(oc, PC_MACHINE_VMPORT, - "Enable vmport (pc & q35)"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D PC_MACHINE_VMPORT, + .description =3D "Enable vmport (pc & q35)", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D pc_machine_get_vmport, + .set =3D pc_machine_set_vmport, + )); =20 object_class_property_add_bool(oc, PC_MACHINE_SMBUS, pc_machine_get_smbus, pc_machine_set_smbus); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144758; cv=none; d=zohomail.com; s=zohoarc; b=iFD536yFBmlmGTVhwMp636lFLTk9bjAWQHxzrMa0++qKYuLUvJ2/VOleDyR5nut0yy0v4EbTIqMnOH1tzPPGuSTtUaAKNdYi06s5OB2Wk8/85AkmhwsJJXi8ZCuIe9j3ZI9d4J1WSmTLYmc8MDDeYICGKVHBpnsf+NNxaVHaVAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144758; h=Content-Type: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=3lpC35gmliS0QhA1JkmfqWaHkZxlzKVeH5o0OEMIMN4=; b=f8lnlfDN9WN4pE0NrEwP8cMYV8wXV55asSuffkOoZNTa+E5PWTgnEResn44fE74ZEgsEhvAbJZh+kXU5k45gH0CID8XQ+/6nN6Jnp/b/M0YVRpffYYJVZNJ4n49jGitcPT67BZtC7cNcTLaDBlNqgdF2IdQf0SM+Q6Ys4kFRZOs= 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 1789144758325176.57593670343283; Fri, 11 Sep 2026 09:39:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54H7-0001g4-HX; Fri, 11 Sep 2026 12:38:53 -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 1x54H5-0001Uc-7t for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:51 -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 1x54H3-0006Xq-Md for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:50 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-669-tA0paACZNHGTUu7cEE-MrQ-1; Fri, 11 Sep 2026 12:38:45 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 858EA195E912; Fri, 11 Sep 2026 16:38:44 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8A625195608F; Fri, 11 Sep 2026 16:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144729; 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=3lpC35gmliS0QhA1JkmfqWaHkZxlzKVeH5o0OEMIMN4=; b=YQUkmIbwQuxBr9+icPZtPuSw/EAnRS+Zo+LYojFkTfsjnEFiMLhvIoX6GBjeyG9fxjdio6 Q6LGZav2hwTSDhEzmiGxW1wO6VG2ThgR4iLxJ2S3LXfDLou4usLV/l7etxQ9u1I0NYJYRG ynGAD0wukVuo5uCHUSpN33asS+Z+p+8= X-MC-Unique: tA0paACZNHGTUu7cEE-MrQ-1 X-Mimecast-MFC-AGG-ID: tA0paACZNHGTUu7cEE-MrQ_1789144724 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:55 +0400 Subject: [PATCH v5 21/62] arm/virt: convert OnOffAuto acpi property to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-21-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , qemu-arm@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=2389; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=VEvZEB5tSbvTYsPJm20+OtQi7DOxjCPx8lu+wm1r8Ps=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC24UsnAuXMKLk9QqxMhFfDZx6P7EDZ2q31rJ YpiU4FS9ACJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuAAKCRDa6OEJdZac 5e1mEAC0JDvHGC4iKIE2gEKffiCT+w/oGHcOeoR0nAmPMkzBVH8mrHBDsdjGYds0LqnUQahr2SP ZySlmdjhpr93sTz3lVi7hdaiHbcnYZGyJjxOMP8i5ztapvZj/7OJ3ralgxZZVsLY5sEYrhHftyt 5RI3M+wZ1sdId94jVa5jc9CSgxiATt6e0nqGt9td8sFUMPbqBDWx0RRpCGzK4J2VEXkbwVunSaQ 7X+Tknuw+2+FgosXSpKZQVRosmj2aZnYyIM5+EFwRWwTOSYwyinwS1CKujuphIh6Hk7YpDklPwM C212Up8eNyJa71YRq2MjLdGBkGVoUGcGuCenULFsr3DUkKlZmtkDzzZ5RLpB/CPOXbrk+bJTppJ eccS90oyOlrKB8McAzZv5NNlEABYeTbpMZwN0RvycfV55uX0nXH/1kK+oCF/nnL9sNqTfXNaYGn jdS5jGALkOyyJRE34cvSlnBYj5eryG6QUZaK94lJRMLK570wXKkhSY/P3w0QJslCt+sTh54gl7s LVYMB4+mTQ4FiCTkvJaRb1XRV21OCOvfyFv+n798VSe/N8ram3wh2TS6Fce/CRaCRjnLMFcu2aa 5SCXEnqMVBrqHdNwzYLjOxSE0YOeuw9wrpSC8UPH07wzwXinmny7/BsdZSVVx3c9eGRDqQYNZ2g OoyMHrtGLnouABw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144760180158500 Convert the acpi OnOffAuto property from manual visitor-based callbacks to property_add_qapi_enum(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/arm/virt.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 0871a35e11f7..872920b6482b 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -73,7 +73,7 @@ #include "whpx_arm.h" #include "hw/firmware/smbios.h" #include "qapi/visitor.h" -#include "qapi/qapi-visit-common.h" +#include "qapi/qapi-type-infos-common.h" #include "qobject/qlist.h" #include "standard-headers/linux/input.h" #include "hw/arm/smmuv3.h" @@ -3567,21 +3567,16 @@ bool virt_is_acpi_enabled(const VirtMachineState *v= ms) return true; } =20 -static void virt_get_acpi(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static int virt_get_acpi(Object *obj, Error **errp) { VirtMachineState *vms =3D VIRT_MACHINE(obj); - OnOffAuto acpi =3D vms->acpi; - - visit_type_OnOffAuto(v, name, &acpi, errp); + return vms->acpi; } =20 -static void virt_set_acpi(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void virt_set_acpi(Object *obj, int value, Error **errp) { VirtMachineState *vms =3D VIRT_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &vms->acpi, errp); + vms->acpi =3D value; } =20 static bool virt_get_ras(Object *obj, Error **errp) @@ -4208,11 +4203,13 @@ static void virt_machine_class_init(ObjectClass *oc= , const void *data) mc->default_ram_id =3D "mach-virt.ram"; mc->default_nic =3D "virtio-net-pci"; =20 - object_class_property_add(oc, "acpi", "OnOffAuto", - virt_get_acpi, virt_set_acpi, - NULL, NULL); - object_class_property_set_description(oc, "acpi", - "Enable ACPI"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "acpi", + .description =3D "Enable ACPI", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D virt_get_acpi, + .set =3D virt_set_acpi, + )); object_class_property_add_bool(oc, "secure", virt_get_secure, virt_set_secure); object_class_property_set_description(oc, "secure", --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144783; cv=none; d=zohomail.com; s=zohoarc; b=Gy5WjHJDheJGB5lZelJ1JlddMTmJxvTdhjGgf9qm4Vw+t/bdIrkReqxhesXCIkH3FCmA2xsnkcRZPr2UPNpdurzMaoGDoeQWejKxwwize6IJ3F5Wr9n7hp4/5b6eIE/hk32x0MdBtROO70usEgbGBR89dVkynA73nFVaxQ0vzDg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144783; h=Content-Type: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=19eU8BkbUT5yPnSB94y+jaPCOhQJnzr2y1t5c/eQStM=; b=H3rYZpHgS741d2N1edadvZxGoBc0awGEJm6A+CegZcvwQ8DYjNFOVZNqB+edXCkW4G2CtCAYpO3CItON6YhUmCL5wJvS9zv0tDVVn/HBxPL6ykVFmcUirjsOIm/sKUaGKY21rZd3OnjHH+ET8PaLDOS7zSpRYYjFvY029nQZ9GE= 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 1789144783761705.3964355911655; Fri, 11 Sep 2026 09:39:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54HC-0002CQ-DJ; Fri, 11 Sep 2026 12:38:58 -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 1x54H9-0001wd-UM for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:56 -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 1x54H8-0006Zf-8Q for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:38:55 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-617-wA26IdLwMUGcGxU7dGNe7Q-1; Fri, 11 Sep 2026 12:38:50 -0400 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2BA72195394F; Fri, 11 Sep 2026 16:38:48 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3FF601956095; Fri, 11 Sep 2026 16:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144733; 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=19eU8BkbUT5yPnSB94y+jaPCOhQJnzr2y1t5c/eQStM=; b=CcwPt8YvXLisnCnFr125CgIO+ki1PJh4bUsZmyhVziOoTGlpbDGfzGjAc97oA+EGYMN8qS DcsIp6D6UmPIcAHNcVyg4HnDn1SU5FtKqunndKz8K08EoUTup0JYkPbS1J5kChyg0ZcVN0 S43m8cV0csB8RTziRq7+txgmG0EPFw4= X-MC-Unique: wA26IdLwMUGcGxU7dGNe7Q-1 X-Mimecast-MFC-AGG-ID: wA26IdLwMUGcGxU7dGNe7Q_1789144728 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:56 +0400 Subject: [PATCH v5 22/62] riscv/virt: convert OnOffAuto properties to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-22-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , qemu-riscv@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=3984; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=gJqAR7C1ceK/clyg5x7Xek2bQLsqUAtpTSiuYb1BSc4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC24yzqUZ3EHbMnlCeQ9GOXJ/XMe8gvIBIoot 0K75RJFVkeJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuAAKCRDa6OEJdZac 5WE9D/42hinWD4kXRYlhmTcygrq7jkdDpOi3LBx0VMFHZqMvK+VlECWtzuhy3SEwZibLJqPVnet 8WgQob7iV0/YJZ3n65yHYD8i6pSNBiX7rOOuAnIeXQNo40DR6lIfCRpb/PwS5vBs2Y/uP/RjrEO 8l07Miglv4HcZ0FaAjhprcQ9mRrhdYTxFay1CDt1UTNWJ9egUZfV17LAghY29PfbHsUfmBFQeVP SgKf9vn1CZmRkrfvVa27dPBqNRY0ie3GeT4ByByJvFb5Xr7bM4D2ej+CPMLhLXI0hXmUZBHACsW EpFozP2BjbArNtx9U1mlK44uFqEjL5W+NjanAR9MzeifvAwi+i/fRMBuqbqJsjNGRNy2kgZkA2y B7ioondUHh+tJzQnPggQGV7Md529VSriwpEGj5nsjo9ck/nCDVLogQLo9vuGPVRizOAjQmSPxUR jbbFNJozsmWPXlHRmR/GwuWqKPDHbXCwadryyFTfgiSTXl9yYCeAzxhpejwkJmOGPf9BvIzXeoS uhY0z01eJqmOrORmxf1+oVrzvY0V6aWe4vig54YSBTFRAv4mqdyXIB84RJHo/meeiIkHFSRhJFB VcGQ3ep687BBHQuUyDdIwVV8ZtfKeFTmRlAuzM+S8/obq23Ne/0ggKUHtF+qtPFClx8OzbK88a2 6QAieOzHyDnFrtQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144784586158500 Convert the acpi and iommu-sys OnOffAuto properties from manual visitor-based callbacks to property_add_qapi_enum(). Acked-by: Alistair Francis Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/riscv/virt.c | 52 +++++++++++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index f3a1cc5ba33e..5e407a069db8 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -57,7 +57,7 @@ #include "hw/pci-host/gpex.h" #include "hw/display/ramfb.h" #include "hw/acpi/aml-build.h" -#include "qapi/qapi-visit-common.h" +#include "qapi/qapi-type-infos-common.h" #include "hw/virtio/virtio-iommu.h" #include "hw/uefi/var-service-api.h" =20 @@ -1049,21 +1049,16 @@ bool virt_is_iommu_sys_enabled(RISCVVirtState *s) return s->iommu_sys =3D=3D ON_OFF_AUTO_ON; } =20 -static void virt_get_iommu_sys(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static int virt_get_iommu_sys(Object *obj, Error **errp) { RISCVVirtState *s =3D RISCV_VIRT_MACHINE(obj); - OnOffAuto iommu_sys =3D s->iommu_sys; - - visit_type_OnOffAuto(v, name, &iommu_sys, errp); + return s->iommu_sys; } =20 -static void virt_set_iommu_sys(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void virt_set_iommu_sys(Object *obj, int value, Error **errp) { RISCVVirtState *s =3D RISCV_VIRT_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &s->iommu_sys, errp); + s->iommu_sys =3D value; } =20 bool virt_is_acpi_enabled(RISCVVirtState *s) @@ -1071,21 +1066,16 @@ bool virt_is_acpi_enabled(RISCVVirtState *s) return s->acpi !=3D ON_OFF_AUTO_OFF; } =20 -static void virt_get_acpi(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static int virt_get_acpi(Object *obj, Error **errp) { RISCVVirtState *s =3D RISCV_VIRT_MACHINE(obj); - OnOffAuto acpi =3D s->acpi; - - visit_type_OnOffAuto(v, name, &acpi, errp); + return s->acpi; } =20 -static void virt_set_acpi(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void virt_set_acpi(Object *obj, int value, Error **errp) { RISCVVirtState *s =3D RISCV_VIRT_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &s->acpi, errp); + s->acpi =3D value; } =20 static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *mach= ine, @@ -1183,17 +1173,21 @@ static void virt_machine_class_init(ObjectClass *oc= , const void *data) object_class_property_set_description(oc, "aia-guests", str); } =20 - object_class_property_add(oc, "acpi", "OnOffAuto", - virt_get_acpi, virt_set_acpi, - NULL, NULL); - object_class_property_set_description(oc, "acpi", - "Enable ACPI"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "acpi", + .description =3D "Enable ACPI", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D virt_get_acpi, + .set =3D virt_set_acpi, + )); =20 - object_class_property_add(oc, "iommu-sys", "OnOffAuto", - virt_get_iommu_sys, virt_set_iommu_sys, - NULL, NULL); - object_class_property_set_description(oc, "iommu-sys", - "Enable IOMMU platform device"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "iommu-sys", + .description =3D "Enable IOMMU platform device", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D virt_get_iommu_sys, + .set =3D virt_set_iommu_sys, + )); } =20 static const TypeInfo virt_machine_typeinfo =3D { --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144761; cv=none; d=zohomail.com; s=zohoarc; b=FTSjTGLQ7UCVs4RKmtjYvQJH2hWuyXrYsc5VmSU+z3N+SrEwLZS19q+mMHyj8KmR+Ovr3K7AbmQHT9Luh5lnxRrTiD3jJoJ5Xq/2gxJ2CvHx3Epb/5rcBMHWKwMdP2dfglzmdfEEMRN4uCCksG2sutYAP4xbyiHc/wMcG9nMRLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144761; h=Content-Type: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=NqfpP6+T+mMqhutT80shj/MSxHjc1FnuwFPkDl4SbWs=; b=N0oCurolaN4njTMBHjJp242lVfpmkONGm5p9X5Q74qrfTdnok+y2Z6go58IHlK1v2FhjhOqjG3WRnOjyZ6jhyFmSq+7Z3ZRNij+PbFYCyLPitYVegLLaaha4lE4FsnLuUBf3bNppy/IDDWx6oQgbi9q6BZ/BPtFvIk6EhvCzyDc= 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 1789144761773401.74735617254896; Fri, 11 Sep 2026 09:39:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54HH-0002aI-Et; Fri, 11 Sep 2026 12:39:03 -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 1x54HE-0002Kl-Fd for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:00 -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 1x54HC-0006aJ-QI for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:00 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-597-iP7Vm8FNPC-OCwbaPiHKBw-1; Fri, 11 Sep 2026 12:38:53 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A1B03195396B; Fri, 11 Sep 2026 16:38:51 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8AAE11956095; Fri, 11 Sep 2026 16:38:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144738; 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=NqfpP6+T+mMqhutT80shj/MSxHjc1FnuwFPkDl4SbWs=; b=TveH4Dx6RA9Ht7zLuHMIqGCYUUwgBaNv/ri/azDzsJ2P+BZFHVLWq1ygMKjMS/GzA2C9Fn DOemleQcmXzpdPtdRSHlpcvJUSuGh8Eoss5TLWtxe/G0k6gOMIp3KM3igErg7C7BzjM07P 3hcRAD2YpwVyfiksUThKDGe+u2frgjA= X-MC-Unique: iP7Vm8FNPC-OCwbaPiHKBw-1 X-Mimecast-MFC-AGG-ID: iP7Vm8FNPC-OCwbaPiHKBw_1789144732 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:57 +0400 Subject: [PATCH v5 23/62] loongarch/virt: convert OnOffAuto properties to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-23-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Song Gao <17746591750@163.com>, Bibo Mao , Xianglai Li , Jiaxun Yang X-Developer-Signature: v=1; a=openpgp-sha256; l=5919; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=nfckD088YpF8IH5Vqc/iq59Hc1wNBUsrHYJUB8Qf1+k=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC24jNgYCKhMUtO+EMnKhfeD2V9co8Y2J0av+ TP3ki42GliJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuAAKCRDa6OEJdZac 5QI/D/93/+NMO/i04NthpVKKmBW55t8g9xJOU3ignumNiQ05inMBFKsi0OYgZwdfnMxqlFG+wVg rpUscN/dc2PDnPrYYjtd2uV/ftgz1o834AD1Y65IbSdpEfbGMprMGoVu4G9oRpeobvyDoUigMmL i0o6nWd1S+/uRdzEq7EqyzGfwCJCCxL0hU1rkMAxkrPopZp2sDw4yAnsnd0+tRxeDm9zwH3G4CQ U+AjdGmq6/sRKxiAWsKZPkoFvN+bMBX58Xr2MF7JY4yuckjGR1uGMhzrvbWjlt9mXjDmnlmTEMx jbilb7dsMijmpXET6xppPHefQU9cIFBwPJudbksyOjJxYxIauDLHi5+sQ2RHQy2DV2gBAYu8TNI QPGqH9CqmoEIZaVu+kovw3heQKp2AgdfhRaxm/radd1QKbm61RHHspZrzKxKsQMof2/bOzdCSre WO/1WI6xGMoMjeptn4uNgtpzWCfadgMwM0sisnVweuVhJv4Ws4F65WSYpxh5zofw3mJGFuilHeb Y3ohCvdTQ9CLx9C32JoWi9NTj7uxeJ5moW6e7GLJa1e2ySyD2IdNjpHr4LRTu/QlOTEAYGSg3Px 1Ntj+BsLW+hnBSVgf9v4tkR4I4GW1yREvkwgVxs6ZQ3G0Al4bmlBhl9f6OkmDVOoq3djlMCeUsO HkKge4n69p9+CKw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144764366158501 Convert the acpi, v-eiointc, and dmsi OnOffAuto properties from manual visitor-based callbacks to property_add_qapi_enum(). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Bibo Mao --- hw/loongarch/virt.c | 85 +++++++++++++++++++++++++------------------------= ---- 1 file changed, 40 insertions(+), 45 deletions(-) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 9cc79929a8ab..750ce2dbe5fc 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -36,7 +36,8 @@ #include "target/loongarch/cpu.h" #include "target/loongarch/cpu-mmu.h" #include "hw/firmware/smbios.h" -#include "qapi/qapi-visit-common.h" +#include "qapi/qapi-type-infos-common.h" +#include "qapi/visitor.h" #include "hw/acpi/generic_event_device.h" #include "hw/mem/nvdimm.h" #include "hw/core/platform-bus.h" @@ -51,26 +52,21 @@ #include "qemu/log.h" #include "kvm/kvm_loongarch.h" =20 -static void virt_get_dmsi(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static int virt_get_dmsi(Object *obj, Error **errp) { LoongArchVirtMachineState *lvms =3D LOONGARCH_VIRT_MACHINE(obj); - OnOffAuto dmsi =3D lvms->dmsi; - - visit_type_OnOffAuto(v, name, &dmsi, errp); - + return lvms->dmsi; } -static void virt_set_dmsi(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) + +static void virt_set_dmsi(Object *obj, int value, Error **errp) { LoongArchVirtMachineState *lvms =3D LOONGARCH_VIRT_MACHINE(obj); + lvms->dmsi =3D value; =20 - visit_type_OnOffAuto(v, name, &lvms->dmsi, errp); - - if (lvms->dmsi =3D=3D ON_OFF_AUTO_OFF) { + if (value =3D=3D ON_OFF_AUTO_OFF) { lvms->misc_feature &=3D ~BIT(IOCSRF_DMSI); lvms->misc_status &=3D ~BIT_ULL(IOCSRM_DMSI_EN); - } else if (lvms->dmsi =3D=3D ON_OFF_AUTO_ON) { + } else if (value =3D=3D ON_OFF_AUTO_ON) { lvms->misc_feature =3D BIT(IOCSRF_DMSI); } } @@ -78,21 +74,16 @@ static void virt_set_dmsi(Object *obj, Visitor *v, cons= t char *name, #define DEFAULT_HIGH_PCIE_MMIO_SIZE_GB 64 #define DEFAULT_HIGH_PCIE_MMIO_SIZE (DEFAULT_HIGH_PCIE_MMIO_SIZE_GB * GiB) =20 -static void virt_get_veiointc(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static int virt_get_veiointc(Object *obj, Error **errp) { LoongArchVirtMachineState *lvms =3D LOONGARCH_VIRT_MACHINE(obj); - OnOffAuto veiointc =3D lvms->veiointc; - - visit_type_OnOffAuto(v, name, &veiointc, errp); + return lvms->veiointc; } =20 -static void virt_set_veiointc(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void virt_set_veiointc(Object *obj, int value, Error **errp) { LoongArchVirtMachineState *lvms =3D LOONGARCH_VIRT_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &lvms->veiointc, errp); + lvms->veiointc =3D value; } =20 static bool virt_get_highmem_mmio(Object *obj, Error **errp) @@ -1025,21 +1016,16 @@ static void virt_init(MachineState *machine) loongarch_load_kernel(machine, &lvms->bootinfo, phys_addr_mask); } =20 -static void virt_get_acpi(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static int virt_get_acpi(Object *obj, Error **errp) { LoongArchVirtMachineState *lvms =3D LOONGARCH_VIRT_MACHINE(obj); - OnOffAuto acpi =3D lvms->acpi; - - visit_type_OnOffAuto(v, name, &acpi, errp); + return lvms->acpi; } =20 -static void virt_set_acpi(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void virt_set_acpi(Object *obj, int value, Error **errp) { LoongArchVirtMachineState *lvms =3D LOONGARCH_VIRT_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &lvms->acpi, errp); + lvms->acpi =3D value; } =20 static char *virt_get_oem_id(Object *obj, Error **errp) @@ -1483,20 +1469,29 @@ static void virt_class_init(ObjectClass *oc, const = void *data) hc->unplug_request =3D virt_device_unplug_request; hc->unplug =3D virt_device_unplug; =20 - object_class_property_add(oc, "acpi", "OnOffAuto", - virt_get_acpi, virt_set_acpi, - NULL, NULL); - object_class_property_set_description(oc, "acpi", - "Enable ACPI"); - object_class_property_add(oc, "v-eiointc", "OnOffAuto", - virt_get_veiointc, virt_set_veiointc, - NULL, NULL); - object_class_property_set_description(oc, "v-eiointc", - "Enable Virt Extend I/O Interrupt Controller."= ); - object_class_property_add(oc, "dmsi", "OnOffAuto", - virt_get_dmsi, virt_set_dmsi, NULL, NULL); - object_class_property_set_description(oc, "dmsi", - "Enable direct Message-interrupts Controller."= ); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "acpi", + .description =3D "Enable ACPI", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D virt_get_acpi, + .set =3D virt_set_acpi, + )); + + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "v-eiointc", + .description =3D "Enable Virt Extend I/O Interrupt Controller.", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D virt_get_veiointc, + .set =3D virt_set_veiointc, + )); + + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "dmsi", + .description =3D "Enable direct Message-interrupts Controller.", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D virt_get_dmsi, + .set =3D virt_set_dmsi, + )); machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); machine_class_allow_dynamic_sysbus_dev(mc, TYPE_UEFI_VARS_SYSBUS); #ifdef CONFIG_TPM --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144925; cv=none; d=zohomail.com; s=zohoarc; b=Mm0pYPiW7fwKPt65A7NSxoZ9ofUg8yOggRN2jnuhs/hkww2gWK95poNVIeEXpvjwLYQsYFM4l9av9ONNj1PFoGlY0z826evYafO8H8519NJcDERP6qIRJd5H+/vbGjbtNvqVMQPpLD2TGEn9/WpXi5Vh9XK//nvB5Rsm0V8Hr5M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144925; h=Content-Type: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=Hf0XO4+R3gQa5sXkL7jGB/4v7ZvBVWznyOSE409p7Sg=; b=UfqTigUvf/fBVro1OdFqdv2Eb/aOIjYU52c9tXSLD4Dt0Rq3+sHAQjXBW7gLJ7aIbAU+HqbUBoJhGe9tHGShW0imyTpfuhyGFNOwyCuXop5LuXAQTgbbdvuvM95MV1QpgB7W7b9Fa19i32GYpyQ/rDol3kfp4rLC1/58xahVRqE= 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 1789144925044340.8823400492138; Fri, 11 Sep 2026 09:42:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54HJ-0002nR-TO; Fri, 11 Sep 2026 12:39:05 -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 1x54HH-0002X8-1k for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:03 -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 1x54HF-0006ag-Fj for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:02 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-376-a91hesuRNQaQTtdQgbK1fQ-1; Fri, 11 Sep 2026 12:38:57 -0400 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3FE561953967; Fri, 11 Sep 2026 16:38:56 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 61B3A1956042; Fri, 11 Sep 2026 16:38:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144740; 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=Hf0XO4+R3gQa5sXkL7jGB/4v7ZvBVWznyOSE409p7Sg=; b=Ccf8FdAB0Q023qm4uZ/9HX0xf/RtJUAbGO1hQV3f8rBEoIZKIDH1sY4EgVESnGJnY1Bmgz XjH+fTIVo2b3gD1CXM1spNlbqQ6XMooQ3k3bS4OEd/lBGbxUZ8HBwas7M3T2eT4FLLcHb4 s26a37Rkw21knFlyDAAOPMJ7lCqyunI= X-MC-Unique: a91hesuRNQaQTtdQgbK1fQ-1 X-Mimecast-MFC-AGG-ID: a91hesuRNQaQTtdQgbK1fQ_1789144736 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:58 +0400 Subject: [PATCH v5 24/62] hostmem-file: convert OnOffAuto rom property to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-24-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Hildenbrand , Igor Mammedov X-Developer-Signature: v=1; a=openpgp-sha256; l=2963; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=B3mRoWkvytxDScscm5YFItkwCjWimSwDclMREfby+x8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC24vmn1kI5syyK9SP8y7mQRjhtfRgLDFleha TSNzMqPeZWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuAAKCRDa6OEJdZac 5c/VD/9q+xca90nG+SIhIWDmf72s99sVQYYSN1uc7Z/y/1jNGdN48GrGMcfqONZ8HDpSHNfEwhS BA1GsdYOL39n9N1dMYmLCpjEwTgO8pG3WMMCZpE9wT9UFAbC3vRa6OkbuJWumV0SFExy1LHT/sW tmFOwABRt+AWuoXnoWdYUS8/4h1caYrzfC/jWYGo8EE/xANURrITf6hBRSPkQuTBIfSvzNn86Iz YnlPXWwP2VkrKCdzfnSpvIsP97iaSlPRDo43b6zQltEabToKZ0BgyetrZjK5s22VZe9RPJWkUhN pmcHpmp8MwLXniLJe/auFtGd3sSnA9+0ul68RI1qn2SUfeueQGLckAHKaM8FbwG+Yq7ePFH4ZJp /VQHqeJ9H4ynrRPopQED1Kv3gsS5K3PQD+SdcCuDupxPGwS139sQha5jhBAyyGOOwjG32pEkLHu XBXDSHe04foYYeHt/w7ItsaIQsNsTRqBA1eqyA6fgwbOb+d+Ks3YVlMpaeWbB9CUMPcKsQxVByQ FKKYaZDyM4rYHBCFJIJMuW6x00/sZSTEeJn4QOgq9Qib+cdpO3fMXPivQAGDm1F4pZsIEVrVgA5 KPTBSuQD/AL03NUml+VIWHg/1YlD1I2YZbmhjiBQFetPrZ3Bs7j+MQ2NnhjU3vLnrqoUKjqyx3V PGofm5fVDRAb9IA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144927310158500 Convert the rom OnOffAuto property from manual visitor-based callbacks to property_add_qapi_enum(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- backends/hostmem-file.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index 8cf27ad67e13..9c7e0183d480 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -19,7 +19,7 @@ #include "qom/object_interfaces.h" #include "qom/object.h" #include "qapi/visitor.h" -#include "qapi/qapi-visit-common.h" +#include "qapi/qapi-type-infos-common.h" =20 OBJECT_DECLARE_SIMPLE_TYPE(HostMemoryBackendFile, MEMORY_BACKEND_FILE) =20 @@ -230,30 +230,24 @@ static void file_memory_backend_set_readonly(Object *= obj, bool value, fb->readonly =3D value; } =20 -static void file_memory_backend_get_rom(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) +static int file_memory_backend_get_rom(Object *obj, Error **errp) { HostMemoryBackendFile *fb =3D MEMORY_BACKEND_FILE(obj); - OnOffAuto rom =3D fb->rom; - - visit_type_OnOffAuto(v, name, &rom, errp); + return fb->rom; } =20 -static void file_memory_backend_set_rom(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) +static void file_memory_backend_set_rom(Object *obj, int value, Error **er= rp) { HostMemoryBackend *backend =3D MEMORY_BACKEND(obj); HostMemoryBackendFile *fb =3D MEMORY_BACKEND_FILE(obj); =20 if (host_memory_backend_mr_inited(backend)) { - error_setg(errp, "cannot change property '%s' of %s.", name, + error_setg(errp, "cannot change property 'rom' of %s.", object_get_typename(obj)); return; } =20 - visit_type_OnOffAuto(v, name, &fb->rom, errp); + fb->rom =3D value; } =20 static void file_backend_unparent(Object *obj) @@ -298,10 +292,13 @@ file_backend_class_init(ObjectClass *oc, const void *= data) object_class_property_add_bool(oc, "readonly", file_memory_backend_get_readonly, file_memory_backend_set_readonly); - object_class_property_add(oc, "rom", "OnOffAuto", - file_memory_backend_get_rom, file_memory_backend_set_rom, NULL, NU= LL); - object_class_property_set_description(oc, "rom", - "Whether to create Read Only Memory (ROM)"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "rom", + .description =3D "Whether to create Read Only Memory (ROM)", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D file_memory_backend_get_rom, + .set =3D file_memory_backend_set_rom, + )); } =20 static void file_backend_instance_finalize(Object *o) --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144937; cv=none; d=zohomail.com; s=zohoarc; b=SDn0CB0kgOunVEVNGRVlvlHPUPhThoKn9BTmjiaEkajfNDcGXZ5Pxrm/DIrLWBApuHNdOOtfaz9qKNGoCdAEx/oI/RZQKpy9M3AcL0lIjYSY0KOVBL9VZ4i82FwjX0RQyN8lKRS/tFTGuP7b4mlkk7mDIo266F1JirhkPH0b+3M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144937; h=Content-Type: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=774JTQE9fhFJYG5Yl825DuZO/ePui9QPF2Hyr3EDJC0=; b=bs7zj1x2q8seOoi2cAy+3O1njUYZRrTz11VyRgBxRNAFKA7b+8T0MKlbnP92oR7/q6L4eHNcCPz4WRg2ldi/MSxs/57H6yu4PH0LY+ACYEtczh2Md1JYEFZrcHnpryolvGyonRJXviTVOVjycAXkysy6kFJ73G9OkpvVdVJBuxQ= 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 1789144937554571.7896076119436; Fri, 11 Sep 2026 09:42:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54HK-0002rK-SM; Fri, 11 Sep 2026 12:39:06 -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 1x54HI-0002h1-6t for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:04 -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 1x54HG-0006az-Oc for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:03 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-29-heiQtx9APsquJXVwH4zRNQ-1; Fri, 11 Sep 2026 12:39:00 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6C20919560BC; Fri, 11 Sep 2026 16:38:59 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9C612195608F; Fri, 11 Sep 2026 16:38:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144742; 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=774JTQE9fhFJYG5Yl825DuZO/ePui9QPF2Hyr3EDJC0=; b=P7b1+D3aCA/ZbgTnwk880uA6XEa1YTjzzlybj/DTJxkYNN2mGK3tqQ0fCnlXie9ij1fDYK KVI1Mm2ThqjtEhhiGsBm4oOlsaOwqCDfdOVtXxEz4uHjYIq4/JKcjDXmN5QGxwmM797lbL l9S4bd8u0iOyIZ2qiyC2BWeN/75tyJE= X-MC-Unique: heiQtx9APsquJXVwH4zRNQ-1 X-Mimecast-MFC-AGG-ID: heiQtx9APsquJXVwH4zRNQ_1789144739 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:34:59 +0400 Subject: [PATCH v5 25/62] sev: convert OnOffAuto legacy-vm-type property to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-25-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Zhao Liu , Marcelo Tosatti , kvm@vger.kernel.org X-Developer-Signature: v=1; a=openpgp-sha256; l=2878; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=pBhxWaKYyHBx9ZkVP2bH1ohKdCKTnUGjTGeRf5Z8Jaw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC24mHOWV8nmdnaMmebPMtRlNq2lIP+U4Q9Nr WW+iORi+TeJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuAAKCRDa6OEJdZac 5RugD/99ysEL4XCJKNgrFsFucRle6qBYg/BkI2PXbeTgDUE9ZuoAwumSJVG4rFKZJEHI1cTBebU KwMwAmCMThqWXvNwfghqHlW12u7Rc9hKkmtYb9qhmFZyA5t7k15Hnoc7dg/SSnEWqMwIZfR/fr/ fKILard5zTmO4+/W3CYqloBtlDlWJLMCUCo3WUSfS/H7DSRD9xhu+MjdjlYbdSfL1Vp5OaXxbUb GD0lPFDVw1Lek29wnlb/khZ5AdqvwYLtOVTAZg2guzWdv6iS1W8FCXmh5wRtOaaZ2xogR7FIgti OsBQaR+GD9R/sQ85nAAtjV6Z/EvFMZwwal+0/2yCbBwHg9scOAd6kAfdH0h+CL46IadrPoDjJF4 MLLXawVhXEAWFTPR+fChhcaOM4D9PqHSxTVZaEww8KBa01yk/XmoCzK67R/DmnEwf9wjFIQSh4t RoPuFwIriHzIWH9x0Rr1kHDRiitsASeXmG3DCzPq4fCfYZvG+/2EY050sa/tZdq1MIGQhMCuTcD fJhRPKrSnRegbPHVmR+RdGK92osiL1j8188qavg1NbfQZo68hYAyJh+cXrcUF/RIwUKCPggmnfe ilEEJALJwzyM1doHD7pvP4GsII4dHB6okBh4imdDVF8QY5VQtCsqURN/eDK2XkZ/w+sB8tA8qrU 8a6V2Ui8aBmVzYw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144939314158500 Convert the legacy-vm-type OnOffAuto property from manual visitor-based callbacks to property_add_qapi_enum(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- target/i386/sev.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index cc16c6b07123..b2c7260c80a4 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -20,6 +20,7 @@ #include =20 #include "qapi/error.h" +#include "qapi/qapi-type-infos-common.h" #include "qom/object_interfaces.h" #include "qemu/base64.h" #include "qemu/module.h" @@ -2939,23 +2940,16 @@ sev_guest_set_session_file(Object *obj, const char = *value, Error **errp) SEV_GUEST(obj)->session_file =3D g_strdup(value); } =20 -static void sev_guest_get_legacy_vm_type(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) +static int sev_guest_get_legacy_vm_type(Object *obj, Error **errp) { SevGuestState *sev_guest =3D SEV_GUEST(obj); - OnOffAuto legacy_vm_type =3D sev_guest->legacy_vm_type; - - visit_type_OnOffAuto(v, name, &legacy_vm_type, errp); + return sev_guest->legacy_vm_type; } =20 -static void sev_guest_set_legacy_vm_type(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) +static void sev_guest_set_legacy_vm_type(Object *obj, int value, Error **e= rrp) { SevGuestState *sev_guest =3D SEV_GUEST(obj); - - visit_type_OnOffAuto(v, name, &sev_guest->legacy_vm_type, errp); + sev_guest->legacy_vm_type =3D value; } =20 static void @@ -2981,11 +2975,14 @@ sev_guest_class_init(ObjectClass *oc, const void *d= ata) sev_guest_set_session_file); object_class_property_set_description(oc, "session-file", "guest owners session parameters (encoded with base64)"); - object_class_property_add(oc, "legacy-vm-type", "OnOffAuto", - sev_guest_get_legacy_vm_type, - sev_guest_set_legacy_vm_type, NULL, NULL); - object_class_property_set_description(oc, "legacy-vm-type", - "use legacy VM type to maintain measurement compatibility with= older QEMU or kernel versions."); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "legacy-vm-type", + .description =3D "use legacy VM type to maintain measurement " + "compatibility with older QEMU or kernel versions.", + .qapi_type =3D &OnOffAuto_type_info, + .get =3D sev_guest_get_legacy_vm_type, + .set =3D sev_guest_set_legacy_vm_type, + )); } =20 static void --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145011; cv=none; d=zohomail.com; s=zohoarc; b=MV4u9Sf235v+n1j+U7irO2CSEjasBatYY2ehF5z93QewPcRtz1iG2da/Aoopcl4IEAYIzhJ2GMULPjTuT2uWYWO4zzhpKdHbi//FfxT/8sAA7HjPmfPLZhWbm4mRr631h9F17juRdD/S7WLNgW0yPJpk8j6z8ZUI0zSX2/8ID3M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145011; h=Content-Type: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=7J5rDG5/EYHfs0elw1VWOZICe1bhAnDOgdsBA4H/iS4=; b=XONb6m78Gmlxp79kjAa38FtqHymyUlrGiTwFzd8U2Uk4fPpNVmkIv/J2j6kPEUZK/5cDvOdcMtpVebhm9Rpxfe9avebs7E4+eIFMXLrLPLaOVAXe8ypL3u21qStabvgmc/bWE4BFUud5RvWFx6lxbPrmaMe9nJIcmTRkUJfV9io= 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 1789145011490839.2173906378638; Fri, 11 Sep 2026 09:43:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54HR-0003GR-7h; Fri, 11 Sep 2026 12:39:13 -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 1x54HO-00035L-B9 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:10 -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 1x54HM-0006bq-LM for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:09 -0400 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-475-WM0cybK1PIqR8-Et3PYUqQ-1; Fri, 11 Sep 2026 12:39:04 -0400 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 5FF9318009DF; Fri, 11 Sep 2026 16:39:03 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 071EF1956095; Fri, 11 Sep 2026 16:39:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144747; 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=7J5rDG5/EYHfs0elw1VWOZICe1bhAnDOgdsBA4H/iS4=; b=Luim62mo4MtTwbTpfow2poGuhKRs8kPXDEtnujI3pgN0fj3jn3pMNQNyf/JrEJPLLbm8im gfnsVjp5XhZ/Lj0szwLUdc/2+g9amN24zm8V7htBTz9IRqBsYAk8p60UvrohPAiy+b1Ekr zPNgpQObV9iaPqTH2H6O5IxLMxa2Q9s= X-MC-Unique: WM0cybK1PIqR8-Et3PYUqQ-1 X-Mimecast-MFC-AGG-ID: WM0cybK1PIqR8-Et3PYUqQ_1789144743 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:00 +0400 Subject: [PATCH v5 26/62] whpx: convert OnOffAuto hyperv property to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-26-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pedro Barbuda , Mohamed Mediouni X-Developer-Signature: v=1; a=openpgp-sha256; l=2570; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Mn+NBGd5O+Kz+F0i6rOpINobPupnBt+Vn6TD6qzoVJo=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC25AQpy6aAOvD5xmV5VTDVhCX6v80HKIbZo7 l+xwt3H5giJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuQAKCRDa6OEJdZac 5TXkD/9XnCeNozkvTdilvAz3753rCTe7zei5is5ckMs1BAOMk7deklWXXG07V+AZmpQ2/75AKSt XiaKziPZ/XOYh0LS6aUlMo8hsylZcOmYO4HQ0bZy7FVZu7RM1b795hXwQC6+W/Q+PCixf1Dnoyp 4AcPsxv3GKPk/WQ/wZbLtGC2PSgYZ85WuaW0pz9X1GylOpq5lgma6+eGmwc9HvW4gRw1J+DV7fO R7e9o9f6Y9Bml9yHnthrsTViw1fgFSOOwi4gwWm4s5HVBrZeTIExJxOTWE1fEWeC8BvPh8ZJcHO TgEyxfzaorZfLDuYK3sa5ffhOfKXJwaOt4u6rtg5QEguiJ/+iBDy+ETKevDSA1uuYB8PUOweulm VfhF1SHq8OnA+nnwxOMGJYbMJFIJo7FZMsClNWQeglxjeN8Ggjub1XSLlfqk0IAfgjQtT94pKJb m8eSjebl5aMN4k+BMJmzKzDw2h/0yx04zCePGE799Qgpw1K/Au1Sah5zgkwLiIH1kviz0zOUGF5 GAU9lyllFWX4ylVRzNKEc9BBtxtf9wtgBsjibtP3xa1m9Fhh4OGZmTQv8MFZKO04Av73UEkoF2A uU64pdj3wBsCwBWIhHUFS1qp2efEBDppXkCBUqbRNU9FadwziQ7xy9aulJgHrZqLSHC8/EE1P/9 xPeDW09rgLSWEhA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=marcandre.lureau@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_H2=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: 1789145011842158500 Convert the hyperv OnOffAuto property from manual visitor-based callbacks to property_add_qapi_enum(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- accel/whpx/whpx-common.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c index 247e12db8128..187938c02b51 100644 --- a/accel/whpx/whpx-common.c +++ b/accel/whpx/whpx-common.c @@ -22,6 +22,7 @@ #include "qemu/error-report.h" #include "qapi/error.h" #include "qapi/qapi-types-common.h" +#include "qapi/qapi-type-infos-common.h" #include "qapi/qapi-visit-common.h" #include "migration/blocker.h" #include "accel/accel-cpu-target.h" @@ -470,18 +471,11 @@ static void whpx_set_kernel_irqchip(Object *obj, Visi= tor *v, } } =20 -static void whpx_set_hyperv(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) +static void whpx_set_hyperv(Object *obj, int value, Error **errp) { struct whpx_state *whpx =3D &whpx_global; - OnOffAuto mode; =20 - if (!visit_type_OnOffAuto(v, name, &mode, errp)) { - return; - } - - switch (mode) { + switch (value) { case ON_OFF_AUTO_ON: whpx->hyperv_enlightenments_allowed =3D true; whpx->hyperv_enlightenments_required =3D true; @@ -497,11 +491,7 @@ static void whpx_set_hyperv(Object *obj, Visitor *v, whpx->hyperv_enlightenments_required =3D false; break; default: - /* - * The value was checked in visit_type_OnOffAuto() above. If - * we get here, then something is wrong in QEMU. - */ - abort(); + g_assert_not_reached(); } } =20 @@ -533,11 +523,12 @@ static void whpx_accel_class_init(ObjectClass *oc, co= nst void *data) NULL, NULL); object_class_property_set_description(oc, "kernel-irqchip", "Configure WHPX in-kernel irqchip"); - object_class_property_add(oc, "hyperv", "OnOffAuto", - NULL, whpx_set_hyperv, - NULL, NULL); - object_class_property_set_description(oc, "hyperv", - "Configure Hyper-V enlightenments"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "hyperv", + .description =3D "Configure Hyper-V enlightenments", + .qapi_type =3D &OnOffAuto_type_info, + .set =3D whpx_set_hyperv, + )); =20 whpx_arch_accel_class_init(oc); } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144777; cv=none; d=zohomail.com; s=zohoarc; b=RWcxeY74VWmH3ln56j/AENwZd4Uuxe6gHqgJ5l+rw2nAUmigF6+dY6Wq6r7scw0MT7iYzsvrhLugDAZCHKw0d3x9JQD+ceO6Oc0frryDVvZsCxNT4o13zdABlpP8aUDtnaiXgNWb12EYMQbyZvePUrVsmzDdDBkJDV2F8iHXzow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144777; h=Content-Type: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=sPgRadxNMCR6rJBX+OgeUWY7AcJNlaEQ9KAIrEOu/Xk=; b=UvcTW66E2msl9PdYh8gWioKD8GlQIc1hJ/r0IOJFZv+HkjMtFul++rjg/wis+NxZ7XOns3flCAmH7d84xrU+0Vrgvde4I1bjPFZu6HTiPuOmvTYmYsTeSdamyeZFHQ4vqIt0Uq7sc9C0NFoqzM+KyNJQUXugUj+QeWQeqdzUiTM= 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 1789144776998703.8773023384439; Fri, 11 Sep 2026 09:39:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54HW-0003Y8-H9; Fri, 11 Sep 2026 12:39:18 -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 1x54HU-0003S0-Nn for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:17 -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 1x54HS-0006cq-Qj for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:16 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-646-E1D5NRi0OnmyJEdJbCeMwg-1; Fri, 11 Sep 2026 12:39:09 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 64D271953940; Fri, 11 Sep 2026 16:39:07 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D16D3433; Fri, 11 Sep 2026 16:39:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144754; 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=sPgRadxNMCR6rJBX+OgeUWY7AcJNlaEQ9KAIrEOu/Xk=; b=R3iZTg125XrDn7gyS2aQBoDvTD6a4JC6kd6UgYc7lly3+CWGSGNZa+khmy05h+kXwdi8gZ LYS3rPVwdoE1KcE64qjadHFjnHZvpooX9rLAZHXbaRfDIglQ/UzUqi9636a03+P8gZv4YY 7obF8Uerw3hEU/14BndbI/pNSqwrY5M= X-MC-Unique: E1D5NRi0OnmyJEdJbCeMwg-1 X-Mimecast-MFC-AGG-ID: E1D5NRi0OnmyJEdJbCeMwg_1789144747 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:01 +0400 Subject: [PATCH v5 27/62] whpx: convert OnOffAuto arch properties to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-27-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pedro Barbuda , Mohamed Mediouni X-Developer-Signature: v=1; a=openpgp-sha256; l=6648; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=N+U0XEJTrcuE1wu4Sw7QHz4tc0v3EhcfKlq5/Zejm8c=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC254rTu+gBvR6f9ycu1/BFQYAioKUdzr3zrz MjWlN5OskSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuQAKCRDa6OEJdZac 5ZnZEACUdPnr28Xr22uycK5YdGaxXbBM+PnmJJPyc2YytqdTXLLSjXjxZNckunyNa1bMtKnnWhx rYFqozSFHUugBdMgTBS569XJsl5yXCCOm4zCbAgSCOSWNDiRYFMCMHCf1+J54jk/mHgvYuHhzRs uQ7TQ5RLnzOHimy5QVppTs83BHv4xm1p/ElIanAMp6ebVkznA19gbJRfRZpaMlAhXVVDDDyDqMe 20lqeZievaHfLVFAdUdYVUMcCUIulWBYtfpvBZL2HakOeHiqlZiPImYVkirZORAqHoKXAcExHu4 2dp+eUQXZgVrEJW3Dk/hlvrzUclJ6THBHDmQglvwg/VOVFAETkOY8RIK8BMi+sJDHha38H/RxJv jJk1Uw+n8zycu49Gl3bWmp99NnBj/9koHTG3x4kK1C0iTB0BkTr01NDXXMpEGudjCxH79gBTKL2 I13vYleUb7GvX6xxTd9PYqY1CR501CZ4b1Fts+RkQ/mFIr2/ia0pfWk9/lRTXczKyVILEe5F08D //rmvRw9ZrxbsMqqWd+RrNzPs/96J0Uh1CXT0m/ivXLirSdPEz6wkq9wvQPh2v8NwF4z2T5+/+p Vc4X91f1cXBUDJq7prwiUkUobDmEl1PtKWJWu+HevFwHmtZyxCGlumFQke2klsu8yZbc/bqZUDk Zpj7SkPgHZ7YJ8w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144778723158500 Convert the ignore-unknown-msr, intercept-msr-gp, and ssd OnOffAuto properties from manual visitor-based callbacks to property_add_qapi_enum(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- target/i386/whpx/whpx-all.c | 101 +++++++++++++++-------------------------= ---- 1 file changed, 34 insertions(+), 67 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 113f79afb9ab..64fa389a2f93 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -30,7 +30,7 @@ #include "qemu/error-report.h" #include "qapi/error.h" #include "qapi/qapi-types-common.h" -#include "qapi/qapi-visit-common.h" +#include "qapi/qapi-type-infos-common.h" #include "migration/blocker.h" #include "host-cpu.h" #include "accel/accel-cpu-target.h" @@ -1875,6 +1875,7 @@ void whpx_apply_breakpoints( } } =20 + void whpx_arch_destroy_vcpu(CPUState *cpu) { X86CPU *x86cpu =3D X86_CPU(cpu); @@ -1955,7 +1956,7 @@ static int whpx_handle_hyperv_guestidle(CPUState *cpu) return whpx_handle_halt(cpu); } =20 -static void whpx_vcpu_kick_out_of_hlt(CPUState *cpu)=20 +static void whpx_vcpu_kick_out_of_hlt(CPUState *cpu) { WHV_REGISTER_VALUE reg; whpx_get_reg(cpu, WHvRegisterInternalActivityState, ®); @@ -2059,7 +2060,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) .Vector =3D irq, }; reg_count +=3D 1; - /*=20 + /* * When the Hyper-V APIC is enabled, to get out of HLT we * either have to request an interrupt or manually get it away * from HLT. @@ -2359,7 +2360,7 @@ int whpx_vcpu_run(CPUState *cpu) WHV_REGISTER_VALUE reg_values[3] =3D {0}; WHV_REGISTER_NAME reg_names[3]; UINT32 reg_count; - bool is_known_msr =3D 0;=20 + bool is_known_msr =3D 0; bool raises_gpf =3D false; uint64_t val; =20 @@ -2911,120 +2912,86 @@ void whpx_cpu_instance_init(CPUState *cs) * Partition support */ =20 -static void whpx_set_unknown_msr(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) +static void whpx_set_unknown_msr(Object *obj, int value, Error **errp) { struct whpx_state *whpx =3D &whpx_global; - OnOffAuto mode; =20 - if (!visit_type_OnOffAuto(v, name, &mode, errp)) { - return; - } - - switch (mode) { + switch (value) { case ON_OFF_AUTO_ON: whpx->ignore_unknown_msr =3D true; break; - case ON_OFF_AUTO_OFF: whpx->ignore_unknown_msr =3D false; break; - case ON_OFF_AUTO_AUTO: whpx->ignore_unknown_msr =3D true; break; default: - /* - * The value was checked in visit_type_OnOffAuto() above. If - * we get here, then something is wrong in QEMU. - */ - abort(); + g_assert_not_reached(); } } =20 -static void whpx_set_intercept_msr_gp(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) +static void whpx_set_intercept_msr_gp(Object *obj, int value, Error **errp) { struct whpx_state *whpx =3D &whpx_global; - OnOffAuto mode; =20 - if (!visit_type_OnOffAuto(v, name, &mode, errp)) { - return; - } - - switch (mode) { + switch (value) { case ON_OFF_AUTO_ON: whpx->intercept_msr_gp =3D true; break; - case ON_OFF_AUTO_OFF: whpx->intercept_msr_gp =3D false; break; - case ON_OFF_AUTO_AUTO: whpx->intercept_msr_gp =3D false; break; default: - /* - * The value was checked in visit_type_OnOffAuto() above. If - * we get here, then something is wrong in QEMU. - */ - abort(); + g_assert_not_reached(); } } =20 -static void whpx_set_ssd(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) +static void whpx_set_ssd(Object *obj, int value, Error **errp) { struct whpx_state *whpx =3D &whpx_global; - OnOffAuto mode; =20 - if (!visit_type_OnOffAuto(v, name, &mode, errp)) { - return; - } - - switch (mode) { + switch (value) { case ON_OFF_AUTO_ON: whpx->separate_security_domain =3D true; break; - case ON_OFF_AUTO_OFF: whpx->separate_security_domain =3D false; break; - case ON_OFF_AUTO_AUTO: whpx->separate_security_domain =3D true; break; default: - /* - * The value was checked in visit_type_OnOffAuto() above. If - * we get here, then something is wrong in QEMU. - */ - abort(); + g_assert_not_reached(); } } =20 =20 void whpx_arch_accel_class_init(ObjectClass *oc) { - object_class_property_add(oc, "ignore-unknown-msr", "OnOffAuto", - NULL, whpx_set_unknown_msr, - NULL, NULL); - object_class_property_set_description(oc, "ignore-unknown-msr", - "Configure unknown MSR behavior"); - object_class_property_add(oc, "intercept-msr-gp", "OnOffAuto", - NULL, whpx_set_intercept_msr_gp, - NULL, NULL); - object_class_property_set_description(oc, "intercept-msr-gp", - "Intercept #GP to log erroring MSR accesses."); - object_class_property_add(oc, "ssd", "OnOffAuto", - NULL, whpx_set_ssd, - NULL, NULL); - object_class_property_set_description(oc, "ssd", - "Separate security domain"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "ignore-unknown-msr", + .description =3D "Configure unknown MSR behavior", + .qapi_type =3D &OnOffAuto_type_info, + .set =3D whpx_set_unknown_msr, + )); + + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "intercept-msr-gp", + .description =3D "Intercept #GP to log erroring MSR accesses.", + .qapi_type =3D &OnOffAuto_type_info, + .set =3D whpx_set_intercept_msr_gp, + )); + + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "ssd", + .description =3D "Separate security domain", + .qapi_type =3D &OnOffAuto_type_info, + .set =3D whpx_set_ssd, + )); } =20 int whpx_accel_init(AccelState *as, MachineState *ms) --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144895; cv=none; d=zohomail.com; s=zohoarc; b=eiAhXhqZrJKfbvp+N9TfGT+dh+LKnB9OWJjevw8ip9L0wk5dr0/EUs/xyROsOss44y2M9lCbWUY2g78flEGGaxaigqvJOo/8qu6zyK605FfE8tFhHHV/y3rugUsYiy1Xn5bBEGuJ/Jp+EXN+rpjRsUClu/AiiJ0rt+att0C5fq4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144895; h=Content-Type: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=QDNDYwMd+sicJrNeQLwCkPpcMo5x0mg7HS77Hu2tB3c=; b=HUwqGK0MDzFZfa0b8psPxElrkSVFr4u3TNjsoNIlaBjP1mE5BRxjtcJ9mN/IvgQHGU/0/4IjJRTCZ0PZg7NwZhsZbthemzZqR1VGMpVu1nGZleHOyPeKaBVyiZArY54cs6cbPIAsiMXjFWBmV3FIuj8lp5o6bSrtFcHIdMxMX5A= 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 1789144895456265.5535832139353; Fri, 11 Sep 2026 09:41:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54HZ-0003iJ-6g; Fri, 11 Sep 2026 12:39:21 -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 1x54HV-0003Wx-JF for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:17 -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 1x54HU-0006d8-2z for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:17 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-214-9De6hxvcP7-d4kD-hUwgTA-1; Fri, 11 Sep 2026 12:39:12 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E517C19539B2; Fri, 11 Sep 2026 16:39:10 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1925B180034C; Fri, 11 Sep 2026 16:39:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144755; 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=QDNDYwMd+sicJrNeQLwCkPpcMo5x0mg7HS77Hu2tB3c=; b=KCoxxAUQRh8VSB+gAZvtstwwfGP2Q81axQZm0jaL+ruxRpg0LAYEBPd3HZgp57I129tW/P tzwxObEBo2FFSNeCyBR/po9ZeXmadZwwMjKUbSdmz2jBUGUdJ0mlbxIWZP86xtXq+lHx1B fOZ5ZsAD2RZY/EAikcLkZCCIuPDpRP4= X-MC-Unique: 9De6hxvcP7-d4kD-hUwgTA-1 X-Mimecast-MFC-AGG-ID: 9De6hxvcP7-d4kD-hUwgTA_1789144751 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:02 +0400 Subject: [PATCH v5 28/62] accel/kvm: convert OnOffSplit property to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-28-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org X-Developer-Signature: v=1; a=openpgp-sha256; l=2729; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=zjd5b/7UtrJcexJ7ZEgc0BXA9ixM3XyWJFnBq9YLcUU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC25CxJ4xEHJLvxJhaHYnIycAp0qraAcc6cI3 Xcpn82CiXKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuQAKCRDa6OEJdZac 5RH0EACf1M4aVMk9P2eEktkHlLqlaQdRuqWYVtFHmfbNFnL1vO/wZ2M4Aba/4ygc+MBbDEOJdds 3/28LzWiL+AMdOazOalSYfBFnEWvDFBQEx+K2pQIgjsRA2q1nTXzgWZT1MfKWDbHX9wYmpUpuYx 38AHMRr59mtrGBIAeB/IQa42bRW3nDghRn50xJ1HjLkJwA/R4juIexRubqEUUcl6GVWRTHaI5NX WgNwYZisHed93SC4IO+o7Hl2m6coThM8I4qOoZH8S/+jlJ4n3KnBnh0BMlHTepQVqG7BsVWfG1d 1TLJ4lZjru+DQslA1k9KBJa8UVPTwaocKK1RqtbbxI911470wG0+L8byw1MprPgiTTjX1I9Ngjh mmg9aYhmOTi8F4cOVTIkdsh/TXc0rQXqb3ZvjdG75i7qCmAk/FuQhrRwtVzXj2APTom9eF3qtvG e4emnnftnFg84kywvXDqGkynVylv/0TEuoBQgA9VUyIMj1KKNZl6sE6n+vD9A4F7HzNjqaTwV2K 5OBrC81Ad69hAAKRtIzSMKF2VFty8K6rs+6ojxLHdRTOP5mB6dNHpBx8mALrSqeAc1/wBNC9Ix9 mTsyxhtmTRg9pqoFf2B6dlyihKa9vVpZIr1N6m7+GJxQs7NByEKclIiHCJJXt4zUT52+tH1BPJw 3eV2vav+zPpw8xw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144897074158500 Convert the OnOffSplit property from manual visitor-based callbacks to property_add_qapi_enum(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- accel/kvm/kvm-all.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 83cbd120a847..e2cfbcf44046 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -46,6 +46,7 @@ #include "qapi/visitor.h" #include "qapi/qapi-types-common.h" #include "qapi/qapi-visit-common.h" +#include "qapi/qapi-type-infos-common.h" #include "system/reset.h" #include "qemu/guest-random.h" #include "system/hw_accel.h" @@ -4126,22 +4127,17 @@ static void kvm_set_kvm_shadow_mem(Object *obj, Vis= itor *v, s->kvm_shadow_mem =3D value; } =20 -static void kvm_set_kernel_irqchip(Object *obj, Visitor *v, - const char *name, void *opaque, +static void kvm_set_kernel_irqchip(Object *obj, int value, Error **errp) { KVMState *s =3D KVM_STATE(obj); - OnOffSplit mode; =20 if (s->fd !=3D -1) { error_setg(errp, "Cannot set properties after the accelerator has = been initialized"); return; } =20 - if (!visit_type_OnOffSplit(v, name, &mode, errp)) { - return; - } - switch (mode) { + switch (value) { case ON_OFF_SPLIT_ON: s->kernel_irqchip_allowed =3D true; s->kernel_irqchip_required =3D true; @@ -4158,10 +4154,7 @@ static void kvm_set_kernel_irqchip(Object *obj, Visi= tor *v, s->kernel_irqchip_split =3D ON_OFF_AUTO_ON; break; default: - /* The value was checked in visit_type_OnOffSplit() above. If - * we get here, then something is wrong in QEMU. - */ - abort(); + g_assert_not_reached(); } } =20 @@ -4278,11 +4271,12 @@ static void kvm_accel_class_init(ObjectClass *oc, c= onst void *data) ac->has_memory =3D kvm_accel_has_memory; ac->allowed =3D &kvm_allowed; =20 - object_class_property_add(oc, "kernel-irqchip", "on|off|split", - NULL, kvm_set_kernel_irqchip, - NULL, NULL); - object_class_property_set_description(oc, "kernel-irqchip", - "Configure KVM in-kernel irqchip"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "kernel-irqchip", + .qapi_type =3D &OnOffSplit_type_info, + .set =3D kvm_set_kernel_irqchip, + .description =3D "Configure KVM in-kernel irqchip", + )); =20 object_class_property_add(oc, "kvm-shadow-mem", "int", kvm_get_kvm_shadow_mem, kvm_set_kvm_shadow_mem, --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144788; cv=none; d=zohomail.com; s=zohoarc; b=ZTuWgQgcNHtU4s+Qq1fD0AsRGDSkizMRwQmR/d/bltsRmR2qSyVjzZw0SdEeytUezWWpl4nvdaFaDHu7lfmhMr4a9gYiS7a0W9ulG66Xx79/Eh8RBNiA1PWQvij6jFgG0GohoiUz5jaEeYkrwv54wJ98KWxMyl/F+oeqGKNQxpU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144788; h=Content-Type: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=BgmINsOfsOg8avUK0DI3pyw4m6ampH+tq1kvfcER51g=; b=E5XLXALtPfDxWRpq0Lny1nAmPT/QVVSkwmXlw4p7c4Awdw9sVUYb+PCPM4Z/8EiCk10sSiGsxZVlpBBn1RBc6ScmInHyjQZdcHwhm7xShaxBAql6LwE+58rzgld4hZXPn9Lol09qADllaJt9Kz6G2ff/Wm053dFe6NnRNsQ1MO0= 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 1789144788811224.67732702809667; Fri, 11 Sep 2026 09:39:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Hb-0003n7-BN; Fri, 11 Sep 2026 12:39:23 -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 1x54HZ-0003kL-Qs for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:21 -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 1x54HY-0006eJ-6X for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:21 -0400 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-680-dnq8je54PB2dsVgNJhC7Bg-1; Fri, 11 Sep 2026 12:39:16 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 950951800671; Fri, 11 Sep 2026 16:39:14 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 45504195608F; Fri, 11 Sep 2026 16:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144759; 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=BgmINsOfsOg8avUK0DI3pyw4m6ampH+tq1kvfcER51g=; b=K3GTM18xcvIG1hKdNfD16AZgLHGkcbcbHl5oaCYEZGECIiX52A/4zuzfUPFjZInQGzfqK4 sbGaQYB09OOdjfQiCp4RP5el1MThWPDltGl4aCKMRJDtmhUWNVP99xfIh94GExIJnZoPk1 GonHFRPCfho7YGpRv4XXiwD4Ov77ddQ= X-MC-Unique: dnq8je54PB2dsVgNJhC7Bg-1 X-Mimecast-MFC-AGG-ID: dnq8je54PB2dsVgNJhC7Bg_1789144755 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:03 +0400 Subject: [PATCH v5 29/62] whpx: convert OnOffSplit property to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-29-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pedro Barbuda , Mohamed Mediouni X-Developer-Signature: v=1; a=openpgp-sha256; l=2351; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=65zE86SlpLyxllbMtWWTTzs6HGNGESGG/p9K0JvZjvc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC25s1fgeJxREGDJLbqxKzdTHOLfwdwbZ9q5i Or2N+r8aPCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuQAKCRDa6OEJdZac 5Xk3D/4ryGv9rx03Qbh2ijMmJDadeAn1KByzyeT+DZwhbf/1KTRk9s5TvWBueRYxPZBOShJCBcC xSBGMTpQ4wcwXy2B5oZj5MhZ4ioF962NOmwQl0J5jyFtDFwwWP/wKBzAJL/H3NbMLYKB+ckEaS9 B7DscwIDeaenpyk4umK2BEVgCZsjTmncYMCrD0z0AB8J0FtFBfUFjB/f7CzVa1doEnWy6SnE4b/ vSPsrdkyP6MP+VB8QPFIqD8MPjFUHxdsJ7svh+nIT0ufeePmIOsGyhB2T+qv7XKPlHVo/40aH5z nPuG1YXPYyGRGK3HWPgRXBEVH7sQzJWPYCo81rWRRkd91WVEig70q9yYsO4dh6KtFRNGQznUK9T v0r4ffG1CD/1jlLmcTrCt8CPeqJPm9PGLC7od6nPpIY252E9JdOmwlEEJSeW9YQ0BGojYK2xAuj VrKc0kbBtRb3TrcgVC1lnjYzIlBmDCec0/4/VU7F9QoTmS/aWxzvU68vXrHnp4WOtx1x0c/BMsT Tyg5tJQ6s1+GrCtienYC+Wn/w7yeKVz8ni0OkpIYadp9PNDoy9xNAwP5LImPXFzY2c/SSqZ8jEx RIA7kJ4JOL0DU6k+kcaNEIlP+BgkAUrWye0lidftRy60pNppCM2agnng9xVWcgRLA2V2gxn5VaR vJ9NBsN/gPyLcjw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=marcandre.lureau@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, 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: 1789144790668158500 Convert the OnOffSplit property from manual visitor-based callbacks to property_add_qapi_enum(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- accel/whpx/whpx-common.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c index 187938c02b51..5d4b405e56d3 100644 --- a/accel/whpx/whpx-common.c +++ b/accel/whpx/whpx-common.c @@ -434,18 +434,12 @@ error: return false; } =20 -static void whpx_set_kernel_irqchip(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) +static void whpx_set_kernel_irqchip(Object *obj, int value, + Error **errp) { struct whpx_state *whpx =3D &whpx_global; - OnOffSplit mode; =20 - if (!visit_type_OnOffSplit(v, name, &mode, errp)) { - return; - } - - switch (mode) { + switch (value) { case ON_OFF_SPLIT_ON: whpx->kernel_irqchip_allowed =3D true; whpx->kernel_irqchip_required =3D true; @@ -463,11 +457,7 @@ static void whpx_set_kernel_irqchip(Object *obj, Visit= or *v, break; =20 default: - /* - * The value was checked in visit_type_OnOffSplit() above. If - * we get here, then something is wrong in QEMU. - */ - abort(); + g_assert_not_reached(); } } =20 @@ -518,11 +508,12 @@ static void whpx_accel_class_init(ObjectClass *oc, co= nst void *data) ac->pre_resume_vm =3D whpx_pre_resume_vm; ac->allowed =3D &whpx_allowed; =20 - object_class_property_add(oc, "kernel-irqchip", "on|off|split", - NULL, whpx_set_kernel_irqchip, - NULL, NULL); - object_class_property_set_description(oc, "kernel-irqchip", - "Configure WHPX in-kernel irqchip"); + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "kernel-irqchip", + .qapi_type =3D &OnOffSplit_type_info, + .set =3D whpx_set_kernel_irqchip, + .description =3D "Configure WHPX in-kernel irqchip", + )); object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( .name =3D "hyperv", .description =3D "Configure Hyper-V enlightenments", --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144807; cv=none; d=zohomail.com; s=zohoarc; b=EiHHQpHq3XhUY4ypGHiqaYKkp1vH56ZXDKQSSl+EfJyzXC9COkZovFOSueYmckfTjoa4a6Q9dhStXBH8a7nKLS5xI/2gR5zoh6/tc0+Mnpjnh0IYtkCC/juq3o5LRwApgUi7u7VPedyD5naE/kUxmLtjPcRWeoH5iFrAz7JWZ14= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144807; h=Content-Type: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=nE4wE7Vr00ggZDuc6y9TMHo+nuujfU5xQYCn00bJGmw=; b=L0XQJ0czDTtXmDnnhgqBWCANfpfglKdxWVLwVkUXNKmrJSdRS6vnMljk9ypsDkSKsBT3+NViodCOrb4Vul9zS+28aiVCeL/RNnJJpthYn6zryhDQo1Xl0gj1Ja6OOuTceDbqybi3OkwSfHZUNmdCWxnt1drqFFc6J8kj+Nz8/OY= 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 1789144807446392.0074752637096; Fri, 11 Sep 2026 09:40:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Hf-000470-JE; Fri, 11 Sep 2026 12:39:27 -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 1x54Hc-0003vP-U6 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:24 -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 1x54Hb-0006ep-JB for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:24 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-481-Af2T2tHrPxuaJ2KZ8obSOw-1; Fri, 11 Sep 2026 12:39:19 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5B91D1954B27; Fri, 11 Sep 2026 16:39:18 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5F639300022B; Fri, 11 Sep 2026 16:39:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144762; 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=nE4wE7Vr00ggZDuc6y9TMHo+nuujfU5xQYCn00bJGmw=; b=VtUMGeISSi17nDDh8nRFJnKyTe6dxDrErz0NRRJg6tdSwurB8AiOWxym1MGErZYMvihWzj szFVSyGlMHhodoTc+tcEoMr3PMyEQws3AdbL5n4Yh7TMXOyNimmz014EDWZ+z+ntbJGS60 dNK7fgiJ4VIcLip8j22h2QigyACmrRA= X-MC-Unique: Af2T2tHrPxuaJ2KZ8obSOw-1 X-Mimecast-MFC-AGG-ID: Af2T2tHrPxuaJ2KZ8obSOw_1789144758 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:04 +0400 Subject: [PATCH v5 30/62] hw/ppc/spapr_caps: fix property type name MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-30-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Nicholas Piggin , Harsh Prateek Bora , Amit Machhiwal , qemu-ppc@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=770; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=yjDU09QQD1RdjsAGx182K+QsfEuGKmB07G1tsWr4n9Q=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC25UOYVQhAywYVMNDDp0qESogZl9E1jtrh0g 3iyF25JaoKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuQAKCRDa6OEJdZac 5eTSEACxKVsQL84XGukh6qc5hhGsDhdy5EHiXQSj1eEMnvOF6Od5T7oZQEBYtvjqKa3lo/Tq3PU PS7sPio3ccT5u7SP0VckfPqIQv1LSu6V1090n6LgsTrDNYC7AwXi+5byf3nE8qTuriL5IMVvPXv gWhl7RfknoLbGtQDTZU9cMNwG5RCJm0Qtmx/rZnbHIu07Ei8h//Fd3xnqiQ5ce893LAVtHrMNOK yWgTWre6Ec6J6dQsMDiiJ5ESkDCJM6uOhq6nZIzB7dJwuRkj9DysTEOqlZGUnRd+EkjZF7qKB8W ba8dRkC29gVlOcan7hJXhfdgiyxrChwP8BBKahXZElgnbJY+ZnhIct9Z6UzGoynRM9cV1oD83Eq noe7OKlx11GlcujZOi+BtmpjtFEOXe9Quf5fH31F8kf8qEEr9eUczT8eB2kUQh8dcoK3mv/z8T+ DiBkiNpDVarTmV+5rc4HcwtGGJDZ9/NmD61ujdLLtYSzDuSTRQucEj9zWe7fiw6sW/n55f3ueGw Gt/B4SwWLUkwo5RZEaXLEW3nHQF5CUGuHWUgYxDSrkuuCl/2db+ZSNLTwcVh63T7Wf5zzWX/pL4 HOcLxpNq2LxKZC2Zs/CjVR4aQ7jD4RJSPx/7mxLEPNDuuC7F+KgquBJ2/AhpthwvBikdYodckov HECnpyCH+pinRpA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144808406158500 The getter/setter use visit_type_size(). Fix the type name mismatch. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Amit Machhiwal --- hw/ppc/spapr_caps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index 0d659e9b0251..103b17364feb 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -784,7 +784,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_HPT_MAXPAGESIZE, .get =3D spapr_cap_get_pagesize, .set =3D spapr_cap_set_pagesize, - .type =3D "int", + .type =3D "size", .apply =3D cap_hpt_maxpagesize_apply, .cpu_apply =3D cap_hpt_maxpagesize_cpu_apply, }, --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145053; cv=none; d=zohomail.com; s=zohoarc; b=GUScZ/QOmAqiQUkgV9YBcfnHcHH2lhhTQq/FPPKo5knV4jXqdUFcrlP96A5YaCpnVHF2o4QT8OFYhPWGYuLW3LcENEjl+5B9iNs1XDy5XfwQO2k36PMcymLghSfBkEiV+UEm0NuX42jiazEq/n+mXoP1qp/GGzEfAcpTzY87du0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145053; h=Content-Type: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=L4daiw1O0y8MP6wCqPmdkQ+ZNA0FZIDSAxSHuGH4+YE=; b=C6Y8vZL5UYfYa75rbjRXMRZSB/5/1Ru6GvN6OpwvVCc6hv5mxNQS/WIwuObO05aw1WuDdjVnlaEBdqwClMoqUSp7IQOnj5blIp5jGKFjuXXeP8PELTbdd7GpaBvZ6sw3rcq/1OJpoy0o12dnOvB4xh7YfBMorvaSGN7PTaJW4T4= 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 1789145053980911.2166829527524; Fri, 11 Sep 2026 09:44:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Hk-0004Ry-4V; Fri, 11 Sep 2026 12:39:32 -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 1x54Hh-0004Ks-61 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:29 -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 1x54Hf-0006fp-Fb for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:28 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-296-WnAO2mu8NHubAGQjb0rwbw-1; Fri, 11 Sep 2026 12:39:23 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D7499195394C; Fri, 11 Sep 2026 16:39:21 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 098CF300022B; Fri, 11 Sep 2026 16:39:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144766; 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=L4daiw1O0y8MP6wCqPmdkQ+ZNA0FZIDSAxSHuGH4+YE=; b=QHlp6fhlwzIuxWvlp8RxUT5CI8p3xyrx+Tux6GF/hmHDngvASHcSt+fCa2AcRu3gKJMmhr DCO0r56YmMaKoHITb9WdhKdX7mtYFl/Etl2rf3JX2auH3fPiP2L3DhCI7xPOM4HyptQTqF mD8uLvsbH5iVPPDhGqkRITxWvLqaujk= X-MC-Unique: WnAO2mu8NHubAGQjb0rwbw-1 X-Mimecast-MFC-AGG-ID: WnAO2mu8NHubAGQjb0rwbw_1789144762 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:05 +0400 Subject: [PATCH v5 31/62] ppc/spapr-caps: convert to QAPI-aware property registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-31-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Nicholas Piggin , Harsh Prateek Bora , Amit Machhiwal , qemu-ppc@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=6855; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=4IR84cfS3T5/36NZwT4mSDXVr9c1uLdFg9iOjWPr1NM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC25MbEU7a6gcypaVVYQOXtyewKMRR2jrq9Gb mEDXZE5AHmJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuQAKCRDa6OEJdZac 5cDZD/9TFHL1/UtotGgqtY472mMM7hWYg2qaZEl6wnZAlXsgUWMYclGEzP/fT4kB0+51RRcXil6 D7ozqN/BZnijybgdeqVF3U/I7Nw3Kzdda1cyyZ7eL1JDIWtgcmqEG6mRuN3maYRWhN4Izdn5zWl wojzAnffTK11Lg7jQ51vdpXuqckDrNONlyNlYl/6tS6r6nbinLrIWf14V/OcJmLn7GEQc1R9sgE k5jhlR+bUXEJdGpoqsvffSQxIbSGsegB2ZzuugHTVQ6lE1sl7K8EFhjo3omLIIr8CgFxeGAQ2FN j+xQxTnZLP7RgcOacEC0/riq7g9s6C5UFBzOmkMaiVm5z8ys032lR1F6/pJHr4CrVvtR1UzL6QJ ynLQDYY20FXA4Z0kHuQEoBd3877pnUzG8T2WUS+c4QEBZ8iwp/Y11+tE+yRB95BpBtwZNUU/3bx UBQswPjHzWS8Emyder+qlDmr/iH7DsdH2jYEY11OiIhZwtor7b4a3acyIc5/mai3mwgF20NM3ZA NGVLL3JGe9or+yfwjVQnZMKo5KBkVMJGqNJ0+5CRz6yJJj+HX+9QJxqwKH1KTKueQXYABjlnXqu jYtgUJNHQnxgdN8/BvKrO1DGOvGZF+BgC3LsLcqDI6ATY4op/+caM3897X/xT1hFQRsE03BUS9D 7+iJGh+vZYezioQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789145056020158500 Replace the type string in SpaprCapabilityInfo with a QAPITypeInfo pointer and switch spapr_caps_add_properties() from object_class_property_add() to object_class_property_add_qapi(). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Amit Machhiwal --- hw/ppc/spapr_caps.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index 103b17364feb..e622c79eb52a 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -24,6 +24,7 @@ =20 #include "qemu/osdep.h" #include "qemu/error-report.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/error.h" #include "qapi/visitor.h" #include "system/hw_accel.h" @@ -59,7 +60,7 @@ typedef struct SpaprCapabilityInfo { /* Getter and Setter Function Pointers */ ObjectPropertyAccessor *get; ObjectPropertyAccessor *set; - const char *type; + const QAPITypeInfo *type; /* Possible values if this is a custom string type */ SpaprCapPossible *possible; /* Make sure the virtual hardware can support this capability */ @@ -725,7 +726,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_HTM, .get =3D spapr_cap_get_bool, .set =3D spapr_cap_set_bool, - .type =3D "bool", + .type =3D &bool_type_info, .apply =3D cap_htm_apply, }, [SPAPR_CAP_VSX] =3D { @@ -734,7 +735,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_VSX, .get =3D spapr_cap_get_bool, .set =3D spapr_cap_set_bool, - .type =3D "bool", + .type =3D &bool_type_info, .apply =3D cap_vsx_apply, }, [SPAPR_CAP_DFP] =3D { @@ -743,7 +744,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_DFP, .get =3D spapr_cap_get_bool, .set =3D spapr_cap_set_bool, - .type =3D "bool", + .type =3D &bool_type_info, .apply =3D cap_dfp_apply, }, [SPAPR_CAP_CFPC] =3D { @@ -752,7 +753,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_CFPC, .get =3D spapr_cap_get_string, .set =3D spapr_cap_set_string, - .type =3D "string", + .type =3D &str_type_info, .possible =3D &cap_cfpc_possible, .apply =3D cap_safe_cache_apply, }, @@ -762,7 +763,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_SBBC, .get =3D spapr_cap_get_string, .set =3D spapr_cap_set_string, - .type =3D "string", + .type =3D &str_type_info, .possible =3D &cap_sbbc_possible, .apply =3D cap_safe_bounds_check_apply, }, @@ -774,7 +775,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_IBS, .get =3D spapr_cap_get_string, .set =3D spapr_cap_set_string, - .type =3D "string", + .type =3D &str_type_info, .possible =3D &cap_ibs_possible, .apply =3D cap_safe_indirect_branch_apply, }, @@ -784,7 +785,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_HPT_MAXPAGESIZE, .get =3D spapr_cap_get_pagesize, .set =3D spapr_cap_set_pagesize, - .type =3D "size", + .type =3D &size_type_info, .apply =3D cap_hpt_maxpagesize_apply, .cpu_apply =3D cap_hpt_maxpagesize_cpu_apply, }, @@ -794,7 +795,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_NESTED_KVM_HV, .get =3D spapr_cap_get_bool, .set =3D spapr_cap_set_bool, - .type =3D "bool", + .type =3D &bool_type_info, .apply =3D cap_nested_kvm_hv_apply, }, [SPAPR_CAP_NESTED_PAPR] =3D { @@ -803,7 +804,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_NESTED_PAPR, .get =3D spapr_cap_get_bool, .set =3D spapr_cap_set_bool, - .type =3D "bool", + .type =3D &bool_type_info, .apply =3D cap_nested_papr_apply, }, [SPAPR_CAP_LARGE_DECREMENTER] =3D { @@ -812,7 +813,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_LARGE_DECREMENTER, .get =3D spapr_cap_get_bool, .set =3D spapr_cap_set_bool, - .type =3D "bool", + .type =3D &bool_type_info, .apply =3D cap_large_decr_apply, .cpu_apply =3D cap_large_decr_cpu_apply, }, @@ -822,7 +823,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_CCF_ASSIST, .get =3D spapr_cap_get_bool, .set =3D spapr_cap_set_bool, - .type =3D "bool", + .type =3D &bool_type_info, .apply =3D cap_ccf_assist_apply, }, [SPAPR_CAP_FWNMI] =3D { @@ -831,7 +832,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_FWNMI, .get =3D spapr_cap_get_bool, .set =3D spapr_cap_set_bool, - .type =3D "bool", + .type =3D &bool_type_info, .apply =3D cap_fwnmi_apply, }, [SPAPR_CAP_RPT_INVALIDATE] =3D { @@ -840,7 +841,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_RPT_INVALIDATE, .get =3D spapr_cap_get_bool, .set =3D spapr_cap_set_bool, - .type =3D "bool", + .type =3D &bool_type_info, .apply =3D cap_rpt_invalidate_apply, }, [SPAPR_CAP_AIL_MODE_3] =3D { @@ -849,7 +850,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_AIL_MODE_3, .get =3D spapr_cap_get_bool, .set =3D spapr_cap_set_bool, - .type =3D "bool", + .type =3D &bool_type_info, .apply =3D cap_ail_mode_3_apply, }, [SPAPR_CAP_DAWR1] =3D { @@ -858,7 +859,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] =3D= { .index =3D SPAPR_CAP_DAWR1, .get =3D spapr_cap_get_bool, .set =3D spapr_cap_set_bool, - .type =3D "bool", + .type =3D &bool_type_info, .apply =3D cap_dawr1_apply, }, }; @@ -1069,9 +1070,9 @@ void spapr_caps_add_properties(SpaprMachineClass *smc) g_autofree char *name =3D g_strdup_printf("cap-%s", cap->name); g_autofree char *desc =3D g_strdup(cap->description); =20 - object_class_property_add(klass, name, cap->type, - cap->get, cap->set, - NULL, cap); + object_class_property_add_qapi(klass, name, cap->type, + cap->get, cap->set, + NULL, cap); =20 object_class_property_set_description(klass, name, desc); } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145155; cv=none; d=zohomail.com; s=zohoarc; b=NWwJi8w2ejnmHnBXcIEyCHO9CSDoCN1L234TY5c1jff7EMB9yYY49rJP43WFeeFg6agpniuzFQZDrq+xJuaojd/jqGkRa4l8avpEQDM0Ve+9nAJaenGWLibOv/KlfpOXl48qVApjrmmrg71jpVTqMCzDC8YAMchSZnBowvGdkb8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145155; h=Content-Type: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=ToLJhQPMRz6Q1MKU2Z1nPk0uHGyHQ2rzehLqFuMaRso=; b=YFtNYIQ1vkBUy2dNh9UUGM/6VyRaE3mcCGMDokfPJFE3/gKryCMHD2/3Uml7XDk4JrIPX/+Wh1oicyZXHXIfCUj4ePtcutoTUaN41popuEyQrCi3iS/lSd+9i0ErbYG7k0vfGFa1sxkr7w+/JAgOOcTaia99ehGv3Fm4MHjjrTI= 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 1789145155735188.55636439330237; Fri, 11 Sep 2026 09:45:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Hl-0004Yf-3h; Fri, 11 Sep 2026 12:39:33 -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 1x54Hi-0004Nh-CE for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:30 -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 1x54Hh-0006gG-0k for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:30 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-14-tEmOfhpsNlSEzQUaGzNDAw-1; Fri, 11 Sep 2026 12:39:27 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7CCC619539B0; Fri, 11 Sep 2026 16:39:25 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 77AE9180034C; Fri, 11 Sep 2026 16:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144768; 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=ToLJhQPMRz6Q1MKU2Z1nPk0uHGyHQ2rzehLqFuMaRso=; b=Hu2XXKYzuQ8FB+IJSgi/wGemc0UpTRi3NWOj7X8XWg3g1VHLZppRRaqqw6pJof+lfb9pfD w5DH2SQhvmPFOjGMBySRfvxyG4n8gXJ4vozzPp+DW8d27Mwo4+23e4n3xOs6B4i2kExYWc vJWnrgVFMLtuoIcEJ7DmbvFvuXEkOaE= X-MC-Unique: tEmOfhpsNlSEzQUaGzNDAw-1 X-Mimecast-MFC-AGG-ID: tEmOfhpsNlSEzQUaGzNDAw_1789144765 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:06 +0400 Subject: [PATCH v5 32/62] net/colo-compare: fix compare_timeout setter visitor type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-32-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Zhang Chen , Li Zhijian , Jason Wang X-Developer-Signature: v=1; a=openpgp-sha256; l=932; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=rEFhsqDOs12Ay0m8ssGFoc+f7fZzJv5d/VfvFSaHnOw=; b=kA0DAAoB2ujhCXWWnOUByyZiAGqkLbmiiI9ArRMJfGGcCRU24fzwyHlxwJAHuamfXi1jQm66Y YkCMwQAAQoAHRYhBIepvZM/h8YG0nb2Ldro4Ql1lpzlBQJqpC25AAoJENro4Ql1lpzl8QcP/1WD ugl39BJG8jYTslnmM8DsUWSH9KTbeT68Mg8Lci4omvAfF7hqRA7nAq/yEriLyeSwh71z2WP1E0k SeQ9+HIRzqqs9/nUpjm/8W7whwtaKxxw7lKz9ZUTIdnwokkWL0THVg3bXR+vevIc5HPt9Y3lF6C AeXoR+Yybl08DyCB13mv2L2iFRA6dPfOS3GGcyI65Za1y0YmB5T5LQO3wQLyza8QW7lnLSKK4W+ gy8SxVBZZbxR0lKrDk5/8Ttp6p6AzubJKOorGWje6H8aNtNKMBrVwSkNfRq3deud7fOh43fszS0 J5W4I3UMwtjQNxUntdnXWbSNBCfSkTb1yeOgcGtUtXDvKKzBvKn3E5/JvcPsE01O95Ynv3fcm9j gPlVdyCcrWCr1UJEIiQ64SMjzbh9MuDGt97vklEMJYALm4rpx6f1cqF9/i/aF7OsKe1RPcI8OQa Wiq4yCVrS8DcydMvxTf4najYrNiznOBlsrmUOyF07xzXJQYTesFCfbSffND5vk0LABTZxG/gQcy DY/M0Im9+2ikE7tYRi3/Pg4rt5zYkKmneiGU5QAdkLvphxKKIn7nqqSS6eN9UpmG88DMVQ8sEwZ FfnRIxsg+C2hHw5IrvewBigfbaZV5sxZdPnccs2vJY6fy8YJHDR4EjSfeXO/bYp0hGGL88AV+ke HzR7z X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789145156607158500 The setter was using visit_type_uint32, truncating the value, while the getter and typename use uint64. Use visit_type_uint64 consistently. Fixes: 0c4266ef2690 ("net/colo-compare.c: Fix compare_timeout format issue") Signed-off-by: Marc-Andr=C3=A9 Lureau --- net/colo-compare.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 5986fb1e8800..948a2f7f9e4b 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -1075,9 +1075,9 @@ static void compare_set_timeout(Object *obj, Visitor = *v, Error **errp) { CompareState *s =3D COLO_COMPARE(obj); - uint32_t value; + uint64_t value; =20 - if (!visit_type_uint32(v, name, &value, errp)) { + if (!visit_type_uint64(v, name, &value, errp)) { return; } if (!value) { --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144873; cv=none; d=zohomail.com; s=zohoarc; b=iMfwwDz08txtFvHhG9Ki6Mm5LwaLha6OkVlndpm5WAypp+l79AOGrJr6DhoCKZwAOpH5vBk4mUJmke/ewx9RmHQFN6Jj5nk+uLx6O4z3PUc2ghOSkiy2/FbLLp7nSVnPdWKkfZiQ0R6lrZEKPLMWiAtNylGuni5Q921TaOQhT9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144873; h=Content-Type: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=Emw5udw/hAqZHIGzxhMNpVnsgLj93r4j1DXVLXU5PSI=; b=krSe88fcHqO46mRh5cr8zK/s3R45ZQyfdVjKkogjvZeLpouar+N6CcEwx3NYypTQy4jeAMjK1/M+VMyC57rVxXD39Mst1fVD3YZx1Py9+FC+olAylqa9zqSVt7NI0AdRDKBy+YNbK/r7dwwy1hObOiJELNL+5YyUQFNH041ehCo= 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 1789144873011855.5351001469129; Fri, 11 Sep 2026 09:41:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Hv-00052C-SR; Fri, 11 Sep 2026 12:39:45 -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 1x54Ht-0004yR-RV for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:42 -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 1x54Hs-0006jP-9Y for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:41 -0400 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-351-DjqXfDi6OwOL5NwFBHu7Vw-1; Fri, 11 Sep 2026 12:39:30 -0400 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 CD1EF18009C6; Fri, 11 Sep 2026 16:39:28 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D086B1956095; Fri, 11 Sep 2026 16:39:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144779; 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=Emw5udw/hAqZHIGzxhMNpVnsgLj93r4j1DXVLXU5PSI=; b=Lj+Z3TL9xUR2cl0Il36gkD3ureFCZR5gFqp8bVlYCzXIR9tdXQeGTxjti2HP1JUZyczpgK aODiG0trNE3MjpXfKdsDfug5PD0P9j4DQl6FL8PuFJw8D1JgQmX7S2vjS4y4JwvKz7Ggot hm47WnI0KB0Fd/g78IqxDZJuLZrumxk= X-MC-Unique: DjqXfDi6OwOL5NwFBHu7Vw-1 X-Mimecast-MFC-AGG-ID: DjqXfDi6OwOL5NwFBHu7Vw_1789144768 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:07 +0400 Subject: [PATCH v5 33/62] net/colo-compare: fix max_queue_size setter visitor type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-33-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Zhang Chen , Li Zhijian , Jason Wang X-Developer-Signature: v=1; a=openpgp-sha256; l=965; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=gH4V4GYmKlKV9gTVHip9VTPSlJHQiKGxkIO6FkOUkhE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC25F2I1jFg3Wd4LHgwnQRrx5vJnIkl4bT3l5 W3jAbHYThiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuQAKCRDa6OEJdZac 5XnzD/9+4ueAAlJzxga5eShp2DBvON/Qepk5aWJCcBVEjfnGo6NP05Ar2vv91e6stTxDw2OlW/v WOUSLfsdKN18pgjbQvBpn8ZWDRBIF9YErXzLwwLVL80SrKxO4lqCU/O4Sg3txnnMkUf5RUS49cP HeYQSHQg4+MO1PUwsqiQV7H0ARPgTKTMHEazkPIr5JBTaIPZLQ5p/ClQYptn+W05oEux4oHoNDh zmYbfWXAK7dof/jxBb/JfAui3V1p78RZjOuzwehB1a8EKoND+OFrIT4SgLMkewuE7fBsfHSk5JM xW1ij2hgSq5yRjYfwrz7ZcX0cgf89Mt3394wdZziRoz6JesV05rOP0ec2sliXlQxaZytwTk6Dis jqvmsIoL9GYfi0zaqRO2cavF1gUfTxG1iRC1BxmJ1+dH+V9q2YXA8lyMh73lWkvUg93ij5thIFM fjd3R5/3iMsnG2BZK2IOKKIhJ7DI8GUCrPTeqAgisSKRARqpVCY1iBLI5laxtWADT7OaFH72Ixl aEXJw2wIHK8aGCnxqyjToPNxKyKGr0Xi+VmzZkUSzCIrXZfE/OoX/Xeah3x6bDHWFEZB+w3g+MU uCiMXPMN0thIok/6UOMEo3PFrmxRjbEB9Qzxu9FGbv8NVYaGPELfejLhoH6Pq5DyGjeZyA7GhUv 3XFzSQwMgTNY/xA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=marcandre.lureau@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_H2=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: 1789144874888158500 The setter was using visit_type_uint64, accepting values wider than the uint32_t field. Use visit_type_uint32 to match the getter, field, and typename. Fixes: 0c4266ef2690 ("net/colo-compare.c: Fix compare_timeout format issue") Signed-off-by: Marc-Andr=C3=A9 Lureau --- net/colo-compare.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 948a2f7f9e4b..a6910de869ff 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -1129,9 +1129,9 @@ static void set_max_queue_size(Object *obj, Visitor *= v, const char *name, void *opaque, Error **errp) { - uint64_t value; + uint32_t value; =20 - if (!visit_type_uint64(v, name, &value, errp)) { + if (!visit_type_uint32(v, name, &value, errp)) { return; } if (!value) { --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145021; cv=none; d=zohomail.com; s=zohoarc; b=UXJ2fLnBxV7QbVpXIWrOLyG7dI+IHbwE/IPhiD25YKrETY6R8/RpGLlr/4qnpbqkOUqao/aYUPO6FSK7eiPeNiFJ5dI/5hjB+WVoVvvONHw8o/GT9rSXeE9vTo8GZ1DpnzlcoTBRP2OQQP5HSZ7/e8lfcVa7bNzGmbfiDApbdU8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145021; h=Content-Type: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=zrBI6APmfni1eZ8vuc+OAu7+inaV3ylbVMAHuz3FiqY=; b=fdbEoIV44VjtGmVq+Z70nakoaHb8pNtYUId4ECZToSOpungbpB8xTW97TL1qOZklyIu89THaaIoDVJYAfJvEBCT1ebMtRkRDGwtCQAtZUdVrNs2vGZWzvNeJg1shVRpY4jTjwVW+KZc8HQ03fCQYWnuoKrHlhvkSlAP04Ajnvbg= 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 1789145021823351.57083958228645; Fri, 11 Sep 2026 09:43:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Ht-0004y9-2U; Fri, 11 Sep 2026 12:39:41 -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 1x54Hr-0004uK-5v for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:39 -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 1x54Hp-0006il-SA for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:38 -0400 Received: from mx-prod-mc-08.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-673-FlClNALdOyqGC2yZOnh_sg-1; Fri, 11 Sep 2026 12:39:34 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 87674180135F; Fri, 11 Sep 2026 16:39:32 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7DED95C0; Fri, 11 Sep 2026 16:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144777; 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=zrBI6APmfni1eZ8vuc+OAu7+inaV3ylbVMAHuz3FiqY=; b=L788nWeu/GKetBaDRwi49ncjeQQs40wMFMatW0gmB5zYHyf17s8SLdJF7WRiM6429H46DV lntrOe8X58PlDQAAwrOd4NVc5m34LKkknOBfw50S62Ssfq8drRanVMmc6FmT2IF8lATr8E ziBL9ZlDoB8pH1udH2dF8RLsAsBWkwM= X-MC-Unique: FlClNALdOyqGC2yZOnh_sg-1 X-Mimecast-MFC-AGG-ID: FlClNALdOyqGC2yZOnh_sg_1789144772 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:08 +0400 Subject: [PATCH v5 34/62] hw/misc/xlnx-versal-trng: add missing getter for fips-fault-events MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-34-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=1168; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=tocXDybXXj46+RW2LpIpFFkqPlAIhRzMx+5fSJL7tHQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC26iuXU+8dpyebeBWhkMFvUYcrSSy95htSun vSuDgJvHVqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtugAKCRDa6OEJdZac 5cE+EACEr/KHyu0wRYB/qOYWIh/N3I0AhGelhxdougLKq80F79/mwFMslmH8NiTZSJReb+nW6a+ ndkHimVHt4UNDLL40qoZe+TfVDUumbnU2RoniTO/QfdKdQibdB5Z7L7fN3dj02O0fqcuFh6ElYr 4nOYrt0ZjL8eMnJfZkfjloKKboH0H7Txfv34mKKh1tgbnxZQuvez29JLrRKERwCK1kDYPFsDnSc 4RKS6ba2nh+i/yokXVarPR7UcR+GpdXEyVTelxT7nLMx2tLAUo2yVtWpsqmnSwQSBn+oW+S9P1Q xLUphurwgCqPxreq0KaU8+fDODq2CRwMSxF8PpyStLE5ASTGj/iuG0/kZq+lL+69ZE3Bjkg8FtV oOqvfIfSia6+evQIyXnQRYGELlMdW6HiUQ7loh+3nTgvA7ZEV7pTmaEN5u+QFxPCOlyOYnYMkSk r+R1zxyR7Ok36G5VXd9aHCSitUzIyQl42LLyT8Yzqu3naZ4vK6hy8xs/D/1T/faOmZzzJdTFvsW X9s9sXXM5yUZaUf8OHlr9Ou7uHvhKA7SXvLx2BIdcHI2kwm08KedrZXfm+WN4rZOWTJEDo9p4X+ 3AUe8nEi0iO1lhAwIO3I/dQXsfTMBMQB+WHpjqki7GvXrnwKa1bwjeIM+NHjrD/djwYMvBE1rA4 JgsjPiawxaswOfQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=marcandre.lureau@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_H2=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: 1789145023867158500 Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/misc/xlnx-versal-trng.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/misc/xlnx-versal-trng.c b/hw/misc/xlnx-versal-trng.c index aa1d65de7b70..0584ee089e3c 100644 --- a/hw/misc/xlnx-versal-trng.c +++ b/hw/misc/xlnx-versal-trng.c @@ -650,10 +650,22 @@ static void trng_prop_fault_event_set(Object *obj, Vi= sitor *v, trng_fault_event_set(XLNX_VERSAL_TRNG(obj), *events); } =20 +static void trng_prop_fault_event_get(Object *obj, Visitor *v, + const char *name, + void *opaque, + Error **errp) +{ + const Property *prop =3D opaque; + uint32_t *events =3D object_field_prop_ptr(obj, prop); + + visit_type_uint32(v, name, events, errp); +} + static const PropertyInfo trng_prop_fault_events =3D { .type =3D "uint32", .description =3D "Set to trigger TRNG fault events", .set =3D trng_prop_fault_event_set, + .get =3D trng_prop_fault_event_get, .realized_set_allowed =3D true, }; =20 --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1789144825; cv=none; d=zohomail.com; s=zohoarc; b=AiIE4xgmYwHmsbctCDkeVAgIttCk3GWBeEvZULyb1bXCjFwZi8cZNTObWc5WqryaKy7vfD70a0txCoWUJxYd+UOBKUIVNaDwBuF5pqx/WEj9KSphk0uxFzN23LwX+lyGYdT9Kqqmts0AgUY4Bl/0uNzxEjB6zRAOI2fF2QXmELg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144825; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=n7kLKMCQpmhePPANiYhWYMYAMrriWH4JjeS/cBrPX8I=; b=HzArjV0ys7QqQAvleZReI82Wmcgif1LClF1Gy3Y2jEvgWrkS8y+8QcW/BFY0gJuYwWexB7zVQDISogb5CaswtiKTioRN+ghIWjc1HLTBkJCCOop5U1UIMfcAjuLmpVXKKh4kW9sU4zUQMFLaBv2AxwEb9IGT4cIhnEmyHN8iafk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1789144825485563.128699084988; Fri, 11 Sep 2026 09:40:25 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1417561.1646277 (Exim 4.92) (envelope-from ) id 1x54I8-0000WX-B3; Fri, 11 Sep 2026 16:39:56 +0000 Received: by outflank-mailman (output) from mailman id 1417561.1646277; Fri, 11 Sep 2026 16:39:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1x54I8-0000WQ-7q; Fri, 11 Sep 2026 16:39:56 +0000 Received: by outflank-mailman (input) for mailman id 1417561; Fri, 11 Sep 2026 16:39:54 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1x54I6-0000WI-JI for xen-devel@lists.xenproject.org; Fri, 11 Sep 2026 16:39:54 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1x54I5-006L8m-T5 for xen-devel@lists.xenproject.org; Fri, 11 Sep 2026 18:39:53 +0200 Received: from [10.42.69.12] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6aa42ec2-e002-0a2a0a5209dd-0a2a450c99e4-38 for ; Fri, 11 Sep 2026 18:39:53 +0200 Received: from [170.10.133.124] (helo=us-smtp-delivery-124.mimecast.com) by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6aa42ed8-f479-0a2a450c0019-aa0a857cee33-3 for ; Fri, 11 Sep 2026 18:39:53 +0200 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-694-UlP3wVwwN-SsTXEDvMc_9Q-1; Fri, 11 Sep 2026 12:39:47 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C59C01955F14; Fri, 11 Sep 2026 16:39:39 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 908D4433; Fri, 11 Sep 2026 16:39:34 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=mimecast20190719 header.d=redhat.com header.i="@redhat.com" header.h="From:Subject:Date:Message-Id:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144792; 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=n7kLKMCQpmhePPANiYhWYMYAMrriWH4JjeS/cBrPX8I=; b=GOf1z3g2gD8YkHuHGHXrybY7hmY+gm2bObavWrp4plaw4ECpRMvHXbZnBFGs+90r4T7Y7k kEaNHYu2GXIYKr93ZNLF1OHzL5Vvq6a21BX6Nh1+lU2WdH71sCTq5wKGmz+bZ+G7baC+Sx 42YDw+AdabW0LLwHKLLOKdTuEZbBnO8= X-MC-Unique: UlP3wVwwN-SsTXEDvMc_9Q-1 X-Mimecast-MFC-AGG-ID: UlP3wVwwN-SsTXEDvMc_9Q_1789144782 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:09 +0400 Subject: [PATCH v5 35/62] qom: convert scalar properties to QAPI-aware registration MIME-Version: 1.0 Message-Id: <20260911-qom-qapi-v5-35-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Amit Machhiwal , Alexander Graf , Richard Henderson , "Gonglei (Arei)" , zhenwei pi , David Hildenbrand , Igor Mammedov , Alberto Garcia , Kevin Wolf , Hanna Reitz , "Michael S. Tsirkin" , Ani Sinha , Peter Maydell , Luc Michel , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Zhao Liu , Jonathan Cameron , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , Samuel Tardieu , Marcelo Tosatti , John Snow , "Denis V. Lunev" , Song Gao <17746591750@163.com>, Bibo Mao , Xianglai Li , Jiaxun Yang , FangSheng Huang , Tyrone Ting , Hao Wu , Jason Wang , Keith Busch , Klaus Jensen , Jesper Devantier , Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , Amit Machhiwal , Conor Dooley , Sebastian Huber , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Halil Pasic , Christian Borntraeger , Jason Herne , Cornelia Huck , Eric Farman , Matthew Rosato , Ilya Leoshkevich , Titus Rwantare , Stefano Stabellini , Anthony PERARD , "Edgar E. Iglesias" , Zhang Chen , Li Zhijian , Peter Xu , Chinmay Rath , Hendrik Brueckner , kvm@vger.kernel.org, qemu-block@nongnu.org, qemu-arm@nongnu.org, linux-cxl@vger.kernel.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org X-Developer-Signature: v=1; a=openpgp-sha256; l=108182; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=mPg1F4fKLAvQtx73sQYbUGyKE/L5S5p7sMB8QV3n394=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC260yI9VAQcQ6aEdGdAMcElEGZpokov8qFTJ qDkKIVXTJOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtugAKCRDa6OEJdZac 5R7qEACr2Hv512AspLmegcehc6w1nUlRMPxvkWPfM7Ug/f06heqWe4RbGPPsz7wCZXNM6/MDIM5 SGxBCQ7kFkOAXROlYyIyAABLuFl4Ij6jhN4CsltVLsPhaNsiTK/jQ55pdFWTtZmdTiHMyTcAChQ bK+8KqlNiACpj75rZFpNCuOJnqFlu2WKlTZIgNeVsKJ5sIpXd2Af1xAinycm4+fKg1xZ+M2Duuq CxZwnhKNhOWT4OqrrGw8tFyrR4CjAMcD2FBzDWOQjGvhjdzr0cRQf/46/35yYWQ6rdFZ42vQFc/ aGoK4Vv2/JMVmpGbCLVXOA3jaJvOkHFFavEbrOP8vtDBSmRR7BEQKd39IEhrpMUk+VbTlGDWfi9 slA7lL/v9ua+VMNgZ1W30jANsZ1kKXoj4ot00hdRaHaDKLpQy7WykqklUDQEhlJZ5+3d5tNFYXl 0sMS55Rgbx7bxwO7lpa0Ge3p3E02Do0hx02/kIecwjj4Q1kpyHYGNSMnIozZmgkig5IGgtC+4w7 qqsWB2x+cWfPHTlP7FGeh1lcl/99lOdruXWO+gqnknqlFCM6nDcTxWNZDyJWBXS+teubBPBC7B4 071cpuEuKQSR8H1eJN8ar0Y+CVjKlfuWCQGCOx08Iz2PgjpvLbaiiRWFYdJXzobhhjgE0GYVSVl 3B/NDidF+InlSLA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: GyN8XkCP2-k-WXjcu1vDSAFUDpmTJ6TaFSFOYxM4C9o_1789144782 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-d25034/1789144793-51B359FB-E26671D8/0/0 X-purgate-type: clean X-purgate-size: 108184 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1789144827906158500 Reviewed-by: Amit Machhiwal Signed-off-by: Marc-Andr=C3=A9 Lureau --- accel/kvm/kvm-all.c | 5 ++- accel/nitro/nitro-accel.c | 3 +- accel/tcg/tcg-all.c | 3 +- backends/cryptodev.c | 7 ++-- backends/hostmem-file.c | 4 +- backends/hostmem-memfd.c | 3 +- backends/hostmem.c | 6 +-- block/throttle-groups.c | 5 ++- crypto/secret_keyring.c | 9 +++-- event-loop-base.c | 7 ++-- hw/acpi/ich9.c | 1 + hw/acpi/pci.c | 7 ++-- hw/arm/virt.c | 4 +- hw/core/clock.c | 3 +- hw/core/machine.c | 2 +- hw/cpu/core.c | 10 +++-- hw/cxl/cxl-host.c | 2 +- hw/gpio/aspeed_gpio.c | 5 ++- hw/gpio/aspeed_sgpio.c | 3 +- hw/gpio/stm32l4x5_gpio.c | 5 ++- hw/i386/pc.c | 6 +-- hw/i386/sgx-epc.c | 3 +- hw/i386/x86.c | 6 +-- hw/ide/ide-dev.c | 3 +- hw/intc/apic_common.c | 3 +- hw/loongarch/virt.c | 2 +- hw/mem/nvdimm.c | 7 ++-- hw/mem/pc-dimm.c | 3 +- hw/misc/aspeed_lpc.c | 73 +++++++++++++++++++++++++--------= ---- hw/misc/aspeed_sdmc.c | 3 +- hw/misc/npcm7xx_mft.c | 3 +- hw/net/ne2000-isa.c | 3 +- hw/nvme/ctrl.c | 3 +- hw/pci-bridge/pci_expander_bridge.c | 3 +- hw/pci-host/i440fx.c | 29 +++++++++------ hw/pci-host/pnv_phb3.c | 5 ++- hw/pci-host/pnv_phb4.c | 5 ++- hw/pci-host/q35.c | 9 +++-- hw/ppc/spapr_drc.c | 3 +- hw/riscv/microchip_pfsoc.c | 3 +- hw/s390x/sclpcpi.c | 8 ++-- hw/s390x/virtio-ccw-mem.c | 3 +- hw/sensor/adc128d818.c | 16 +++++--- hw/sensor/adm1266.c | 3 +- hw/sensor/adm1272.c | 9 +++-- hw/sensor/emc141x.c | 9 +++-- hw/sensor/isl_pmbus_vr.c | 19 +++++----- hw/sensor/lsm303dlhc_mag.c | 9 +++-- hw/sensor/max34451.c | 5 ++- hw/sensor/tmp105.c | 3 +- hw/sensor/tmp421.c | 9 +++-- hw/usb/dev-storage-classic.c | 3 +- hw/virtio/virtio-balloon.c | 3 +- hw/virtio/virtio-mem-pci.c | 3 +- hw/virtio/virtio-mem.c | 18 +++++---- hw/xen/xen-pvh-common.c | 9 +++-- iothread.c | 9 +++-- net/colo-compare.c | 7 ++-- net/dump.c | 6 ++- net/filter-buffer.c | 3 +- qom/object.c | 42 ++++++++++----------- system/bootdevice.c | 3 +- system/memory.c | 5 ++- target/arm/cpu64.c | 11 +++--- target/arm/kvm.c | 3 +- target/arm/tcg/cpu64.c | 11 +++--- target/i386/cpu.c | 12 +++--- target/i386/kvm/kvm.c | 8 ++-- target/i386/sev.c | 2 +- target/ppc/compat.c | 3 +- target/riscv/cpu.c | 15 ++++---- target/riscv/kvm/kvm-cpu.c | 7 ++-- target/riscv/tcg/tcg-cpu.c | 13 ++++--- target/s390x/cpu_models.c | 5 ++- tests/unit/test-qdev-global-props.c | 11 ++++-- ui/console.c | 3 +- util/thread-context.c | 7 ++-- 77 files changed, 343 insertions(+), 241 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index e2cfbcf44046..ff9db3ca8b3d 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -24,6 +24,7 @@ #include "qemu/config-file.h" #include "qemu/error-report.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "hw/pci/msi.h" #include "hw/pci/msix.h" #include "hw/s390x/adapter.h" @@ -4278,13 +4279,13 @@ static void kvm_accel_class_init(ObjectClass *oc, c= onst void *data) .description =3D "Configure KVM in-kernel irqchip", )); =20 - object_class_property_add(oc, "kvm-shadow-mem", "int", + object_class_property_add_qapi(oc, "kvm-shadow-mem", &int_type_info, kvm_get_kvm_shadow_mem, kvm_set_kvm_shadow_mem, NULL, NULL); object_class_property_set_description(oc, "kvm-shadow-mem", "KVM shadow MMU size"); =20 - object_class_property_add(oc, "dirty-ring-size", "uint32", + object_class_property_add_qapi(oc, "dirty-ring-size", &uint32_type_inf= o, kvm_get_dirty_ring_size, kvm_set_dirty_ring_size, NULL, NULL); object_class_property_set_description(oc, "dirty-ring-size", diff --git a/accel/nitro/nitro-accel.c b/accel/nitro/nitro-accel.c index a1e97a9162e9..05841c1277dc 100644 --- a/accel/nitro/nitro-accel.c +++ b/accel/nitro/nitro-accel.c @@ -29,6 +29,7 @@ #include "qemu/osdep.h" #include "qemu/error-report.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qemu/module.h" #include "qemu/rcu.h" @@ -238,7 +239,7 @@ static void nitro_accel_class_init(ObjectClass *oc, con= st void *data) object_class_property_set_description(oc, "debug-mode", "Start enclave in debug mode (enables console output)"); =20 - object_class_property_add(oc, "enclave-cid", "uint64", + object_class_property_add_qapi(oc, "enclave-cid", &uint64_type_info, nitro_get_enclave_cid, nitro_set_enclave_cid, NULL, NULL); diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 767e8805552f..277cf0e2d012 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -29,6 +29,7 @@ #include "exec/icount.h" #include "tcg/startup.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qemu/error-report.h" #include "qemu/accel.h" #include "qemu/atomic.h" @@ -270,7 +271,7 @@ static void tcg_accel_class_init(ObjectClass *oc, const= void *data) tcg_get_thread, tcg_set_thread); =20 - object_class_property_add(oc, "tb-size", "uint32", + object_class_property_add_qapi(oc, "tb-size", &uint32_type_info, tcg_get_tb_size, tcg_set_tb_size, NULL, NULL); object_class_property_set_description(oc, "tb-size", diff --git a/backends/cryptodev.c b/backends/cryptodev.c index e8f2b18f2017..a69adb70440c 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -25,6 +25,7 @@ #include "system/cryptodev.h" #include "system/stats.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/qapi-commands-cryptodev.h" #include "qapi/qapi-types-stats.h" #include "qapi/visitor.h" @@ -622,15 +623,15 @@ cryptodev_backend_class_init(ObjectClass *oc, const v= oid *data) ucc->prepare_delete =3D cryptodev_backend_prepare_delete; =20 QTAILQ_INIT(&crypto_clients); - object_class_property_add(oc, "queues", "uint32", + object_class_property_add_qapi(oc, "queues", &uint32_type_info, cryptodev_backend_get_queues, cryptodev_backend_set_queues, NULL, NULL); - object_class_property_add(oc, "throttle-bps", "uint64", + object_class_property_add_qapi(oc, "throttle-bps", &uint64_type_info, cryptodev_backend_get_bps, cryptodev_backend_set_bps, NULL, NULL); - object_class_property_add(oc, "throttle-ops", "uint64", + object_class_property_add_qapi(oc, "throttle-ops", &uint64_type_info, cryptodev_backend_get_ops, cryptodev_backend_set_ops, NULL, NULL); diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index 9c7e0183d480..aeb6fc37858c 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -275,11 +275,11 @@ file_backend_class_init(ObjectClass *oc, const void *= data) file_memory_backend_get_discard_data, file_memory_backend_set_disc= ard_data); object_class_property_add_str(oc, "mem-path", get_mem_path, set_mem_path); - object_class_property_add(oc, "align", "uint64", + object_class_property_add_qapi(oc, "align", &uint64_type_info, file_memory_backend_get_align, file_memory_backend_set_align, NULL, NULL); - object_class_property_add(oc, "offset", "int", + object_class_property_add_qapi(oc, "offset", &int_type_info, file_memory_backend_get_offset, file_memory_backend_set_offset, NULL, NULL); diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c index e21c5a3f2e24..42027529ab50 100644 --- a/backends/hostmem-memfd.c +++ b/backends/hostmem-memfd.c @@ -16,6 +16,7 @@ #include "qemu/memfd.h" #include "qemu/module.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qom/object.h" #include "migration/cpr.h" =20 @@ -145,7 +146,7 @@ memfd_backend_class_init(ObjectClass *oc, const void *d= ata) memfd_backend_set_hugetlb); object_class_property_set_description(oc, "hugetlb", "Use huge pages"); - object_class_property_add(oc, "hugetlbsize", "uint64", + object_class_property_add_qapi(oc, "hugetlbsize", &uint64_type_inf= o, memfd_backend_get_hugetlbsize, memfd_backend_set_hugetlbsize, NULL, NULL); diff --git a/backends/hostmem.c b/backends/hostmem.c index e7f9b436a459..d05ab53ab662 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -529,7 +529,7 @@ host_memory_backend_class_init(ObjectClass *oc, const v= oid *data) host_memory_backend_set_prealloc); object_class_property_set_description(oc, "prealloc", "Preallocate memory"); - object_class_property_add(oc, "prealloc-threads", "int", + object_class_property_add_qapi(oc, "prealloc-threads", &int_type_info, host_memory_backend_get_prealloc_threads, host_memory_backend_set_prealloc_threads, NULL, NULL); @@ -540,13 +540,13 @@ host_memory_backend_class_init(ObjectClass *oc, const= void *data) object_property_allow_set_link, OBJ_PROP_LINK_STRONG); object_class_property_set_description(oc, "prealloc-context", "Context to use for creating CPU threads for preallocation"); - object_class_property_add(oc, "size", "size", + object_class_property_add_qapi(oc, "size", &size_type_info, host_memory_backend_get_size, host_memory_backend_set_size, NULL, NULL); object_class_property_set_description(oc, "size", "Size of the memory region (ex: 500M)"); - object_class_property_add(oc, "host-nodes", "[uint16]", + object_class_property_add_qapi(oc, "host-nodes", &uint16List_type_info, host_memory_backend_get_host_nodes, host_memory_backend_set_host_nodes, NULL, NULL); diff --git a/block/throttle-groups.c b/block/throttle-groups.c index 6312157802da..851617237f80 100644 --- a/block/throttle-groups.c +++ b/block/throttle-groups.c @@ -31,6 +31,7 @@ #include "qemu/thread.h" #include "system/qtest.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/qapi-type-infos-block-core.h" #include "qapi/qapi-visit-block-core.h" #include "qom/object.h" @@ -983,9 +984,9 @@ static void throttle_group_obj_class_init(ObjectClass *= klass, =20 /* individual properties */ for (i =3D 0; i < sizeof(properties) / sizeof(ThrottleParamInfo); i++)= { - object_class_property_add(klass, + object_class_property_add_qapi(klass, properties[i].name, - "int64", + &int64_type_info, throttle_group_get, throttle_group_set, NULL, &properties[i]); diff --git a/crypto/secret_keyring.c b/crypto/secret_keyring.c index 3b332276ef5b..6ac7cd6a232d 100644 --- a/crypto/secret_keyring.c +++ b/crypto/secret_keyring.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include #include +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/error.h" #include "qom/object_interfaces.h" #include "trace.h" @@ -107,10 +108,10 @@ qcrypto_secret_keyring_class_init(ObjectClass *oc, co= nst void *data) QCryptoSecretCommonClass *sic =3D QCRYPTO_SECRET_COMMON_CLASS(oc); sic->load_data =3D qcrypto_secret_keyring_load_data; =20 - object_class_property_add(oc, "serial", "int32_t", - qcrypto_secret_prop_get_key, - qcrypto_secret_prop_set_key, - NULL, NULL); + object_class_property_add_qapi(oc, "serial", &int32_type_info, + qcrypto_secret_prop_get_key, + qcrypto_secret_prop_set_key, + NULL, NULL); } =20 =20 diff --git a/event-loop-base.c b/event-loop-base.c index 23f554d92ce8..c16c5366f680 100644 --- a/event-loop-base.c +++ b/event-loop-base.c @@ -14,6 +14,7 @@ #include "qemu/osdep.h" #include "qom/object_interfaces.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "block/thread-pool.h" #include "system/event-loop-base.h" =20 @@ -104,15 +105,15 @@ static void event_loop_base_class_init(ObjectClass *k= lass, ucc->complete =3D event_loop_base_complete; ucc->prepare_delete =3D event_loop_base_prepare_delete; =20 - object_class_property_add(klass, "aio-max-batch", "int64", + object_class_property_add_qapi(klass, "aio-max-batch", &int64_type_inf= o, event_loop_base_get_param, event_loop_base_set_param, NULL, &aio_max_batch_info); - object_class_property_add(klass, "thread-pool-min", "int64", + object_class_property_add_qapi(klass, "thread-pool-min", &int64_type_i= nfo, event_loop_base_get_param, event_loop_base_set_param, NULL, &thread_pool_min_info); - object_class_property_add(klass, "thread-pool-max", "int64", + object_class_property_add_qapi(klass, "thread-pool-max", &int64_type_i= nfo, event_loop_base_get_param, event_loop_base_set_param, NULL, &thread_pool_max_info); diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 8082eae4282a..cf503668c00a 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -26,6 +26,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "hw/pci/pci.h" #include "migration/vmstate.h" diff --git a/hw/acpi/pci.c b/hw/acpi/pci.c index c82924be8620..71d01307e141 100644 --- a/hw/acpi/pci.c +++ b/hw/acpi/pci.c @@ -27,6 +27,7 @@ #include "qemu/error-report.h" #include "qom/object_interfaces.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "hw/core/boards.h" #include "hw/acpi/aml-build.h" #include "hw/acpi/pci.h" @@ -139,7 +140,7 @@ static void acpi_generic_initiator_class_init(ObjectCla= ss *oc, const void *data) acpi_generic_initiator_set_pci_device); object_class_property_set_description(oc, "pci-dev", "PCI device to associate with the node"); - object_class_property_add(oc, "node", "uint32", NULL, + object_class_property_add_qapi(oc, "node", &uint32_type_info, NULL, acpi_generic_initiator_set_node, NULL, NULL); object_class_property_set_description(oc, "node", "NUMA node associated with the PCI device"); @@ -253,8 +254,8 @@ static void acpi_generic_port_class_init(ObjectClass *o= c, const void *data) acpi_generic_port_set_pci_bus); object_class_property_set_description(oc, "pci-bus", "PCI Bus of the host bridge associated with this GP affinity struct= ure"); - object_class_property_add(oc, "node", "uint32", NULL, - acpi_generic_port_set_node, NULL, NULL); + object_class_property_add_qapi(oc, "node", &uint32_type_info, NULL, + acpi_generic_port_set_node, NULL, NULL); object_class_property_set_description(oc, "node", "The NUMA node like ID to index HMAT/SLIT NUMA properties involving= GP"); } diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 872920b6482b..4e5d8d9f86e3 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -4258,7 +4258,7 @@ static void virt_machine_class_init(ObjectClass *oc, = const void *data) "Set on/off to enable/disable hi= gh " "memory region for PCI MMIO"); =20 - object_class_property_add(oc, "highmem-mmio-size", "size", + object_class_property_add_qapi(oc, "highmem-mmio-size", &size_type_inf= o, virt_get_highmem_mmio_size, virt_set_highmem_mmio_size, NULL, NULL); @@ -4266,7 +4266,7 @@ static void virt_machine_class_init(ObjectClass *oc, = const void *data) "Set the high memory region size= " "for PCI MMIO"); =20 - object_class_property_add(oc, "virtio-mmio-transports", "uint8", + object_class_property_add_qapi(oc, "virtio-mmio-transports", &uint8_ty= pe_info, virt_get_virtio_transports, virt_set_virtio_transports, NULL, NULL); diff --git a/hw/core/clock.c b/hw/core/clock.c index 3fc98a0c65d5..f55cb17af77e 100644 --- a/hw/core/clock.c +++ b/hw/core/clock.c @@ -13,6 +13,7 @@ =20 #include "qemu/osdep.h" #include "qemu/cutils.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "system/qtest.h" #include "hw/core/clock.h" @@ -185,7 +186,7 @@ static void clock_initfn(Object *obj) QLIST_INIT(&clk->children); =20 if (qtest_enabled()) { - object_property_add(obj, "qtest-clock-period", "uint64", + object_property_add_qapi(obj, "qtest-clock-period", &uint64_type_i= nfo, clock_period_prop_get, NULL, NULL, NULL); } } diff --git a/hw/core/machine.c b/hw/core/machine.c index 530fbaeb0b28..aa2d90a4e4df 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1133,7 +1133,7 @@ static void machine_class_init(ObjectClass *oc, const= void *data) object_class_property_set_description(oc, "smp-cache", "Cache properties list for SMP machine"); =20 - object_class_property_add(oc, "phandle-start", "int", + object_class_property_add_qapi(oc, "phandle-start", &int_type_info, machine_get_phandle_start, machine_set_phandle_start, NULL, NULL); object_class_property_set_description(oc, "phandle-start", diff --git a/hw/cpu/core.c b/hw/cpu/core.c index 26e488f3d8e3..d7c89f47ab04 100644 --- a/hw/cpu/core.c +++ b/hw/cpu/core.c @@ -12,6 +12,7 @@ #include "hw/core/boards.h" #include "hw/cpu/core.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" =20 static void core_prop_get_core_id(Object *obj, Visitor *v, const char *nam= e, @@ -82,10 +83,11 @@ static void cpu_core_class_init(ObjectClass *oc, const = void *data) DeviceClass *dc =3D DEVICE_CLASS(oc); =20 set_bit(DEVICE_CATEGORY_CPU, dc->categories); - object_class_property_add(oc, "core-id", "int", core_prop_get_core_id, - core_prop_set_core_id, NULL, NULL); - object_class_property_add(oc, "nr-threads", "int", core_prop_get_nr_th= reads, - core_prop_set_nr_threads, NULL, NULL); + object_class_property_add_qapi(oc, "core-id", &int_type_info, core_pro= p_get_core_id, + core_prop_set_core_id, NULL, NULL); + object_class_property_add_qapi(oc, "nr-threads", &int_type_info, + core_prop_get_nr_threads, core_prop_set= _nr_threads, + NULL, NULL); } =20 static const TypeInfo cpu_core_type_info =3D { diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c index 7592c4ac6c7b..4133398fec48 100644 --- a/hw/cxl/cxl-host.c +++ b/hw/cxl/cxl-host.c @@ -565,7 +565,7 @@ static void machine_set_cfmw(Object *obj, Visitor *v, c= onst char *name, =20 void cxl_machine_init(Object *obj, CXLState *state) { - object_property_add(obj, "cxl", "bool", machine_get_cxl, + object_property_add_qapi(obj, "cxl", &bool_type_info, machine_get_cxl, machine_set_cxl, NULL, state); object_property_set_description(obj, "cxl", "Set on/off to enable/disable " diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c index 1cf6f5df5505..0c90bcd723da 100644 --- a/hw/gpio/aspeed_gpio.c +++ b/hw/gpio/aspeed_gpio.c @@ -12,6 +12,7 @@ #include "hw/gpio/aspeed_gpio.h" #include "hw/misc/aspeed_scu.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "hw/core/irq.h" #include "migration/vmstate.h" @@ -1481,7 +1482,7 @@ static void aspeed_gpio_init(Object *obj) int pin_idx =3D j % GPIOS_PER_GROUP; const char *group =3D &props->group_label[group_idx][0]; char *name =3D g_strdup_printf("gpio%s%d", group, pin_idx); - object_property_add(obj, name, "bool", aspeed_gpio_get_pin, + object_property_add_qapi(obj, name, &bool_type_info, aspeed_gp= io_get_pin, aspeed_gpio_set_pin, NULL, NULL); g_free(name); } @@ -1489,7 +1490,7 @@ static void aspeed_gpio_init(Object *obj) =20 for (int i =3D 0; i < agc->nr_gpio_sets; i++) { g_autofree char *name =3D g_strdup_printf("gpio-set[%d]", i); - object_property_add(obj, name, "uint32", aspeed_gpio_get_set, + object_property_add_qapi(obj, name, &uint32_type_info, aspeed_gpio= _get_set, aspeed_gpio_set_set, NULL, NULL); } } diff --git a/hw/gpio/aspeed_sgpio.c b/hw/gpio/aspeed_sgpio.c index 7d2f73699520..67b0c10d79fa 100644 --- a/hw/gpio/aspeed_sgpio.c +++ b/hw/gpio/aspeed_sgpio.c @@ -11,6 +11,7 @@ #include "qemu/log.h" #include "qemu/error-report.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "hw/core/irq.h" #include "hw/core/qdev-properties.h" @@ -300,7 +301,7 @@ static void aspeed_sgpio_init(Object *obj) { for (int i =3D 0; i < ASPEED_SGPIO_MAX_PIN_PAIR * 2; i++) { g_autofree char *name =3D g_strdup_printf("sgpio%03d", i); - object_property_add(obj, name, "bool", aspeed_sgpio_get_pin, + object_property_add_qapi(obj, name, &bool_type_info, aspeed_sgpio_= get_pin, aspeed_sgpio_set_pin, NULL, NULL); } } diff --git a/hw/gpio/stm32l4x5_gpio.c b/hw/gpio/stm32l4x5_gpio.c index 92fa397fbafe..d349d41e41a1 100644 --- a/hw/gpio/stm32l4x5_gpio.c +++ b/hw/gpio/stm32l4x5_gpio.c @@ -25,6 +25,7 @@ #include "hw/core/qdev-properties.h" #include "qapi/visitor.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "migration/vmstate.h" #include "trace.h" =20 @@ -409,10 +410,10 @@ static void stm32l4x5_gpio_init(Object *obj) =20 s->clk =3D qdev_init_clock_in(DEVICE(s), "clk", NULL, s, 0); =20 - object_property_add(obj, "disconnected-pins", "uint16", + object_property_add_qapi(obj, "disconnected-pins", &uint16_type_info, disconnected_pins_get, disconnected_pins_set, NULL, &s->disconnected_pins); - object_property_add(obj, "clock-freq-hz", "uint32", + object_property_add_qapi(obj, "clock-freq-hz", &uint32_type_info, clock_freq_get, NULL, NULL, NULL); } =20 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 18b5dc169ab7..24c4c589ed04 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1720,7 +1720,7 @@ static void pc_machine_class_init(ObjectClass *oc, co= nst void *data) mc->default_ram_id =3D "pc.ram"; pcmc->default_smbios_ep_type =3D SMBIOS_ENTRY_POINT_TYPE_AUTO; =20 - object_class_property_add(oc, PC_MACHINE_MAX_RAM_BELOW_4G, "size", + object_class_property_add_qapi(oc, PC_MACHINE_MAX_RAM_BELOW_4G, &size_= type_info, pc_machine_get_max_ram_below_4g, pc_machine_set_max_ram_below_4g, NULL, NULL); object_class_property_set_description(oc, PC_MACHINE_MAX_RAM_BELOW_4G, @@ -1758,13 +1758,13 @@ static void pc_machine_class_init(ObjectClass *oc, = const void *data) pc_machine_get_default_bus_bypass_iommu, pc_machine_set_default_bus_bypass_iommu); =20 - object_class_property_add(oc, PC_MACHINE_MAX_FW_SIZE, "size", + object_class_property_add_qapi(oc, PC_MACHINE_MAX_FW_SIZE, &size_type_= info, pc_machine_get_max_fw_size, pc_machine_set_max_fw_size, NULL, NULL); object_class_property_set_description(oc, PC_MACHINE_MAX_FW_SIZE, "Maximum combined firmware size"); =20 - object_class_property_add(oc, PC_MACHINE_SMBIOS_EP, "str", + object_class_property_add_qapi(oc, PC_MACHINE_SMBIOS_EP, &str_type_inf= o, pc_machine_get_smbios_ep, pc_machine_set_smbios_ep, NULL, NULL); object_class_property_set_description(oc, PC_MACHINE_SMBIOS_EP, diff --git a/hw/i386/sgx-epc.c b/hw/i386/sgx-epc.c index d3fe10028c51..d9b9ab3f7a96 100644 --- a/hw/i386/sgx-epc.c +++ b/hw/i386/sgx-epc.c @@ -15,6 +15,7 @@ #include "hw/mem/memory-device.h" #include "hw/core/qdev-properties.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "target/i386/cpu.h" #include "system/address-spaces.h" @@ -43,7 +44,7 @@ static void sgx_epc_get_size(Object *obj, Visitor *v, con= st char *name, =20 static void sgx_epc_init(Object *obj) { - object_property_add(obj, SGX_EPC_SIZE_PROP, "uint64", sgx_epc_get_size, + object_property_add_qapi(obj, SGX_EPC_SIZE_PROP, &uint64_type_info, sg= x_epc_get_size, NULL, NULL, NULL); } =20 diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 63f297a10532..d0c782ec8544 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -420,9 +420,9 @@ static void x86_machine_class_init(ObjectClass *oc, con= st void *data) "in ACPI table header." "The string may be up to 8 bytes= in size"); =20 - object_class_property_add(oc, X86_MACHINE_BUS_LOCK_RATELIMIT, "uint64_= t", - x86_machine_get_bus_lock_ratelimit, - x86_machine_set_bus_lock_ratelimit, NULL, = NULL); + object_class_property_add_qapi(oc, X86_MACHINE_BUS_LOCK_RATELIMIT, &ui= nt64_type_info, + x86_machine_get_bus_lock_ratelimit, + x86_machine_set_bus_lock_ratelimit, NUL= L, NULL); object_class_property_set_description(oc, X86_MACHINE_BUS_LOCK_RATELIM= IT, "Set the ratelimit for the bus locks acquired in VMs"); =20 diff --git a/hw/ide/ide-dev.c b/hw/ide/ide-dev.c index 5d478588c614..e2dd2439991f 100644 --- a/hw/ide/ide-dev.c +++ b/hw/ide/ide-dev.c @@ -19,6 +19,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/qapi-types-block.h" #include "qemu/error-report.h" #include "qemu/module.h" @@ -174,7 +175,7 @@ out: =20 static void ide_dev_instance_init(Object *obj) { - object_property_add(obj, "bootindex", "int32", + object_property_add_qapi(obj, "bootindex", &int32_type_info, ide_dev_get_bootindex, ide_dev_set_bootindex, NULL, NULL); object_property_set_int(obj, "bootindex", -1, NULL); diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c index 0f0f37d45734..dc0517ceea90 100644 --- a/hw/intc/apic_common.c +++ b/hw/intc/apic_common.c @@ -22,6 +22,7 @@ #include "qemu/error-report.h" #include "qemu/module.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "hw/i386/apic.h" #include "hw/i386/apic_internal.h" @@ -442,7 +443,7 @@ static void apic_common_initfn(Object *obj) APICCommonState *s =3D APIC_COMMON(obj); =20 s->id =3D s->initial_apic_id =3D -1; - object_property_add(obj, "id", "uint32", + object_property_add_qapi(obj, "id", &uint32_type_info, apic_common_get_id, apic_common_set_id, NULL, NULL); } diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 750ce2dbe5fc..209a0feddd80 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -1520,7 +1520,7 @@ static void virt_class_init(ObjectClass *oc, const vo= id *data) object_class_property_set_description(oc, "highmem-mmio", "Set on/off to enable/disable hi= gh " "memory region for PCI MMIO"); - object_class_property_add(oc, "highmem-mmio-size", "size", + object_class_property_add_qapi(oc, "highmem-mmio-size", &size_type_inf= o, virt_get_highmem_mmio_size, virt_set_highmem_mmio_size, NULL, NULL); diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c index cf8a4d8c5f2a..123ddc938546 100644 --- a/hw/mem/nvdimm.c +++ b/hw/mem/nvdimm.c @@ -26,6 +26,7 @@ #include "qemu/module.h" #include "qemu/pmem.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "hw/mem/nvdimm.h" #include "hw/core/qdev-properties.h" @@ -99,9 +100,9 @@ static void nvdimm_set_uuid(Object *obj, Visitor *v, con= st char *name, =20 static void nvdimm_init(Object *obj) { - object_property_add(obj, NVDIMM_LABEL_SIZE_PROP, "size", - nvdimm_get_label_size, nvdimm_set_label_size, NULL, - NULL); + object_property_add_qapi(obj, NVDIMM_LABEL_SIZE_PROP, &size_type_info, + nvdimm_get_label_size, nvdimm_set_label_size,= NULL, + NULL); =20 object_property_add(obj, NVDIMM_UUID_PROP, "QemuUUID", nvdimm_get_uuid, nvdimm_set_uuid, NULL, NULL); diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index 68862926ee2d..ee586ecc0c7d 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -26,6 +26,7 @@ #include "hw/mem/nvdimm.h" #include "hw/mem/memory-device.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qemu/module.h" #include "system/hostmem.h" @@ -176,7 +177,7 @@ static void pc_dimm_get_size(Object *obj, Visitor *v, c= onst char *name, =20 static void pc_dimm_init(Object *obj) { - object_property_add(obj, PC_DIMM_SIZE_PROP, "uint64", pc_dimm_get_size, + object_property_add_qapi(obj, PC_DIMM_SIZE_PROP, &uint64_type_info, pc= _dimm_get_size, NULL, NULL, NULL); } =20 diff --git a/hw/misc/aspeed_lpc.c b/hw/misc/aspeed_lpc.c index 7f7e4f1a0985..e2d9b7572f27 100644 --- a/hw/misc/aspeed_lpc.c +++ b/hw/misc/aspeed_lpc.c @@ -12,6 +12,7 @@ #include "qemu/error-report.h" #include "hw/misc/aspeed_lpc.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "hw/core/irq.h" #include "hw/core/qdev-properties.h" @@ -417,30 +418,54 @@ static void aspeed_lpc_realize(DeviceState *dev, Erro= r **errp) =20 static void aspeed_lpc_init(Object *obj) { - object_property_add(obj, "idr1", "uint32", aspeed_kcs_get_register_pro= perty, - aspeed_kcs_set_register_property, NULL, NULL); - object_property_add(obj, "odr1", "uint32", aspeed_kcs_get_register_pro= perty, - aspeed_kcs_set_register_property, NULL, NULL); - object_property_add(obj, "str1", "uint32", aspeed_kcs_get_register_pro= perty, - aspeed_kcs_set_register_property, NULL, NULL); - object_property_add(obj, "idr2", "uint32", aspeed_kcs_get_register_pro= perty, - aspeed_kcs_set_register_property, NULL, NULL); - object_property_add(obj, "odr2", "uint32", aspeed_kcs_get_register_pro= perty, - aspeed_kcs_set_register_property, NULL, NULL); - object_property_add(obj, "str2", "uint32", aspeed_kcs_get_register_pro= perty, - aspeed_kcs_set_register_property, NULL, NULL); - object_property_add(obj, "idr3", "uint32", aspeed_kcs_get_register_pro= perty, - aspeed_kcs_set_register_property, NULL, NULL); - object_property_add(obj, "odr3", "uint32", aspeed_kcs_get_register_pro= perty, - aspeed_kcs_set_register_property, NULL, NULL); - object_property_add(obj, "str3", "uint32", aspeed_kcs_get_register_pro= perty, - aspeed_kcs_set_register_property, NULL, NULL); - object_property_add(obj, "idr4", "uint32", aspeed_kcs_get_register_pro= perty, - aspeed_kcs_set_register_property, NULL, NULL); - object_property_add(obj, "odr4", "uint32", aspeed_kcs_get_register_pro= perty, - aspeed_kcs_set_register_property, NULL, NULL); - object_property_add(obj, "str4", "uint32", aspeed_kcs_get_register_pro= perty, - aspeed_kcs_set_register_property, NULL, NULL); + object_property_add_qapi(obj, "idr1", &uint32_type_info, + aspeed_kcs_get_register_property, + aspeed_kcs_set_register_property, + NULL, NULL); + object_property_add_qapi(obj, "odr1", &uint32_type_info, + aspeed_kcs_get_register_property, + aspeed_kcs_set_register_property, + NULL, NULL); + object_property_add_qapi(obj, "str1", &uint32_type_info, + aspeed_kcs_get_register_property, + aspeed_kcs_set_register_property, + NULL, NULL); + object_property_add_qapi(obj, "idr2", &uint32_type_info, + aspeed_kcs_get_register_property, + aspeed_kcs_set_register_property, + NULL, NULL); + object_property_add_qapi(obj, "odr2", &uint32_type_info, + aspeed_kcs_get_register_property, + aspeed_kcs_set_register_property, + NULL, NULL); + object_property_add_qapi(obj, "str2", &uint32_type_info, + aspeed_kcs_get_register_property, + aspeed_kcs_set_register_property, + NULL, NULL); + object_property_add_qapi(obj, "idr3", &uint32_type_info, + aspeed_kcs_get_register_property, + aspeed_kcs_set_register_property, + NULL, NULL); + object_property_add_qapi(obj, "odr3", &uint32_type_info, + aspeed_kcs_get_register_property, + aspeed_kcs_set_register_property, + NULL, NULL); + object_property_add_qapi(obj, "str3", &uint32_type_info, + aspeed_kcs_get_register_property, + aspeed_kcs_set_register_property, + NULL, NULL); + object_property_add_qapi(obj, "idr4", &uint32_type_info, + aspeed_kcs_get_register_property, + aspeed_kcs_set_register_property, + NULL, NULL); + object_property_add_qapi(obj, "odr4", &uint32_type_info, + aspeed_kcs_get_register_property, + aspeed_kcs_set_register_property, + NULL, NULL); + object_property_add_qapi(obj, "str4", &uint32_type_info, + aspeed_kcs_get_register_property, + aspeed_kcs_set_register_property, + NULL, NULL); } =20 static const VMStateDescription vmstate_aspeed_lpc =3D { diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index f8fbaebee6ab..d096cc88f5c5 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -15,6 +15,7 @@ #include "hw/core/qdev-properties.h" #include "migration/vmstate.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "trace.h" #include "qemu/units.h" #include "qemu/cutils.h" @@ -259,7 +260,7 @@ static void aspeed_sdmc_set_ram_size(Object *obj, Visit= or *v, const char *name, =20 static void aspeed_sdmc_initfn(Object *obj) { - object_property_add(obj, "ram-size", "int", + object_property_add_qapi(obj, "ram-size", &int_type_info, aspeed_sdmc_get_ram_size, aspeed_sdmc_set_ram_size, NULL, NULL); } diff --git a/hw/misc/npcm7xx_mft.c b/hw/misc/npcm7xx_mft.c index 742166c4e828..99e9e49788c0 100644 --- a/hw/misc/npcm7xx_mft.c +++ b/hw/misc/npcm7xx_mft.c @@ -23,6 +23,7 @@ #include "hw/core/registerfields.h" #include "migration/vmstate.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qemu/bitops.h" #include "qemu/error-report.h" @@ -491,7 +492,7 @@ static void npcm7xx_mft_init(Object *obj) s->clock_2 =3D qdev_init_clock_out(dev, "clock2"); =20 for (int i =3D 0; i < NPCM7XX_PWM_PER_MODULE; ++i) { - object_property_add(obj, "max_rpm[*]", "uint32", + object_property_add_qapi(obj, "max_rpm[*]", &uint32_type_info, npcm7xx_mft_get_max_rpm, npcm7xx_mft_set_max_rpm, NULL, &s->max_rpm[i]); diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c index 673c785abc94..63e0d40ee726 100644 --- a/hw/net/ne2000-isa.c +++ b/hw/net/ne2000-isa.c @@ -29,6 +29,7 @@ #include "ne2000.h" #include "system/system.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qemu/module.h" #include "qom/object.h" @@ -131,7 +132,7 @@ out: =20 static void isa_ne2000_instance_init(Object *obj) { - object_property_add(obj, "bootindex", "int32", + object_property_add_qapi(obj, "bootindex", &int32_type_info, isa_ne2000_get_bootindex, isa_ne2000_set_bootindex, NULL, NULL); object_property_set_int(obj, "bootindex", -1, NULL); diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index c662d968db1e..a72189e0a63c 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -203,6 +203,7 @@ #include "qemu/units.h" #include "qemu/range.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "system/system.h" #include "system/block-backend.h" @@ -10578,7 +10579,7 @@ static void nvme_instance_init(Object *obj) "bootindex", "/namespace@1,0", DEVICE(obj)); =20 - object_property_add(obj, "smart_critical_warning", "uint8", + object_property_add_qapi(obj, "smart_critical_warning", &uint8_type_in= fo, nvme_get_smart_warning, nvme_set_smart_warning, NULL, NULL); } diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expand= er_bridge.c index 40ffbc4e0821..9bb7d3c9debe 100644 --- a/hw/pci-bridge/pci_expander_bridge.c +++ b/hw/pci-bridge/pci_expander_bridge.c @@ -12,6 +12,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "hw/pci/pci.h" #include "hw/pci/pci_bus.h" #include "hw/pci/pci_host.h" @@ -103,7 +104,7 @@ static void pxb_bus_class_init(ObjectClass *class, cons= t void *data) pbc->bus_num =3D pxb_bus_num; pbc->numa_node =3D pxb_bus_numa_node; =20 - object_class_property_add(class, "acpi_uid", "uint32", + object_class_property_add_qapi(class, "acpi_uid", &uint32_type_info, prop_pxb_uid_get, NULL, NULL, NULL); object_class_property_set_description(class, "acpi_uid", "ACPI Unique ID used to distinguish this PCI Host Bridge / ACPI000= 16"); diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index c1982f7962a6..feafa6a72fe4 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -32,6 +32,7 @@ #include "hw/core/qdev-properties.h" #include "hw/core/sysbus.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "migration/vmstate.h" #include "qapi/visitor.h" #include "qemu/error-report.h" @@ -387,21 +388,25 @@ static void i440fx_pcihost_class_init(ObjectClass *kl= ass, const void *data) /* Reason: needs to be wired up by pc_init1 */ dc->user_creatable =3D false; =20 - object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_START, "uint32= ", - i440fx_pcihost_get_pci_hole_start, - NULL, NULL, NULL); + object_class_property_add_qapi(klass, PCI_HOST_PROP_PCI_HOLE_START, + &uint32_type_info, + i440fx_pcihost_get_pci_hole_start, + NULL, NULL, NULL); =20 - object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_END, "uint32", - i440fx_pcihost_get_pci_hole_end, - NULL, NULL, NULL); + object_class_property_add_qapi(klass, PCI_HOST_PROP_PCI_HOLE_END, + &uint32_type_info, + i440fx_pcihost_get_pci_hole_end, + NULL, NULL, NULL); =20 - object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_START, "uint= 64", - i440fx_pcihost_get_pci_hole64_start, - NULL, NULL, NULL); + object_class_property_add_qapi(klass, PCI_HOST_PROP_PCI_HOLE64_START, + &uint64_type_info, + i440fx_pcihost_get_pci_hole64_start, + NULL, NULL, NULL); =20 - object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_END, "uint64= ", - i440fx_pcihost_get_pci_hole64_end, - NULL, NULL, NULL); + object_class_property_add_qapi(klass, PCI_HOST_PROP_PCI_HOLE64_END, + &uint64_type_info, + i440fx_pcihost_get_pci_hole64_end, + NULL, NULL, NULL); } =20 static const TypeInfo i440fx_pcihost_info =3D { diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index db061c134e95..667e9585ab8f 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -11,6 +11,7 @@ #include "qemu/bswap.h" #include "qapi/visitor.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "hw/pci-host/pnv_phb3_regs.h" #include "hw/pci-host/pnv_phb.h" #include "hw/pci-host/pnv_phb3.h" @@ -1164,12 +1165,12 @@ static void pnv_phb3_root_bus_class_init(ObjectClas= s *klass, const void *data) { BusClass *k =3D BUS_CLASS(klass); =20 - object_class_property_add(klass, "phb-id", "uint32", + object_class_property_add_qapi(klass, "phb-id", &uint32_type_info, pnv_phb3_root_bus_get_prop, pnv_phb3_root_bus_set_prop, NULL, NULL); =20 - object_class_property_add(klass, "chip-id", "uint32", + object_class_property_add_qapi(klass, "chip-id", &uint32_type_info, pnv_phb3_root_bus_get_prop, pnv_phb3_root_bus_set_prop, NULL, NULL); diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index 9acaf4c0c2f5..96c2f89f889b 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -11,6 +11,7 @@ #include "qemu/bswap.h" #include "qapi/visitor.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "target/ppc/cpu.h" #include "hw/pci-host/pnv_phb4_regs.h" #include "hw/pci-host/pnv_phb4.h" @@ -1761,12 +1762,12 @@ static void pnv_phb4_root_bus_class_init(ObjectClas= s *klass, const void *data) { BusClass *k =3D BUS_CLASS(klass); =20 - object_class_property_add(klass, "phb-id", "uint32", + object_class_property_add_qapi(klass, "phb-id", &uint32_type_info, pnv_phb4_root_bus_get_prop, pnv_phb4_root_bus_set_prop, NULL, NULL); =20 - object_class_property_add(klass, "chip-id", "uint32", + object_class_property_add_qapi(klass, "chip-id", &uint32_type_info, pnv_phb4_root_bus_get_prop, pnv_phb4_root_bus_set_prop, NULL, NULL); diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index f4556ad03a04..6eba30e06811 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -35,6 +35,7 @@ #include "hw/core/qdev-properties.h" #include "migration/vmstate.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qemu/module.h" =20 @@ -226,19 +227,19 @@ static void q35_host_initfn(Object *obj) qdev_prop_set_uint64(DEVICE(s), PCI_HOST_PROP_PCI_HOLE64_SIZE, Q35_PCI_HOST_HOLE64_SIZE_DEFAULT); =20 - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_START, "uint32", + object_property_add_qapi(obj, PCI_HOST_PROP_PCI_HOLE_START, &uint32_ty= pe_info, q35_host_get_pci_hole_start, NULL, NULL, NULL); =20 - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_END, "uint32", + object_property_add_qapi(obj, PCI_HOST_PROP_PCI_HOLE_END, &uint32_type= _info, q35_host_get_pci_hole_end, NULL, NULL, NULL); =20 - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_START, "uint64", + object_property_add_qapi(obj, PCI_HOST_PROP_PCI_HOLE64_START, &uint64_= type_info, q35_host_get_pci_hole64_start, NULL, NULL, NULL); =20 - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_END, "uint64", + object_property_add_qapi(obj, PCI_HOST_PROP_PCI_HOLE64_END, &uint64_ty= pe_info, q35_host_get_pci_hole64_end, NULL, NULL, NULL); =20 diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 5c2150b71c86..64f9ca29b02e 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -12,6 +12,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qobject/qnull.h" #include "qemu/cutils.h" #include "hw/ppc/spapr_drc.h" @@ -584,7 +585,7 @@ static void spapr_dr_connector_instance_init(Object *ob= j) SpaprDrcClass *drck =3D SPAPR_DR_CONNECTOR_GET_CLASS(drc); =20 object_property_add_uint32_ptr(obj, "id", &drc->id, OBJ_PROP_FLAG_READ= ); - object_property_add(obj, "index", "uint32", prop_get_index, + object_property_add_qapi(obj, "index", &uint32_type_info, prop_get_ind= ex, NULL, NULL, NULL); object_property_add(obj, "fdt", "struct", prop_get_fdt, NULL, NULL, NULL); diff --git a/hw/riscv/microchip_pfsoc.c b/hw/riscv/microchip_pfsoc.c index edd29626fa07..e36063244bde 100644 --- a/hw/riscv/microchip_pfsoc.c +++ b/hw/riscv/microchip_pfsoc.c @@ -39,6 +39,7 @@ #include "qemu/units.h" #include "qemu/cutils.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "hw/core/boards.h" #include "hw/core/loader.h" @@ -743,7 +744,7 @@ static void microchip_icicle_kit_machine_class_init(Obj= ectClass *oc, */ mc->default_ram_size =3D 1537 * MiB; =20 - object_class_property_add(oc, "clint-timebase-frequency", "uint32_t", + object_class_property_add_qapi(oc, "clint-timebase-frequency", &uint32= _type_info, microchip_icicle_kit_get_clint_timebase_freq, microchip_icicle_kit_set_clint_timebase_freq, NULL, NULL); diff --git a/hw/s390x/sclpcpi.c b/hw/s390x/sclpcpi.c index ec4bdf23509b..97d37ae4b932 100644 --- a/hw/s390x/sclpcpi.c +++ b/hw/s390x/sclpcpi.c @@ -53,6 +53,7 @@ #include "qemu/timer.h" #include "hw/s390x/event-facility.h" #include "hw/s390x/ebcdic.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/qapi-visit-machine.h" #include "qapi/qapi-events-machine-s390x.h" #include "migration/vmstate.h" @@ -195,12 +196,13 @@ static void cpi_class_init(ObjectClass *klass, const = void *data) "name of the cluster which the VM belongs to, if any" " e.g. \"PLEX \""); =20 - object_class_property_add(klass, "system_level", "uint64", get_system_= level, - NULL, NULL, NULL); + object_class_property_add_qapi(klass, "system_level", + &uint64_type_info, get_system_level, + NULL, NULL, NULL); object_class_property_set_description(klass, "system_level", "distribution and kernel version in Linux e.g. 748723438054305= 28"); =20 - object_class_property_add(klass, "timestamp", "uint64", get_timestamp, + object_class_property_add_qapi(klass, "timestamp", &uint64_type_info, = get_timestamp, NULL, NULL, NULL); object_class_property_set_description(klass, "timestamp", "latest update of CPI data in nanoseconds since the UNIX EPOCH= "); diff --git a/hw/s390x/virtio-ccw-mem.c b/hw/s390x/virtio-ccw-mem.c index dea30aacfb32..046dfd544cf3 100644 --- a/hw/s390x/virtio-ccw-mem.c +++ b/hw/s390x/virtio-ccw-mem.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "hw/core/qdev-properties.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qemu/module.h" #include "virtio-ccw-mem.h" #include "hw/mem/memory-device.h" @@ -205,7 +206,7 @@ static void virtio_ccw_mem_instance_init(Object *obj) OBJECT(&dev->vdev), VIRTIO_MEM_BLOCK_SIZE_PR= OP); object_property_add_alias(obj, VIRTIO_MEM_SIZE_PROP, OBJECT(&dev->vdev= ), VIRTIO_MEM_SIZE_PROP); - object_property_add(obj, VIRTIO_MEM_REQUESTED_SIZE_PROP, "size", + object_property_add_qapi(obj, VIRTIO_MEM_REQUESTED_SIZE_PROP, &size_ty= pe_info, virtio_ccw_mem_get_requested_size, virtio_ccw_mem_set_requested_size, NULL, NULL); } diff --git a/hw/sensor/adc128d818.c b/hw/sensor/adc128d818.c index c65508cba144..7efc48a036ec 100644 --- a/hw/sensor/adc128d818.c +++ b/hw/sensor/adc128d818.c @@ -8,6 +8,7 @@ =20 #include "qemu/osdep.h" #include "qemu/log.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/error.h" #include "qapi/visitor.h" #include "qom/object.h" @@ -642,15 +643,18 @@ static void adc128d818_initfn(Object *obj) for (unsigned ch =3D 0u; ch < ADC128D818_NUM_CHANNELS; ch++) { char *name =3D g_strdup_printf("ain%u", ch); =20 - object_property_add(obj, name, "int", adc128d818_get_ain, - adc128d818_set_ain, NULL, NULL); + object_property_add_qapi(obj, name, &int_type_info, + adc128d818_get_ain, + adc128d818_set_ain, NULL, NULL); g_free(name); } =20 - object_property_add(obj, "temperature", "int", adc128d818_get_temperat= ure, - adc128d818_set_temperature, NULL, NULL); - object_property_add(obj, "ext-vref-mv", "int", adc128d818_get_ext_vref, - adc128d818_set_ext_vref, NULL, NULL); + object_property_add_qapi(obj, "temperature", &int_type_info, + adc128d818_get_temperature, + adc128d818_set_temperature, NULL, NULL); + object_property_add_qapi(obj, "ext-vref-mv", &int_type_info, + adc128d818_get_ext_vref, + adc128d818_set_ext_vref, NULL, NULL); } =20 static void adc128d818_realize(DeviceState *dev, Error **errp) diff --git a/hw/sensor/adm1266.c b/hw/sensor/adm1266.c index 37d1cffd57a9..62f563af7a7a 100644 --- a/hw/sensor/adm1266.c +++ b/hw/sensor/adm1266.c @@ -14,6 +14,7 @@ #include "hw/core/irq.h" #include "migration/vmstate.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qemu/log.h" #include "qemu/module.h" @@ -217,7 +218,7 @@ static void adm1266_init(Object *obj) for (int i =3D 0; i < ADM1266_NUM_PAGES; i++) { pmbus_page_config(pmdev, i, flags); =20 - object_property_add(obj, "vout[*]", "uint16", + object_property_add_qapi(obj, "vout[*]", &uint16_type_info, adm1266_get, adm1266_set, NULL, &pmdev->pages[i].read_vout); } diff --git a/hw/sensor/adm1272.c b/hw/sensor/adm1272.c index 0aa2a8655683..e1c1bf1c54de 100644 --- a/hw/sensor/adm1272.c +++ b/hw/sensor/adm1272.c @@ -12,6 +12,7 @@ #include "hw/core/irq.h" #include "migration/vmstate.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qemu/log.h" #include "qemu/module.h" @@ -493,19 +494,19 @@ static void adm1272_init(Object *obj) =20 pmbus_page_config(pmdev, 0, flags); =20 - object_property_add(obj, "vin", "uint16", + object_property_add_qapi(obj, "vin", &uint16_type_info, adm1272_get, adm1272_set, NULL, &pmdev->pages[0].read_vin); =20 - object_property_add(obj, "vout", "uint16", + object_property_add_qapi(obj, "vout", &uint16_type_info, adm1272_get, adm1272_set, NULL, &pmdev->pages[0].read_vout); =20 - object_property_add(obj, "iout", "uint16", + object_property_add_qapi(obj, "iout", &uint16_type_info, adm1272_get, adm1272_set, NULL, &pmdev->pages[0].read_iout); =20 - object_property_add(obj, "pin", "uint16", + object_property_add_qapi(obj, "pin", &uint16_type_info, adm1272_get, adm1272_set, NULL, &pmdev->pages[0].read_pin); =20 diff --git a/hw/sensor/emc141x.c b/hw/sensor/emc141x.c index a51fc44395ab..5efe94643ca0 100644 --- a/hw/sensor/emc141x.c +++ b/hw/sensor/emc141x.c @@ -22,6 +22,7 @@ #include "hw/i2c/i2c.h" #include "migration/vmstate.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qemu/module.h" #include "qom/object.h" @@ -251,16 +252,16 @@ static void emc141x_reset(DeviceState *dev) =20 static void emc141x_initfn(Object *obj) { - object_property_add(obj, "temperature0", "int", + object_property_add_qapi(obj, "temperature0", &int_type_info, emc141x_get_temperature, emc141x_set_temperature, NULL, NULL); - object_property_add(obj, "temperature1", "int", + object_property_add_qapi(obj, "temperature1", &int_type_info, emc141x_get_temperature, emc141x_set_temperature, NULL, NULL); - object_property_add(obj, "temperature2", "int", + object_property_add_qapi(obj, "temperature2", &int_type_info, emc141x_get_temperature, emc141x_set_temperature, NULL, NULL); - object_property_add(obj, "temperature3", "int", + object_property_add_qapi(obj, "temperature3", &int_type_info, emc141x_get_temperature, emc141x_set_temperature, NULL, NULL); } diff --git a/hw/sensor/isl_pmbus_vr.c b/hw/sensor/isl_pmbus_vr.c index 0fad04def773..8923e9e87510 100644 --- a/hw/sensor/isl_pmbus_vr.c +++ b/hw/sensor/isl_pmbus_vr.c @@ -9,6 +9,7 @@ #include "qemu/osdep.h" #include "hw/sensor/isl_pmbus_vr.h" #include "hw/core/qdev-properties.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qemu/log.h" #include "qemu/module.h" @@ -136,63 +137,63 @@ static void isl_pmbus_vr_add_props(Object *obj, uint6= 4_t *flags, uint8_t pages) PMBusDevice *pmdev =3D PMBUS_DEVICE(obj); for (int i =3D 0; i < pages; i++) { if (flags[i] & PB_HAS_VIN) { - object_property_add(obj, "vin[*]", "uint16", + object_property_add_qapi(obj, "vin[*]", &uint16_type_info, isl_pmbus_vr_get, isl_pmbus_vr_set, NULL, &pmdev->pages[i].read_vin); } =20 if (flags[i] & PB_HAS_VOUT) { - object_property_add(obj, "vout[*]", "uint16", + object_property_add_qapi(obj, "vout[*]", &uint16_type_info, isl_pmbus_vr_get, isl_pmbus_vr_set, NULL, &pmdev->pages[i].read_vout); } =20 if (flags[i] & PB_HAS_IIN) { - object_property_add(obj, "iin[*]", "uint16", + object_property_add_qapi(obj, "iin[*]", &uint16_type_info, isl_pmbus_vr_get, isl_pmbus_vr_set, NULL, &pmdev->pages[i].read_iin); } =20 if (flags[i] & PB_HAS_IOUT) { - object_property_add(obj, "iout[*]", "uint16", + object_property_add_qapi(obj, "iout[*]", &uint16_type_info, isl_pmbus_vr_get, isl_pmbus_vr_set, NULL, &pmdev->pages[i].read_iout); } =20 if (flags[i] & PB_HAS_PIN) { - object_property_add(obj, "pin[*]", "uint16", + object_property_add_qapi(obj, "pin[*]", &uint16_type_info, isl_pmbus_vr_get, isl_pmbus_vr_set, NULL, &pmdev->pages[i].read_pin); } =20 if (flags[i] & PB_HAS_POUT) { - object_property_add(obj, "pout[*]", "uint16", + object_property_add_qapi(obj, "pout[*]", &uint16_type_info, isl_pmbus_vr_get, isl_pmbus_vr_set, NULL, &pmdev->pages[i].read_pout); } =20 if (flags[i] & PB_HAS_TEMPERATURE) { - object_property_add(obj, "temp1[*]", "uint16", + object_property_add_qapi(obj, "temp1[*]", &uint16_type_info, isl_pmbus_vr_get, isl_pmbus_vr_set, NULL, &pmdev->pages[i].read_temperature_1); } =20 if (flags[i] & PB_HAS_TEMP2) { - object_property_add(obj, "temp2[*]", "uint16", + object_property_add_qapi(obj, "temp2[*]", &uint16_type_info, isl_pmbus_vr_get, isl_pmbus_vr_set, NULL, &pmdev->pages[i].read_temperature_2); } =20 if (flags[i] & PB_HAS_TEMP3) { - object_property_add(obj, "temp3[*]", "uint16", + object_property_add_qapi(obj, "temp3[*]", &uint16_type_info, isl_pmbus_vr_get, isl_pmbus_vr_set, NULL, &pmdev->pages[i].read_temperature_3); diff --git a/hw/sensor/lsm303dlhc_mag.c b/hw/sensor/lsm303dlhc_mag.c index cd5773ae64e8..c8085739ca47 100644 --- a/hw/sensor/lsm303dlhc_mag.c +++ b/hw/sensor/lsm303dlhc_mag.c @@ -25,6 +25,7 @@ #include "hw/i2c/i2c.h" #include "migration/vmstate.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qemu/module.h" #include "qemu/log.h" @@ -509,19 +510,19 @@ static void lsm303dlhc_mag_reset(DeviceState *dev) */ static void lsm303dlhc_mag_initfn(Object *obj) { - object_property_add(obj, "mag-x", "int", + object_property_add_qapi(obj, "mag-x", &int_type_info, lsm303dlhc_mag_get_x, lsm303dlhc_mag_set_x, NULL, NULL); =20 - object_property_add(obj, "mag-y", "int", + object_property_add_qapi(obj, "mag-y", &int_type_info, lsm303dlhc_mag_get_y, lsm303dlhc_mag_set_y, NULL, NULL); =20 - object_property_add(obj, "mag-z", "int", + object_property_add_qapi(obj, "mag-z", &int_type_info, lsm303dlhc_mag_get_z, lsm303dlhc_mag_set_z, NULL, NULL); =20 - object_property_add(obj, "temperature", "int", + object_property_add_qapi(obj, "temperature", &int_type_info, lsm303dlhc_mag_get_temperature, lsm303dlhc_mag_set_temperature, NULL, NULL); } diff --git a/hw/sensor/max34451.c b/hw/sensor/max34451.c index 4d64434f3af4..3c8fa3d4a861 100644 --- a/hw/sensor/max34451.c +++ b/hw/sensor/max34451.c @@ -11,6 +11,7 @@ #include "hw/core/irq.h" #include "migration/vmstate.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qemu/log.h" #include "qemu/module.h" @@ -727,7 +728,7 @@ static void max34451_init(Object *obj) =20 /* get and set the voltage in millivolts, max is 32767 mV */ for (int i =3D 0; i < MAX34451_NUM_PWR_DEVICES; i++) { - object_property_add(obj, "vout[*]", "uint16", + object_property_add_qapi(obj, "vout[*]", &uint16_type_info, max34451_get, max34451_set, NULL, &pmdev->pages[i].read_vout= ); } @@ -737,7 +738,7 @@ static void max34451_init(Object *obj) * centidegrees Celsius i.e.: 2500 -> 25.00 C, max is 327.67 C */ for (int i =3D 0; i < MAX34451_NUM_TEMP_DEVICES; i++) { - object_property_add(obj, "temperature[*]", "uint16", + object_property_add_qapi(obj, "temperature[*]", &uint16_type_info, max34451_get, max34451_set, NULL, diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index ece0650d703f..5b6cc3ba2dc5 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -28,6 +28,7 @@ #include "qemu/osdep.h" #include "qemu/module.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qom/object.h" #include "hw/sensor/tmp105.h" @@ -408,7 +409,7 @@ static void tmp105_realize(DeviceState *dev, Error **er= rp) =20 static void tmp105_initfn(Object *obj) { - object_property_add(obj, "temperature", "int", + object_property_add_qapi(obj, "temperature", &int_type_info, tmp105_get_temperature, tmp105_set_temperature, NULL, NULL); object_property_set_description(obj, "temperature", diff --git a/hw/sensor/tmp421.c b/hw/sensor/tmp421.c index 127edd0ba568..60844e76b21f 100644 --- a/hw/sensor/tmp421.c +++ b/hw/sensor/tmp421.c @@ -28,6 +28,7 @@ #include "hw/i2c/i2c.h" #include "migration/vmstate.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qemu/module.h" #include "qom/object.h" @@ -350,16 +351,16 @@ static void tmp421_class_init(ObjectClass *klass, con= st void *data) dc->vmsd =3D &vmstate_tmp421; sc->dev =3D (DeviceInfo *) data; =20 - object_class_property_add(klass, "temperature0", "int", + object_class_property_add_qapi(klass, "temperature0", &int_type_info, tmp421_get_temperature, tmp421_set_temperature, NULL, NULL); - object_class_property_add(klass, "temperature1", "int", + object_class_property_add_qapi(klass, "temperature1", &int_type_info, tmp421_get_temperature, tmp421_set_temperature, NULL, NULL); - object_class_property_add(klass, "temperature2", "int", + object_class_property_add_qapi(klass, "temperature2", &int_type_info, tmp421_get_temperature, tmp421_set_temperature, NULL, NULL); - object_class_property_add(klass, "temperature3", "int", + object_class_property_add_qapi(klass, "temperature3", &int_type_info, tmp421_get_temperature, tmp421_set_temperature, NULL, NULL); } diff --git a/hw/usb/dev-storage-classic.c b/hw/usb/dev-storage-classic.c index 977151c4a087..06584092bcae 100644 --- a/hw/usb/dev-storage-classic.c +++ b/hw/usb/dev-storage-classic.c @@ -9,6 +9,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "hw/usb/usb.h" #include "hw/usb/desc.h" @@ -122,7 +123,7 @@ out: =20 static void usb_msd_instance_init(Object *obj) { - object_property_add(obj, "bootindex", "int32", + object_property_add_qapi(obj, "bootindex", &int32_type_info, usb_msd_get_bootindex, usb_msd_set_bootindex, NULL, NULL); object_property_set_int(obj, "bootindex", -1, NULL); diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 4c5f486ba238..9e43948128f7 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -27,6 +27,7 @@ #include "hw/virtio/virtio-balloon.h" #include "system/address-spaces.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/qapi-events-machine.h" #include "qapi/visitor.h" #include "trace.h" @@ -1022,7 +1023,7 @@ static void virtio_balloon_instance_init(Object *obj) object_property_add(obj, "guest-stats", "guest statistics", balloon_stats_get_all, NULL, NULL, NULL); =20 - object_property_add(obj, "guest-stats-polling-interval", "int", + object_property_add_qapi(obj, "guest-stats-polling-interval", &int_typ= e_info, balloon_stats_get_poll_interval, balloon_stats_set_poll_interval, NULL, NULL); diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c index f592eb1a7849..80e9bfedd9f5 100644 --- a/hw/virtio/virtio-mem-pci.c +++ b/hw/virtio/virtio-mem-pci.c @@ -14,6 +14,7 @@ #include "virtio-mem-pci.h" #include "hw/mem/memory-device.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/qapi-events-machine.h" #include "qapi/qapi-events-misc.h" =20 @@ -211,7 +212,7 @@ static void virtio_mem_pci_instance_init(Object *obj) OBJECT(&dev->vdev), VIRTIO_MEM_BLOCK_SIZE_PR= OP); object_property_add_alias(obj, VIRTIO_MEM_SIZE_PROP, OBJECT(&dev->vdev= ), VIRTIO_MEM_SIZE_PROP); - object_property_add(obj, VIRTIO_MEM_REQUESTED_SIZE_PROP, "size", + object_property_add_qapi(obj, VIRTIO_MEM_REQUESTED_SIZE_PROP, &size_ty= pe_info, virtio_mem_pci_get_requested_size, virtio_mem_pci_set_requested_size, NULL, NULL); } diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index 7130ed852d9c..42dc028e3bdc 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -26,6 +26,7 @@ #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-mem.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "migration/misc.h" #include "hw/core/boards.h" @@ -1533,14 +1534,15 @@ static void virtio_mem_instance_init(Object *obj) =20 notifier_list_init(&vmem->size_change_notifiers); =20 - object_property_add(obj, VIRTIO_MEM_SIZE_PROP, "size", virtio_mem_get_= size, - NULL, NULL, NULL); - object_property_add(obj, VIRTIO_MEM_REQUESTED_SIZE_PROP, "size", - virtio_mem_get_requested_size, - virtio_mem_set_requested_size, NULL, NULL); - object_property_add(obj, VIRTIO_MEM_BLOCK_SIZE_PROP, "size", - virtio_mem_get_block_size, virtio_mem_set_block_si= ze, - NULL, NULL); + object_property_add_qapi(obj, VIRTIO_MEM_SIZE_PROP, &size_type_info, + virtio_mem_get_size, + NULL, NULL, NULL); + object_property_add_qapi(obj, VIRTIO_MEM_REQUESTED_SIZE_PROP, &size_ty= pe_info, + virtio_mem_get_requested_size, + virtio_mem_set_requested_size, NULL, NULL); + object_property_add_qapi(obj, VIRTIO_MEM_BLOCK_SIZE_PROP, &size_type_i= nfo, + virtio_mem_get_block_size, virtio_mem_set_blo= ck_size, + NULL, NULL); } =20 static void virtio_mem_instance_finalize(Object *obj) diff --git a/hw/xen/xen-pvh-common.c b/hw/xen/xen-pvh-common.c index cca37202ffb2..7b4fd933a8fb 100644 --- a/hw/xen/xen-pvh-common.c +++ b/hw/xen/xen-pvh-common.c @@ -9,6 +9,7 @@ #include "qemu/osdep.h" #include "qemu/error-report.h" #include "qemu/units.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "hw/core/boards.h" #include "hw/core/irq.h" @@ -413,7 +414,7 @@ void xen_pvh_class_setup_common_props(XenPVHMachineClas= s *xpc) =20 #define OC_MEMMAP_PROP_BASE(c, prop_name, name) \ do { \ - object_class_property_add(c, prop_name "-base", "uint64_t", \ + object_class_property_add_qapi(c, prop_name "-base", &uint64_type_info= ,\ xen_pvh_get_ ## name ## _base, \ xen_pvh_set_ ## name ## _base, NULL, NULL); \ object_class_property_set_description(oc, prop_name "-base", \ @@ -422,7 +423,7 @@ do { = \ =20 #define OC_MEMMAP_PROP_SIZE(c, prop_name, name) \ do { \ - object_class_property_add(c, prop_name "-size", "uint64_t", \ + object_class_property_add_qapi(c, prop_name "-size", &size_type_info, \ xen_pvh_get_ ## name ## _size, \ xen_pvh_set_ ## name ## _size, NULL, NULL); \ object_class_property_set_description(oc, prop_name "-size", \ @@ -458,7 +459,7 @@ do { = \ OC_MEMMAP_PROP(oc, "pci-mmio", pci_mmio); OC_MEMMAP_PROP(oc, "pci-mmio-high", pci_mmio_high); =20 - object_class_property_add(oc, "pci-intx-irq-base", "uint32_t", + object_class_property_add_qapi(oc, "pci-intx-irq-base", &uint32_ty= pe_info, xen_pvh_get_pci_intx_irq_base, xen_pvh_set_pci_intx_irq_base, NULL, NULL); @@ -468,7 +469,7 @@ do { = \ =20 #ifdef CONFIG_TPM if (xpc->has_tpm) { - object_class_property_add(oc, "tpm-base-addr", "uint64_t", + object_class_property_add_qapi(oc, "tpm-base-addr", &uint64_type_i= nfo, xen_pvh_get_tpm_base, xen_pvh_set_tpm_base, NULL, NULL); diff --git a/iothread.c b/iothread.c index 76eea6df3861..7285135d40a8 100644 --- a/iothread.c +++ b/iothread.c @@ -20,6 +20,7 @@ #include "system/event-loop-base.h" #include "system/iothread.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/qapi-commands-misc.h" #include "qemu/error-report.h" #include "qemu/rcu.h" @@ -315,19 +316,19 @@ static void iothread_class_init(ObjectClass *klass, c= onst void *class_data) bc->init =3D iothread_init; bc->update_params =3D iothread_set_aio_context_params; =20 - object_class_property_add(klass, "poll-max-ns", "int64", + object_class_property_add_qapi(klass, "poll-max-ns", &int64_type_info, iothread_get_poll_param, iothread_set_poll_param, NULL, &poll_max_ns_info); - object_class_property_add(klass, "poll-grow", "int64", + object_class_property_add_qapi(klass, "poll-grow", &int64_type_info, iothread_get_poll_param, iothread_set_poll_param, NULL, &poll_grow_info); - object_class_property_add(klass, "poll-shrink", "int64", + object_class_property_add_qapi(klass, "poll-shrink", &int64_type_info, iothread_get_poll_param, iothread_set_poll_param, NULL, &poll_shrink_info); - object_class_property_add(klass, "poll-weight", "int64", + object_class_property_add_qapi(klass, "poll-weight", &int64_type_info, iothread_get_poll_param, iothread_set_poll_param, NULL, &poll_weight_info); diff --git a/net/colo-compare.c b/net/colo-compare.c index a6910de869ff..4b237a59d120 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -16,6 +16,7 @@ #include "qemu/error-report.h" #include "trace.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "net/net.h" #include "net/eth.h" #include "qom/object_interfaces.h" @@ -1373,15 +1374,15 @@ static void colo_compare_init(Object *obj) object_property_add_str(obj, "notify_dev", compare_get_notify_dev, compare_set_notify_dev= ); =20 - object_property_add(obj, "compare_timeout", "uint64", + object_property_add_qapi(obj, "compare_timeout", &uint64_type_info, compare_get_timeout, compare_set_timeout, NULL, NULL); =20 - object_property_add(obj, "expired_scan_cycle", "uint32", + object_property_add_qapi(obj, "expired_scan_cycle", &uint32_type_info, compare_get_expired_scan_cycle, compare_set_expired_scan_cycle, NULL, NULL); =20 - object_property_add(obj, "max_queue_size", "uint32", + object_property_add_qapi(obj, "max_queue_size", &uint32_type_info, get_max_queue_size, set_max_queue_size, NULL, NULL); =20 diff --git a/net/dump.c b/net/dump.c index 0c39f09892c2..3d7bb36182ec 100644 --- a/net/dump.c +++ b/net/dump.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "clients.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qemu/error-report.h" #include "qemu/iov.h" #include "qemu/module.h" @@ -238,8 +239,9 @@ static void filter_dump_class_init(ObjectClass *oc, con= st void *data) { NetFilterClass *nfc =3D NETFILTER_CLASS(oc); =20 - object_class_property_add(oc, "maxlen", "uint32", filter_dump_get_maxl= en, - filter_dump_set_maxlen, NULL, NULL); + object_class_property_add_qapi(oc, "maxlen", &uint32_type_info, + filter_dump_get_maxlen, + filter_dump_set_maxlen, NULL, NULL); object_class_property_add_str(oc, "file", file_dump_get_filename, file_dump_set_filename); =20 diff --git a/net/filter-buffer.c b/net/filter-buffer.c index 427da24097f2..9d7a9f5cb2c7 100644 --- a/net/filter-buffer.c +++ b/net/filter-buffer.c @@ -10,6 +10,7 @@ #include "net/filter.h" #include "net/queue.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qemu/timer.h" #include "qemu/iov.h" #include "qapi/qapi-builtin-visit.h" @@ -182,7 +183,7 @@ static void filter_buffer_class_init(ObjectClass *oc, c= onst void *data) { NetFilterClass *nfc =3D NETFILTER_CLASS(oc); =20 - object_class_property_add(oc, "interval", "uint32", + object_class_property_add_qapi(oc, "interval", &uint32_type_info, filter_buffer_get_interval, filter_buffer_set_interval, NULL, NULL); =20 diff --git a/qom/object.c b/qom/object.c index 8e6ca25dc49d..bbaa999ae0c9 100644 --- a/qom/object.c +++ b/qom/object.c @@ -22,9 +22,9 @@ #include "qapi/string-output-visitor.h" #include "qapi/qobject-input-visitor.h" #include "qapi/forward-visitor.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/qapi-builtin-visit.h" #include "qobject/qdict.h" -#include "qobject/qjson.h" #include "qemu/id.h" #include "qapi/qmp/qerror.h" #include "trace.h" @@ -2429,7 +2429,7 @@ object_property_add_str(Object *obj, const char *name, prop->get =3D get; prop->set =3D set; =20 - return object_property_add(obj, name, "string", + return object_property_add_qapi(obj, name, &str_type_info, get ? property_get_str : NULL, set ? property_set_str : NULL, property_release_data, @@ -2447,7 +2447,7 @@ object_class_property_add_str(ObjectClass *klass, con= st char *name, prop->get =3D get; prop->set =3D set; =20 - return object_class_property_add(klass, name, "string", + return object_class_property_add_qapi(klass, name, &str_type_info, get ? property_get_str : NULL, set ? property_set_str : NULL, NULL, @@ -2499,7 +2499,7 @@ object_property_add_bool(Object *obj, const char *nam= e, prop->get =3D get; prop->set =3D set; =20 - return object_property_add(obj, name, "bool", + return object_property_add_qapi(obj, name, &bool_type_info, get ? property_get_bool : NULL, set ? property_set_bool : NULL, property_release_data, @@ -2516,7 +2516,7 @@ object_class_property_add_bool(ObjectClass *klass, co= nst char *name, prop->get =3D get; prop->set =3D set; =20 - return object_class_property_add(klass, name, "bool", + return object_class_property_add_qapi(klass, name, &bool_type_info, get ? property_get_bool : NULL, set ? property_set_bool : NULL, NULL, @@ -2856,8 +2856,8 @@ object_property_add_uint8_ptr(Object *obj, const char= *name, setter =3D property_set_uint8_ptr; } =20 - return object_property_add(obj, name, "uint8", - getter, setter, NULL, (void *)v); + return object_property_add_qapi(obj, name, &uint8_type_info, + getter, setter, NULL, (void *)v); } =20 ObjectProperty * @@ -2897,8 +2897,8 @@ object_class_static_property_add_uint8_ptr(ObjectClas= s *klass, setter =3D property_set_uint8_ptr; } =20 - return object_class_property_add(klass, name, "uint8", - getter, setter, NULL, (void *)v); + return object_class_property_add_qapi(klass, name, &uint8_type_info, + getter, setter, NULL, (void *)v); } =20 ObjectProperty * @@ -2917,8 +2917,8 @@ object_property_add_uint16_ptr(Object *obj, const cha= r *name, setter =3D property_set_uint16_ptr; } =20 - return object_property_add(obj, name, "uint16", - getter, setter, NULL, (void *)v); + return object_property_add_qapi(obj, name, &uint16_type_info, + getter, setter, NULL, (void *)v); } =20 ObjectProperty * @@ -2958,8 +2958,8 @@ object_class_static_property_add_uint16_ptr(ObjectCla= ss *klass, setter =3D property_set_uint16_ptr; } =20 - return object_class_property_add(klass, name, "uint16", - getter, setter, NULL, (void *)v); + return object_class_property_add_qapi(klass, name, &uint16_type_info, + getter, setter, NULL, (void *)v); } =20 ObjectProperty * @@ -2978,8 +2978,8 @@ object_property_add_uint32_ptr(Object *obj, const cha= r *name, setter =3D property_set_uint32_ptr; } =20 - return object_property_add(obj, name, "uint32", - getter, setter, NULL, (void *)v); + return object_property_add_qapi(obj, name, &uint32_type_info, + getter, setter, NULL, (void *)v); } =20 ObjectProperty * @@ -3019,8 +3019,8 @@ object_class_static_property_add_uint32_ptr(ObjectCla= ss *klass, setter =3D property_set_uint32_ptr; } =20 - return object_class_property_add(klass, name, "uint32", - getter, setter, NULL, (void *)v); + return object_class_property_add_qapi(klass, name, &uint32_type_info, + getter, setter, NULL, (void *)v); } =20 ObjectProperty * @@ -3039,8 +3039,8 @@ object_property_add_uint64_ptr(Object *obj, const cha= r *name, setter =3D property_set_uint64_ptr; } =20 - return object_property_add(obj, name, "uint64", - getter, setter, NULL, (void *)v); + return object_property_add_qapi(obj, name, &uint64_type_info, + getter, setter, NULL, (void *)v); } =20 ObjectProperty * @@ -3080,8 +3080,8 @@ object_class_static_property_add_uint64_ptr(ObjectCla= ss *klass, setter =3D property_set_uint64_ptr; } =20 - return object_class_property_add(klass, name, "uint64", - getter, setter, NULL, (void *)v); + return object_class_property_add_qapi(klass, name, &uint64_type_info, + getter, setter, NULL, (void *)v); } =20 typedef struct { diff --git a/system/bootdevice.c b/system/bootdevice.c index 9538b08983f5..7789e464186a 100644 --- a/system/bootdevice.c +++ b/system/bootdevice.c @@ -24,6 +24,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "system/system.h" #include "qapi/visitor.h" #include "qemu/error-report.h" @@ -336,7 +337,7 @@ void device_add_bootindex_property(Object *obj, int32_t= *bootindex, prop->suffix =3D suffix; prop->dev =3D dev; =20 - object_property_add(obj, name, "int32", + object_property_add_qapi(obj, name, &int32_type_info, device_get_bootindex, device_set_bootindex, property_release_bootindex, diff --git a/system/memory.c b/system/memory.c index 264dc90c0a55..72ecb3115496 100644 --- a/system/memory.c +++ b/system/memory.c @@ -16,6 +16,7 @@ #include "qemu/osdep.h" #include "qemu/log.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "system/memory.h" #include "qapi/visitor.h" #include "qemu/bitops.h" @@ -1293,11 +1294,11 @@ static void memory_region_initfn(Object *obj) =20 object_property_add_uint64_ptr(OBJECT(mr), "addr", &mr->addr, OBJ_PROP_FLAG_READ); - object_property_add(OBJECT(mr), "priority", "int32", + object_property_add_qapi(OBJECT(mr), "priority", &int32_type_info, memory_region_get_priority, NULL, /* memory_region_set_priority */ NULL, NULL); - object_property_add(OBJECT(mr), "size", "uint64", + object_property_add_qapi(OBJECT(mr), "size", &uint64_type_info, memory_region_get_size, NULL, /* memory_region_set_size, */ NULL, NULL); diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 4e8c47253086..55df765e64d1 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -20,6 +20,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "cpu.h" #include "cpregs.h" #include "qemu/module.h" @@ -320,7 +321,7 @@ static void prop_bool_set_false(Object *obj, Visitor *v= , const char *name, =20 static void prop_add_stub_bool(Object *obj, const char *name) { - object_property_add(obj, name, "bool", prop_bool_get_false, + object_property_add_qapi(obj, name, &bool_type_info, prop_bool_get_fal= se, prop_bool_set_false, NULL, NULL); } =20 @@ -510,13 +511,13 @@ void aarch64_add_sve_properties(Object *obj) for (vq =3D 1; vq <=3D ARM_MAX_VQ; ++vq) { char name[8]; snprintf(name, sizeof(name), "sve%d", vq * 128); - object_property_add(obj, name, "bool", cpu_arm_get_vq, + object_property_add_qapi(obj, name, &bool_type_info, cpu_arm_get_v= q, cpu_arm_set_vq, NULL, &cpu->sve_vq); } =20 #ifdef CONFIG_USER_ONLY /* Mirror linux /proc/sys/abi/sve_default_vector_length. */ - object_property_add(obj, "sve-default-vector-length", "int32", + object_property_add_qapi(obj, "sve-default-vector-length", &int32_type= _info, cpu_arm_get_default_vec_len, cpu_arm_set_default_vec_len, NULL, &cpu->sve_default_vq); @@ -535,13 +536,13 @@ void aarch64_add_sme_properties(Object *obj) for (vq =3D 1; vq <=3D ARM_MAX_VQ; vq <<=3D 1) { char name[8]; snprintf(name, sizeof(name), "sme%d", vq * 128); - object_property_add(obj, name, "bool", cpu_arm_get_vq, + object_property_add_qapi(obj, name, &bool_type_info, cpu_arm_get_v= q, cpu_arm_set_vq, NULL, &cpu->sme_vq); } =20 #ifdef CONFIG_USER_ONLY /* Mirror linux /proc/sys/abi/sme_default_vector_length. */ - object_property_add(obj, "sme-default-vector-length", "int32", + object_property_add_qapi(obj, "sme-default-vector-length", &int32_type= _info, cpu_arm_get_default_vec_len, cpu_arm_set_default_vec_len, NULL, &cpu->sme_default_vq); diff --git a/target/arm/kvm.c b/target/arm/kvm.c index ed99be7fd80c..198b7615f4cc 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -20,6 +20,7 @@ #include "qemu/main-loop.h" #include "qom/object.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "system/system.h" #include "system/runstate.h" #include "system/ramblock.h" @@ -1777,7 +1778,7 @@ static void kvm_arch_set_eager_split_size(Object *obj= , Visitor *v, =20 void kvm_arch_accel_class_init(ObjectClass *oc) { - object_class_property_add(oc, "eager-split-size", "size", + object_class_property_add_qapi(oc, "eager-split-size", &size_type_info, kvm_arch_get_eager_split_size, kvm_arch_set_eager_split_size, NULL, NULL); =20 diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c index affd87a3ae55..da8d44f1fc61 100644 --- a/target/arm/tcg/cpu64.c +++ b/target/arm/tcg/cpu64.c @@ -20,6 +20,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "cpu.h" #include "qemu/module.h" #include "qapi/visitor.h" @@ -1392,9 +1393,9 @@ void aarch64_max_v8_tcg_initfn(Object *obj) /* v8.2: FEAT_SVE */ cpu->sve_vq.supported =3D MAKE_64BIT_MASK(0, ARM_MAX_VQ); aarch64_add_sve_properties(OBJECT(cpu)); - object_property_add(OBJECT(cpu), "sve-max-vq", "uint32", - cpu_max_get_sve_max_vq, cpu_max_set_sve_max_vq, - NULL, NULL); + object_property_add_qapi(OBJECT(cpu), "sve-max-vq", &uint32_type_info, + cpu_max_get_sve_max_vq, + cpu_max_set_sve_max_vq, NULL, NULL); =20 /* v8.2: FEAT_PAuth2 */ aarch64_add_pauth_properties(OBJECT(cpu)); @@ -1524,8 +1525,8 @@ void aarch64_max_v9_tcg_initfn(Object *obj) object_property_add_bool(obj, "x-rme", cpu_arm_get_rme, cpu_arm_set_rm= e); =20 /* v9.4: FEAT_RME_GPC2 */ - object_property_add(obj, "x-l0gptsz", "uint32", cpu_max_get_l0gptsz, - cpu_max_set_l0gptsz, NULL, NULL); + object_property_add_qapi(obj, "x-l0gptsz", &uint32_type_info, cpu_max_= get_l0gptsz, + cpu_max_set_l0gptsz, NULL, NULL); } =20 static const ARMCPUInfo aarch64_cpus[] =3D { diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 8650ff6caecc..ebce8e128224 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -10431,7 +10431,7 @@ static void x86_cpu_register_bit_prop(X86CPUClass *= xcc, fp =3D g_new0(BitProperty, 1); fp->w =3D w; fp->mask =3D mask; - object_class_property_add(oc, prop_name, "bool", + object_class_property_add_qapi(oc, prop_name, &bool_type_info, x86_cpu_get_bit_prop, x86_cpu_set_bit_prop, NULL, fp); @@ -10950,13 +10950,13 @@ static void x86_cpu_common_class_init(ObjectClass= *oc, const void *data) =20 dc->user_creatable =3D true; =20 - object_class_property_add(oc, "family", "uint64", + object_class_property_add_qapi(oc, "family", &uint64_type_info, x86_cpuid_version_get_family, x86_cpuid_version_set_family, NULL, NULL); - object_class_property_add(oc, "model", "uint64", + object_class_property_add_qapi(oc, "model", &uint64_type_info, x86_cpuid_version_get_model, x86_cpuid_version_set_model, NULL, NULL); - object_class_property_add(oc, "stepping", "uint64", + object_class_property_add_qapi(oc, "stepping", &uint64_type_info, x86_cpuid_version_get_stepping, x86_cpuid_version_set_stepping, NULL, NULL); object_class_property_add_str(oc, "vendor", @@ -10965,7 +10965,7 @@ static void x86_cpu_common_class_init(ObjectClass *= oc, const void *data) object_class_property_add_str(oc, "model-id", x86_cpuid_get_model_id, x86_cpuid_set_model_id); - object_class_property_add(oc, "tsc-frequency", "int", + object_class_property_add_qapi(oc, "tsc-frequency", &int_type_info, x86_cpuid_get_tsc_freq, x86_cpuid_set_tsc_freq, NULL, NULL); /* @@ -10978,7 +10978,7 @@ static void x86_cpu_common_class_init(ObjectClass *= oc, const void *data) x86_cpu_get_unavailable_features, NULL, NULL, NULL); =20 - object_class_property_add(oc, "avx10-version", "uint8", + object_class_property_add_qapi(oc, "avx10-version", &uint8_type_info, x86_cpuid_get_avx10_version, x86_cpuid_set_avx10_version, NULL, NULL); diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 9f65419a2c1a..aa4967adf99e 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -7099,7 +7099,7 @@ void kvm_arch_accel_class_init(ObjectClass *oc) .set =3D kvm_arch_set_notify_vmexit, )); =20 - object_class_property_add(oc, "notify-window", "uint32", + object_class_property_add_qapi(oc, "notify-window", &uint32_type_info, kvm_arch_get_notify_window, kvm_arch_set_notify_window, NULL, NULL); @@ -7107,7 +7107,7 @@ void kvm_arch_accel_class_init(ObjectClass *oc) "Clock cycles without an event w= indow " "after which a notification VM e= xit occurs"); =20 - object_class_property_add(oc, "xen-version", "uint32", + object_class_property_add_qapi(oc, "xen-version", &uint32_type_info, kvm_arch_get_xen_version, kvm_arch_set_xen_version, NULL, NULL); @@ -7116,14 +7116,14 @@ void kvm_arch_accel_class_init(ObjectClass *oc) "(in XENVER_version form " "e.g. 0x4000a for 4.10)"); =20 - object_class_property_add(oc, "xen-gnttab-max-frames", "uint16", + object_class_property_add_qapi(oc, "xen-gnttab-max-frames", &uint16_ty= pe_info, kvm_arch_get_xen_gnttab_max_frames, kvm_arch_set_xen_gnttab_max_frames, NULL, NULL); object_class_property_set_description(oc, "xen-gnttab-max-frames", "Maximum number of grant table f= rames"); =20 - object_class_property_add(oc, "xen-evtchn-max-pirq", "uint16", + object_class_property_add_qapi(oc, "xen-evtchn-max-pirq", &uint16_type= _info, kvm_arch_get_xen_evtchn_max_pirq, kvm_arch_set_xen_evtchn_max_pirq, NULL, NULL); diff --git a/target/i386/sev.c b/target/i386/sev.c index b2c7260c80a4..3a36fa4d0b95 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -3266,7 +3266,7 @@ sev_snp_guest_class_init(ObjectClass *oc, const void = *data) x86_klass->adjust_cpuid_features =3D sev_snp_adjust_cpuid_features; x86_klass->kvm_type =3D sev_snp_kvm_type; =20 - object_class_property_add(oc, "policy", "uint64", + object_class_property_add_qapi(oc, "policy", &uint64_type_info, sev_snp_guest_get_policy, sev_snp_guest_set_policy, NULL, NULL); object_class_property_add_str(oc, "guest-visible-workarounds", diff --git a/target/ppc/compat.c b/target/ppc/compat.c index 55de3bd5d5de..4d81225de37f 100644 --- a/target/ppc/compat.c +++ b/target/ppc/compat.c @@ -23,6 +23,7 @@ #include "kvm_ppc.h" #include "system/cpus.h" #include "qemu/error-report.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/error.h" #include "qapi/visitor.h" #include "cpu-models.h" @@ -335,7 +336,7 @@ void ppc_compat_add_property(Object *obj, const char *n= ame, gchar *names, *desc; int i; =20 - object_property_add(obj, name, "string", + object_property_add_qapi(obj, name, &str_type_info, ppc_compat_prop_get, ppc_compat_prop_set, NULL, compat_pvr); =20 diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 5fff9d745e9b..bd3fa786ee40 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -27,6 +27,7 @@ #include "target/riscv/tcg/csr.h" #include "internals.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qemu/error-report.h" #include "qemu/timer.h" @@ -1396,20 +1397,20 @@ void riscv_add_satp_mode_properties(Object *obj) { RISCVCPU *cpu =3D RISCV_CPU(obj); =20 - object_property_add(obj, "svbare", "bool", cpu_riscv_get_satp, - cpu_riscv_set_satp, NULL, &cpu->satp_modes); + object_property_add_qapi(obj, "svbare", &bool_type_info, cpu_riscv_get= _satp, + cpu_riscv_set_satp, NULL, &cpu->satp_modes); =20 if (cpu->env.misa_mxl =3D=3D MXL_RV32) { - object_property_add(obj, "sv32", "bool", cpu_riscv_get_satp, + object_property_add_qapi(obj, "sv32", &bool_type_info, cpu_riscv_g= et_satp, cpu_riscv_set_satp, NULL, &cpu->satp_modes); } else { - object_property_add(obj, "sv39", "bool", cpu_riscv_get_satp, + object_property_add_qapi(obj, "sv39", &bool_type_info, cpu_riscv_g= et_satp, cpu_riscv_set_satp, NULL, &cpu->satp_modes); - object_property_add(obj, "sv48", "bool", cpu_riscv_get_satp, + object_property_add_qapi(obj, "sv48", &bool_type_info, cpu_riscv_g= et_satp, cpu_riscv_set_satp, NULL, &cpu->satp_modes); - object_property_add(obj, "sv57", "bool", cpu_riscv_get_satp, + object_property_add_qapi(obj, "sv57", &bool_type_info, cpu_riscv_g= et_satp, cpu_riscv_set_satp, NULL, &cpu->satp_modes); - object_property_add(obj, "sv64", "bool", cpu_riscv_get_satp, + object_property_add_qapi(obj, "sv64", &bool_type_info, cpu_riscv_g= et_satp, cpu_riscv_set_satp, NULL, &cpu->satp_modes); } } diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c index 68e1501b21e2..d2d6cb7a4c66 100644 --- a/target/riscv/kvm/kvm-cpu.c +++ b/target/riscv/kvm/kvm-cpu.c @@ -24,6 +24,7 @@ =20 #include "qemu/timer.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qapi/visitor.h" @@ -532,7 +533,7 @@ static void riscv_cpu_add_kvm_unavail_prop(Object *obj,= const char *prop_name) * unknown to KVM and error out if the user attempts * to enable any of them. */ - object_property_add(obj, prop_name, "bool", + object_property_add_qapi(obj, prop_name, &bool_type_info, cpu_get_cfg_unavailable, cpu_set_cfg_unavailable, NULL, (void *)prop_name); @@ -552,7 +553,7 @@ static void kvm_riscv_add_cpu_user_properties(Object *c= pu_obj) misa_cfg->name =3D riscv_get_misa_ext_name(bit); misa_cfg->description =3D riscv_get_misa_ext_description(bit); =20 - object_property_add(cpu_obj, misa_cfg->name, "bool", + object_property_add_qapi(cpu_obj, misa_cfg->name, &bool_type_info, kvm_cpu_get_misa_ext_cfg, kvm_cpu_set_misa_ext_cfg, NULL, misa_cfg); @@ -568,7 +569,7 @@ static void kvm_riscv_add_cpu_user_properties(Object *c= pu_obj) for (i =3D 0; i < ARRAY_SIZE(kvm_multi_ext_cfgs); i++) { KVMCPUConfig *multi_cfg =3D &kvm_multi_ext_cfgs[i]; =20 - object_property_add(cpu_obj, multi_cfg->name, "bool", + object_property_add_qapi(cpu_obj, multi_cfg->name, &bool_type_info, kvm_cpu_get_multi_ext_cfg, kvm_cpu_set_multi_ext_cfg, NULL, multi_cfg); diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index b68160af8307..6f3e1e10eb04 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -26,6 +26,7 @@ #include "pmu.h" #include "time_helper.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qemu/accel.h" #include "qemu/error-report.h" @@ -1437,7 +1438,7 @@ static void riscv_cpu_add_misa_properties(Object *cpu= _obj) continue; } =20 - object_property_add(cpu_obj, name, "bool", + object_property_add_qapi(cpu_obj, name, &bool_type_info, cpu_get_misa_ext_cfg, cpu_set_misa_ext_cfg, NULL, (void *)misa_cfg); @@ -1491,7 +1492,7 @@ static void riscv_cpu_add_profiles(Object *cpu_obj) for (int i =3D 0; riscv_profiles[i] !=3D NULL; i++) { RISCVCPUProfile *profile =3D riscv_profiles[i]; =20 - object_property_add(cpu_obj, profile->name, "bool", + object_property_add_qapi(cpu_obj, profile->name, &bool_type_info, cpu_get_profile, cpu_set_profile, NULL, (void *)profile); =20 @@ -1567,10 +1568,10 @@ static void riscv_cpu_add_user_properties(Object *o= bj) =20 for (edata =3D isa_edata_arr; edata && edata->name; edata++) { if (edata->prop_name) { - object_property_add(obj, edata->prop_name, "bool", - cpu_get_multi_ext_cfg, - cpu_set_multi_ext_cfg, - NULL, (void *)&edata->ext_enable_offset); + object_property_add_qapi(obj, edata->prop_name, &bool_type_inf= o, + cpu_get_multi_ext_cfg, + cpu_set_multi_ext_cfg, + NULL, (void *)&edata->ext_enable_offs= et); } } =20 diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index c41d629d6803..72bf0f48de83 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -17,6 +17,7 @@ #include "system/kvm.h" #include "system/tcg.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qemu/error-report.h" #include "qapi/visitor.h" #include "qemu/module.h" @@ -915,13 +916,13 @@ void s390_cpu_model_class_register_props(ObjectClass = *oc) =20 for (feat =3D 0; feat < S390_FEAT_MAX; feat++) { const S390FeatDef *def =3D s390_feat_def(feat); - object_class_property_add(oc, def->name, "bool", get_feature, + object_class_property_add_qapi(oc, def->name, &bool_type_info, get= _feature, set_feature, NULL, (void *) feat); object_class_property_set_description(oc, def->name, def->desc); } for (group =3D 0; group < S390_FEAT_GROUP_MAX; group++) { const S390FeatGroupDef *def =3D s390_feat_group_def(group); - object_class_property_add(oc, def->name, "bool", get_feature_group, + object_class_property_add_qapi(oc, def->name, &bool_type_info, get= _feature_group, set_feature_group, NULL, (void *) group); object_class_property_set_description(oc, def->name, def->desc); } diff --git a/tests/unit/test-qdev-global-props.c b/tests/unit/test-qdev-glo= bal-props.c index 8ea362cbb902..204436fb7276 100644 --- a/tests/unit/test-qdev-global-props.c +++ b/tests/unit/test-qdev-global-props.c @@ -27,6 +27,7 @@ #include "hw/core/qdev-properties.h" #include "qom/object.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" =20 =20 @@ -171,10 +172,12 @@ static void prop2_accessor(Object *obj, Visitor *v, c= onst char *name, =20 static void dynamic_instance_init(Object *obj) { - object_property_add(obj, "prop1", "uint32", prop1_accessor, prop1_acce= ssor, - NULL, NULL); - object_property_add(obj, "prop2", "uint32", prop2_accessor, prop2_acce= ssor, - NULL, NULL); + object_property_add_qapi(obj, "prop1", &uint32_type_info, + prop1_accessor, prop1_accessor, + NULL, NULL); + object_property_add_qapi(obj, "prop2", &uint32_type_info, + prop2_accessor, prop2_accessor, + NULL, NULL); } =20 static void dynamic_class_init(ObjectClass *oc, const void *data) diff --git a/ui/console.c b/ui/console.c index 14f148118e37..ee280eedf3da 100644 --- a/ui/console.c +++ b/ui/console.c @@ -28,6 +28,7 @@ #include "ui/vgafont.h" #include "hw/core/qdev.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/qapi-commands-ui.h" #include "qapi/visitor.h" #include "qemu/coroutine.h" @@ -535,7 +536,7 @@ qemu_graphic_console_class_init(ObjectClass *oc, const = void *data) offsetof(QemuGraphicConsole, device), object_property_allow_set_link, OBJ_PROP_LINK_STRONG); - object_class_property_add(oc, "head", "uint32", + object_class_property_add_qapi(oc, "head", &uint32_type_info, qemu_graphic_console_prop_get_head, NULL, NULL, NULL); =20 diff --git a/util/thread-context.c b/util/thread-context.c index 88d8f0a55a4e..7fa6840dd401 100644 --- a/util/thread-context.c +++ b/util/thread-context.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "qemu/thread-context.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/qapi-builtin-visit.h" #include "qapi/visitor.h" #include "qemu/config-file.h" @@ -278,13 +279,13 @@ static void thread_context_class_init(ObjectClass *oc= , const void *data) UserCreatableClass *ucc =3D USER_CREATABLE_CLASS(oc); =20 ucc->complete =3D thread_context_instance_complete; - object_class_property_add(oc, "thread-id", "uint64", + object_class_property_add_qapi(oc, "thread-id", &uint64_type_info, thread_context_get_thread_id, NULL, NULL, NULL); - object_class_property_add(oc, "cpu-affinity", "[uint16]", + object_class_property_add_qapi(oc, "cpu-affinity", &uint16List_type_in= fo, thread_context_get_cpu_affinity, thread_context_set_cpu_affinity, NULL, NULL); - object_class_property_add(oc, "node-affinity", "[uint16]", NULL, + object_class_property_add_qapi(oc, "node-affinity", &uint16List_type_i= nfo, NULL, thread_context_set_node_affinity, NULL, NULL= ); } =20 --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144939; cv=none; d=zohomail.com; s=zohoarc; b=ExbX3nfm1AHY2JdOj++JElP1OM5iQEfGZeAuskdaZdLhxSXXIyKe0ZVmNg15dUNd4qEfawzj9FGEFOMJ1jaxOMvoj043yOuoVwgH1iv/VsWcxOiir/9gZ6+4ftzsXQ+S0UT0khpeAIf7HAQ8HytcP8tOz7AFuneB4lz6A7wArcE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144939; h=Content-Type: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=ZqbhsKNjbgDXlQcuFtKvsuc9htp5BzIptdWvWLI5SlA=; b=dEPWKe9Scls99ragfZE/XSnde92aKYW/NpndgQ53lsi+zXZ/TDiBO+mEDmS3Y/cGvoAzMIdhYaJBf03i1BOZvQPAS0OO4+h5CgsYbI9LH2DiisdLhGI9pfEeHawBQWvLsfG4bNgHr8sa0i6k+QQGnxFiCeXmV4bnAa0pwQF3Do4= 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 1789144939875198.82003942820972; Fri, 11 Sep 2026 09:42:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54IF-0005FQ-2l; Fri, 11 Sep 2026 12:40:03 -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 1x54I3-00059u-OF for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:53 -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 1x54I1-0006ke-HZ for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:50 -0400 Received: from mx-prod-mc-08.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-120-KeZxKL_YNBahI64En4K7sg-1; Fri, 11 Sep 2026 12:39:44 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5AC05180066A; Fri, 11 Sep 2026 16:39:43 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5F336180034C; Fri, 11 Sep 2026 16:39:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144788; 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=ZqbhsKNjbgDXlQcuFtKvsuc9htp5BzIptdWvWLI5SlA=; b=I+hfXxsedhmtLHHwPalpbmZPEXgY6oWx/2ULXH2CD/rPIGRWSrxgeiIsqYvdKFGOs67U7z qdAHxmUOBSYTetCgJfKfgKxcsYpjcz4CJxnoa6vOsKCw9X3iU6VuDKfoT4VhzpdHPZ472S IS212I5NPbTwlI61gqiasahoIHHJPsg= X-MC-Unique: KeZxKL_YNBahI64En4K7sg-1 X-Mimecast-MFC-AGG-ID: KeZxKL_YNBahI64En4K7sg_1789144783 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:10 +0400 Subject: [PATCH v5 36/62] i386/cpu: convert strList property to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-36-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Zhao Liu X-Developer-Signature: v=1; a=openpgp-sha256; l=873; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=SPRNseSbAdO6Ph77aIE7aq7IziNtT5hbLLPbez+gQAA=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC26y1iV/AbIOdlmH8K4rZ7SSGuWuhsglgivM lOmDBS9dXCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtugAKCRDa6OEJdZac 5UxlD/9+FVW1WEM/H5Nn/Kod0HPNKL7wApEp033LAvKI+i94jLwDQy2Ghb3mZGDDolabs+30tsC 8NUYQhcLVGLOBvPg+rQhJt7BMaI64PdAr7cPb9DDDlRS+XcSPpyYve3b1l/nSDG/bLwa9qGDiAe P3f/Zne47ur2IffwA2R5mRzvvPJt59SJreDZjz+Sv2OFAgUsWFNiJeG+0AD+v+0/iZWj21axheU a639Fky0K/LiWxN80FDXfErk9SeBrIwMzIu1w/aKVEyVsQw6Whro4aAjnh2XBtjnT0wnPkoLQX+ bq5wa5H9s+Kn8X8NH9fFjvr3e6A73Ex2yYySVwlk7wwqxtxbnkRydsNhZV8y9brF2PIW7Bqnp4A KwfLozwbhjj7g8XhJPVIMPt0vPF34Yen5Gq1jLhDAE+58A/ubLGffqpFbeGYgBbSRfVTgFmlC1i g8vvGP6v2vU0hm3itN93q56ekvdHIUmWBNJLDhWRfYBtX3vXQZQlbylANc19ExVNUiiSjSoKNRt k9hJW2MzzlD7N2kn0VSVeznIducHRxzPM0AhvBrggSeDx9jNJah2ntn3etYBbIVVAqXBvOpvjU7 iKZ/oBwSitvV1jZ13c5YmccCgKGTTxk00U7k8bNXswxptfp82IMqaax+Qc0L+bjjUANaAiFWGJr T9QhpIKQPhMz6kA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=marcandre.lureau@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, 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: 1789144941315158500 Signed-off-by: Marc-Andr=C3=A9 Lureau --- target/i386/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index ebce8e128224..f5a9d7c3d2c2 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -10974,7 +10974,8 @@ static void x86_cpu_common_class_init(ObjectClass *= oc, const void *data) * QMP command: they list the features that would have prevented the * CPU from running if the "enforce" flag was set. */ - object_class_property_add(oc, "unavailable-features", "strList", + object_class_property_add_qapi(oc, "unavailable-features", + &strList_type_info, x86_cpu_get_unavailable_features, NULL, NULL, NULL); =20 --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144959; cv=none; d=zohomail.com; s=zohoarc; b=k8sDwdesZvcuDC0Ee1s7fb11fKSjFnVN6xme48zM28GPEh/fp6akva8uy5k9XM1hNDxFCoJ/5aIyEB5xOqSbl4gAV5zthhQSHS+GXuGPWzCq1xcv+zJ8CmaHLFGapqmXedmNAgB7Xm7KQEKk4cuy43fhao1ylzsXi0W1a6kgh6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144959; h=Content-Type: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=bjQUeWzB+URGNhy51pTY8kngaMPVjWJKxA5gkx975Fc=; b=Px6ulasuPQxsx+9lQfR8Z1qISDKnx5JAzzWzwLpbLYnSb6Z/gCBTFaMwsknTpSBWd0NKA8AHo7Ng9q3q6g+ysgGPUN5o36gDt0qQvSvcwP1N9SiUL5Z5L5GJsEerkTkaLrmN1c40HaQCl7H9SdatmqrqOJLtAsaSLYrR4SuUDhk= 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 1789144959459502.01059641821564; Fri, 11 Sep 2026 09:42:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54IJ-0005Ro-6s; Fri, 11 Sep 2026 12:40:07 -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 1x54I7-0005AR-M5 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:57 -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 1x54I2-0006lB-HX for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:55 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-267-DNNff0GvM0GF50dvFOsTCw-1; Fri, 11 Sep 2026 12:39:48 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CA1AB195C267; Fri, 11 Sep 2026 16:39:46 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B0582433; Fri, 11 Sep 2026 16:39:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144789; 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=bjQUeWzB+URGNhy51pTY8kngaMPVjWJKxA5gkx975Fc=; b=FIKVNvMTUw1i/sufMKiWgoL1OUEkHr19N8X91XlKKxpIeZsNSK5Eet8erDyY73G3MOd/5j 6yCAxdcueDzVcFWayP2GKIAIavEAoI7B9igxb4AMNEirrSLu4NTZspk3S5ObJnimqeVMRU UEpkLWVMihFpMFhxlsmqPmaOCTbZNvM= X-MC-Unique: DNNff0GvM0GF50dvFOsTCw-1 X-Mimecast-MFC-AGG-ID: DNNff0GvM0GF50dvFOsTCw_1789144787 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:11 +0400 Subject: [PATCH v5 37/62] accel/hvf: convert OnOffSplit property to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-37-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Roman Bolshakov , Phil Dennis-Jordan X-Developer-Signature: v=1; a=openpgp-sha256; l=2469; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=oWCHQCOKOr/KE6g1VOAN6Z+R3g0iOTOZVDDieDqKREY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC26mpwbS3gGnsMfLRu+h6ruvN/tyewKwGnQ5 X2sq7uRf7OJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtugAKCRDa6OEJdZac 5WECEACcwaIJtniOkboqXSEhS+mu7cn/BUcLFOfZOmv0GuF+4ns9sQgn75MDATFKKmb9cYg94ix ZQS6J2xXzBpNo/0b9I/2/bFJmbTMZdsCYecpMsP0IyvDAFEKVzkOMLMJjFNLttZZg2torcVvvcI cZeBmg2LMV4XevGpTebj7blbNAcKVLSMmywnA1A9ydCC5ZhWG0LFJGXe76R7QyfNJpRr2SImUxZ MvSi3PzBMOVXYg8kKY0lcjscn9ToZt6//xuz1A96jMe7NwgsseqqJmvOQP/VppNr7Q4c49rU3nG ZYqMpHYe3zCcua8uAx3hsAupoGqbn2dDgl73KX4XBeS4rz+G7lYwtL8hQGd0drw3vGN7iJrLzds KarExe4xpldWJks5HvEC17U98I5i8Be8aYPK1tliDmNKXdtFnfzLQe2fH5ZHfUvH23858wXa1ll nEG08qmqhoo5rPPs1StQPE2NXHnTJaBI7mFzLE952nCs1+6Lv7c1+mHMu74aRbNaf531I3hQwyO tZTw5yIaP0QH6mTofSHmLJ8Llc+1JZOzFdzCANpfyN5pMjNUk5Em56Y91Lod+nULLGSadGH0ifv ze+46JvQWS1DO/PiL/bO0QZr4nimJ0L/svocr69gEnDXDoz/tn0wRDgVq+PCIVQXLUhu5rjjRCK No1X3d4heNy/SaA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144961745158500 Convert the OnOffSplit property from manual visitor-based callbacks to property_add_qapi_enum(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- accel/hvf/hvf-all.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c index 8bd9154a50b6..2fd594ad156f 100644 --- a/accel/hvf/hvf-all.c +++ b/accel/hvf/hvf-all.c @@ -11,6 +11,7 @@ #include "qemu/osdep.h" #include "qemu/error-report.h" #include "qapi/error.h" +#include "qapi/qapi-type-infos-common.h" #include "qapi/qapi-visit-common.h" #include "accel/accel-ops.h" #include "exec/cpu-common.h" @@ -230,18 +231,12 @@ static int hvf_accel_init(AccelState *as, MachineStat= e *ms) return hvf_arch_init(); } =20 -static void hvf_set_kernel_irqchip(Object *obj, Visitor *v, - const char *name, void *opaque, +static void hvf_set_kernel_irqchip(Object *obj, int value, Error **errp) { - OnOffSplit mode; - hvf_kernel_irqchip_override =3D true; - if (!visit_type_OnOffSplit(v, name, &mode, errp)) { - return; - } =20 - switch (mode) { + switch (value) { case ON_OFF_SPLIT_ON: #ifdef HOST_X86_64 /* macOS 12 onwards exposes an HVF virtual APIC. */ @@ -261,11 +256,7 @@ static void hvf_set_kernel_irqchip(Object *obj, Visito= r *v, break; =20 default: - /* - * The value was checked in visit_type_OnOffSplit() above. If - * we get here, then something is wrong in QEMU. - */ - abort(); + g_assert_not_reached(); } } =20 @@ -277,11 +268,13 @@ static void hvf_accel_class_init(ObjectClass *oc, con= st void *data) ac->allowed =3D &hvf_allowed; hvf_kernel_irqchip_override =3D false; hvf_kernel_irqchip =3D false; - object_class_property_add(oc, "kernel-irqchip", "on|off|split", - NULL, hvf_set_kernel_irqchip, - NULL, NULL); - object_class_property_set_description(oc, "kernel-irqchip", - "Configure HVF irqchip"); + + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name =3D "kernel-irqchip", + .qapi_type =3D &OnOffSplit_type_info, + .set =3D hvf_set_kernel_irqchip, + .description =3D "Configure HVF irqchip", + )); } =20 static const TypeInfo hvf_accel_type =3D { --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145042; cv=none; d=zohomail.com; s=zohoarc; b=lK4OPSrVNhpDklKCscyPg5m959wUaxeWaISat5buCEaSCL18cMuYmup+BQE6ngGmUQZPLD8wAFaXMkJvqkkB7z1oIIeflrG/WvzSLg83/yqLLvOXTX2FIU0+NUg5rMqc+0HSjjrBGDbaLIQritlN3B+QomW9FhHJvZw7N6g0Txg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145042; h=Content-Type: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=oIiDAG2jKPc8trfxeDzWrsYVGy/FtqWuSjPzxQy4+IM=; b=BrgWYuBFNL/qjO/9x2hIT3VWTn7RKeY99SxNFT+Q452LiZSUR1i95jjH4hoS4x0swgahE5qiSX5i42Fm4JQ2m60nPrCXMOrxObXrFhEQCAcSex5GkKewc7NDSa0c73p29qeMcZ2NgOOGrJ6o4Xsug7etSo+rnIz8URvZQNwn/kA= 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 178914504252830.526214986865966; Fri, 11 Sep 2026 09:44:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54IJ-0005UT-RK; Fri, 11 Sep 2026 12:40:07 -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 1x54I9-0005AW-9a for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:59 -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 1x54I7-0006mh-In for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:39:57 -0400 Received: from mx-prod-mc-08.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-468-b9yL8P5nO4SHtFln-2BJ9Q-1; Fri, 11 Sep 2026 12:39:51 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 639D9180066A; Fri, 11 Sep 2026 16:39:50 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 656631800351; Fri, 11 Sep 2026 16:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144795; 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=oIiDAG2jKPc8trfxeDzWrsYVGy/FtqWuSjPzxQy4+IM=; b=YfWioLEbQsYT/8b+7aV0yCFZLOUBUJReXGms0b01fjycmWWG9CTcuFphe0D4i6iBJ9Zi8X JH6wi/A1xM6/vLyvnlCTbLWHs2nD7zRj6YUyc1yZl9PRKMmKoRR3vIuGlQmFoZ4fXzPxjO TS/KILORhBRh6rhzwMvN0UXUqcjKM7M= X-MC-Unique: b9yL8P5nO4SHtFln-2BJ9Q-1 X-Mimecast-MFC-AGG-ID: b9yL8P5nO4SHtFln-2BJ9Q_1789144790 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:12 +0400 Subject: [PATCH v5 38/62] i386/x86: convert SgxEPCList property to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-38-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , "Michael S. Tsirkin" X-Developer-Signature: v=1; a=openpgp-sha256; l=1068; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=cnTGm8gLgIdGgYxLJNoo6ULUUXiyoyqTdIIMx4XVumw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC26H9DZNgzXp/VsNdN0oOlGLnBJ80XJW5mVA 55iztTy0JyJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtugAKCRDa6OEJdZac 5cokD/9tTTxjcYnlAVOXSAGvCLDk5YkAsjTQznJ9UOdaU2o+ucWIDZ4buG2q64CwWti07X0P6K1 PPxZDHnwwKQ1OBPNxzt1QQ5PPTUHNXak/LifWgmHvNwKb2MyPknlUZJYo7ktyE4JsGroDipbqVS eaeNRZS06Us4j28uxjlG+8X+F6Rh9sDUqUrIlBKNWsTjC6Rd3gl0Y/ffCZ4kHhsBimwn+KmwsaK uFXJzr7aX2XscA7WhjDMQ+71AOm/HdING3+QoAqFZpLy/MzTgpYibCuy1qwfEAwxmEwPfFgf1bv Tsijr9d3dU5ZzwFjKS+n+ogY8r2DZfIxtnGljm2u4lLvMR8wKKgWXsXYdI8zhRepQ9qMTlz8w/M Qu8qdlLzLuy/WiKX45TbN0UILgDEeHLxbsf2n+CHWBOAvheaHrtXW9LDfB3zadn+8CJjesR7TS6 vbNiFU9u28+8Wd3FJo4kqpv2xcRwuVJ5KHY3A6QAQIgOvwEfN/m9Q4M9lzacISsNLcy5GHama+B EHctpstK57jc0rehWBH+wuZTJpNqfYoTlw7Dsky+uKbKSE7dPunNZOinDeyeKtS7GaaYM7qZL/p hMSHFe6AKT+oDvl1xqtnzvB5sLFNxysnz7EdfrM5j53DyIR3+izW8DFfOe/jvxd09sE16CkZadE UmbDygtAO1jBK8w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=marcandre.lureau@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, 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: 1789145043905158500 Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/i386/x86.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index d0c782ec8544..ed38760d798d 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -25,6 +25,7 @@ #include "qemu/units.h" #include "qapi/error.h" #include "qapi/qapi-type-infos-common.h" +#include "qapi/qapi-type-infos-machine.h" #include "qapi/qapi-visit-machine.h" #include "qapi/visitor.h" #include "system/qtest.h" @@ -426,7 +427,7 @@ static void x86_machine_class_init(ObjectClass *oc, con= st void *data) object_class_property_set_description(oc, X86_MACHINE_BUS_LOCK_RATELIM= IT, "Set the ratelimit for the bus locks acquired in VMs"); =20 - object_class_property_add(oc, "sgx-epc", "SgxEPC", + object_class_property_add_qapi(oc, "sgx-epc", &SgxEPCList_type_info, machine_get_sgx_epc, machine_set_sgx_epc, NULL, NULL); object_class_property_set_description(oc, "sgx-epc", --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144925; cv=none; d=zohomail.com; s=zohoarc; b=Vz1GveQ/DtekFEDMfiWVN3X7Ejx1OOrEE/+aPmQ5fQl+1epT7pqGIPDW2vFGXiMTc5zKsS7gmAaN/5KT9Ri8ESuCfpUgIdFAkiH126xik8C24q5PFIzDd479AZ0CRuxHBFYC9ASwgaY4esXhMGesC6qx3EPDB2UaXZiWyCIPiDQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144925; h=Content-Type: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=AW3x7UFETjhbxcBvJveET4/kYyJB8eslOj8OPFxXamY=; b=hgnGtfretjpDktGAU9dO21u452cuusHxafFg/YVGmSOHTLcFLbnS5GzENq8gVaVe92K+WY2pGljjYeHjhCrM9qNjui8/TmEwQJ4jv+wBTHp5/tJ+Vb2W3R+cPCRzZx6E92oQZ02N+3j2FEK0k5XzVVtxV6UGRX+e1x+irITD2tQ= 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 1789144925119588.7589692879528; Fri, 11 Sep 2026 09:42:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54IK-0005Xa-O1; Fri, 11 Sep 2026 12:40:08 -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 1x54IF-0005HV-GQ for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:03 -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 1x54IB-0006nr-C4 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:02 -0400 Received: from mx-prod-mc-08.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-193-gbbKQNxVNFWdNhnkch7vDg-1; Fri, 11 Sep 2026 12:39:55 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B2F2C1801366; Fri, 11 Sep 2026 16:39:53 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B5F2D180029C; Fri, 11 Sep 2026 16:39:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144798; 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=AW3x7UFETjhbxcBvJveET4/kYyJB8eslOj8OPFxXamY=; b=e6kea82kkOGnDvL6eUv5soHsaDO4TS6Wzf5LKxNaNgiU+uk0z+qJOqDd1A71VKyrDpw2Y3 11LClktfca/Y6mwe9dVJ7JMqTQ3ZnCS0+RuJQTayAwUh2tRsYFkeft9ZtJLTtFurt7qfFb 75KgpXcJujnD9dng+i8oW4nlgB+TBpk= X-MC-Unique: gbbKQNxVNFWdNhnkch7vDg-1 X-Mimecast-MFC-AGG-ID: gbbKQNxVNFWdNhnkch7vDg_1789144793 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:13 +0400 Subject: [PATCH v5 39/62] virtio-balloon: convert guest-stats property to QAPI type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-39-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Zhao Liu , Eric Blake X-Developer-Signature: v=1; a=openpgp-sha256; l=10078; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=wAG3gHYjMgKsDKDJ91QsQeDsDiDGOctuzZ3U1NVRvyY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC26X+sCaAHzm3Xb9Zdw9JmKrUmoxy6cSgn5U 73Fa0jnYv6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtugAKCRDa6OEJdZac 5bQhEACdKclyFAaSkAGoIvZmGG4hPNS8DwE/m3VUZVKjjxXJhulidghFvetYD4H0+DPx924uSLW gnbq+8BLcR5c7AYtD9GfsfQ3yBbsIZGBQ50i15UWf4GhQjp0R8YplcUG8QoPJenGo0ENXX3wT/m VNS2dpZMdN8199vjECaa1fBAvkRQYVMVKw3ephXmBRMimw1yxs0i/ObPkKAgcC1olrEIaTjIWWt W4mPSiV98eq1kVqnlpvuFc6QAX94v70uhL1P0OeEzBqHoZVOC1nT3WpQ7g1raCpx61HeCxhr71D Ar5ADWBuWtc5u/rnmACFmIl1CA+TuHzUdn5sY4f4SUw8UGVZTaLLDqHcEL2fJ5Ed6HBa77X/o1R Ef7isbKs+CN/qRVJWNNoVQRzckdgLpbncUm4VMSCMHXP3lngm3GcO9PBr36PRkc6H6Nco5IRAOy NluOacr9FV7hws67SV7q4JuzaSV0vvzbD3Mf2rjPO4qtK9kYaExdBeBplHbt8A1ieH1LP7Px5Wt ELyx8J02FQ07skVULeFQtA3m50pyvHaljqdEtKJFM+ib3L0JmMJdSj0sGWaJ/wNoYLY0kCT6c/c gfam8+BF7oFg/j+WzMfn/BcX2F26GHSqTOZ+jWidv9OdapxLr5nRnzxYMW2Mw6VPEvF5mDpF3LG RH3vPPFedPMK+rg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=marcandre.lureau@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_H2=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: 1789144927343158501 Define VirtioBalloonStats and VirtioBalloonGuestStats QAPI struct types in the schema, replacing the hand-rolled visitor in balloon_stats_get_all() with a generated visit_type_VirtioBalloonGuestStats() call. The wire format is preserved: the JSON output from qom-get is identical to the previous hand-rolled visitor output. Signed-off-by: Marc-Andr=C3=A9 Lureau --- docs/interop/virtio-balloon-stats.rst | 22 +-------- hw/virtio/virtio-balloon.c | 84 ++++++++++++-------------------- qapi/machine.json | 92 +++++++++++++++++++++++++++++++= ++++ 3 files changed, 123 insertions(+), 75 deletions(-) diff --git a/docs/interop/virtio-balloon-stats.rst b/docs/interop/virtio-ba= lloon-stats.rst index b9a6a6edb229..88d3271bbb02 100644 --- a/docs/interop/virtio-balloon-stats.rst +++ b/docs/interop/virtio-balloon-stats.rst @@ -22,27 +22,7 @@ polling the guest's balloon driver for new stats in the = specified time interval. =20 To retrieve those stats, clients have to query the guest-stats property, -which will return a dictionary containing: - - * A key named 'stats', containing all available stats. If the guest - doesn't support a particular stat, or if it couldn't be retrieved, - its value will be -1. Currently, the following stats are supported: - - - stat-swap-in - - stat-swap-out - - stat-major-faults - - stat-minor-faults - - stat-free-memory - - stat-total-memory - - stat-available-memory - - stat-disk-caches - - stat-htlb-pgalloc - - stat-htlb-pgfail - - * A key named last-update, which contains the last stats update - timestamp in seconds. Since this timestamp is generated by the host, - a buggy guest can't influence its value. The value is 0 if the guest - has not updated the stats (yet). +which will return a VirtioBalloonGuestStats (see QAPI documentation). =20 It's also important to note the following: =20 diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 9e43948128f7..c9873f8cf0c2 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -29,6 +29,8 @@ #include "qapi/error.h" #include "qapi/qapi-builtin-type-infos.h" #include "qapi/qapi-events-machine.h" +#include "qapi/qapi-type-infos-machine.h" +#include "qapi/qapi-visit-machine.h" #include "qapi/visitor.h" #include "trace.h" #include "qemu/error-report.h" @@ -169,33 +171,8 @@ static void balloon_deflate_page(VirtIOBalloon *balloo= n, } } =20 -/* - * All stats upto VIRTIO_BALLOON_S_NR /must/ have a - * non-NULL name declared here, since these are used - * as keys for populating the QDict with stats - */ -static const char *balloon_stat_names[] =3D { - [VIRTIO_BALLOON_S_SWAP_IN] =3D "stat-swap-in", - [VIRTIO_BALLOON_S_SWAP_OUT] =3D "stat-swap-out", - [VIRTIO_BALLOON_S_MAJFLT] =3D "stat-major-faults", - [VIRTIO_BALLOON_S_MINFLT] =3D "stat-minor-faults", - [VIRTIO_BALLOON_S_MEMFREE] =3D "stat-free-memory", - - [VIRTIO_BALLOON_S_MEMTOT] =3D "stat-total-memory", - [VIRTIO_BALLOON_S_AVAIL] =3D "stat-available-memory", - [VIRTIO_BALLOON_S_CACHES] =3D "stat-disk-caches", - [VIRTIO_BALLOON_S_HTLB_PGALLOC] =3D "stat-htlb-pgalloc", - [VIRTIO_BALLOON_S_HTLB_PGFAIL] =3D "stat-htlb-pgfail", - - [VIRTIO_BALLOON_S_OOM_KILL] =3D "stat-oom-kills", - [VIRTIO_BALLOON_S_ALLOC_STALL] =3D "stat-alloc-stalls", - [VIRTIO_BALLOON_S_ASYNC_SCAN] =3D "stat-async-scans", - [VIRTIO_BALLOON_S_DIRECT_SCAN] =3D "stat-direct-scans", - [VIRTIO_BALLOON_S_ASYNC_RECLAIM] =3D "stat-async-reclaims", - - [VIRTIO_BALLOON_S_DIRECT_RECLAIM] =3D "stat-direct-reclaims", -}; -G_STATIC_ASSERT(G_N_ELEMENTS(balloon_stat_names) =3D=3D VIRTIO_BALLOON_S_N= R); +/* Update VirtioBalloonStats QAPI type when new stats are added */ +G_STATIC_ASSERT(VIRTIO_BALLOON_S_NR =3D=3D 16); =20 /* * reset_stats - Mark all items in the stats array as unset @@ -257,33 +234,31 @@ static void balloon_stats_get_all(Object *obj, Visito= r *v, const char *name, void *opaque, Error **errp) { VirtIOBalloon *s =3D VIRTIO_BALLOON(obj); - bool ok =3D false; - int i; + VirtioBalloonStats stats =3D { + .stat_swap_in =3D s->stats[VIRTIO_BALLOON_S_SWAP_IN], + .stat_swap_out =3D s->stats[VIRTIO_BALLOON_S_SWAP_OUT], + .stat_major_faults =3D s->stats[VIRTIO_BALLOON_S_MAJFLT], + .stat_minor_faults =3D s->stats[VIRTIO_BALLOON_S_MINFLT], + .stat_free_memory =3D s->stats[VIRTIO_BALLOON_S_MEMFREE], + .stat_total_memory =3D s->stats[VIRTIO_BALLOON_S_MEMTOT], + .stat_available_memory =3D s->stats[VIRTIO_BALLOON_S_AVAIL], + .stat_disk_caches =3D s->stats[VIRTIO_BALLOON_S_CACHES], + .stat_htlb_pgalloc =3D s->stats[VIRTIO_BALLOON_S_HTLB_PGALLOC], + .stat_htlb_pgfail =3D s->stats[VIRTIO_BALLOON_S_HTLB_PGFAIL], + .stat_oom_kills =3D s->stats[VIRTIO_BALLOON_S_OOM_KILL], + .stat_alloc_stalls =3D s->stats[VIRTIO_BALLOON_S_ALLOC_STALL], + .stat_async_scans =3D s->stats[VIRTIO_BALLOON_S_ASYNC_SCAN], + .stat_direct_scans =3D s->stats[VIRTIO_BALLOON_S_DIRECT_SCAN], + .stat_async_reclaims =3D s->stats[VIRTIO_BALLOON_S_ASYNC_RECLAIM], + .stat_direct_reclaims =3D s->stats[VIRTIO_BALLOON_S_DIRECT_RECLAIM= ], + }; + VirtioBalloonGuestStats guest_stats =3D { + .last_update =3D s->stats_last_update, + .stats =3D &stats, + }; + VirtioBalloonGuestStats *argp =3D &guest_stats; =20 - if (!visit_start_struct(v, name, NULL, 0, errp)) { - return; - } - if (!visit_type_int(v, "last-update", &s->stats_last_update, errp)) { - goto out_end; - } - - if (!visit_start_struct(v, "stats", NULL, 0, errp)) { - goto out_end; - } - for (i =3D 0; i < VIRTIO_BALLOON_S_NR; i++) { - if (!visit_type_uint64(v, balloon_stat_names[i], &s->stats[i], err= p)) { - goto out_nested; - } - } - ok =3D visit_check_struct(v, errp); -out_nested: - visit_end_struct(v, NULL); - - if (ok) { - visit_check_struct(v, errp); - } -out_end: - visit_end_struct(v, NULL); + visit_type_VirtioBalloonGuestStats(v, name, &argp, errp); } =20 static void balloon_stats_get_poll_interval(Object *obj, Visitor *v, @@ -1020,7 +995,8 @@ static void virtio_balloon_instance_init(Object *obj) s->free_page_hint_cmd_id =3D VIRTIO_BALLOON_FREE_PAGE_HINT_CMD_ID_MIN; s->free_page_hint_notify.notify =3D virtio_balloon_free_page_hint_noti= fy; =20 - object_property_add(obj, "guest-stats", "guest statistics", + object_property_add_qapi(obj, "guest-stats", + &VirtioBalloonGuestStats_type_info, balloon_stats_get_all, NULL, NULL, NULL); =20 object_property_add_qapi(obj, "guest-stats-polling-interval", &int_typ= e_info, diff --git a/qapi/machine.json b/qapi/machine.json index 2d63c1bac3b4..d418b34a8643 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1132,6 +1132,98 @@ ## { 'struct': 'BalloonInfo', 'data': {'actual': 'int' } } =20 +## +# @VirtioBalloonStats: +# +# VirtIO balloon device guest memory statistics. +# +# If the guest doesn't support a particular stat, or if it couldn't +# be retrieved, its value will be -1. +# +# @stat-swap-in: The amount of memory that has been +# swapped in (in bytes). +# +# @stat-swap-out: The amount of memory that has been +# swapped out to disk (in bytes). +# +# @stat-major-faults: The number of major page faults +# that have occurred. +# +# @stat-minor-faults: The number of minor page faults +# that have occurred. +# +# @stat-free-memory: The amount of memory not being used +# for any purpose (in bytes). +# +# @stat-total-memory: The total amount of memory available +# (in bytes). +# +# @stat-available-memory: An estimate of how much memory is available +# (in bytes) for starting new applications, without pushing the +# system to swap. +# +# @stat-disk-caches: The amount of memory, in bytes, that can be +# quickly reclaimed without additional I/O. Typically these pages +# are used for caching files from disk. +# +# @stat-htlb-pgalloc: The number of successful hugetlb page +# allocations +# +# @stat-htlb-pgfail: The number of failed hugetlb page +# allocations +# +# @stat-oom-kills: The number of OOM killer invocations +# +# @stat-alloc-stalls: The number of memory allocation stalls +# +# @stat-async-scans: The number of memory scanned asynchronously +# +# @stat-direct-scans: The number of memory scanned directly +# +# @stat-async-reclaims: The number of memory reclaimed asynchronously +# +# @stat-direct-reclaims: The number of memory reclaimed directly +# +# Since: 11.2 +## +{ 'struct': 'VirtioBalloonStats', + 'data': { + 'stat-swap-in': 'uint64', + 'stat-swap-out': 'uint64', + 'stat-major-faults': 'uint64', + 'stat-minor-faults': 'uint64', + 'stat-free-memory': 'uint64', + 'stat-total-memory': 'uint64', + 'stat-available-memory': 'uint64', + 'stat-disk-caches': 'uint64', + 'stat-htlb-pgalloc': 'uint64', + 'stat-htlb-pgfail': 'uint64', + 'stat-oom-kills': 'uint64', + 'stat-alloc-stalls': 'uint64', + 'stat-async-scans': 'uint64', + 'stat-direct-scans': 'uint64', + 'stat-async-reclaims': 'uint64', + 'stat-direct-reclaims': 'uint64' } } + +## +# @VirtioBalloonGuestStats: +# +# Guest statistics from the VirtIO balloon device. +# +# @last-update: timestamp in seconds of the last stats +# update from the guest (since this timestamp is generated +# by the host, a buggy guest can't influence its value), +# or 0 if no update has been received yet. +# +# @stats: balloon memory statistics +# +# Since: 11.2 +## +{ 'struct': 'VirtioBalloonGuestStats', + 'data': { + 'last-update': 'int', + 'stats': 'VirtioBalloonStats' } } + ## # @query-balloon: # --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145107; cv=none; d=zohomail.com; s=zohoarc; b=S9vkIou6tn4HeSmJke7Ig8SoCHzBNwiRAf4RKM3qixKCNUNciho2XatpjEgUw8x2i4/mAbMitU+jw2fGhQ8d06WfFZJyM4WRJWgfmIgtXXC+xGLD5mpOVQuWtVdntY17WuLOCU0ufDVBOYsdXdiC71Li/e5D1welh/QbYgKCsAI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145107; h=Content-Type: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=7pFnOPIVSD/q/liBLZTnNnkSnKkxuxZIk4GNrSsFg4g=; b=OPD5rosPiLmow0fMIK2K+3aSHs9dlOxu7MYBwKdaDdkSSOCecWEjRzWixG+YTrmoNHmKRhI1VeoYW1NnlFs/nlpWbwVvPtTGxVixoXuTqueWfkD4mX51mACP+g4CRXBN8cP7rIOko4oUqZSjgLJu8C3xigXxNcSO7np6ajWnlg0= 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 1789145107394453.0177565623562; Fri, 11 Sep 2026 09:45:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54IM-0005cx-0B; Fri, 11 Sep 2026 12:40:10 -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 1x54IH-0005NP-V1 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:06 -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 1x54IF-0006qw-Oc for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:05 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-6WK0kDukNGqV55lQ5JouMg-1; Fri, 11 Sep 2026 12:39:58 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4CDBF195394B; Fri, 11 Sep 2026 16:39:57 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7D10B180029C; Fri, 11 Sep 2026 16:39:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144803; 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=7pFnOPIVSD/q/liBLZTnNnkSnKkxuxZIk4GNrSsFg4g=; b=T5H3Sn6r6K/j2TfF9c1294AC/wMJrllk/wi28OTjYO3bL/WPXvrx+A8NVKToUo+KUCWkOY BfRy/FIhBxVzdh2G0jn+hbLzygQ48nsFanYCT4/S58Va8ifh4yk/oEg7uUL33tMtP4JgSi NqPT9L/RLYQehfLpljFUYImRE51VQ8E= X-MC-Unique: 6WK0kDukNGqV55lQ5JouMg-1 X-Mimecast-MFC-AGG-ID: 6WK0kDukNGqV55lQ5JouMg_1789144797 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:14 +0400 Subject: [PATCH v5 40/62] qom: replace object_property_add_tm with StructTm QAPI type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-40-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Nicholas Piggin , Harsh Prateek Bora , Amit Machhiwal , "Michael S. Tsirkin" , Eric Blake , qemu-ppc@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=9797; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=ObykVpty7Jy5t30r2m/tiqdJDn/8pQllDBNIvkjrFA8=; b=owEBbAKT/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC26p+ws01aNcEWJsO9gYX1q8yfmZvc2Tqm2E XKUkTouF4WJAjIEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtugAKCRDa6OEJdZac 5dTJD/UeOeyjjFmfhQr1tfVZrjD8xYkVorK3xBjvqW124bxqrj5bgRjOCKFIu+bkKAYeozwfN+j LhIP9GM+t1u/ospiicgbjWeNZZYzHNJ1S1g7O00EwbkwEdWAzbsnr2q1GwVJQb5nhuld5FRae9l rhVzwQ1AvsebF1C7FiMzv2ZT5KXd6QYTioZBR96re58VkpxFWLDrQNu+VLgHp5gK2HZMI9Xin6J 7bmegsw+TFM4mt0Ju8d/LdEgr6uIPz3v3naEoiuKOStXOXkoXi8FcvrJse4zMNNnewLgsMIE8Nt fCxL2QliS0O9OV9F15O1zVtspN6R1vL3n9Xz77PpPsvcYWw4Le5Ra8qBNT9xXPgWBHFIoEExHue i14mWriO9lxeh+UwjPz3FZ687N2//Tl+G51wMPm2SqPJH3aHLsXnkZS9yrtMfQudPoPRk9b0p5y 8aNNtcLY0+atKJ5GtIRQJEybfzPuin8cJSicBR4dSr10zjFxnvEkfhxltBCfu7VXwqwPCPWdGsm U556nMeM0lMo5H3j4st2QcuHZMsiE7YqG3CfVtcPbeQhppbB1gYkLlMAe+0FeOY7KIYvfkgEq0H JNFEjQ4BCSrcb4GPZFuhgh6f9y2BCLswabahgateZiIuHaRHu7gvbuZrd9osBeiZpW/Q3Q1HLzi b2nrwpC1t7DBM X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789145108469158500 Define a StructTm QAPI struct in common.json matching the existing "struct tm" property wire format (tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec as int32). Convert the two callers (mc146818rtc and spapr_rtc) to use object_property_add_qapi() with a standard ObjectPropertyAccessor that populates a StructTm and calls the generated visitor. Remove object_property_add_tm(), object_class_property_add_tm(), the TMProperty type, and the property_get_tm() helper from qom/object.c, along with their declarations in object.h. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Amit Machhiwal --- hw/ppc/spapr_rtc.c | 18 +++++++++++--- hw/rtc/mc146818rtc.c | 16 +++++++++--- include/qom/object.h | 29 ---------------------- qapi/common.json | 28 +++++++++++++++++++++ qapi/pragma.json | 1 + qom/object.c | 69 ------------------------------------------------= ---- 6 files changed, 57 insertions(+), 104 deletions(-) diff --git a/hw/ppc/spapr_rtc.c b/hw/ppc/spapr_rtc.c index 1f7d2d8f898b..a4a2b3237e26 100644 --- a/hw/ppc/spapr_rtc.c +++ b/hw/ppc/spapr_rtc.c @@ -33,6 +33,9 @@ #include "migration/vmstate.h" #include "qapi/error.h" #include "qapi/qapi-events-misc.h" +#include "qapi/qapi-type-infos-common.h" +#include "qapi/qapi-visit-common.h" +#include "qapi/visitor.h" #include "qemu/cutils.h" #include "qemu/module.h" =20 @@ -131,9 +134,17 @@ static void rtas_set_time_of_day(PowerPCCPU *cpu, Spap= rMachineState *spapr, rtas_st(rets, 0, RTAS_OUT_SUCCESS); } =20 -static void spapr_rtc_qom_date(Object *obj, struct tm *current_tm, Error *= *errp) +static void spapr_rtc_qom_date(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { - spapr_rtc_read(SPAPR_RTC(obj), current_tm, NULL); + struct tm value; + StructTm tm, *tmp =3D &tm; + + spapr_rtc_read(SPAPR_RTC(obj), &value, NULL); + + tm =3D (StructTm) { value.tm_year, value.tm_mon, value.tm_mday, + value.tm_hour, value.tm_min, value.tm_sec }; + visit_type_StructTm(v, name, &tmp, errp); } =20 static void spapr_rtc_realize(DeviceState *dev, Error **errp) @@ -150,7 +161,8 @@ static void spapr_rtc_realize(DeviceState *dev, Error *= *errp) rtc_ns =3D qemu_clock_get_ns(rtc_clock); rtc->ns_offset =3D host_s * NANOSECONDS_PER_SECOND - rtc_ns; =20 - object_property_add_tm(OBJECT(rtc), "date", spapr_rtc_qom_date); + object_property_add_qapi(OBJECT(rtc), "date", &StructTm_type_info, + spapr_rtc_qom_date, NULL, NULL, NULL); } =20 static const VMStateDescription vmstate_spapr_rtc =3D { diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c index ba396435d1af..328dd038f167 100644 --- a/hw/rtc/mc146818rtc.c +++ b/hw/rtc/mc146818rtc.c @@ -42,6 +42,8 @@ #include "migration/vmstate.h" #include "qapi/error.h" #include "qapi/qapi-events-misc.h" +#include "qapi/qapi-type-infos-common.h" +#include "qapi/qapi-visit-common.h" #include "qapi/visitor.h" #include "trace.h" =20 @@ -854,12 +856,19 @@ static const MemoryRegionOps cmos_ops =3D { .endianness =3D DEVICE_LITTLE_ENDIAN, }; =20 -static void rtc_get_date(Object *obj, struct tm *current_tm, Error **errp) +static void rtc_get_date(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { MC146818RtcState *s =3D MC146818_RTC(obj); + struct tm value; + StructTm tm, *tmp =3D &tm; =20 rtc_update_time(s); - rtc_get_time(s, current_tm); + rtc_get_time(s, &value); + + tm =3D (StructTm) { value.tm_year, value.tm_mon, value.tm_mday, + value.tm_hour, value.tm_min, value.tm_sec }; + visit_type_StructTm(v, name, &tmp, errp); } =20 static void rtc_realizefn(DeviceState *dev, Error **errp) @@ -1019,7 +1028,8 @@ static void rtc_class_initfn(ObjectClass *klass, cons= t void *data) device_class_set_props(dc, mc146818rtc_properties); set_bit(DEVICE_CATEGORY_MISC, dc->categories); =20 - object_class_property_add_tm(klass, "date", rtc_get_date); + object_class_property_add_qapi(klass, "date", &StructTm_type_info, + rtc_get_date, NULL, NULL, NULL); } =20 static const TypeInfo mc146818rtc_info =3D { diff --git a/include/qom/object.h b/include/qom/object.h index 6d84bbb25bb5..4bedf17b6c8f 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -2080,35 +2080,6 @@ object_class_property_add_qapi(ObjectClass *klass, ObjectPropertyRelease *release, void *opaque); =20 -/** - * object_property_add_tm: - * @obj: the object to add a property to - * @name: the name of the property - * @get: the getter or NULL if the property is write-only. - * - * Add a read-only struct tm valued property using a getter function. - * This function will add a property of type 'struct tm'. - * - * Returns: The newly added property on success, or %NULL on failure. - */ -ObjectProperty *object_property_add_tm(Object *obj, const char *name, - void (*get)(Object *, struct tm *, Error **)); - -/** - * object_class_property_add_tm: - * @klass: the object class to add a property to - * @name: the name of the property - * @get: the getter or NULL if the property is write-only. - * - * Add a read-only struct tm valued property using a getter function. - * This function will add a property of type 'struct tm'. - * - * Returns: The newly added property on success, or %NULL on failure. - */ -ObjectProperty *object_class_property_add_tm(ObjectClass *klass, - const char *name, - void (*get)(Object *, struct tm *, Error **)); - typedef enum { /* Automatically add a getter to the property */ OBJ_PROP_FLAG_READ =3D 1 << 0, diff --git a/qapi/common.json b/qapi/common.json index af7e3d618a7c..928ba0ba2c63 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -228,3 +228,31 @@ ## { 'enum': 'EndianMode', 'data': [ 'unspecified', 'little', 'big' ] } + +## +# @StructTm: +# +# Broken-down time. Field semantics match C ``struct tm``. +# +# @tm_year: years since 1900 +# +# @tm_mon: months since January (0-11) +# +# @tm_mday: day of the month (1-31) +# +# @tm_hour: hours since midnight (0-23) +# +# @tm_min: minutes after the hour (0-59) +# +# @tm_sec: seconds after the minute (0-59, 60-61 for leap seconds) +# +# Since: 11.2 +## +{ 'struct': 'StructTm', + 'data': { + 'tm_year': 'int32', + 'tm_mon': 'int32', + 'tm_mday': 'int32', + 'tm_hour': 'int32', + 'tm_min': 'int32', + 'tm_sec': 'int32' } } diff --git a/qapi/pragma.json b/qapi/pragma.json index 342cedc42e76..9be2819a46bd 100644 --- a/qapi/pragma.json +++ b/qapi/pragma.json @@ -109,6 +109,7 @@ 'QKeyCode', # send-key, input-sent-event 'QapiErrorClass', # QMP error replies 'SshHostKeyCheckMode', # blockdev-add, -blockdev + 'StructTm', # qom-get of RTC date property 'SysEmuTarget', # query-cpu-fast, query-target 'UuidInfo', # query-uuid 'VncClientInfo', # query-vnc, query-vnc-servers, ... diff --git a/qom/object.c b/qom/object.c index bbaa999ae0c9..a0e3af61ae29 100644 --- a/qom/object.c +++ b/qom/object.c @@ -2632,75 +2632,6 @@ object_class_property_add_qapi(ObjectClass *klass, c= onst char *name, return prop; } =20 -typedef struct TMProperty { - void (*get)(Object *, struct tm *, Error **); -} TMProperty; - -static void property_get_tm(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - TMProperty *prop =3D opaque; - Error *err =3D NULL; - struct tm value; - - prop->get(obj, &value, &err); - if (err) { - error_propagate(errp, err); - return; - } - - if (!visit_start_struct(v, name, NULL, 0, errp)) { - return; - } - if (!visit_type_int32(v, "tm_year", &value.tm_year, errp)) { - goto out_end; - } - if (!visit_type_int32(v, "tm_mon", &value.tm_mon, errp)) { - goto out_end; - } - if (!visit_type_int32(v, "tm_mday", &value.tm_mday, errp)) { - goto out_end; - } - if (!visit_type_int32(v, "tm_hour", &value.tm_hour, errp)) { - goto out_end; - } - if (!visit_type_int32(v, "tm_min", &value.tm_min, errp)) { - goto out_end; - } - if (!visit_type_int32(v, "tm_sec", &value.tm_sec, errp)) { - goto out_end; - } - visit_check_struct(v, errp); -out_end: - visit_end_struct(v, NULL); -} - -ObjectProperty * -object_property_add_tm(Object *obj, const char *name, - void (*get)(Object *, struct tm *, Error **)) -{ - TMProperty *prop =3D g_malloc0(sizeof(*prop)); - - prop->get =3D get; - - return object_property_add(obj, name, "struct tm", - get ? property_get_tm : NULL, NULL, - property_release_data, - prop); -} - -ObjectProperty * -object_class_property_add_tm(ObjectClass *klass, const char *name, - void (*get)(Object *, struct tm *, Error **)) -{ - TMProperty *prop =3D g_malloc0(sizeof(*prop)); - - prop->get =3D get; - - return object_class_property_add(klass, name, "struct tm", - get ? property_get_tm : NULL, - NULL, NULL, prop); -} =20 static char *object_get_type(Object *obj, Error **errp) { --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145017; cv=none; d=zohomail.com; s=zohoarc; b=GZ5yogbnt8bACUFV6yxtULux5UDSvR3qRo4k+5Oh2s6iVyB3lp5pA710um02WPfCMD1EITcjQkyqWWJpFaERKZeiUaCn6OzUuRnBAN68kLZY2JuvoB+BQsDFDTieyC4e02PBa1NbtZI/aeykOmU+x1kiLRjPIBeyOQpp14fSan4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145017; h=Content-Type: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=q1pBm4JIf/lwRiA1/QfhUtOlQUt1nuvI50NpLc2soGA=; b=M+WWCJS+Ar/exEgf4+qy7PhVLdRZV98BtzE+DawP3Kg/iy3dIcd89dSfiwQMQD8PyKg5zEImANDqdqL38mSS4spsr4nPuXrekiFcayNedvIusB8esMUSNk5cQsl5cOrRqgvxQ28KeZ3OBE1lI9NlSZSyhLHqAHj0bjfO9uJKOdo= 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 1789145017820315.26101453730985; Fri, 11 Sep 2026 09:43:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54IM-0005gE-W9; Fri, 11 Sep 2026 12:40:11 -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 1x54IJ-0005UU-Nm for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:07 -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 1x54II-00071F-1f for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:07 -0400 Received: from mx-prod-mc-08.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-673-chgpMnD9Pl-s8axk8vd-Sg-1; Fri, 11 Sep 2026 12:40:02 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BF05C18011E7; Fri, 11 Sep 2026 16:40:00 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B5CFD180034C; Fri, 11 Sep 2026 16:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144805; 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=q1pBm4JIf/lwRiA1/QfhUtOlQUt1nuvI50NpLc2soGA=; b=Wol0klMPH754k/mxKGyM0D7ct/RVrPtWTNG16KUlfGyGHWN3tJxRTfIymEmx4ixxWKwbOP 8kzWhjPBI6Y4NvtGSrsDsasW3TwuoNDduHqZvWVinPXfcU6gUsKz6KESIynqOXJ+QRIK/O tD9cXUgBNZctp9i1POCKY3lu71V3u0Q= X-MC-Unique: chgpMnD9Pl-s8axk8vd-Sg-1 X-Mimecast-MFC-AGG-ID: chgpMnD9Pl-s8axk8vd-Sg_1789144800 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:15 +0400 Subject: [PATCH v5 41/62] hw/nvdimm: convert UUID property to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-41-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Hildenbrand , Igor Mammedov , FangSheng Huang , Fam Zheng X-Developer-Signature: v=1; a=openpgp-sha256; l=2344; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=wdkmnzVqdE+H1nVJim++EcOuJVmDwXZEbt7GE3F4KZ8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC27eu+LbvGum5hSXTSauztivm8X4ySQjE9VJ Qt3pVCUA9iJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuwAKCRDa6OEJdZac 5QvdD/wOvr0i2+yGzDHcEkTWXSuRHCMTCU1k2J9CHttsvnDei1XXGyAoC91WMjDpDYlMhWy0ndY eMOB5O/Lj0+f0EXztsAwQqS5bA7OYt9CX/a0VbC0a6lUKveXcjFxCSroVuQbfam/zAv8Py4SZF2 zOo01cKIr8jIMOtRhioRrTgpeiy0OUZLvMuWh/Ht5eEQ0L+E4EaoURvkKxcb2UyZ8I0MzeNWUof kqdZ5FIW0i06ar0DMAA1uxcsGT7WmFlFPl6IcEpQ6Pfl7zqLm6V52OBdnI8SOTD8guNAezbHV2j QQRG5l0FLugrKPXPovdGkY4o3SzcNVjEApo/dpScU09TXr9C6/IyPeciCMXACPlcurX1+1xG++z rjzbNtS9h8+++SAp91PM4ILxve68Bn/DDjsQaelkGjeSuAmX5w4zf4jFmrIsoM5PWCt7BlhsMwq vX+vT3+2BGRJL70LbyBoWID3i/eHT3h7btrGh/GmV/D/M7umXVn63uin+m6Qhvi6jwnqUo0PcNL YOrGufUCyRU7PwXwAavQyNnll0BkOHi1tb8QX2YorAo/nLr3aJZfEEJs5lqJkmJzJ7daNkDr87R 4Hbg4Mnt0knFy3uxgvVQLIsY3Z2hmpOfDr3ktojBVDkgEe1OpoCvtQt3Od3R5Ha9p7xdtQJAZOA qTmcDiWIF9Q1TxQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=marcandre.lureau@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_H2=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: 1789145019890158500 Add a QemuUUID_type_info and use object_property_add_qapi() instead of object_property_add() for the nvdimm UUID property. The type info is defined manually in uuid.c rather than generated, since QAPI does not yet support string typedefs. An alternative would be to extend the QAPI schema language with a 'typedef' construct (e.g. { 'typedef': 'UUID', 'data': 'str' }), which would let the generator produce the type info, C typedef, and introspection entry automatically. Alternatively, the exposed type being a string, we could change the property to be str_type_info. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/mem/nvdimm.c | 4 ++-- include/qemu/uuid.h | 4 ++++ util/uuid.c | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c index 123ddc938546..b7ccb5c93678 100644 --- a/hw/mem/nvdimm.c +++ b/hw/mem/nvdimm.c @@ -104,8 +104,8 @@ static void nvdimm_init(Object *obj) nvdimm_get_label_size, nvdimm_set_label_size,= NULL, NULL); =20 - object_property_add(obj, NVDIMM_UUID_PROP, "QemuUUID", nvdimm_get_uuid, - nvdimm_set_uuid, NULL, NULL); + object_property_add_qapi(obj, NVDIMM_UUID_PROP, &QemuUUID_type_info, + nvdimm_get_uuid, nvdimm_set_uuid, NULL, NULL); } =20 static void nvdimm_finalize(Object *obj) diff --git a/include/qemu/uuid.h b/include/qemu/uuid.h index 869f84af09dd..ed0c62327d4d 100644 --- a/include/qemu/uuid.h +++ b/include/qemu/uuid.h @@ -16,6 +16,8 @@ #ifndef QEMU_UUID_H #define QEMU_UUID_H =20 +#include "qapi/qapi-type-info.h" + =20 /* Version 4 UUID (pseudo random numbers), RFC4122 4.4. */ =20 @@ -99,4 +101,6 @@ QemuUUID qemu_uuid_bswap(QemuUUID uuid); =20 uint32_t qemu_uuid_hash(const void *uuid); =20 +extern const QAPITypeInfo QemuUUID_type_info; + #endif diff --git a/util/uuid.c b/util/uuid.c index 234619dd5e69..363a03051aba 100644 --- a/util/uuid.c +++ b/util/uuid.c @@ -17,6 +17,11 @@ #include "qemu/uuid.h" #include "qemu/bswap.h" =20 +const QAPITypeInfo QemuUUID_type_info =3D { + .name =3D "QemuUUID", + .masked_name =3D "str", +}; + void qemu_uuid_generate(QemuUUID *uuid) { int i; --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145068; cv=none; d=zohomail.com; s=zohoarc; b=LpiSFG/MJ0ThNwEoNMtDiFpu1zrl53ecuxkgVU1kF41psu4HIUZokN+LrESJklmT48VD6Lef2VAGMeizaLxbsiH0iIrMRvvAK1qyYuwmWsRYU3o1SGM248yFdVjsST3rWjpdo7YPobogc2Vvms1uxKNmYRDfKbJ9b8zybUuCnT0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145068; h=Content-Type: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=3xZxsb+MXYVOcFZg8ztTLLylkyJWXaelgAGqcUYHEZA=; b=EDTYxGaUlsC5ezimfQVtIMtrNYM0ICYamisv1kRBrWM4m6/jIwdJzAQGKashBTm5uQdlu5MixeGwzFcCuoh3nOPaPIB6R8v70NV6UQiHr04Ou4gWWndAgSqh9GrGCXh6aoMpMtZ/9jOY/qndmfk1eBNu5FOwB58gjKZkPWpz3eg= 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 1789145068274398.540822639972; Fri, 11 Sep 2026 09:44:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54IP-0005q7-JP; Fri, 11 Sep 2026 12:40:13 -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 1x54IN-0005ll-Rb for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:11 -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 1x54IM-00072u-48 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:11 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-594-peq_1-_3NaqhbrIqU3dZGg-1; Fri, 11 Sep 2026 12:40:06 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 65DDE1953964; Fri, 11 Sep 2026 16:40:04 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 87C741800351; Fri, 11 Sep 2026 16:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144809; 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=3xZxsb+MXYVOcFZg8ztTLLylkyJWXaelgAGqcUYHEZA=; b=EhgNO97Sc2HYjsmdxKlqkf5+ph25OgLAxTMPQY2vprDWWLBZ8CM1XRJvNZZ0satgFnE6Jl dVuLrxKlWxLnw0wf8za1O6aocbJv1B6lq2zGFNMf7foiLmkQkoCg3uD3URIts2jfglmU+r wYRfbRpV1YcsUnU1TJPqAmSpmZun2fc= X-MC-Unique: peq_1-_3NaqhbrIqU3dZGg-1 X-Mimecast-MFC-AGG-ID: peq_1-_3NaqhbrIqU3dZGg_1789144804 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:16 +0400 Subject: [PATCH v5 42/62] hw/s390-virtio-ccw: convert loadparm property to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-42-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Ilya Leoshkevich , David Hildenbrand , Cornelia Huck , Eric Farman , Matthew Rosato , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=1384; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=+wSBO6Yrs9Pd23pJ8FlEO+Ge0DCPAboQHJQxxLgvCf0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC27zp/YBc9UWc3jKZsW95seUNcz0EC6K+8k/ yXdW5RJ8mqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuwAKCRDa6OEJdZac 5ThcD/sFf/ndHKBZJl5ymyLs1wz+/DiGz+rcH3xR2XvzWGiDw9BZOZADP3bRSCVrY/X8aJ/3fd6 YDRCVvJ51JrCmNaRwRqIPAdRynQdcO0lsvNfXoeKYC0m9wK8+PO/sd0Ise/zvTODetEJgB8v5N6 GLGIc1srwHIWkUQTZxHzHiPqE77KvkwkTTFH7ri0H0SuiOy1BIZ5OQNAoMMdwhHvud/1yr4ttjm O8IiQd752Ngc1nnt130TE46igX1BC40okboJE28G4FOfXAqpQHzgNCbcVTRZ8B4epS0UxY+0RjS yTGNx2mEmEdoyBBxG2Fmwrdtkfu7qsDatCzFQTGQlHXCexJzuiWmL21HT5RAa213LOuhNjqUZa+ gE2E1IzTNYQauUlzzDrzLcSitJzYk349+XP3MTWTRsl8nrtBK9xFop4txH3MmjAUPVZve71O2zu 0U7N1yCRXJs9Y3lq4rJ5EIvMv0cuCoqaJqYm4b8xO3g3ca2iGoE+kGML9ptm5COG6elqFbb1JxC l83YFDPJFkb5tow0Wed8Yf6kETscD4/JqvOU9pq0w2pj3EFtDGqUmf8Rpi67zOVViSiZBL4/v/0 Dq9CtVl2Z/RRigjhZE7FjylSg7eIbKFJbiVNJmH4XskzZ7KSXEq0pt+qcr4Z3Sdslh69C5S+zZL uxUegMLYWIPVIow== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789145070113158500 The QAPI type is actually a string. Here also, if we had typedef support we could expose a more specific type. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/s390x/s390-virtio-ccw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 17266779a6c1..1c8838aeabb6 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -43,6 +43,7 @@ #include "system/hostmem.h" #include "target/s390x/kvm/pv.h" #include "migration/blocker.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qapi/qapi-visit-machine-s390x.h" #include "hw/s390x/cpu-topology.h" @@ -901,7 +902,8 @@ static void ccw_machine_class_init(ObjectClass *oc, con= st void *data) object_class_property_set_description(oc, "dea-key-wrap", "enable/disable DEA key wrapping using the CPACF wrapping key"= ); =20 - object_class_property_add(oc, "loadparm", "loadparm", + /* if QAPI learns to typedef str, we could expose a more specific type= */ + object_class_property_add_qapi(oc, "loadparm", &str_type_info, machine_get_loadparm, machine_set_loadparm, NULL, NULL); object_class_property_set_description(oc, "loadparm", --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144951; cv=none; d=zohomail.com; s=zohoarc; b=IdRdnmd2AQvhaYzHwPpE9ZdpW/qD12+KHJt8yENzsNHR2MkHPIrB5Sz2g9BU6hf/kBEzY1yq2ebyUxIc8yUSxwlKOJtwvtfBkAngkA4lg6U3lYOeFuLJ3sSq/S899SHuaWfgrQu8Ty5vXY3+fdaCcj13wSiFILRu9sk+mGnHoYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144951; h=Content-Type: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=tz/am8znVea0EH/I3yKmAvS/zTKGWDHDy5Io0oDOs84=; b=dObk+Jukaj2iZ0Lrsge/Ie1j9CLUPKRZu1+QF/tcPyyLa/s4bh0wzmczqm6b//6n6PWBcAHaVLOY70rADLjGyqVt9yp9fj6AtP9j0ycLaSNAWQmukOI3NfgcPDklaRqlFUSiO3kgKCfufIcmkn3uA4AuxE1Bi64UBCUHXfdbnNs= 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 1789144951912568.2693323232372; Fri, 11 Sep 2026 09:42:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54IT-00061M-F1; Fri, 11 Sep 2026 12:40:17 -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 1x54IR-0005wl-93 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:15 -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 1x54IP-00074O-Tj for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:15 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-619-I-UzbmaEMC6oBD8EOSyWqA-1; Fri, 11 Sep 2026 12:40:09 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8F52919540D3; Fri, 11 Sep 2026 16:40:07 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B89FB1800351; Fri, 11 Sep 2026 16:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144813; 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=tz/am8znVea0EH/I3yKmAvS/zTKGWDHDy5Io0oDOs84=; b=dTl9NOlevi2GBwvzTCYxQ/gwWqYBE6nc2alQrSNDsVVQeS5NQMm2MBCN8S++ffOJC428+B RjS8NVdtJ8p9VKK0LMhzBpyZd76nzL+CY23+Lzvl+fgzuhsrp8GMxWwbpbIaZdgDfZClyH LfDD4B8UkhLLb80GtDVPQevk+EjtWP8= X-MC-Unique: I-UzbmaEMC6oBD8EOSyWqA-1 X-Mimecast-MFC-AGG-ID: I-UzbmaEMC6oBD8EOSyWqA_1789144807 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:17 +0400 Subject: [PATCH v5 43/62] hw/ppc/spapr_drc: convert fdt property to QAPI-aware registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-43-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Nicholas Piggin , Harsh Prateek Bora , Amit Machhiwal , qemu-ppc@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=1018; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=p8JanILoeFCoElHoPfG5YjLfU2MyrEO5wI6M3UiSSaA=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC27YOTb+IKQQDTrv0ZXeYfeoPZ7xrPqr/bfB l6Xo/QG7leJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuwAKCRDa6OEJdZac 5YQtEAC4d86nvAaYJngkT0FME5WbN1EXHmkEgFFdEkXlyWA8wUjaANN2tBEjWqhi8jaC3/KywzQ aw+KvqlG7bFbLgWEs4JLoash2TMozxigZUBoXj6AgcqG8KXVi2NjsvdJrP0TB+oGtg4LTD/YuLD uF4nJsvh67Rtu8G1q8jg7qQ8nDP4gF9UDanJ0MubIIF4xYjwvrJTyKa43PiJyJst3sC4HzlpE7O Q4NGkVo7qVyGOrji3ag8REV/6l1wyXV0VW0pnY1KfjuE1Sqs/DrZGlQxq+TvRCKmUwezpLwgt0s mn54MCS+dRBKK4nQwzcVaL/QwI6Vca5BbdDu4V18gUiAD7di+GxM1okOh5SDFkma1DQeixtnWg/ +iudWurH5nShTZi0wLxwyKkUIg0fjY9vmmuftcCsJGLDfwROScooRRCQYZTevbX8FIN20X3lWII uCWeYmCWqvakoRLgZzjBs+hAF0y9y3qwpWItoZd/93m7vZsDwsdWJFr+NCyOsmSgxfyrcpgLQxe flbzTrq0j/u7TV720yJRXprHqrXmDk4NiWNopc4avEgEOGr9qspXg/zao3w0QukjecUGkOoBNJA 8PbKzcLqB57TR51Wz4/d/NiN0uyN1MuNMoI7+t1s7B/e3oqCslUl15F7KMvfEqZfypl7ffGdK84 eD/vw0YsIFm4vQA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144953400158500 Use object_property_add_qapi() with any_type_info for the "fdt" property, since the FDT structure is dynamically shaped at runtime and cannot be represented as a static QAPI type. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Amit Machhiwal --- hw/ppc/spapr_drc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 64f9ca29b02e..740149ffdf3e 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -587,7 +587,7 @@ static void spapr_dr_connector_instance_init(Object *ob= j) object_property_add_uint32_ptr(obj, "id", &drc->id, OBJ_PROP_FLAG_READ= ); object_property_add_qapi(obj, "index", &uint32_type_info, prop_get_ind= ex, NULL, NULL, NULL); - object_property_add(obj, "fdt", "struct", prop_get_fdt, + object_property_add_qapi(obj, "fdt", &any_type_info, prop_get_fdt, NULL, NULL, NULL); drc->state =3D drck->empty_state; } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144850; cv=none; d=zohomail.com; s=zohoarc; b=fkkW2F94jQpNpz09qulurDUO0RJBjQMDS6k0myqvQVC9jQfTnSYQFeJ1Kz8XB9gE3nw1OgJ0wSgnLS6DiGUuwIoMH7FdmUggZ4guPh7E/GjP9FquNs0GwsEGzjrPMkqHCKChmRswJ9DfS4g8WkyaiJWHa7P9Kdg8tsHfaiNk4eM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144850; h=Content-Type: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=qREL4rLqmsKjsuOlLljdIaMwFLp75inzgflxtWc4AuE=; b=KK9myFiJkXHl1RLgZirzQgUO3vRC/h6W22cFxeClsX7usXkHc4mYjfB3ZfbbTCNr7W+dFHkPAoD1dZI3T5S7DWl6Z1H9+12ezTfwIH3DKYv+hLW4fpNID0UKHaZjVtjWW83tMnQry9y6kfMYrFaRNByyZjqtV9m8ZfpixCvLuns= 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 1789144850688234.5805610841834; Fri, 11 Sep 2026 09:40:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54IX-00063o-I7; Fri, 11 Sep 2026 12:40:21 -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 1x54IV-000637-O7 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:19 -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 1x54IT-00075G-C6 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:19 -0400 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-192-xtYC3ZgsOLaPOSqdnjGWhA-1; Fri, 11 Sep 2026 12:40:13 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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 8C6651800598; Fri, 11 Sep 2026 16:40:11 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5987F433; Fri, 11 Sep 2026 16:40:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144816; 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=qREL4rLqmsKjsuOlLljdIaMwFLp75inzgflxtWc4AuE=; b=TPmraRv4M2btl2nl4o3PTHgYb+MoKkIW+gyYk1X5Luv4kGgJxXvsOvb4uc7ellkQLi9i7K v2HK2IdFyZwc6tfuFCEZ+KUqf7WpktJrvabxhqRry96Bssp0nm0Rkduewzogb7KyVT1xdk hJW/MJi+bc4E06676dViMam+AeCAFqU= X-MC-Unique: xtYC3ZgsOLaPOSqdnjGWhA-1 X-Mimecast-MFC-AGG-ID: xtYC3ZgsOLaPOSqdnjGWhA_1789144811 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:18 +0400 Subject: [PATCH v5 44/62] hw/gpio/pca955x: use QAPI enums for led and pin properties MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-44-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Glenn Miles , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Zhao Liu , Eric Blake , qemu-ppc@nongnu.org, qemu-arm@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=14925; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=XlkmyZuB8ML4Dwyx9HhUYqfHoTK+rV9hfdym0B0GJhw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC27VEDDC38DbjceUdTE7G7+7g5wlD3oscrjR CQ5Y8+JjhKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuwAKCRDa6OEJdZac 5ZJ7D/4vV6WQCkK8QpmEBawbSTdzjiZImI+qHyD/15zFG84yvtE1JRd+3GRRHUJjcu0pGvte1LX 5BEdNejrG4RP2KP9Rux61vWHMNL0pfdZipjIVOJPEZVgWPkCvDNmxkOwV8PATAlxJA+ApyjhLRr sbF+07tJv4j5XbCQDtmHDkhqgDTVoDt2JHlcnhCp04l743dOVlaKbXP+Ypm+LluWyHfi+yxyohz XO5BXHwqx+hPM7LNlUXuy74xLpbRmhBaEdziP4CXDj6cIU+VKYu8WaSlDr8XZEaJ+OOrEE23UxC X3IBYvQ2mTxYPbc4AxTQBhj0AeQFsbm4XXcioNWziy0YP+msXXJoWYnJuYnUFcOtG3KWZf56Zjv Qxk9rlhg2uAO8pNSADYrHwegfuaCwNj/2dmgIkTxjb/Po07GktQZgHVf0n8rIPC64YM5mnrRp1S Atwua3WKMtWI20N3RTq2o8QtqLExmuEEI0/JP8BWW60X18RrCWVVQLgRupRiVHCPGq3gZHGnQvO +q+zZQ3eibkXvSTeAW5YbXApdyicFAH4ESzwV9BWR9WIj5kFHRn1pxzIeMM1AII82a5ziQ/rFud qy7FWPS4umlU2oAoVNpHVMPeTZtb2AUspqanp86a2+EGM0PxlYsjT9ZfUpbDPy9J/aeqc2s2edr 34l9gdRSJ/I4n1A== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=marcandre.lureau@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, 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: 1789144852883158500 Replace hand-rolled string lookup tables with QAPI enums Pca9552LedState and Pca955{2,4}PinState for the led%d and pin%d QOM properties. This fixes the incorrect property type ("bool" for LEDs, "str" for pins) and lets QAPI handle string-to-enum conversion in the visitor, removing the manual string matching in the setters. Add QEMU_BUILD_BUG_ON guards to ensure the QAPI-generated enum values stay in sync with the hardware register encoding. I kept Pca9552PinState & @Pca9554PinState separate types, because I don't know if they could diverge. We could eventually merge those. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/gpio/pca9552.c | 82 +++++++++++++++++++++------------------------------= ---- hw/gpio/pca9554.c | 39 ++++++++++---------------- qapi/machine.json | 46 +++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 75 deletions(-) diff --git a/hw/gpio/pca9552.c b/hw/gpio/pca9552.c index 719149b7174b..16741c22dea3 100644 --- a/hw/gpio/pca9552.c +++ b/hw/gpio/pca9552.c @@ -23,7 +23,8 @@ #include "hw/core/irq.h" #include "migration/vmstate.h" #include "qapi/error.h" -#include "qapi/visitor.h" +#include "qapi/qapi-types-machine.h" +#include "qapi/qapi-visit-machine.h" #include "trace.h" #include "qom/object.h" =20 @@ -59,16 +60,15 @@ struct PCA955xClass { /* * Note: The LED_ON and LED_OFF configuration values for the PCA955X * chips are the reverse of the PCA953X family of chips. + * + * The QAPI enums must match the hardware register values. */ -#define PCA9552_LED_ON 0x0 -#define PCA9552_LED_OFF 0x1 -#define PCA9552_LED_PWM0 0x2 -#define PCA9552_LED_PWM1 0x3 -#define PCA9552_PIN_LOW 0x0 -#define PCA9552_PIN_HIZ 0x1 - -static const char *led_state[] =3D {"on", "off", "pwm0", "pwm1"}; -static const char *pin_state[] =3D {"low", "high"}; +QEMU_BUILD_BUG_ON(PCA9552_LED_STATE_ON !=3D 0x0); +QEMU_BUILD_BUG_ON(PCA9552_LED_STATE_OFF !=3D 0x1); +QEMU_BUILD_BUG_ON(PCA9552_LED_STATE_PWM0 !=3D 0x2); +QEMU_BUILD_BUG_ON(PCA9552_LED_STATE_PWM1 !=3D 0x3); +QEMU_BUILD_BUG_ON(PCA9552_PIN_STATE_LOW !=3D 0x0); +QEMU_BUILD_BUG_ON(PCA9552_PIN_STATE_HIGH !=3D 0x1); =20 static uint8_t pca955x_pin_get_config(PCA955xState *s, int pin) { @@ -142,24 +142,24 @@ static void pca955x_update_pin_input(PCA955xState *s) uint8_t config =3D pca955x_pin_get_config(s, i); =20 switch (config) { - case PCA9552_LED_ON: + case PCA9552_LED_STATE_ON: /* Pin is set to 0V to turn on LED */ s->regs[input_reg] &=3D ~bit_mask; break; - case PCA9552_LED_OFF: + case PCA9552_LED_STATE_OFF: /* * Pin is set to Hi-Z to turn off LED and * pullup sets it to a logical 1 unless * external device drives it low. */ - if (s->ext_state[i] =3D=3D PCA9552_PIN_LOW) { + if (s->ext_state[i] =3D=3D PCA9552_PIN_STATE_LOW) { s->regs[input_reg] &=3D ~bit_mask; } else { s->regs[input_reg] |=3D bit_mask; } break; - case PCA9552_LED_PWM0: - case PCA9552_LED_PWM1: + case PCA9552_LED_STATE_PWM0: + case PCA9552_LED_STATE_PWM1: /* TODO */ default: break; @@ -176,7 +176,7 @@ static void pca955x_update_pin_input(PCA955xState *s) */ if (s->regs[config_reg] & bit_mask) { /* Input mode - reflect external state */ - if (s->ext_state[i] =3D=3D PCA9552_PIN_LOW) { + if (s->ext_state[i] =3D=3D PCA9552_PIN_STATE_LOW) { s->regs[input_reg] &=3D ~bit_mask; } else { s->regs[input_reg] |=3D bit_mask; @@ -360,7 +360,7 @@ static void pca955x_get_led(Object *obj, Visitor *v, co= nst char *name, PCA955xClass *k =3D PCA955X_GET_CLASS(obj); PCA955xState *s =3D PCA955X(obj); int led, rc, reg; - uint8_t state; + Pca9552LedState state; =20 rc =3D sscanf(name, "led%2d", &led); if (rc !=3D 1) { @@ -378,7 +378,7 @@ static void pca955x_get_led(Object *obj, Visitor *v, co= nst char *name, */ reg =3D PCA9552_LS0 + led / 4; state =3D (pca955x_read(s, reg) >> ((led % 4) * 2)) & 0x3; - visit_type_str(v, name, (char **)&led_state[state], errp); + visit_type_Pca9552LedState(v, name, &state, errp); } =20 /* @@ -397,10 +397,9 @@ static void pca955x_set_led(Object *obj, Visitor *v, c= onst char *name, PCA955xClass *k =3D PCA955X_GET_CLASS(obj); PCA955xState *s =3D PCA955X(obj); int led, rc, reg, val; - uint8_t state; - g_autofree char *state_str =3D NULL; + Pca9552LedState state; =20 - if (!visit_type_str(v, name, &state_str, errp)) { + if (!visit_type_Pca9552LedState(v, name, &state, errp)) { return; } rc =3D sscanf(name, "led%2d", &led); @@ -413,16 +412,6 @@ static void pca955x_set_led(Object *obj, Visitor *v, c= onst char *name, return; } =20 - for (state =3D 0; state < ARRAY_SIZE(led_state); state++) { - if (!strcmp(state_str, led_state[state])) { - break; - } - } - if (state >=3D ARRAY_SIZE(led_state)) { - error_setg(errp, "%s invalid led state %s", __func__, state_str); - return; - } - reg =3D PCA9552_LS0 + led / 4; val =3D pca955x_read(s, reg); val =3D pca955x_ledsel(val, led % 4, state); @@ -437,7 +426,8 @@ static void pca955x_get_pin(Object *obj, Visitor *v, co= nst char *name, PCA955xClass *k =3D PCA955X_GET_CLASS(obj); PCA955xState *s =3D PCA955X(obj); int pin, rc; - uint8_t input_reg, state; + uint8_t input_reg; + Pca9552PinState state; =20 rc =3D sscanf(name, "pin%2d", &pin); if (rc !=3D 1) { @@ -455,7 +445,7 @@ static void pca955x_get_pin(Object *obj, Visitor *v, co= nst char *name, */ input_reg =3D PCA9535_INPUT0 + (pin / 8); state =3D (s->regs[input_reg] >> (pin % 8)) & 0x1; - visit_type_str(v, name, (char **)&pin_state[state], errp); + visit_type_Pca9552PinState(v, name, &state, errp); } =20 static void pca955x_set_pin(Object *obj, Visitor *v, const char *name, @@ -464,10 +454,10 @@ static void pca955x_set_pin(Object *obj, Visitor *v, = const char *name, PCA955xClass *k =3D PCA955X_GET_CLASS(obj); PCA955xState *s =3D PCA955X(obj); int pin, rc; - uint8_t state, config_reg; - g_autofree char *state_str =3D NULL; + Pca9552PinState state; + uint8_t config_reg; =20 - if (!visit_type_str(v, name, &state_str, errp)) { + if (!visit_type_Pca9552PinState(v, name, &state, errp)) { return; } rc =3D sscanf(name, "pin%2d", &pin); @@ -480,16 +470,6 @@ static void pca955x_set_pin(Object *obj, Visitor *v, c= onst char *name, return; } =20 - for (state =3D 0; state < ARRAY_SIZE(pin_state); state++) { - if (!strcmp(state_str, pin_state[state])) { - break; - } - } - if (state >=3D ARRAY_SIZE(pin_state)) { - error_setg(errp, "%s invalid pin state %s", __func__, state_str); - return; - } - /* Only input-configured pins can be driven by an external device. */ config_reg =3D PCA9535_CONFIG0 + (pin / 8); if (!((s->regs[config_reg] >> (pin % 8)) & 0x1)) { @@ -499,7 +479,7 @@ static void pca955x_set_pin(Object *obj, Visitor *v, co= nst char *name, return; } =20 - pca955x_set_ext_state(s, pin, state !=3D PCA9552_PIN_LOW); + pca955x_set_ext_state(s, pin, state !=3D PCA9552_PIN_STATE_LOW); } =20 static const VMStateDescription pca9552_vmstate =3D { @@ -529,7 +509,7 @@ static void pca9552_reset_hold(Object *obj, ResetType t= ype) s->regs[PCA9552_LS2] =3D 0x55; s->regs[PCA9552_LS3] =3D 0x55; =20 - memset(s->ext_state, PCA9552_PIN_HIZ, PCA955X_PIN_COUNT_MAX); + memset(s->ext_state, PCA9552_PIN_STATE_HIGH, PCA955X_PIN_COUNT_MAX); pca955x_update_pin_input(s); =20 s->pointer =3D 0xFF; @@ -549,7 +529,7 @@ static void pca9535_reset_hold(Object *obj, ResetType t= ype) s->regs[PCA9535_CONFIG0] =3D 0xFF; /* All pins as inputs */ s->regs[PCA9535_CONFIG1] =3D 0xFF; /* All pins as inputs */ =20 - memset(s->ext_state, PCA9552_PIN_HIZ, PCA955X_PIN_COUNT_MAX); + memset(s->ext_state, PCA9552_PIN_STATE_HIGH, PCA955X_PIN_COUNT_MAX); pca955x_update_pin_input(s); =20 s->pointer =3D 0xFF; @@ -567,12 +547,12 @@ static void pca955x_initfn(Object *obj) if (k->has_led_support) { /* LED variant: expose the LED selector state as led%d. */ name =3D g_strdup_printf("led%d", ix); - object_property_add(obj, name, "bool", + object_property_add(obj, name, "Pca9552LedState", pca955x_get_led, pca955x_set_led, NULL, NU= LL); } else { /* GPIO variant: expose the pin logic level as pin%d. */ name =3D g_strdup_printf("pin%d", ix); - object_property_add(obj, name, "str", + object_property_add(obj, name, "Pca9552PinState", pca955x_get_pin, pca955x_set_pin, NULL, NU= LL); } g_free(name); diff --git a/hw/gpio/pca9554.c b/hw/gpio/pca9554.c index 904698cdce85..e4eddc829ef7 100644 --- a/hw/gpio/pca9554.c +++ b/hw/gpio/pca9554.c @@ -16,6 +16,8 @@ #include "hw/core/irq.h" #include "migration/vmstate.h" #include "qapi/error.h" +#include "qapi/qapi-types-machine.h" +#include "qapi/qapi-visit-machine.h" #include "qapi/visitor.h" #include "trace.h" #include "qom/object.h" @@ -32,10 +34,8 @@ typedef struct PCA9554Class PCA9554Class; DECLARE_CLASS_CHECKERS(PCA9554Class, PCA9554, TYPE_PCA9554) =20 -#define PCA9554_PIN_LOW 0x0 -#define PCA9554_PIN_HIZ 0x1 - -static const char *pin_state[] =3D {"low", "high"}; +QEMU_BUILD_BUG_ON(PCA9554_PIN_STATE_LOW !=3D 0x0); +QEMU_BUILD_BUG_ON(PCA9554_PIN_STATE_HIGH !=3D 0x1); =20 static void pca9554_update_pin_input(PCA9554State *s) { @@ -54,7 +54,7 @@ static void pca9554_update_pin_input(PCA9554State *s) * Input: the pin is Hi-Z with a pull-up, so it reads high * unless an external device drives it low. */ - if (s->ext_state[i] =3D=3D PCA9554_PIN_LOW) { + if (s->ext_state[i] =3D=3D PCA9554_PIN_STATE_LOW) { s->regs[PCA9554_INPUT] &=3D ~bit_mask; } else { s->regs[PCA9554_INPUT] |=3D bit_mask; @@ -156,7 +156,7 @@ static void pca9554_get_pin(Object *obj, Visitor *v, co= nst char *name, { PCA9554State *s =3D PCA9554(obj); int pin, rc; - uint8_t state; + Pca9554PinState state; =20 rc =3D sscanf(name, "pin%2d", &pin); if (rc !=3D 1) { @@ -175,7 +175,7 @@ static void pca9554_get_pin(Object *obj, Visitor *v, co= nst char *name, * holds the wire level regardless of the configured direction. */ state =3D (s->regs[PCA9554_INPUT] >> pin) & 0x1; - visit_type_str(v, name, (char **)&pin_state[state], errp); + visit_type_Pca9554PinState(v, name, &state, errp); } =20 static void pca9554_set_pin(Object *obj, Visitor *v, const char *name, @@ -183,10 +183,10 @@ static void pca9554_set_pin(Object *obj, Visitor *v, = const char *name, { PCA9554State *s =3D PCA9554(obj); int pin, rc, val; - uint8_t state, mask; - g_autofree char *state_str =3D NULL; + uint8_t mask; + Pca9554PinState state; =20 - if (!visit_type_str(v, name, &state_str, errp)) { + if (!visit_type_Pca9554PinState(v, name, &state, errp)) { return; } rc =3D sscanf(name, "pin%2d", &pin); @@ -199,16 +199,6 @@ static void pca9554_set_pin(Object *obj, Visitor *v, c= onst char *name, return; } =20 - for (state =3D 0; state < ARRAY_SIZE(pin_state); state++) { - if (!strcmp(state_str, pin_state[state])) { - break; - } - } - if (state >=3D ARRAY_SIZE(pin_state)) { - error_setg(errp, "%s invalid pin state %s", __func__, state_str); - return; - } - if (s->hw_dir) { /* Warn and ignore if the guest has configured this pin as output = */ if (!((s->regs[PCA9554_CONFIG] >> pin) & 0x1)) { @@ -219,13 +209,13 @@ static void pca9554_set_pin(Object *obj, Visitor *v, = const char *name, return; } /* Drive the external input level */ - pca9554_set_ext_state(s, pin, state !=3D PCA9554_PIN_LOW); + pca9554_set_ext_state(s, pin, state !=3D PCA9554_PIN_STATE_LOW); } else { /* Legacy behavior: force output mode and drive */ /* First, modify the output register bit */ val =3D pca9554_read(s, PCA9554_OUTPUT); mask =3D 0x1 << pin; - if (state =3D=3D PCA9554_PIN_LOW) { + if (state =3D=3D PCA9554_PIN_STATE_LOW) { val &=3D ~(mask); } else { val |=3D mask; @@ -264,7 +254,7 @@ static void pca9554_reset(DeviceState *dev) s->regs[PCA9554_POLARITY] =3D 0x0; /* No pins are inverted */ s->regs[PCA9554_CONFIG] =3D pin_mask; /* All pins are inputs */ =20 - memset(s->ext_state, PCA9554_PIN_HIZ, pc->pin_count); + memset(s->ext_state, PCA9554_PIN_STATE_HIGH, pc->pin_count); pca9554_update_pin_input(s); =20 s->pointer =3D 0x0; @@ -280,7 +270,8 @@ static void pca9554_initfn(Object *obj) char *name; =20 name =3D g_strdup_printf("pin%d", pin); - object_property_add(obj, name, "str", pca9554_get_pin, pca9554_set= _pin, + object_property_add(obj, name, "Pca9554PinState", + pca9554_get_pin, pca9554_set_pin, NULL, NULL); g_free(name); } diff --git a/qapi/machine.json b/qapi/machine.json index d418b34a8643..0e0d85d0a76d 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -429,6 +429,52 @@ { 'enum': 'LostTickPolicy', 'data': ['discard', 'delay', 'slew' ] } =20 +## +# @Pca9552LedState: +# +# LED state for PCA9552. +# +# @on: LED on +# +# @off: LED off +# +# @pwm0: LED controlled by PWM0 +# +# @pwm1: LED controlled by PWM1 +# +# Since: 11.2 +## +{ 'enum': 'Pca9552LedState', + 'data': ['on', 'off', 'pwm0', 'pwm1'] } + +## +# @Pca9552PinState: +# +# Pin state for PCA9552. +# +# @low: Pin low +# +# @high: Pin high +# +# Since: 11.2 +## +{ 'enum': 'Pca9552PinState', + 'data': ['low', 'high'] } + +## +# @Pca9554PinState: +# +# Pin state for PCA9554. +# +# @low: Pin low +# +# @high: Pin high +# +# Since: 11.2 +## +{ 'enum': 'Pca9554PinState', + 'data': ['low', 'high'] } + ## # @inject-nmi: # --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145156; cv=none; d=zohomail.com; s=zohoarc; b=Wz21k6Ttq6fJt5IZuBIBA0BK7Zmc6QQFyH7NKlrNtjEPfTEzhKAVLRXqSd4tluxduUz4GrdML6uQboS46tBWpeSjhE6kg01c0849oX5CDRFgd/iSAg4Ql29Ep5ryFW30oTXfkKV+MkmtHmVM5ftPv6X0AuPkAXGGaTpzYfjurQM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145156; h=Content-Type: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=oPypAJmHalIuZO8Qh6uXAHLk6oL+F+SAlk4t9kCAeHs=; b=R9jTP1gCnsb7TUbNIus/0zZqrtItkYyBlHrTtAqF7fGetdsMPwXVHmXc4J3+9IzrnkE7Ul/m/+7s4dIlS6xLzoKnbTCHuEjDTf2GulfFSrmRSFbaVNxoL47aHAqLy2ZbnsN+UtR9YUyZC3ub7dMLPSyXqQitrgBV+lqveHMnt+Y= 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 178914515638067.87160409317983; Fri, 11 Sep 2026 09:45:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Ic-0006Er-A4; Fri, 11 Sep 2026 12:40:26 -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 1x54Ia-0006Af-Ch for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:24 -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 1x54IW-00076Q-N9 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:22 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-450-F79_-1BnPfueYsb-lUAPEg-1; Fri, 11 Sep 2026 12:40:16 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 02EAE1954B1C; Fri, 11 Sep 2026 16:40:15 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 02533300022B; Fri, 11 Sep 2026 16:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144820; 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=oPypAJmHalIuZO8Qh6uXAHLk6oL+F+SAlk4t9kCAeHs=; b=UZTB03JL9roaSRq+rY4btnLKVFFbCPiw4U8r4pVt5yYSyxqsLnUMh4UtukSEaSW/XQ8JT9 gezgd5OqEBsZZNptbC+wkox6CbTPWM3lzmyAJ1UEewKp/r9sIJlz/3SVd46QYjZJ3mHcx9 LR/jAFa32w9hPgiltQtjVhdAOi1Za5w= X-MC-Unique: F79_-1BnPfueYsb-lUAPEg-1 X-Mimecast-MFC-AGG-ID: F79_-1BnPfueYsb-lUAPEg_1789144815 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:19 +0400 Subject: [PATCH v5 45/62] include: add QEMU_REPEAT helper macro MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-45-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Elena Ufimtseva , Jagannathan Raman , Jonathan Cameron , qemu-arm@nongnu.org, linux-cxl@vger.kernel.org X-Developer-Signature: v=1; a=openpgp-sha256; l=5015; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=EAQeZe1XEuAWHJARuU6IDW2Xx2TnIuJB2OqRLsbMlaA=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC27e1GZ9h+t8HjfLlru0PtcsL2oxGUkDdXLw sXsc1WkU92JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuwAKCRDa6OEJdZac 5SL/D/9Di4Hwl5aWMkxJtvYwk2A0TNhNdL/qDxWUmTEaa0r0EM7lBKICiTEGybKGLZAKxRsGA3i DD5G+JKYC2mu2p8LIAuuPQlPiybwo92BxvpW0GfZbRsRiPzu+w1NU0yjSxtlbprBMPXSxor2bhZ IgDf0kPbeVZoSU+h3fZx5QOxViLVZylOsWv7hOnMmaqNb2QNdn1WAVA1fsKSScgpi8sZrd4jj0+ P8fNnsW+vcNDfAbQsWRlH2EUlzLS1C6dRPJOEuv/y0+MwpFtfNiup+QXq91Puq7YkQS/4joRQOi 50ZY3pimp5+1hXQTBpS7oGNwUt1QEsTUgytvvEpetOVddrezRKwjr6v+QjnBMNeuuoZpkdOpsI/ 2bfAf7VYui0b7oSnP6ELjlvREUn+GXwOTKml/qFOPVDSSbYr+uJPrHGBfDCf4dpG2Oy96n/Et1k BBaLK4rmzCPwe+IinPPE5LIRrbyF8sUstGoLJTlcI/Pt59Vho6wY/QuHM/zUGY8VMLS7M+UBxpz qTye+RKZ3I7YqSMBV9Wq8leb3KnhpKNpkagD067AZIh/u2aGB2Mk6ViVqIudqluvVPKh9kRxD+C 2ptqEv+8waQ9gIwUWAguD/z0eEAMjY66UTv7LFTjfHoYJpc9IQX7OfYkIUGAi3MJhCB9pwfGDbA aXtgKN7qt0b8N+g== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789145156605158500 Introduce a macro used in following commit, and convert a few existing candidates. Inspired by a similar macro in Linux kernel/trace/bpf_trace.c Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/misc/tz-ppc.c | 19 ++----------------- hw/remote/vfio-user-obj.c | 17 +++-------------- include/hw/cxl/cxl_component.h | 5 +---- include/qemu/osdep.h | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 35 deletions(-) diff --git a/hw/misc/tz-ppc.c b/hw/misc/tz-ppc.c index 6f820430eed8..5f09ce164c19 100644 --- a/hw/misc/tz-ppc.c +++ b/hw/misc/tz-ppc.c @@ -303,26 +303,11 @@ static const VMStateDescription tz_ppc_vmstate =3D { =20 #define DEFINE_PORT(N) \ DEFINE_PROP_LINK("port[" #N "]", TZPPC, port[N].downstream, \ - TYPE_MEMORY_REGION, MemoryRegion *) + TYPE_MEMORY_REGION, MemoryRegion *), =20 static const Property tz_ppc_properties[] =3D { DEFINE_PROP_UINT32("NONSEC_MASK", TZPPC, nonsec_mask, 0), - DEFINE_PORT(0), - DEFINE_PORT(1), - DEFINE_PORT(2), - DEFINE_PORT(3), - DEFINE_PORT(4), - DEFINE_PORT(5), - DEFINE_PORT(6), - DEFINE_PORT(7), - DEFINE_PORT(8), - DEFINE_PORT(9), - DEFINE_PORT(10), - DEFINE_PORT(11), - DEFINE_PORT(12), - DEFINE_PORT(13), - DEFINE_PORT(14), - DEFINE_PORT(15), + QEMU_REPEAT(TZ_NUM_PORTS, DEFINE_PORT) }; =20 static void tz_ppc_class_init(ObjectClass *klass, const void *data) diff --git a/hw/remote/vfio-user-obj.c b/hw/remote/vfio-user-obj.c index 7e6819f670b5..84c3ff05cfb8 100644 --- a/hw/remote/vfio-user-obj.c +++ b/hw/remote/vfio-user-obj.c @@ -496,22 +496,11 @@ static size_t vfu_object_bar_rw(PCIDevice *pci_dev, i= nt pci_bar, buf, count, is_write); = \ } = \ =20 -VFU_OBJECT_BAR_HANDLER(0) -VFU_OBJECT_BAR_HANDLER(1) -VFU_OBJECT_BAR_HANDLER(2) -VFU_OBJECT_BAR_HANDLER(3) -VFU_OBJECT_BAR_HANDLER(4) -VFU_OBJECT_BAR_HANDLER(5) -VFU_OBJECT_BAR_HANDLER(6) +QEMU_REPEAT(PCI_NUM_REGIONS, VFU_OBJECT_BAR_HANDLER) =20 +#define VFU_OBJECT_BAR_HANDLER_PTR(BAR_NO) vfu_object_bar##BAR_NO##_handle= r, static vfu_region_access_cb_t *vfu_object_bar_handlers[PCI_NUM_REGIONS] = =3D { - &vfu_object_bar0_handler, - &vfu_object_bar1_handler, - &vfu_object_bar2_handler, - &vfu_object_bar3_handler, - &vfu_object_bar4_handler, - &vfu_object_bar5_handler, - &vfu_object_bar6_handler, + QEMU_REPEAT(PCI_NUM_REGIONS, VFU_OBJECT_BAR_HANDLER_PTR) }; =20 /** diff --git a/include/hw/cxl/cxl_component.h b/include/hw/cxl/cxl_component.h index ffc82202206c..fca8b7055ccd 100644 --- a/include/hw/cxl/cxl_component.h +++ b/include/hw/cxl/cxl_component.h @@ -186,10 +186,7 @@ REG32(CXL_HDM_DECODER_GLOBAL_CONTROL, CXL_HDM_REGISTER= S_OFFSET + 4) /* Support 4 decoders at all levels of topology */ #define CXL_HDM_DECODER_COUNT 4 =20 -HDM_DECODER_INIT(0); -HDM_DECODER_INIT(1); -HDM_DECODER_INIT(2); -HDM_DECODER_INIT(3); +QEMU_REPEAT(CXL_HDM_DECODER_COUNT, HDM_DECODER_INIT) =20 /* * CXL r3.1 Section 8.2.4.21: CXL Extended Security Capability Structure diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 1ec5b42230be..a5e7ff99cb89 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -191,6 +191,39 @@ extern "C" { =20 #include "qemu/typedefs.h" =20 +/* + * QEMU_REPEAT(n, m) - invoke m(0) m(1) ... m(n-1) + * + * Expands to n invocations of m, each with a literal integer argument. + * n must be a compile-time constant in 0..16. + * + * Example - generate 4 per-index function definitions: + * + * #define DEFINE_GETTER(i) \ + * static int get_##i(void) { return values[i]; } + * + * QEMU_REPEAT(4, DEFINE_GETTER) + */ +#define QEMU_REPEAT_0(m) +#define QEMU_REPEAT_1(m) QEMU_REPEAT_0(m) m(0) +#define QEMU_REPEAT_2(m) QEMU_REPEAT_1(m) m(1) +#define QEMU_REPEAT_3(m) QEMU_REPEAT_2(m) m(2) +#define QEMU_REPEAT_4(m) QEMU_REPEAT_3(m) m(3) +#define QEMU_REPEAT_5(m) QEMU_REPEAT_4(m) m(4) +#define QEMU_REPEAT_6(m) QEMU_REPEAT_5(m) m(5) +#define QEMU_REPEAT_7(m) QEMU_REPEAT_6(m) m(6) +#define QEMU_REPEAT_8(m) QEMU_REPEAT_7(m) m(7) +#define QEMU_REPEAT_9(m) QEMU_REPEAT_8(m) m(8) +#define QEMU_REPEAT_10(m) QEMU_REPEAT_9(m) m(9) +#define QEMU_REPEAT_11(m) QEMU_REPEAT_10(m) m(10) +#define QEMU_REPEAT_12(m) QEMU_REPEAT_11(m) m(11) +#define QEMU_REPEAT_13(m) QEMU_REPEAT_12(m) m(12) +#define QEMU_REPEAT_14(m) QEMU_REPEAT_13(m) m(13) +#define QEMU_REPEAT_15(m) QEMU_REPEAT_14(m) m(14) +#define QEMU_REPEAT_16(m) QEMU_REPEAT_15(m) m(15) +#define QEMU_REPEAT_(n, m) QEMU_REPEAT_##n(m) +#define QEMU_REPEAT(n, m) QEMU_REPEAT_(n, m) + /** * Mark a function that executes in coroutine context * --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144870; cv=none; d=zohomail.com; s=zohoarc; b=fpPVQlqrV9V5/Q2TyeWRW8hxPjr4L0UgDs1Ix0wbfKpbLvHfFz2Q6XJjCwQ+H/lzzEs0N3GLTmLhmmukLA/lpbhpxFdbgqTCHlK5bb686b7e2LB/gpndKN4tgxAb19wdqOKgiIsXjUBmtWlqzYaw2A3INTGfRxrY5b0X515Ym5M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144870; h=Content-Type: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=Q+7N6lQaNJ3+ymbHkk8ge+yyGgvBETdQK+dHzHp83lE=; b=YR+qQ5oxvBjST3r+PxOndYsJ3ttdG7sDCdF3vkM3E7vFp9mRPxxUPZTV60uV8P9R2sFkeK6lmd8T0jcXz91RxYurxNnSWjNlDLaccQUi6Q4XoMyIFmPS/VPeFaWMlMtl+/SjnPKAKWTI2evBlDZTD5vN1lBRhoKUVr1+zVb9j6A= 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 1789144870467742.0508671073608; Fri, 11 Sep 2026 09:41:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Ih-0006NA-9l; Fri, 11 Sep 2026 12:40:31 -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 1x54Ie-0006Kw-Jw for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:28 -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 1x54Ia-000779-9K for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:28 -0400 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-600-ERvAatcPMVevlHH1EgWtiQ-1; Fri, 11 Sep 2026 12:40:20 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 8DFC618005A0; Fri, 11 Sep 2026 16:40:18 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 937D618002B7; Fri, 11 Sep 2026 16:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144823; 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=Q+7N6lQaNJ3+ymbHkk8ge+yyGgvBETdQK+dHzHp83lE=; b=hhFSMz6nT8efmBqol/36Sdh4laT+YnEU7k2tr/6zwfNER5NHnjbTlvbzWdPFSz3lsSatuZ r96CEujjT4fFlVA4HErIn3majeRkSwQD49bojrluxa/JLKRC4qPnGiYw+oSCCfkkQP2yTJ sbAynuje+TriRbIV1c8I3Q2L0emVcvc= X-MC-Unique: ERvAatcPMVevlHH1EgWtiQ-1 X-Mimecast-MFC-AGG-ID: ERvAatcPMVevlHH1EgWtiQ_1789144818 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:20 +0400 Subject: [PATCH v5 46/62] hw/gpio/pca955x: convert pin/led property to QAPI-aware enum MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-46-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Glenn Miles , qemu-ppc@nongnu.org, qemu-arm@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=18122; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=jaJ89zwuq2tH/Z6pbH2n/emoNfh0O7+7mD66hHhyAJk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC27X8QmKohYG6hf5+yRUb8ka8itT1Z/jHiKx mauFGtMIDqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuwAKCRDa6OEJdZac 5d5PEACgihcgrdH4FOZkuZQxmCt6kjr1esyVHKQxYxAPmJ0fQKkiw2aIgxWmaiL8Ft1qTJYWJ5h 9S3O/2+OTJrGOWRz/WazsKHSWT70K+hbyYfp5tK7nzXcXc8zrVkbJGUyzhSSVvhiuxvCxqi8f4i HUjTaLN3mhmQmZpqsJ/D09nxwSlOO1WHwJVgpXjPlxTHLM0DS8AL5PaDwr9SoQ5Kcqphqw+4sJd jJUaHy7p7ghmsPvn9za4lN6/eoo6e7ncoOlxkAFV04Zbobqhh9f7AJQoQJtL3G/l/0Q/aru78bt qiXAhO3gw0kdd7ZufRi25jRKo16Xyb90RIvrHi6A0qWrW0IAH2qBbvcB9g9rGhqvmO1SrvEog35 xyVq1PpY4BzwuCgbJ6HNiYOY+xSjBsMcP3l48/Fk+4dfmzkNSn3wxmjeABGfsWVfP3qzl3l1NAv 1ecmWx3wmHeuMc/mTrBm9zltFZ/q3tUiZrgODwCCU6fMd4E+s47t2RXf5s+BfyEY+nfJqYsj5TU 46a5Q+2fWR5p94vVa0ggFnSc/qXwAhLoAb9AkqA6J7xunY2/PKTmOz5XRBevXkPUGZ3JApF/dPY h6+GOFD6leaDLKEg0XpBL7WNg21nypv0UVXO8znb4AUOuAt8PJmCzMpk7cPUf9jpd/rcPLbKotB imBKvpd1MGqPg4Q== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=marcandre.lureau@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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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: 1789144872959158500 Replaces the runtime-parsed visitor-based QOM property accessors with compile-time per-pin/per-LED accessor functions using QEMU_REPEAT. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/gpio/pca9552.c | 205 +++++++++++++++++++++-----------------------------= ---- hw/gpio/pca9554.c | 136 ++++++++++++++---------------------- 2 files changed, 131 insertions(+), 210 deletions(-) diff --git a/hw/gpio/pca9552.c b/hw/gpio/pca9552.c index 16741c22dea3..b743a30d80ff 100644 --- a/hw/gpio/pca9552.c +++ b/hw/gpio/pca9552.c @@ -25,6 +25,7 @@ #include "qapi/error.h" #include "qapi/qapi-types-machine.h" #include "qapi/qapi-visit-machine.h" +#include "qapi/qapi-type-infos-machine.h" #include "trace.h" #include "qom/object.h" =20 @@ -354,33 +355,6 @@ static int pca955x_event(I2CSlave *i2c, enum i2c_event= event) return 0; } =20 -static void pca955x_get_led(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - PCA955xClass *k =3D PCA955X_GET_CLASS(obj); - PCA955xState *s =3D PCA955X(obj); - int led, rc, reg; - Pca9552LedState state; - - rc =3D sscanf(name, "led%2d", &led); - if (rc !=3D 1) { - error_setg(errp, "%s: error reading %s", __func__, name); - return; - } - if (led < 0 || led >=3D k->pin_count) { - error_setg(errp, "%s: invalid led %s", __func__, name); - return; - } - /* - * Get the LSx register as the qom interface should expose the device - * state, not the modeled 'input line' behaviour which would come from - * reading the INPUTx reg - */ - reg =3D PCA9552_LS0 + led / 4; - state =3D (pca955x_read(s, reg) >> ((led % 4) * 2)) & 0x3; - visit_type_Pca9552LedState(v, name, &state, errp); -} - /* * Return an LED selector register value based on an existing one, with * the appropriate 2-bit state value set for the given LED number (0-3). @@ -391,97 +365,8 @@ static inline uint8_t pca955x_ledsel(uint8_t oldval, i= nt led_num, int state) ((state & 0x3) << (led_num << 1)); } =20 -static void pca955x_set_led(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - PCA955xClass *k =3D PCA955X_GET_CLASS(obj); - PCA955xState *s =3D PCA955X(obj); - int led, rc, reg, val; - Pca9552LedState state; - - if (!visit_type_Pca9552LedState(v, name, &state, errp)) { - return; - } - rc =3D sscanf(name, "led%2d", &led); - if (rc !=3D 1) { - error_setg(errp, "%s: error reading %s", __func__, name); - return; - } - if (led < 0 || led >=3D k->pin_count) { - error_setg(errp, "%s: invalid led %s", __func__, name); - return; - } - - reg =3D PCA9552_LS0 + led / 4; - val =3D pca955x_read(s, reg); - val =3D pca955x_ledsel(val, led % 4, state); - pca955x_write(s, reg, val); -} - static void pca955x_set_ext_state(PCA955xState *s, int pin, int level); =20 -static void pca955x_get_pin(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - PCA955xClass *k =3D PCA955X_GET_CLASS(obj); - PCA955xState *s =3D PCA955X(obj); - int pin, rc; - uint8_t input_reg; - Pca9552PinState state; - - rc =3D sscanf(name, "pin%2d", &pin); - if (rc !=3D 1) { - error_setg(errp, "%s: error reading %s", __func__, name); - return; - } - if (pin < 0 || pin >=3D k->pin_count) { - error_setg(errp, "%s invalid pin %s", __func__, name); - return; - } - - /* - * Report the raw pin logic level; polarity inversion is a read-time - * transform applied to the INPUT register, not to the pin state itsel= f. - */ - input_reg =3D PCA9535_INPUT0 + (pin / 8); - state =3D (s->regs[input_reg] >> (pin % 8)) & 0x1; - visit_type_Pca9552PinState(v, name, &state, errp); -} - -static void pca955x_set_pin(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - PCA955xClass *k =3D PCA955X_GET_CLASS(obj); - PCA955xState *s =3D PCA955X(obj); - int pin, rc; - Pca9552PinState state; - uint8_t config_reg; - - if (!visit_type_Pca9552PinState(v, name, &state, errp)) { - return; - } - rc =3D sscanf(name, "pin%2d", &pin); - if (rc !=3D 1) { - error_setg(errp, "%s: error reading %s", __func__, name); - return; - } - if (pin < 0 || pin >=3D k->pin_count) { - error_setg(errp, "%s invalid pin %s", __func__, name); - return; - } - - /* Only input-configured pins can be driven by an external device. */ - config_reg =3D PCA9535_CONFIG0 + (pin / 8); - if (!((s->regs[config_reg] >> (pin % 8)) & 0x1)) { - qemu_log_mask(LOG_UNIMP, - "%s: pin %d is configured as output, ignoring set\n", - s->description, pin); - return; - } - - pca955x_set_ext_state(s, pin, state !=3D PCA9552_PIN_STATE_LOW); -} - static const VMStateDescription pca9552_vmstate =3D { .name =3D "PCA9552", .version_id =3D 0, @@ -536,26 +421,92 @@ static void pca9535_reset_hold(Object *obj, ResetType= type) s->len =3D 0; } =20 +/* + * Get the LSx register as the qom interface should expose the device + * state, not the modeled 'input line' behaviour which would come from + * reading the INPUTx reg + */ +#define DEFINE_LED_ACCESSORS(n) = \ +static int prop_get_led##n(Object *obj, Error **errp) = \ +{ = \ + PCA955xState *s =3D PCA955X(obj); = \ + uint8_t reg =3D PCA9552_LS0 + (n) / 4; = \ + return (pca955x_read(s, reg) >> (((n) % 4) * 2)) & 0x3; = \ +} = \ +static void prop_set_led##n(Object *obj, int val, Error **errp) = \ +{ = \ + PCA955xState *s =3D PCA955X(obj); = \ + uint8_t reg =3D PCA9552_LS0 + (n) / 4; = \ + uint8_t old =3D pca955x_read(s, reg); = \ + pca955x_write(s, reg, pca955x_ledsel(old, (n) % 4, val)); = \ +} + +QEMU_REPEAT(PCA955X_PIN_COUNT_MAX, DEFINE_LED_ACCESSORS) + +#define LED_ENUM_PROP(n) { \ + .name =3D "led" #n, \ + .default_value =3D -1, \ + .qapi_type =3D &Pca9552LedState_type_info, \ + .get =3D prop_get_led##n, \ + .set =3D prop_set_led##n, \ +}, + +static const QapiEnumProp led_enum_props[] =3D { + QEMU_REPEAT(PCA955X_PIN_COUNT_MAX, LED_ENUM_PROP) +}; + +/* + * Report the raw pin logic level; polarity inversion is a read-time + * transform applied to the INPUT register, not to the pin state + * itself. + */ +#define DEFINE_PIN_ACCESSORS(n) = \ +static int prop_get_pin##n(Object *obj, Error **errp) = \ +{ = \ + PCA955xState *s =3D PCA955X(obj); = \ + uint8_t input_reg =3D PCA9535_INPUT0 + (n) / 8; = \ + return (s->regs[input_reg] >> ((n) % 8)) & 0x1; = \ +} = \ +static void prop_set_pin##n(Object *obj, int val, Error **errp) = \ +{ = \ + PCA955xState *s =3D PCA955X(obj); = \ + uint8_t config_reg =3D PCA9535_CONFIG0 + (n) / 8; = \ + /* Only input-configured pins can be driven by an external device */ = \ + if (!((s->regs[config_reg] >> ((n) % 8)) & 0x1)) { = \ + qemu_log_mask(LOG_UNIMP, = \ + "%s: pin %d configured as output, ignoring set\n", = \ + s->description, (n)); = \ + return; = \ + } = \ + pca955x_set_ext_state(s, (n), val !=3D PCA9552_PIN_STATE_LOW); = \ +} + +QEMU_REPEAT(PCA955X_PIN_COUNT_MAX, DEFINE_PIN_ACCESSORS) + +#define PIN_ENUM_PROP(n) { \ + .name =3D "pin" #n, \ + .default_value =3D -1, \ + .qapi_type =3D &Pca9552PinState_type_info, \ + .get =3D prop_get_pin##n, \ + .set =3D prop_set_pin##n, \ +}, + +static const QapiEnumProp pin_enum_props[] =3D { + QEMU_REPEAT(PCA955X_PIN_COUNT_MAX, PIN_ENUM_PROP) +}; + static void pca955x_initfn(Object *obj) { PCA955xClass *k =3D PCA955X_GET_CLASS(obj); =20 assert(k->pin_count <=3D PCA955X_PIN_COUNT_MAX); + /* use array/list instead of individual QAPI enum properties */ for (int ix =3D 0; ix < k->pin_count; ix++) { - char *name; - if (k->has_led_support) { - /* LED variant: expose the LED selector state as led%d. */ - name =3D g_strdup_printf("led%d", ix); - object_property_add(obj, name, "Pca9552LedState", - pca955x_get_led, pca955x_set_led, NULL, NU= LL); + object_property_add_qapi_enum(obj, &led_enum_props[ix]); } else { - /* GPIO variant: expose the pin logic level as pin%d. */ - name =3D g_strdup_printf("pin%d", ix); - object_property_add(obj, name, "Pca9552PinState", - pca955x_get_pin, pca955x_set_pin, NULL, NU= LL); + object_property_add_qapi_enum(obj, &pin_enum_props[ix]); } - g_free(name); } } =20 diff --git a/hw/gpio/pca9554.c b/hw/gpio/pca9554.c index e4eddc829ef7..f2a5b94a36d8 100644 --- a/hw/gpio/pca9554.c +++ b/hw/gpio/pca9554.c @@ -18,7 +18,7 @@ #include "qapi/error.h" #include "qapi/qapi-types-machine.h" #include "qapi/qapi-visit-machine.h" -#include "qapi/visitor.h" +#include "qapi/qapi-type-infos-machine.h" #include "trace.h" #include "qom/object.h" =20 @@ -151,83 +151,60 @@ static void pca9554_set_ext_state(PCA9554State *s, in= t pin, int level) } } =20 -static void pca9554_get_pin(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - PCA9554State *s =3D PCA9554(obj); - int pin, rc; - Pca9554PinState state; - - rc =3D sscanf(name, "pin%2d", &pin); - if (rc !=3D 1) { - error_setg(errp, "%s: error reading %s", __func__, name); - return; - } - if (pin < 0 || pin >=3D PCA9554_GET_CLASS(s)->pin_count) { - error_setg(errp, "%s invalid pin %s", __func__, name); - return; - } - - /* - * Report the physical pin level. The input register is kept in sync by - * pca9554_update_pin_input(): output pins mirror the OUTPUT register = and - * input pins reflect the externally driven (or pulled-up) level, so it - * holds the wire level regardless of the configured direction. - */ - state =3D (s->regs[PCA9554_INPUT] >> pin) & 0x1; - visit_type_Pca9554PinState(v, name, &state, errp); +/* + * Report the physical pin level. The input register is kept in sync + * by pca9554_update_pin_input(): output pins mirror the OUTPUT + * register and input pins reflect the externally driven (or + * pulled-up) level, so it holds the wire level regardless of the + * configured direction. + */ +#define DEFINE_PIN_ACCESSORS(n) = \ +static int prop_get_pin##n(Object *obj, Error **errp) = \ +{ = \ + PCA9554State *s =3D PCA9554(obj); = \ + return (s->regs[PCA9554_INPUT] >> (n)) & 0x1; = \ +} = \ +static void prop_set_pin##n(Object *obj, int val, Error **errp) = \ +{ = \ + PCA9554State *s =3D PCA9554(obj); = \ + if (s->hw_dir) { = \ + if (!((s->regs[PCA9554_CONFIG] >> (n)) & 0x1)) { = \ + qemu_log_mask(LOG_UNIMP, = \ + "%s: pin %d configured as output," = \ + " ignoring set\n", = \ + s->description, (n)); = \ + return; = \ + } = \ + pca9554_set_ext_state(s, (n), val !=3D PCA9554_PIN_STATE_LOW); = \ + } else { = \ + /* Legacy behavior: force output mode and drive */ = \ + uint8_t mask =3D 0x1 << (n); = \ + int v =3D pca9554_read(s, PCA9554_OUTPUT); = \ + if (val =3D=3D PCA9554_PIN_STATE_LOW) { = \ + v &=3D ~mask; = \ + } else { = \ + v |=3D mask; = \ + } = \ + pca9554_write(s, PCA9554_OUTPUT, v); = \ + v =3D pca9554_read(s, PCA9554_CONFIG); = \ + v &=3D ~mask; = \ + pca9554_write(s, PCA9554_CONFIG, v); = \ + } = \ } =20 -static void pca9554_set_pin(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - PCA9554State *s =3D PCA9554(obj); - int pin, rc, val; - uint8_t mask; - Pca9554PinState state; +QEMU_REPEAT(PCA9554_PIN_COUNT, DEFINE_PIN_ACCESSORS) =20 - if (!visit_type_Pca9554PinState(v, name, &state, errp)) { - return; - } - rc =3D sscanf(name, "pin%2d", &pin); - if (rc !=3D 1) { - error_setg(errp, "%s: error reading %s", __func__, name); - return; - } - if (pin < 0 || pin >=3D PCA9554_GET_CLASS(s)->pin_count) { - error_setg(errp, "%s invalid pin %s", __func__, name); - return; - } +#define PIN_ENUM_PROP(n) { \ + .name =3D "pin" #n, \ + .default_value =3D -1, \ + .qapi_type =3D &Pca9554PinState_type_info, \ + .get =3D prop_get_pin##n, \ + .set =3D prop_set_pin##n, \ +}, =20 - if (s->hw_dir) { - /* Warn and ignore if the guest has configured this pin as output = */ - if (!((s->regs[PCA9554_CONFIG] >> pin) & 0x1)) { - qemu_log_mask(LOG_UNIMP, - "%s: pin %d is configured as output, " - "ignoring external set\n", - s->description, pin); - return; - } - /* Drive the external input level */ - pca9554_set_ext_state(s, pin, state !=3D PCA9554_PIN_STATE_LOW); - } else { - /* Legacy behavior: force output mode and drive */ - /* First, modify the output register bit */ - val =3D pca9554_read(s, PCA9554_OUTPUT); - mask =3D 0x1 << pin; - if (state =3D=3D PCA9554_PIN_STATE_LOW) { - val &=3D ~(mask); - } else { - val |=3D mask; - } - pca9554_write(s, PCA9554_OUTPUT, val); - - /* Then, clear the config register bit for output mode */ - val =3D pca9554_read(s, PCA9554_CONFIG); - val &=3D ~mask; - pca9554_write(s, PCA9554_CONFIG, val); - } -} +static const QapiEnumProp pin_enum_props[] =3D { + QEMU_REPEAT(PCA9554_PIN_COUNT, PIN_ENUM_PROP) +}; =20 static const VMStateDescription pca9554_vmstate =3D { .name =3D "PCA9554", @@ -264,16 +241,9 @@ static void pca9554_reset(DeviceState *dev) static void pca9554_initfn(Object *obj) { PCA9554Class *pc =3D PCA9554_GET_CLASS(obj); - int pin; =20 - for (pin =3D 0; pin < pc->pin_count; pin++) { - char *name; - - name =3D g_strdup_printf("pin%d", pin); - object_property_add(obj, name, "Pca9554PinState", - pca9554_get_pin, pca9554_set_pin, - NULL, NULL); - g_free(name); + for (int pin =3D 0; pin < pc->pin_count; pin++) { + object_property_add_qapi_enum(obj, &pin_enum_props[pin]); } } =20 --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144857; cv=none; d=zohomail.com; s=zohoarc; b=AfYSOrnKPxsE7po1lXQWWl+C9vdsM8ExOsnfTviOTAXFPb6cL7SffGnCowf5y7X0J9IX5ADwVtmUJ09B2Qhfd36jYo4kiKx8ov6lHoT7wbcvPOZH8fpZJgmdsQ3uH8HN9aQ2eHROzZW0RTCMGDUhy2pelansQaHPgIC64k/u6tg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144857; h=Content-Type: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=JF8h3ORZNfEB8i4Tjr4bqZSkhDQQB1gVmeetkO2W1xk=; b=b3xrhb1tn5th2c9SM+iDfLVLxu310GEDOXxwtSAYv5RY8BnVCRcJnnkm0+UXB1ZVwO2KUfHAjov4PQ7Ew2fUrbu3BfK1Jt31dJkpwweHCM5FMmHdZQh5tiIjM6Bvc2WMQDuiWdvoSJwnzoUGTtSVtnJqMN1+j2LXYyzQkjsf23c= 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 1789144857558284.78357259774896; Fri, 11 Sep 2026 09:40:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Ih-0006ND-FE; Fri, 11 Sep 2026 12:40:31 -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 1x54Ig-0006MM-1h for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:30 -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 1x54Ie-000782-3m for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:29 -0400 Received: from mx-prod-mc-08.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-110-o6s26sP-NGWVx3hOeLVniA-1; Fri, 11 Sep 2026 12:40:23 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 25136180134B; Fri, 11 Sep 2026 16:40:22 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EADA5180034C; Fri, 11 Sep 2026 16:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144827; 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=JF8h3ORZNfEB8i4Tjr4bqZSkhDQQB1gVmeetkO2W1xk=; b=KL6YwTWKM/lhVo961r9rdOpgOcxW8nU9que6XTxw4p1dAHdKgHGv+qJWXSgcNJk9atkLEn GunICmFDqkp+d/O165TzqBPoetyTE7O1DDTGj2qQJJbpSwDRDtiBzZPIGmP4hXyC1cuACN qV07hK7Fg5o2g/Cex44XzoU/Xufukuw= X-MC-Unique: o6s26sP-NGWVx3hOeLVniA-1 X-Mimecast-MFC-AGG-ID: o6s26sP-NGWVx3hOeLVniA_1789144822 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:21 +0400 Subject: [PATCH v5 47/62] hw/pci: change the busnr type to uint8 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-47-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" X-Developer-Signature: v=1; a=openpgp-sha256; l=622; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=um8mwQpkF7gZqlVS3nLmWf6c8kRhu74W62ZkPTk7ysE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC27gQLXIPHRZV+4iId+9qiSI/vkOlJzbO+fW E/pnkUv/pGJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuwAKCRDa6OEJdZac 5fPCD/9M9eFdnv5a6zx+j5UiLAkc6nSifT/nbK/Ft2ZpCvjI5nqliuguSTDTPj/wGPF5vMWPRia Ry/mA3acBb2C59JPdHQG+0K2DaBBGjjCHE7+zvgE43If8tyjxF6jPdLta/DIJRF8nKOGhEwhlLh abB+3N6M3wj3KGFoWngOFU0dXL1Dz8Ob/UfqnefIwAXZVWXBpnuYyYca5xeSK30KQrwEiFBDJP8 Rlg1RaKyJyQOqbyM/XwApi3kSpvKeh80G4S6efmmJiVlJs0XccovXsrIRJFAvFzaf0JOBQaEmB5 xfY0oNH9oL+3NA1iTOUgxrB36Id5UsiYE7eVQNkmq8tjWb658R+NtTN3k5jYqZdCI82RuHTnaHf PWkyb/BmtUXHn1HFM3JLFTLKOS6y5j79xMXBC6sB2A05b8cQCAJJvDOvnNrHII0zJBb5zItTS+U dWJqe/HbG4nyN1pzdAsk3xtSyJli5dsA0aC5eNT0rkL2F88f2CWtkoaWuxYoPgqHa4YaMvqapHA trn1g48GczFMco9wWK27M20cA0M4UIz0j4JeqZ5/H/UzxjS72erYlfiTtHYkdIcK65wVZ5m63eB MsJSMb8K3CNj9WnSaH4Y2eorNQL+FsA9jZQrSjl+dTNBdvr7POXdMgsbq5D+YW/DRTUvti9wY8N j6FftXB/sRn5SzQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=marcandre.lureau@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, 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: 1789144858738158500 It is effectively a u8. The next changes are going to use the uint8_type_info for it. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index c15f2b9f084a..af6e1d440c37 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -80,7 +80,7 @@ static void prop_pci_busnr_get(Object *obj, Visitor *v, c= onst char *name, } =20 static const PropertyInfo prop_pci_busnr =3D { - .type =3D "busnr", + .type =3D "uint8", .get =3D prop_pci_busnr_get, }; =20 --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145155; cv=none; d=zohomail.com; s=zohoarc; b=VVjmWxxzVCqTl67GJwUeeMhh3Nfr+XU5rLMepichPsVywte7lI/ENYJOMO61rQ71R6oe32TN0Geauq6iNLe6//HGg3y4uPrlCECy504nQgWEBiSznkl6YIUb9vv8ph6I/Mm9Ta1ol32cychL6MSaHwGXxnxtnrVmfo9gWM2DJgQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145155; h=Content-Type: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=+U56nlsVf4mgf1W0GndZT5RbL9JsSUbkFD/AB+XKJsA=; b=mTqLUBKA1f9oeJXvmJ/jovAG/6eyXC6b6tfMqa1urJvMtuqJgNxA2Cw8R/kMkCyQHr3o4RNOcam9OXFVqcE6ArcYjxaTDnD+ujomUVthrPcnA84POgRQTNgvjLp5Nqb53ig0nZ6EAmDnxRgWKjV1YjEam+Jph901MIh1k7P6YR0= 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 1789145155577730.0732632799502; Fri, 11 Sep 2026 09:45:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Ij-0006O2-Na; Fri, 11 Sep 2026 12:40:33 -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 1x54Ii-0006Nn-8V for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:32 -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 1x54Ig-00078b-JI for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:31 -0400 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-609-avn7r4kCPe6OtH6ASvvg3Q-1; Fri, 11 Sep 2026 12:40:27 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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 00C5A180074A; Fri, 11 Sep 2026 16:40:26 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 33F22433; Fri, 11 Sep 2026 16:40:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144829; 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=+U56nlsVf4mgf1W0GndZT5RbL9JsSUbkFD/AB+XKJsA=; b=NTepVEiZe6P11CxwnKHDg7aHJcOrPPiCCNpZ2Lm3yO5e+jcursjXr5SW1WxK6PKe6ZEkkm cGuYFjIDEC5sr1lbUkp9BozKU1qhjovQ0dAfOFbM4CrdjYBfzD/Dz0IdQ6oyHQEv0ezEnJ OpSKYPKyNo7pDAM/LSPyRoA/1vd1D88= X-MC-Unique: avn7r4kCPe6OtH6ASvvg3Q-1 X-Mimecast-MFC-AGG-ID: avn7r4kCPe6OtH6ASvvg3Q_1789144826 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:22 +0400 Subject: [PATCH v5 48/62] qdev: add qapi_type field to PropertyInfo with fallback registration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-48-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=7097; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=rVgb3lPZcyuxYB6Idtqpd6v6VbibarNVb6IbHBysRPw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC27Ie4SYs+41MuVARVwzZl8LXSFZI6SL0gio pqGnVOpnhCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuwAKCRDa6OEJdZac 5TgyD/47Ud7C+L7rt6ng7VcjVThBuI/cFzWjgBmvHwW9bel8Law2vqEpAcDGVker9Z6LGxtixbW /5jlb28zXuAg+qeNx3N6zNLuKGbmU0AOrs7NZmwKCn/qHHLZrdE4nyBrlOzWFzb+mg+9qq1zGVP hROK2+TNIJvm3Cg9SzThM3S0RGyaS4fv4M84K9jvD+cMzZhCtMa/fuZA/44cRIhsIty5tZEnCB2 Udc7ChAhwmhyAtORIAzGvrLv6Lkuk4ajU0ebcb87/Ltw91eJG5nH+EumK+W5/Y19SBwwidi1aOU 3GuMmaCqrbaaPuXPnPx/fPZXCcxI7uhQdlE8kZH8h5h04MKFVzPKKrux87+Gvcr4Bt2jQoaHycP XpD9huGmQ6AUz+s15ukK6YFdxu9Ouw13EwwtcYkedkxs8nko0h8xCUHeOOJ8YX6dEbSK/mqHh/N tDGaNj+aPyxkibew/Knur811o8fr3W69ao7pckNt0B26Y+eBhRB0z6KnjeeUpK8JbEedayCVYi2 aa3f0KJ7UVW6e+WiJYeIuvqb6BSPCEgxWG3ybn7rI1kAzDQvBLwgOOcKpJ/80HBScAYSocb8MIs cWA7zTQbD+m/CPNn670oignInj0QERvGxrvUCanRl6UxvHFdX6Z/fHkNq/AEoLfTyWs+MOantMP CzqYpVA7wjP0E4w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=marcandre.lureau@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_H2=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: 1789145156647158500 Add a qapi_type field to PropertyInfo to prepare for the transition from string-based type metadata to QAPI type-info. Add a qdev_prop_qapi_type() helper that resolves the QAPI type for a property from .qapi_type. It will be later extended to cope with array types. Update qdev_property_add_static() and qdev_class_add_property() to prefer object_property_add_qapi() when a QAPI type is available, falling back to the old object_property_add() for unconverted properties. Update the shared enum accessor functions to prefer .qapi_type->lookup over .enum_table via a new qdev_propinfo_enum_lookup() helper. No PropertyInfo definitions are changed, all .qapi_type fields default to NULL, so the fallback paths are always taken. This patch is no-op for now. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/core/qdev-properties.c | 67 +++++++++++++++++++++++++++++------= ---- include/hw/core/qdev-properties.h | 1 + 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 34d7b26a7303..b3d5abd5053c 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -99,13 +99,22 @@ static ObjectPropertyAccessor *field_prop_setter(const = PropertyInfo *info) return info->set ? field_prop_set : NULL; } =20 +static const QEnumLookup *qdev_propinfo_enum_lookup(const PropertyInfo *in= fo) +{ + if (info->qapi_type) { + assert(info->qapi_type->lookup); + return info->qapi_type->lookup; + } + return info->enum_table; +} + void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { const Property *prop =3D opaque; int *ptr =3D object_field_prop_ptr(obj, prop); =20 - visit_type_enum(v, name, ptr, prop->info->enum_table, errp); + visit_type_enum(v, name, ptr, qdev_propinfo_enum_lookup(prop->info), e= rrp); } =20 void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name, @@ -114,14 +123,14 @@ void qdev_propinfo_set_enum(Object *obj, Visitor *v, = const char *name, const Property *prop =3D opaque; int *ptr =3D object_field_prop_ptr(obj, prop); =20 - visit_type_enum(v, name, ptr, prop->info->enum_table, errp); + visit_type_enum(v, name, ptr, qdev_propinfo_enum_lookup(prop->info), e= rrp); } =20 void qdev_propinfo_set_default_value_enum(ObjectProperty *op, const Property *prop) { object_property_set_default_str(op, - qapi_enum_lookup(prop->info->enum_table, prop->defval.i)); + qapi_enum_lookup(qdev_propinfo_enum_lookup(prop->info), prop->defv= al.i)); } =20 /* Bit */ @@ -941,8 +950,8 @@ void qdev_prop_set_enum(DeviceState *dev, const char *n= ame, int value) =20 prop =3D qdev_prop_find(dev, name); object_property_set_str(OBJECT(dev), name, - qapi_enum_lookup(prop->info->enum_table, value= ), - &error_abort); + qapi_enum_lookup(qdev_propinfo_enum_lookup(prop->info), value), + &error_abort); } =20 void qdev_prop_set_array(DeviceState *dev, const char *name, QList *values) @@ -1143,18 +1152,33 @@ const PropertyInfo qdev_prop_link =3D { .set =3D set_link, }; =20 +static const QAPITypeInfo *qdev_prop_qapi_type(const Property *prop) +{ + /* this will be later extended to cope with QAPI array properties */ + return prop->info->qapi_type; +} + void qdev_property_add_static(DeviceState *dev, const Property *prop) { Object *obj =3D OBJECT(dev); ObjectProperty *op; + const QAPITypeInfo *qapi_type =3D qdev_prop_qapi_type(prop); =20 assert(!prop->info->create); =20 - op =3D object_property_add(obj, prop->name, prop->info->type, - field_prop_getter(prop->info), - field_prop_setter(prop->info), - prop->info->release, - (Property *)prop); + if (qapi_type) { + op =3D object_property_add_qapi(obj, prop->name, qapi_type, + field_prop_getter(prop->info), + field_prop_setter(prop->info), + prop->info->release, + (Property *)prop); + } else { + op =3D object_property_add(obj, prop->name, prop->info->type, + field_prop_getter(prop->info), + field_prop_setter(prop->info), + prop->info->release, + (Property *)prop); + } =20 object_property_set_description(obj, prop->name, prop->info->description); @@ -1176,12 +1200,23 @@ static void qdev_class_add_property(DeviceClass *kl= ass, const char *name, if (prop->info->create) { op =3D prop->info->create(oc, name, prop); } else { - op =3D object_class_property_add(oc, - name, prop->info->type, - field_prop_getter(prop->info), - field_prop_setter(prop->info), - prop->info->release, - (Property *)prop); + const QAPITypeInfo *qapi_type =3D qdev_prop_qapi_type(prop); + + if (qapi_type) { + op =3D object_class_property_add_qapi(oc, + name, qapi_type, + field_prop_getter(prop->inf= o), + field_prop_setter(prop->inf= o), + prop->info->release, + (Property *)prop); + } else { + op =3D object_class_property_add(oc, + name, prop->info->type, + field_prop_getter(prop->info), + field_prop_setter(prop->info), + prop->info->release, + (Property *)prop); + } } if (prop->set_default) { prop->info->set_default_value(op, prop); diff --git a/include/hw/core/qdev-properties.h b/include/hw/core/qdev-prope= rties.h index eba5436e53b1..1ea2ba66bb37 100644 --- a/include/hw/core/qdev-properties.h +++ b/include/hw/core/qdev-properties.h @@ -34,6 +34,7 @@ struct PropertyInfo { const char *type; const char *description; const QEnumLookup *enum_table; + const QAPITypeInfo *qapi_type; bool realized_set_allowed; /* allow setting property on realized devic= e */ char *(*print)(Object *obj, const Property *prop); void (*set_default_value)(ObjectProperty *op, const Property *prop); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144890; cv=none; d=zohomail.com; s=zohoarc; b=X6Lm6HNM7434/Yj+TzYj1evI+uY4cZguTdbXoCHUsC7455ZDMgHW3iEK9LGqDKMWW80tNuF3SmSj9Z6e2YpKR6ifsQ6qCctZXIejc4Htlzqd3mRvdlSlKE0mArE1lPv8RQx/thbk+B/j96eQzGNvgvj/Ybvik5XX6hKG8bXI9NY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144890; h=Content-Type: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=yIwJWaK8tsYw5DkqRZdnqVq9NraRNdS/e77Jdg6JGkY=; b=PWKSfIry42x0NvDOrS8JrvVIUO2b+eAV8I5Z8Vfj+cjJTuxnBFq//VMVGopPW1tDzFiP8LJ8dBaZpZwyep+KXPS77NjbnTm1KD6JkJBI95OAngMnoYkY7cQy0diznxvu2W2UiWAn5SXP38I157gSM/3pbXERzFn4QzMMMHFLLAI= 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 17891448901011010.3999173322005; Fri, 11 Sep 2026 09:41:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Im-0006UR-VL; Fri, 11 Sep 2026 12:40:37 -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 1x54Il-0006TA-HU for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:35 -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 1x54Ij-00079B-OW for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:35 -0400 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-121-EqKw1oaDN9SRc_B7xGX3gA-1; Fri, 11 Sep 2026 12:40:31 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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 86CD2180074A; Fri, 11 Sep 2026 16:40:29 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 78FD8768; Fri, 11 Sep 2026 16:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144832; 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=yIwJWaK8tsYw5DkqRZdnqVq9NraRNdS/e77Jdg6JGkY=; b=ghwY8ySuQudz46/ik08x1Ma6Kryog2iqrSwxwdxmZ7qrnT1CKjU9VmW/DVLqIiVpf5FUmJ mX9trz/rnTKbX3qydmq7shkS7GwS9FQryu7GFETYhHIwq2OQQ9TSgXGDLlJKiAveSWOFwV NI13z9qaL/QMbbVLxAKMnNDA6ykILMU= X-MC-Unique: EqKw1oaDN9SRc_B7xGX3gA-1 X-Mimecast-MFC-AGG-ID: EqKw1oaDN9SRc_B7xGX3gA_1789144829 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:23 +0400 Subject: [PATCH v5 49/62] qdev: convert core PropertyInfo definitions to use qapi_type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-49-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=6905; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=uKd4YrvBJdVeN8+KEVzpNUXVhpVCSGsiMFoSt6/JX4Q=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC27/vqM41b7f5MUs0FAK6XAHZJwWiM4AZ6CP hFUyrCCyH+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuwAKCRDa6OEJdZac 5Y2DD/0b/4b2BpflJYn3UJYatssirnmdHZOdfsTKKZH2ILmc9dgf+lf53QPzH9jRWKXb4+VEUCy 6+B7z/1sU8aI2KNcePn3vpciJY3/7K+QwMtQ6jFpBCHd5+Z5IGgmXQEGI/CLdituWDGJAs+0kZt yDBjnEYO5KRn2MzHNHU4wq3HlpCLjtuQF5lMFQkLQVRGNJhgsqhY8KTMchHubIOSwwXYfDtjobt Al/7Cm3SZSATd4KxOa4Z/0rTuntP9Y2tXYpEP6O3+p+1zZGPJtUiB2FSDHN3mXW8SCXGh3llCFt PlG6hS2oOhpNPy6Qcl4KH7xX2qTyildyzLznyALLsPPPohdHPRxZd0lH2SPNgRs6L8rX9S2yMVN Qzw+la6KLZ9X4ft1x0+eae3if/5IsdYZIj75cdYMoHmqcRnrOQw0sL2RklJkZysR5OR0+44C2tc GUGbBstmQGEXjyGlLERqiuPvQJ3yf5uGC9SizmCdVuQTPJvIo27Bbti+Hju2ANG05EIBMw58rc1 ePbW5pbdfSagLrQnmJOPkU4ZfFxMjy2nDYMt2/VunZGBpusBhPns9vjmvLsW60ttMwLUtUykHB4 u5AVQgqV/16fczaA4029K09igQm6YYctO3DvQBUBB5NtRREX8q3cBS00EwaDiwpnlTpj9mvs2sG WCeWY/4Rzv2xvcg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=marcandre.lureau@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_H2=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: 1789144891384158500 Replace .type string with .qapi_type pointer on all core PropertyInfo definitions in qdev-properties.c. Remove .enum_table from enum definitions, since the lookup is now accessed through .qapi_type->lookup via the qdev_propinfo_enum_lookup() fallback helper. Note that qdev_prop_usize now reports "uint32" or "uint64" depending on the host. If usize is worth preserving, it should be added as a QAPI builtin type. Or perhaps we should simply use "size" everywhere (u64)? It's also strange to use type "size" for both u32 (prop_size32) and u64 (prop_size). Link property are actually strings. The "full type name" is set when the property is added, as "link". Array property will be refactored in a subsequent patch. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/core/qdev-properties.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index b3d5abd5053c..e924b040687b 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -12,6 +12,8 @@ #include "qdev-prop-internal.h" #include "qom/compat-properties.h" #include "qom/qom-qobject.h" +#include "qapi/qapi-builtin-type-infos.h" +#include "qapi/qapi-type-infos-common.h" =20 void qdev_prop_set_after_realize(DeviceState *dev, const char *name, Error **errp) @@ -180,7 +182,7 @@ static void set_default_value_bool(ObjectProperty *op, = const Property *prop) } =20 const PropertyInfo qdev_prop_bit =3D { - .type =3D "bool", + .qapi_type =3D &bool_type_info, .description =3D "on/off", .get =3D prop_get_bit, .set =3D prop_set_bit, @@ -230,7 +232,7 @@ static void prop_set_bit64(Object *obj, Visitor *v, con= st char *name, } =20 const PropertyInfo qdev_prop_bit64 =3D { - .type =3D "bool", + .qapi_type =3D &bool_type_info, .description =3D "on/off", .get =3D prop_get_bit64, .set =3D prop_set_bit64, @@ -292,9 +294,8 @@ static void prop_set_on_off_auto_bit64(Object *obj, Vis= itor *v, } =20 const PropertyInfo qdev_prop_on_off_auto_bit64 =3D { - .type =3D "OnOffAuto", + .qapi_type =3D &OnOffAuto_type_info, .description =3D "on/off/auto", - .enum_table =3D &OnOffAuto_lookup, .get =3D prop_get_on_off_auto_bit64, .set =3D prop_set_on_off_auto_bit64, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -321,7 +322,7 @@ static void set_bool(Object *obj, Visitor *v, const cha= r *name, void *opaque, } =20 const PropertyInfo qdev_prop_bool =3D { - .type =3D "bool", + .qapi_type =3D &bool_type_info, .description =3D "on/off", .get =3D get_bool, .set =3D set_bool, @@ -361,7 +362,7 @@ void qdev_propinfo_set_default_value_uint(ObjectPropert= y *op, } =20 const PropertyInfo qdev_prop_uint8 =3D { - .type =3D "uint8", + .qapi_type =3D &uint8_type_info, .get =3D get_uint8, .set =3D set_uint8, .set_default_value =3D qdev_propinfo_set_default_value_uint, @@ -388,7 +389,7 @@ static void set_uint16(Object *obj, Visitor *v, const c= har *name, } =20 const PropertyInfo qdev_prop_uint16 =3D { - .type =3D "uint16", + .qapi_type =3D &uint16_type_info, .get =3D get_uint16, .set =3D set_uint16, .set_default_value =3D qdev_propinfo_set_default_value_uint, @@ -433,14 +434,14 @@ static void set_int32(Object *obj, Visitor *v, const = char *name, void *opaque, } =20 const PropertyInfo qdev_prop_uint32 =3D { - .type =3D "uint32", + .qapi_type =3D &uint32_type_info, .get =3D get_uint32, .set =3D set_uint32, .set_default_value =3D qdev_propinfo_set_default_value_uint, }; =20 const PropertyInfo qdev_prop_int32 =3D { - .type =3D "int32", + .qapi_type =3D &int32_type_info, .get =3D qdev_propinfo_get_int32, .set =3D set_int32, .set_default_value =3D qdev_propinfo_set_default_value_int, @@ -485,14 +486,14 @@ static void set_int64(Object *obj, Visitor *v, const = char *name, } =20 const PropertyInfo qdev_prop_uint64 =3D { - .type =3D "uint64", + .qapi_type =3D &uint64_type_info, .get =3D get_uint64, .set =3D set_uint64, .set_default_value =3D qdev_propinfo_set_default_value_uint, }; =20 const PropertyInfo qdev_prop_int64 =3D { - .type =3D "int64", + .qapi_type =3D &int64_type_info, .get =3D get_int64, .set =3D set_int64, .set_default_value =3D qdev_propinfo_set_default_value_int, @@ -514,7 +515,7 @@ static void set_uint64_checkmask(Object *obj, Visitor *= v, const char *name, } =20 const PropertyInfo qdev_prop_uint64_checkmask =3D { - .type =3D "uint64", + .qapi_type =3D &uint64_type_info, .get =3D get_uint64, .set =3D set_uint64_checkmask, }; @@ -550,7 +551,11 @@ static void set_usize(Object *obj, Visitor *v, const c= har *name, void *opaque, } =20 const PropertyInfo qdev_prop_usize =3D { - .type =3D "usize", +#if HOST_LONG_BITS =3D=3D 32 + .qapi_type =3D &uint32_type_info, +#else + .qapi_type =3D &uint64_type_info, +#endif .get =3D get_usize, .set =3D set_usize, .set_default_value =3D qdev_propinfo_set_default_value_uint, @@ -594,7 +599,7 @@ static void set_string(Object *obj, Visitor *v, const c= har *name, } =20 const PropertyInfo qdev_prop_string =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .release =3D release_string, .get =3D get_string, .set =3D set_string, @@ -603,9 +608,8 @@ const PropertyInfo qdev_prop_string =3D { /* --- on/off/auto --- */ =20 const PropertyInfo qdev_prop_on_off_auto =3D { - .type =3D "OnOffAuto", + .qapi_type =3D &OnOffAuto_type_info, .description =3D "on/off/auto", - .enum_table =3D &OnOffAuto_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -646,7 +650,7 @@ static void set_size32(Object *obj, Visitor *v, const c= har *name, void *opaque, } =20 const PropertyInfo qdev_prop_size32 =3D { - .type =3D "size", + .qapi_type =3D &size_type_info, .get =3D qdev_propinfo_get_size32, .set =3D set_size32, .set_default_value =3D qdev_propinfo_set_default_value_uint, @@ -1059,7 +1063,7 @@ static void set_size(Object *obj, Visitor *v, const c= har *name, void *opaque, } =20 const PropertyInfo qdev_prop_size =3D { - .type =3D "size", + .qapi_type =3D &size_type_info, .get =3D get_size, .set =3D set_size, .set_default_value =3D qdev_propinfo_set_default_value_uint, @@ -1141,7 +1145,7 @@ static void set_link(Object *obj, Visitor *v, const c= har *name, void *opaque, } =20 const PropertyInfo qdev_prop_link =3D { - .type =3D "link", + .qapi_type =3D &str_type_info, .create =3D create_link_property, /* * Since we have a create method, the get and set are used --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144951; cv=none; d=zohomail.com; s=zohoarc; b=V7AkxLUcsGbsptnR6pHHbAVYA0oUQTKN06jV4rPY9RitTSMd3WQ/mzaJUrgdgMwf0zG53FLdouQdt/rfFBmpTLUdgT64chPblrW+1do5GG9ehV0Rtxa1T+qj87nmZiCyh+RAcghydHD+fPzPAW0hL3oiYULxhknazqWMFbPSaRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144951; h=Content-Type: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=+8o3TdsDmTmZflSq3Tpd/g79z8JVPD27QnuhbFbpfBc=; b=GgnXYEV89l1Z9Yvl+4MgAn12MsMWOVEmDHHLIbdt6T8N/K3fZShAeReZML4G7/jpdC6jiAMPl/M8PmtBiiLGKom4e4FD9Qel8NjwUWDVwqvV5WhJRM95fzGQqD8lq3hNWnfC+5efDApOmZtMLAn9UKJxTx1Y8lHUcl9hmx0fnHg= 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 1789144951911457.14243703984164; Fri, 11 Sep 2026 09:42:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54JB-0006pJ-17; Fri, 11 Sep 2026 12:41:01 -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 1x54Ir-0006cB-Og for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:43 -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 1x54Iq-00079h-A8 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:41 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-607-j60Js6rEMiWHwJLMuE9jPw-1; Fri, 11 Sep 2026 12:40:34 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 078DF19539BF; Fri, 11 Sep 2026 16:40:33 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 39762195608F; Fri, 11 Sep 2026 16:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144839; 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=+8o3TdsDmTmZflSq3Tpd/g79z8JVPD27QnuhbFbpfBc=; b=GDrV+cmOVKDzhJhwy4PP5EUHZyYF2vihj8QxBWbXbGwM5mdUP++RsWZhw9gFu+OlszffE3 G66VhAT6tcRTm1RkKWN8CfpcHNkNS1rVEwOytERFOMd5tZ1Hu9QQpbiR+O0bikotvIEvhM DB83SkYWDTLdAilx4lJlFP0QXIFr3WQ= X-MC-Unique: j60Js6rEMiWHwJLMuE9jPw-1 X-Mimecast-MFC-AGG-ID: j60Js6rEMiWHwJLMuE9jPw_1789144833 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:24 +0400 Subject: [PATCH v5 50/62] qdev: adjust PciDevfn declared type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-50-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1128; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=KhDByEWBnxUC3W2CWL4f0/aEPfmWCB/L9BLd30y2XBI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC27VvnlmdnC2sK0BLdK63bEClVNS2CicZkjr kBqPIcKJVGJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuwAKCRDa6OEJdZac 5cAGD/40nO9HqdUxEXPAwQGHyO0qt49CZcgln3EpS0MBi78lLdjXaLW8xs/iQROIcgTpgmVRlAy z0ZOfXGbEBXulIDbGjz4d5u4lpqiD0XSaOdJjqtQtPo+A0Og7+NZVadkdvbVPINrE3gNtmAEQHz PYtYT86V2h9o4u/fO9ztlrS3KCHcyZHsyHH5oi1obJ6RP8ULEPnoBKWOuAWulG6wSWW/7jBRO0R esVTnl64SaN/3iCz9Qvvt/NCPjXnJhAnWGf/R7xaJttgTBxbsYKq0UrtbBt1zoDvmxJp4P9kdtO O8iwk5mslbVXq8wVuZ/UtRGbe9YhW7iyHoLBvCxRA4ka6U28K8Y96WQI48lCVZEbXXVwtFt7rP7 oOQxKjkpVhlwrgSVeoi9D0167aX1jjtlPXwHTvCqLORTDxxWPKYfw6h5n4+CUk7x0BuGOknkwcG IrGPmCYje6nf7vbOlkB6LtCFIHYU04XmPHp5Xs/Kgr18geldR49XjiQIG25e9/7AtsRKZPgde/p yM1Jr1k5Y3hXqqLIabTxOBxF5fkvKzLKGpUNWdKqKpk9+BfHePuyQojiGtGzQu992flzHybZeET k3+twniW6W20J9QyQN+TJ7hsEH1UFlVgQA0nhVCv2gmpNtPQxsS1OHEFJXftF3y117OFRrsK9S+ Sa2WHwmuwOxOBhw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144953401158500 PciDevfn is a bit special, since it accepts integer and string as setter, but only output integer as getter. Unfortunately, we can't declare an alternate str|int QAPI type for it, since: branch 'string' can't be distinguished from 'integer' Rather than declaring it as "str", use the common type instead. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/core/qdev-properties-system.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 5bfdfe1ab9d9..3381de1144d6 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -904,7 +904,8 @@ static char *print_pci_devfn(Object *obj, const Propert= y *prop) } =20 const PropertyInfo qdev_prop_pci_devfn =3D { - .type =3D "str", + /* The formatted string accepted by the setter is a CLI convenience. */ + .type =3D "int32", .description =3D "Slot and optional function number, example: 06.0 or = 06", .print =3D print_pci_devfn, .get =3D qdev_propinfo_get_int32, --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145004; cv=none; d=zohomail.com; s=zohoarc; b=Dbw5mo00oAJQffGMdgOkn2IS3tiNRxkaU8nFABJSz/tuxJzVLXViRlje43u0/sJt1jT1PRTuQFUWb05M9qV6CHvhbEonlvyWuAHvJ3Lv4sqqEgoqwpyQ9Jn8MO1wTs3l1mVCUQHte73NiRyL9d89Iu7qIoOX8mM+CTQHFzxNBWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145004; h=Content-Type: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=hrL77UiYk/Zget/e8RSL9xHwWkdSA8I3FunFDzEsRdA=; b=GXTVE3l12lX+2Y2fR6oWxLLkBQKOij/H6orHSPc2KPdKYuWkU1jzhT/4Tu+A9o6LbaJluhGrMVMz1CEbwEQkWjAeQ44t2vj9EjzaZ6Vz/kAGM/4GAUXm7j5FqHIi9JRRAKMk8o7pwe9iorURzt8/gNk4CAqim69YQbMb2CciavM= 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 1789145004624521.7632009749117; Fri, 11 Sep 2026 09:43:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54JA-0006oE-QK; Fri, 11 Sep 2026 12:41:00 -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 1x54Iu-0006dL-HJ for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:45 -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 1x54Ir-00079t-KV for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:44 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-696-wXSnSC2HN9SBum5R51kPQA-1; Fri, 11 Sep 2026 12:40:37 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 79C4519539BF; Fri, 11 Sep 2026 16:40:36 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7D9E4300022B; Fri, 11 Sep 2026 16:40:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144841; 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=hrL77UiYk/Zget/e8RSL9xHwWkdSA8I3FunFDzEsRdA=; b=ZM54hR4sDWVVew1QGsKLwM54cPhOeh90feiOTtgk1zhs5o3Z0J255oE8wuZ5wEqn0IyrtC 0bTYDHgHL/RI5WHvCxaG85g2jlZyLIEfrvVCIxhSa44T+SnNe1Yieq8pVPKjlnBrQbW8YU 7sN/JxrHpbk43e7EpWtdbJBQpokoKwg= X-MC-Unique: wXSnSC2HN9SBum5R51kPQA-1 X-Mimecast-MFC-AGG-ID: wXSnSC2HN9SBum5R51kPQA_1789144836 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:25 +0400 Subject: [PATCH v5 51/62] qdev: convert system PropertyInfo definitions to use qapi_type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-51-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=16434; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=4Bo/cyQSFiYV2QeJZcz34wORXEtPo4YqPhxF9F/nwuo=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC27av+dBbzTv9awinMy7PUkVNCYPeAaGqwrU oMjRyw/76aJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuwAKCRDa6OEJdZac 5YpMD/9mtH/pelmdrGN0xTTwKXdRkas4wf/ESa1OLOgK3G6QoLOVJ9W6Pl/O/QlqXAa1liRdp5s w9uXDuW4GClvVUOLNOUBoOx8nmdKgROi6PtWPCBieS/FnTycPny5L1akfFYGFkyA3qEj93CmLhd Bj0yhZcGofm5S93VHU6x5ngB8pN8xcEUEdyi0RdhxdoFhb3dW817trcFRNAwqtPOyCCX1RuHc9a gAlWgOw9Ek2ydbaqQYeUw3YVx8htIY0mEko74qmA9Sbw5GlRAhQzDJfReeaBOOJCepQpfEgTqXq 27bcOzBbyBT0ZkhR84Y4pboLaznJ2yYYDe1g1GWiZO06EzOk83ufdueZJ3sZn0YDREeZIxmK3oQ vF55CEOtXaicgnFVBNKkFij2wiAGA5O1pZ/awx2iF6Urz1XqzHV22oL+SLx7BukfdKISS5mRrGR kxNORT1D6qSQ2s6kdhOJAlRjHC7YOv/ppKCtE5VxDorTXPNtb7Z0tRjnonvPim3YiOUDhW36Cjg 6sTjwzmdjMyDMkPGlkIpvTc66I3stsiB9nMIh2LUHvOdKBOueUt4SNGpSpfYhd49B2LwtLRg7gw p9VNpy91n1el0KMXrKg6Hxt7Izmcdaza/bYd4iXtKSmLUI+SHNq3STJGhCjjf8Qfvd8xagc1oh2 eipHGmW8LhF5Z2w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789145006193158500 Replace .type string and .enum_table pointer with .qapi_type in all PropertyInfo definitions in qdev-properties-system.c Update file-private enum accessor functions to use .qapi_type->lookup instead of .enum_table. Note, this should be a faithful conversion, but it would be worth to consider better types than just "str" for references (block node names, chardev/netdev IDs, MAC addrs, etc) Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/core/qdev-prop-internal.h | 2 + hw/core/qdev-properties-system.c | 93 +++++++++++++++++-------------------= ---- hw/core/qdev-properties.c | 2 +- 3 files changed, 43 insertions(+), 54 deletions(-) diff --git a/hw/core/qdev-prop-internal.h b/hw/core/qdev-prop-internal.h index d7b77844fe0b..c190b7b88cf4 100644 --- a/hw/core/qdev-prop-internal.h +++ b/hw/core/qdev-prop-internal.h @@ -8,6 +8,8 @@ #ifndef HW_CORE_QDEV_PROP_INTERNAL_H #define HW_CORE_QDEV_PROP_INTERNAL_H =20 +const QEnumLookup *qdev_propinfo_enum_lookup(const PropertyInfo *info); + void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp); void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name, diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 3381de1144d6..8819a9a0b748 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -27,6 +27,7 @@ #include "qemu/uuid.h" #include "qemu/error-report.h" #include "qdev-prop-internal.h" +#include "qapi/qapi-type-infos.h" =20 #include "qemu/audio.h" #include "chardev/char-fe.h" @@ -238,7 +239,7 @@ static void release_drive(Object *obj, const char *name= , void *opaque) } =20 const PropertyInfo qdev_prop_drive =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "Node name or ID of a block device to use as a backen= d", .realized_set_allowed =3D true, .get =3D get_drive, @@ -247,7 +248,7 @@ const PropertyInfo qdev_prop_drive =3D { }; =20 const PropertyInfo qdev_prop_drive_iothread =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "Node name or ID of a block device to use as a backen= d", .realized_set_allowed =3D true, .get =3D get_drive, @@ -315,7 +316,7 @@ static void release_chr(Object *obj, const char *name, = void *opaque) } =20 const PropertyInfo qdev_prop_chr =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "ID of a chardev to use as a backend", .get =3D get_chr, .set =3D set_chr, @@ -389,7 +390,7 @@ inval: } =20 const PropertyInfo qdev_prop_macaddr =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "Ethernet 6-byte MAC Address, example: 52:54:00:12:34= :56", .get =3D get_mac, .set =3D set_mac, @@ -477,7 +478,7 @@ out: } =20 const PropertyInfo qdev_prop_netdev =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "ID of a netdev to use as a backend", .get =3D get_netdev, .set =3D set_netdev, @@ -514,7 +515,7 @@ static void set_audiodev(Object *obj, Visitor *v, const= char* name, } =20 const PropertyInfo qdev_prop_audiodev =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "ID of an audiodev to use as a backend", /* release done on shutdown */ .get =3D get_audiodev, @@ -584,7 +585,8 @@ static void qdev_propinfo_set_losttickpolicy(Object *ob= j, Visitor *v, int *ptr =3D object_field_prop_ptr(obj, prop); int value; =20 - if (!visit_type_enum(v, name, &value, prop->info->enum_table, errp)) { + if (!visit_type_enum(v, name, &value, + qdev_propinfo_enum_lookup(prop->info), errp)) { return; } =20 @@ -604,9 +606,8 @@ static void qdev_propinfo_set_losttickpolicy(Object *ob= j, Visitor *v, QEMU_BUILD_BUG_ON(sizeof(LostTickPolicy) !=3D sizeof(int)); =20 const PropertyInfo qdev_prop_losttickpolicy =3D { - .type =3D "LostTickPolicy", + .qapi_type =3D &LostTickPolicy_type_info, .description =3D "Policy for handling lost ticks (discard/delay/slew)", - .enum_table =3D &LostTickPolicy_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_losttickpolicy, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -631,7 +632,7 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, } =20 const PropertyInfo qdev_prop_blocksize =3D { - .type =3D "size", + .qapi_type =3D &size_type_info, .description =3D "A power of two between " MIN_BLOCK_SIZE_STR " and " MAX_BLOCK_SIZE_STR, .get =3D qdev_propinfo_get_size32, @@ -644,9 +645,8 @@ const PropertyInfo qdev_prop_blocksize =3D { QEMU_BUILD_BUG_ON(sizeof(BlockdevOnError) !=3D sizeof(int)); =20 const PropertyInfo qdev_prop_blockdev_on_error =3D { - .type =3D "BlockdevOnError", + .qapi_type =3D &BlockdevOnError_type_info, .description =3D "Error handling policy (report/ignore/enospc/stop/aut= o)", - .enum_table =3D &BlockdevOnError_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -657,10 +657,9 @@ const PropertyInfo qdev_prop_blockdev_on_error =3D { QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) !=3D sizeof(int)); =20 const PropertyInfo qdev_prop_bios_chs_trans =3D { - .type =3D "BiosAtaTranslation", + .qapi_type =3D &BiosAtaTranslation_type_info, .description =3D "Logical CHS translation algorithm " " (auto/none/lba/large/rechs)", - .enum_table =3D &BiosAtaTranslation_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -669,9 +668,8 @@ const PropertyInfo qdev_prop_bios_chs_trans =3D { /* --- FDC default drive types */ =20 const PropertyInfo qdev_prop_fdc_drive_type =3D { - .type =3D "FloppyDriveType", + .qapi_type =3D &FloppyDriveType_type_info, .description =3D "Floppy drive type (144/288/120/none/auto)", - .enum_table =3D &FloppyDriveType_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -680,10 +678,9 @@ const PropertyInfo qdev_prop_fdc_drive_type =3D { /* --- MultiFDCompression --- */ =20 const PropertyInfo qdev_prop_multifd_compression =3D { - .type =3D "MultiFDCompression", + .qapi_type =3D &MultiFDCompression_type_info, .description =3D "multifd compression method" " (none/zlib/zstd/qpl/uadk/qatzip)", - .enum_table =3D &MultiFDCompression_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -694,9 +691,8 @@ const PropertyInfo qdev_prop_multifd_compression =3D { QEMU_BUILD_BUG_ON(sizeof(MigMode) !=3D sizeof(int)); =20 const PropertyInfo qdev_prop_mig_mode =3D { - .type =3D "MigMode", + .qapi_type =3D &MigMode_type_info, .description =3D "Migration mode (normal/cpr-reboot)", - .enum_table =3D &MigMode_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -707,18 +703,16 @@ const PropertyInfo qdev_prop_mig_mode =3D { QEMU_BUILD_BUG_ON(sizeof(GranuleMode) !=3D sizeof(int)); =20 const PropertyInfo qdev_prop_granule_mode =3D { - .type =3D "GranuleMode", + .qapi_type =3D &GranuleMode_type_info, .description =3D "Granule page size (4k/8k/16k/64k/host)", - .enum_table =3D &GranuleMode_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, .set_default_value =3D qdev_propinfo_set_default_value_enum, }; =20 const PropertyInfo qdev_prop_zero_page_detection =3D { - .type =3D "ZeroPageDetection", + .qapi_type =3D &ZeroPageDetection_type_info, .description =3D "Zero page detection (none/legacy/multifd)", - .enum_table =3D &ZeroPageDetection_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -729,9 +723,8 @@ const PropertyInfo qdev_prop_zero_page_detection =3D { QEMU_BUILD_BUG_ON(sizeof(SsidSizeMode) !=3D sizeof(int)); =20 const PropertyInfo qdev_prop_ssidsize_mode =3D { - .type =3D "SsidSizeMode", + .qapi_type =3D &SsidSizeMode_type_info, .description =3D "ssidsize mode: auto, 0-20", - .enum_table =3D &SsidSizeMode_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -742,9 +735,8 @@ const PropertyInfo qdev_prop_ssidsize_mode =3D { QEMU_BUILD_BUG_ON(sizeof(OasMode) !=3D sizeof(int)); =20 const PropertyInfo qdev_prop_oas_mode =3D { - .type =3D "OasMode", + .qapi_type =3D &OasMode_type_info, .description =3D "oas mode: auto, 32, 36, 40, 42, 44, 48, 52, 56", - .enum_table =3D &OasMode_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -824,7 +816,7 @@ out: } =20 const PropertyInfo qdev_prop_reserved_region =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "Reserved Region, example: 0xFEE00000:0xFEEFFFFF:0", .get =3D get_reserved_region, .set =3D set_reserved_region, @@ -904,8 +896,7 @@ static char *print_pci_devfn(Object *obj, const Propert= y *prop) } =20 const PropertyInfo qdev_prop_pci_devfn =3D { - /* The formatted string accepted by the setter is a CLI convenience. */ - .type =3D "int32", + .qapi_type =3D &int32_type_info, .description =3D "Slot and optional function number, example: 06.0 or = 06", .print =3D print_pci_devfn, .get =3D qdev_propinfo_get_int32, @@ -1011,7 +1002,7 @@ inval: } =20 const PropertyInfo qdev_prop_pci_host_devaddr =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "Address (bus:device.function) of " "the host device, example: 04:10.0", .get =3D get_pci_host_devaddr, @@ -1021,9 +1012,8 @@ const PropertyInfo qdev_prop_pci_host_devaddr =3D { /* --- OffAutoPCIBAR off/auto/bar0/bar1/bar2/bar3/bar4/bar5 --- */ =20 const PropertyInfo qdev_prop_off_auto_pcibar =3D { - .type =3D "OffAutoPCIBAR", + .qapi_type =3D &OffAutoPCIBAR_type_info, .description =3D "off/auto/bar0/bar1/bar2/bar3/bar4/bar5", - .enum_table =3D &OffAutoPCIBAR_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -1062,7 +1052,8 @@ static void get_prop_pcielinkspeed(Object *obj, Visit= or *v, const char *name, abort(); } =20 - visit_type_enum(v, name, &speed, prop->info->enum_table, errp); + visit_type_enum(v, name, &speed, + qdev_propinfo_enum_lookup(prop->info), errp); } =20 static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *na= me, @@ -1072,8 +1063,8 @@ static void set_prop_pcielinkspeed(Object *obj, Visit= or *v, const char *name, PCIExpLinkSpeed *p =3D object_field_prop_ptr(obj, prop); int speed; =20 - if (!visit_type_enum(v, name, &speed, prop->info->enum_table, - errp)) { + if (!visit_type_enum(v, name, &speed, + qdev_propinfo_enum_lookup(prop->info), errp)) { return; } =20 @@ -1103,9 +1094,8 @@ static void set_prop_pcielinkspeed(Object *obj, Visit= or *v, const char *name, } =20 const PropertyInfo qdev_prop_pcie_link_speed =3D { - .type =3D "PCIELinkSpeed", + .qapi_type =3D &PCIELinkSpeed_type_info, .description =3D "2_5/5/8/16/32/64", - .enum_table =3D &PCIELinkSpeed_lookup, .get =3D get_prop_pcielinkspeed, .set =3D set_prop_pcielinkspeed, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -1147,7 +1137,8 @@ static void get_prop_pcielinkwidth(Object *obj, Visit= or *v, const char *name, abort(); } =20 - visit_type_enum(v, name, &width, prop->info->enum_table, errp); + visit_type_enum(v, name, &width, + qdev_propinfo_enum_lookup(prop->info), errp); } =20 static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *na= me, @@ -1157,8 +1148,8 @@ static void set_prop_pcielinkwidth(Object *obj, Visit= or *v, const char *name, PCIExpLinkWidth *p =3D object_field_prop_ptr(obj, prop); int width; =20 - if (!visit_type_enum(v, name, &width, prop->info->enum_table, - errp)) { + if (!visit_type_enum(v, name, &width, + qdev_propinfo_enum_lookup(prop->info), errp)) { return; } =20 @@ -1191,9 +1182,8 @@ static void set_prop_pcielinkwidth(Object *obj, Visit= or *v, const char *name, } =20 const PropertyInfo qdev_prop_pcie_link_width =3D { - .type =3D "PCIELinkWidth", + .qapi_type =3D &PCIELinkWidth_type_info, .description =3D "1/2/4/8/12/16/32", - .enum_table =3D &PCIELinkWidth_lookup, .get =3D get_prop_pcielinkwidth, .set =3D set_prop_pcielinkwidth, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -1241,7 +1231,7 @@ static void set_default_uuid_auto(ObjectProperty *op,= const Property *prop) } =20 const PropertyInfo qdev_prop_uuid =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "UUID (aka GUID) or \"" UUID_VALUE_AUTO "\" for random value (default)", .get =3D get_uuid, @@ -1254,9 +1244,8 @@ const PropertyInfo qdev_prop_uuid =3D { QEMU_BUILD_BUG_ON(sizeof(S390CpuEntitlement) !=3D sizeof(int)); =20 const PropertyInfo qdev_prop_cpus390entitlement =3D { - .type =3D "S390CpuEntitlement", + .qapi_type =3D &S390CpuEntitlement_type_info, .description =3D "auto/low/medium/high (default medium)", - .enum_table =3D &S390CpuEntitlement_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -1299,7 +1288,7 @@ static void release_iothread_vq_mapping_list(Object *= obj, } =20 const PropertyInfo qdev_prop_iothread_vq_mapping_list =3D { - .type =3D "IOThreadVirtQueueMappingList", + .qapi_type =3D &IOThreadVirtQueueMappingList_type_info, .description =3D "IOThread virtqueue mapping list [{\"iothread\":\"\", " "\"vqs\":[1,2,3,...]},...]", .get =3D get_iothread_vq_mapping_list, @@ -1310,18 +1299,16 @@ const PropertyInfo qdev_prop_iothread_vq_mapping_li= st =3D { /* --- Endian modes */ =20 const PropertyInfo qdev_prop_endian_mode =3D { - .type =3D "EndianMode", + .qapi_type =3D &EndianMode_type_info, .description =3D "Endian mode, big/little/unspecified", - .enum_table =3D &EndianMode_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, .set_default_value =3D qdev_propinfo_set_default_value_enum, }; =20 const PropertyInfo qdev_prop_vmapple_virtio_blk_variant =3D { - .type =3D "VMAppleVirtioBlkVariant", + .qapi_type =3D &VMAppleVirtioBlkVariant_type_info, .description =3D "unspecified/root/aux", - .enum_table =3D &VMAppleVirtioBlkVariant_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, .set_default_value =3D qdev_propinfo_set_default_value_enum, @@ -1364,7 +1351,7 @@ static void release_virtio_gpu_output_list(Object *ob= j, } =20 const PropertyInfo qdev_prop_virtio_gpu_output_list =3D { - .type =3D "VirtIOGPUOutputList", + .qapi_type =3D &VirtIOGPUOutputList_type_info, .description =3D "VirtIO GPU output list [{\"name\":\"\"},...]", .get =3D get_virtio_gpu_output_list, .set =3D set_virtio_gpu_output_list, diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index e924b040687b..c2980c36afa2 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -101,7 +101,7 @@ static ObjectPropertyAccessor *field_prop_setter(const = PropertyInfo *info) return info->set ? field_prop_set : NULL; } =20 -static const QEnumLookup *qdev_propinfo_enum_lookup(const PropertyInfo *in= fo) +const QEnumLookup *qdev_propinfo_enum_lookup(const PropertyInfo *info) { if (info->qapi_type) { assert(info->qapi_type->lookup); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1789144865; cv=none; d=zohomail.com; s=zohoarc; b=hbSdyF2EdI+VLL1GmqytF514aBP/Qtb11GejzGsQQPVvri1C+M7rpGnwkshkkp5Tvx/T6bQkC80pOjeD+0M70lOfHzsyOFnJR5mv18AQszyvWqacQNasuqnRBgrtQpEEc2QxTuf3BhoZJdSS4M6iuA3HF8CFIBLkzWkIepr0Ook= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144865; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uDadYbb+MvTukZ4DS18E0pLdpqsEG2v4jBcqkrYw0bM=; b=QYd/zx76Psz5/+v925vorZEGGaOkgll514ujwpeDscKmMmGpNEKkSqfhRQJHE0kv3jHmMARKjQHxKCLJBcU2XHiHf2HPRQV+Y8d682qgHeQRkMSekcccjvdTWgrdVzzGm+UhrSJoOVanR5t8bjnCcmYFV7bi9qk/TtJioHwlgTM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1789144865544744.7894947921452; Fri, 11 Sep 2026 09:41:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1417571.1646286 (Exim 4.92) (envelope-from ) id 1x54J1-00029N-Nq; Fri, 11 Sep 2026 16:40:51 +0000 Received: by outflank-mailman (output) from mailman id 1417571.1646286; Fri, 11 Sep 2026 16:40:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1x54J1-00029G-Kk; Fri, 11 Sep 2026 16:40:51 +0000 Received: by outflank-mailman (input) for mailman id 1417571; Fri, 11 Sep 2026 16:40:51 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1x54J0-00027r-RL for xen-devel@lists.xenproject.org; Fri, 11 Sep 2026 16:40:50 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1x54J0-0090Wh-8D for xen-devel@lists.xenproject.org; Fri, 11 Sep 2026 18:40:50 +0200 Received: from [10.42.69.4] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6aa42ecf-2eae-0a2a0a5409dd-0a2a4504cc8e-44 for ; Fri, 11 Sep 2026 18:40:50 +0200 Received: from [170.10.129.124] (helo=us-smtp-delivery-124.mimecast.com) by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6aa42f10-b57f-0a2a45040019-aa0a817c69f7-3 for ; Fri, 11 Sep 2026 18:40:49 +0200 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-373-DbPVIgPSPbOP9ibl1dS4OQ-1; Fri, 11 Sep 2026 12:40:44 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 06CD218005A0; Fri, 11 Sep 2026 16:40:41 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2DECE195608F; Fri, 11 Sep 2026 16:40:38 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=mimecast20190719 header.d=redhat.com header.i="@redhat.com" header.h="From:Subject:Date:Message-Id:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144848; 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=uDadYbb+MvTukZ4DS18E0pLdpqsEG2v4jBcqkrYw0bM=; b=U8sgjLLgLHBPOvsOAyAozl7fe7ww2nxBlCfvGNwszauANppzG1vpDM9YepatedT8aoIIQL WVtIYLBRFkBZDvSSIkK0mQ66O4U1SnbsmpQGMBczCEXB4A5WktovSYFukVYsXlaoXqCEuo XIz71EwuF5rFhv2cgNp7eI8vfJjbQgM= X-MC-Unique: DbPVIgPSPbOP9ibl1dS4OQ-1 X-Mimecast-MFC-AGG-ID: DbPVIgPSPbOP9ibl1dS4OQ_1789144841 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:26 +0400 Subject: [PATCH v5 52/62] hw: convert device-local PropertyInfo definitions to use qapi_type MIME-Version: 1.0 Message-Id: <20260911-qom-qapi-v5-52-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefano Stabellini , Anthony PERARD , "Edgar E. Iglesias" , Kevin Wolf , Hanna Reitz , Phil Dennis-Jordan , Alistair Francis , Peter Maydell , Keith Busch , Klaus Jensen , Jesper Devantier , "Michael S. Tsirkin" , Halil Pasic , Christian Borntraeger , Eric Farman , Farhan Ali , Richard Henderson , Ilya Leoshkevich , David Hildenbrand , Matthew Rosato , Cornelia Huck , Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , xen-devel@lists.xenproject.org, qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-s390x@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=8761; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=JMD8CHS/Ms/ZN3B00kadMDC30ZNsy393OriqSCvH/Y0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC27/FrwpaBUFhbPDQM/o0pmo0Fc272pN3kVq if9mhmJslKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtuwAKCRDa6OEJdZac 5RQQD/0VJ4R8+y480kJaLTZ3cqEvpfw1lNnm/uI8n1uA2ZLFzVvlOsEpqHPLE2mR/9Oo/sJhKUg s8P4TDAafsiUyYQpMlrEdjoieMqshEAXlKQkq+RO3/373up8zM8+D39GLdnPqEDFPme25Gr5y2x 8c8PRoLO7vI+lrEiwpI2IyrHWT7Zb21mqnKpLQTBZrhY8Qmj+ZX/JtJpOAdDXxk1OugIQVSeBZq rWHF7eYcufQtH4rtS7mHG2RuJJDd0Kjl+B7E6WmhKeGtdcpHwNTZc+Wvh37MyvdAg2XfYFJLWPP B/N5ofB2dMndTh9s3f3FuHZtQ/i/8i523aDWkDPKsT910Xc5QThMses3GAalYPjif0xtlmfkmaI KUl3FdjHiMA0PchYgdr6e0rZLfZdWs2anxhut6VAH5MNruVPPxvDYTg/eqnB1G5pYbCQuYzvZS2 3dFLRN2YMBiz/hM17+P2uE6VCE+2U76ksfyOOTzxgxcK3xoTnTcCh831KYU2qNptNG7goifUmzX wbKc3GDwzszxYqtef4uRogD37D6cxnipthwixlylbyB+Co8qw8663WPDj1r0bozbQoqxotruS1I yN2/5u/1jktef5brLkbmqVqfE2cxAmrGNOYZ6R32U3ZRIusQ/YOO1qNV9iu8FQ6kfXEIOOlV3kS fX2ixHNs8L+WsjA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-MFC-PROC-ID: iMQhqS9DT0ngcna3A8TO0tqWJjbsw872gXnGlxC4TXo_1789144841 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-ebf023/1789144850-C08D9B50-3D2EFCA6/0/0 X-purgate-type: clean X-purgate-size: 8763 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1789144867341158500 Mechanical conversion of PropertyInfo definitions in device-specific files, replacing .type string with .qapi_type pointer to the corresponding QAPITypeInfo. Except "display_mode" for apple-gfx, which is a string of a specific format. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/block/xen-block.c | 3 ++- hw/display/apple-gfx.m | 3 ++- hw/misc/xlnx-versal-trng.c | 3 ++- hw/nvme/nguid.c | 3 ++- hw/nvram/xlnx-bbram.c | 3 ++- hw/nvram/xlnx-efuse.c | 3 ++- hw/pci/pci.c | 3 ++- hw/s390x/ccw-device.c | 3 ++- hw/s390x/css.c | 5 +++-- hw/s390x/s390-pci-bus.c | 3 ++- hw/vfio/pci-quirks.c | 3 ++- 11 files changed, 23 insertions(+), 12 deletions(-) diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index 474c12fe4ac8..d9721c565c5f 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -29,6 +29,7 @@ #include "dataplane/xen-block.h" #include "hw/xen/interface/io/xs_wire.h" #include "trace.h" +#include "qapi/qapi-builtin-type-infos.h" =20 #define XVDA_MAJOR 202 #define XVDQ_MAJOR (1 << 20) @@ -663,7 +664,7 @@ invalid: * https://xenbits.xen.org/docs/unstable/man/xen-vbd-interface.7.html */ static const PropertyInfo xen_block_prop_vdev =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "Virtual Disk specifier (d*p*/xvd*/hd*/sd*)", .get =3D xen_block_get_vdev, .set =3D xen_block_set_vdev, diff --git a/hw/display/apple-gfx.m b/hw/display/apple-gfx.m index be0061b9db25..77c420b30006 100644 --- a/hw/display/apple-gfx.m +++ b/hw/display/apple-gfx.m @@ -15,6 +15,7 @@ #include "qemu/lockable.h" #include "qemu/cutils.h" #include "qemu/log.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/visitor.h" #include "qapi/error.h" #include "qemu/aio-wait.h" @@ -871,7 +872,7 @@ static void apple_gfx_set_display_mode(Object *obj, Vis= itor *v, } =20 const PropertyInfo qdev_prop_apple_gfx_display_mode =3D { - .type =3D "display_mode", + .qapi_type =3D &str_type_info, .description =3D "Display mode in pixels and Hertz, as x@ " "Example: 3840x2160@60", diff --git a/hw/misc/xlnx-versal-trng.c b/hw/misc/xlnx-versal-trng.c index 0584ee089e3c..97bd3c3f8475 100644 --- a/hw/misc/xlnx-versal-trng.c +++ b/hw/misc/xlnx-versal-trng.c @@ -36,6 +36,7 @@ #include "qapi/visitor.h" #include "migration/vmstate.h" #include "hw/core/qdev-properties.h" +#include "qapi/qapi-builtin-type-infos.h" =20 #ifndef XLNX_VERSAL_TRNG_ERR_DEBUG #define XLNX_VERSAL_TRNG_ERR_DEBUG 0 @@ -662,7 +663,7 @@ static void trng_prop_fault_event_get(Object *obj, Visi= tor *v, } =20 static const PropertyInfo trng_prop_fault_events =3D { - .type =3D "uint32", + .qapi_type =3D &uint32_type_info, .description =3D "Set to trigger TRNG fault events", .set =3D trng_prop_fault_event_set, .get =3D trng_prop_fault_event_get, diff --git a/hw/nvme/nguid.c b/hw/nvme/nguid.c index 4cd6fad6ac9b..6eaf90fca88e 100644 --- a/hw/nvme/nguid.c +++ b/hw/nvme/nguid.c @@ -18,6 +18,7 @@ #include "qapi/visitor.h" #include "qemu/ctype.h" #include "nvme.h" +#include "qapi/qapi-builtin-type-infos.h" =20 #define NGUID_SEPARATOR '-' =20 @@ -179,7 +180,7 @@ static void set_nguid(Object *obj, Visitor *v, const ch= ar *name, void *opaque, } =20 const PropertyInfo qdev_prop_nguid =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "NGUID or \"" NGUID_VALUE_AUTO "\" for random value", .get =3D get_nguid, diff --git a/hw/nvram/xlnx-bbram.c b/hw/nvram/xlnx-bbram.c index e336874bdef4..eb032ab8b9c8 100644 --- a/hw/nvram/xlnx-bbram.c +++ b/hw/nvram/xlnx-bbram.c @@ -34,6 +34,7 @@ #include "hw/core/qdev-properties.h" #include "hw/core/qdev-properties-system.h" #include "hw/nvram/xlnx-efuse.h" +#include "qapi/qapi-builtin-type-infos.h" =20 #ifndef XLNX_BBRAM_ERR_DEBUG #define XLNX_BBRAM_ERR_DEBUG 0 @@ -486,7 +487,7 @@ static void bbram_prop_release_drive(Object *obj, const= char *name, } =20 static const PropertyInfo bbram_prop_drive =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "Node name or ID of a block device to use as BBRAM ba= ckend", .realized_set_allowed =3D true, .get =3D bbram_prop_get_drive, diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c index 03c9fbc0d076..b1c9ee4980a0 100644 --- a/hw/nvram/xlnx-efuse.c +++ b/hw/nvram/xlnx-efuse.c @@ -34,6 +34,7 @@ #include "system/blockdev.h" #include "hw/core/qdev-properties.h" #include "hw/core/qdev-properties-system.h" +#include "qapi/qapi-builtin-type-infos.h" =20 #define TBIT0_OFFSET 28 #define TBIT1_OFFSET 29 @@ -251,7 +252,7 @@ static void efuse_prop_release_drive(Object *obj, const= char *name, } =20 static const PropertyInfo efuse_prop_drive =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "Node name or ID of a block device to use as eFUSE ba= ckend", .realized_set_allowed =3D true, .get =3D efuse_prop_get_drive, diff --git a/hw/pci/pci.c b/hw/pci/pci.c index af6e1d440c37..89a36221bc43 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -53,6 +53,7 @@ #include "qapi/error.h" #include "qemu/cutils.h" #include "pci-internal.h" +#include "qapi/qapi-builtin-type-infos.h" =20 #include "hw/xen/xen.h" #include "hw/i386/kvm/xen_evtchn.h" @@ -80,7 +81,7 @@ static void prop_pci_busnr_get(Object *obj, Visitor *v, c= onst char *name, } =20 static const PropertyInfo prop_pci_busnr =3D { - .type =3D "uint8", + .qapi_type =3D &uint8_type_info, .get =3D prop_pci_busnr_get, }; =20 diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c index 25c427327957..fd21a4346522 100644 --- a/hw/s390x/ccw-device.c +++ b/hw/s390x/ccw-device.c @@ -17,6 +17,7 @@ #include "qapi/visitor.h" #include "qemu/ctype.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-type-infos.h" =20 static void ccw_device_refill_ids(CcwDevice *dev) { @@ -74,7 +75,7 @@ static void ccw_device_set_loadparm(Object *obj, Visitor = *v, } =20 const PropertyInfo ccw_loadparm =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "Up to 8 chars in set of [A-Za-z0-9. ] to select" " a guest kernel", .get =3D ccw_device_get_loadparm, diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 76dbca3bb961..60cba93e7eec 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -24,6 +24,7 @@ #include "hw/s390x/s390-virtio-ccw.h" #include "hw/s390x/s390-ccw.h" #include "exec/cpu-common.h" +#include "qapi/qapi-builtin-type-infos.h" =20 typedef struct CrwContainer { CRW crw; @@ -2518,7 +2519,7 @@ out: } =20 const PropertyInfo css_devid_propinfo =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "Identifier of an I/O device in the channel " "subsystem, example: fe.1.23ab", .get =3D get_css_devid, @@ -2526,7 +2527,7 @@ const PropertyInfo css_devid_propinfo =3D { }; =20 const PropertyInfo css_devid_ro_propinfo =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "Read-only identifier of an I/O device in the channel= " "subsystem, example: fe.1.23ab", .get =3D get_css_devid, diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index eff980fdfe92..f77632810b76 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -33,6 +33,7 @@ #include "system/runstate.h" =20 #include "trace.h" +#include "qapi/qapi-builtin-type-infos.h" =20 S390pciState *s390_get_phb(void) { @@ -1541,7 +1542,7 @@ static void s390_pci_set_fid(Object *obj, Visitor *v,= const char *name, } =20 static const PropertyInfo s390_pci_fid_propinfo =3D { - .type =3D "uint32", + .qapi_type =3D &uint32_type_info, .description =3D "zpci_fid", .get =3D s390_pci_get_fid, .set =3D s390_pci_set_fid, diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index c5b4f9091d49..4a3fd374a211 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -26,6 +26,7 @@ #include "pci.h" #include "pci-quirks.h" #include "trace.h" +#include "qapi/qapi-builtin-type-infos.h" =20 /* * List of device ids/vendor ids for which to disable @@ -1436,7 +1437,7 @@ static void set_nv_gpudirect_clique_id(Object *obj, V= isitor *v, } =20 const PropertyInfo qdev_prop_nv_gpudirect_clique =3D { - .type =3D "uint8", + .qapi_type =3D &uint8_type_info, .description =3D "NVIDIA GPUDirect Clique ID (0 - 15)", .get =3D get_nv_gpudirect_clique_id, .set =3D set_nv_gpudirect_clique_id, --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145139; cv=none; d=zohomail.com; s=zohoarc; b=kUcapnSQlWZAFa+EiJOLvJXuc5BkUbghEtYfcObLXGQ77Sk+7Vy182fqgYcFDH+vXqNonr7uXkNpCBKu2mq7RrCjWxtiW3ZbpR+eriZ+osj1aVVPJeWze7OwPhmyL1eQfJb03I3QK5tC9HyOJ/Z/ooDpe1ZQGpI+aBX3wk6yf10= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145139; h=Content-Type: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=vBTBnSyuQPYSZpchDeQQc5FbGR6kuvSqPTrEOao+1J0=; b=N/QpvnExQ9Ynef9D9f3zR3WRZTy85IrrEQww1nquloyBYgBg3x+u504Bk5HVKvkiwUsSb/uYpAgMwrTS/7O0ETxNawRkua/hziGJXsRkbHxdB3kQplHEz2+mPhEaH0ZNfPkh6niuS+5p+kNH3HHZMoVZDO3+KPqC4z+4QegbkE0= 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 1789145139200861.3090149209389; Fri, 11 Sep 2026 09:45:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54JD-0006wM-3e; Fri, 11 Sep 2026 12:41:03 -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 1x54J2-0006g3-Pl for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:54 -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 1x54Iz-0007Ba-Mr for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:40:52 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-484-szxMgmCwOqe21UMdqrSM8A-1; Fri, 11 Sep 2026 12:40:46 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 77D99195C264; Fri, 11 Sep 2026 16:40:44 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 721A1180034C; Fri, 11 Sep 2026 16:40:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144849; 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=vBTBnSyuQPYSZpchDeQQc5FbGR6kuvSqPTrEOao+1J0=; b=Z9SC8Nsp+xO0hw+UFLeeg884j4EzhZg53KqJgP8VNZ9EUF51dSzbC/ZaWuoxL9L6n1Y7ge Ve9bmZtU2cR8e4HxL1b32h0lOvQmcjhoUyMQedEU8O96rpEh4LGBRGbwtSiKMwoj4hBmYH dopvhzSUu7ANE7kBAO/SCOPmRNdwhBk= X-MC-Unique: szxMgmCwOqe21UMdqrSM8A-1 X-Mimecast-MFC-AGG-ID: szxMgmCwOqe21UMdqrSM8A_1789144844 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:27 +0400 Subject: [PATCH v5 53/62] target/riscv: convert PropertyInfo definitions to use qapi_type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-53-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , qemu-riscv@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=5376; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=UYW3hUyeBwLg4dJw36eUfutz6eBE4Q9tKSHlZKf5fhQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC28CjTvwGW4P+4/Uwi5p70Qn3j7B6OHo6hTf nelgQmu7uKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtvAAKCRDa6OEJdZac 5QsoD/9bDkhhtfnBbtiUOg6zJD0SqQfNVXKBkDDCcN57bQKoSmlIarpGU8UeGmN0NzICCyG73fz tOaifObZYn0Z7FnF/tT+4iyL5KXx/1gngzmIkfV45xaibfbKMQ67oRSw5IUF6do6QK7ODaSh754 CojoQn0aOzH06vEoyhxD0birTQGsUAez6NrriWsFSfoXA0nhwknCV/XbNl6pAifJmmmyxWd0sVr ZmHA5UGYLJIwY3EGGuUi81e2aQ+XSU/FESYmZ9KnukHcU3oct02aaEOPSA4U+vl+7q2rg6g+xEY kR5qRJH3mADJRNF15+mDNJ4TDdLtGbRra5hWeaVjBdfxw95QsxFyFAdb1ezFtByYobdk3Mf8ZJu K4UpJidETcMqPPvvpzsyr8OC5AaJtc5C5QO8M3VCfcV7I9Kg+ApjWKNGT2VydHzaBpdSZLn7Rni dXxbAC9sfhMNHt3/puGw01W8yb49XiGqo1dy74lcb2+GsVF8/7SDYT2GCn0gkq/7V0VGJOkgftj yQW6jntqK/DhlQ+ggJb8j08W3I/A4aQHLTkL1vNxK6+sTQaMk+2lI4ajah+tal4E94c5m09XBjK NrezLbUxXwmA136mfdi5TvuiakWkSqwDbGo9MuLkomRAwpNujVAzrqiYk8YjjeaXpem82i+lTiF uutqTXURd5bpVCg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789145140916158500 Mechanical conversion of all local PropertyInfo definitions in target/riscv/cpu.c Signed-off-by: Marc-Andr=C3=A9 Lureau --- target/riscv/cpu.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index bd3fa786ee40..2f1c12408470 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1688,7 +1688,7 @@ static void prop_pmu_num_get(Object *obj, Visitor *v,= const char *name, } =20 static const PropertyInfo prop_pmu_num =3D { - .type =3D "uint8", + .qapi_type =3D &uint8_type_info, .description =3D "pmu-num", .get =3D prop_pmu_num_get, .set =3D prop_pmu_num_set, @@ -1730,7 +1730,7 @@ static void prop_pmu_mask_get(Object *obj, Visitor *v= , const char *name, } =20 static const PropertyInfo prop_pmu_mask =3D { - .type =3D "uint32", + .qapi_type =3D &uint32_type_info, .description =3D "pmu-mask", .get =3D prop_pmu_mask_get, .set =3D prop_pmu_mask_set, @@ -1762,7 +1762,7 @@ static void prop_mmu_get(Object *obj, Visitor *v, con= st char *name, } =20 static const PropertyInfo prop_mmu =3D { - .type =3D "bool", + .qapi_type =3D &bool_type_info, .description =3D "mmu", .get =3D prop_mmu_get, .set =3D prop_mmu_set, @@ -1795,7 +1795,7 @@ static void prop_pmp_get(Object *obj, Visitor *v, con= st char *name, } =20 static const PropertyInfo prop_pmp =3D { - .type =3D "bool", + .qapi_type =3D &bool_type_info, .description =3D "pmp", .get =3D prop_pmp_get, .set =3D prop_pmp_set, @@ -1835,7 +1835,7 @@ static void prop_num_pmp_regions_get(Object *obj, Vis= itor *v, const char *name, } =20 static const PropertyInfo prop_num_pmp_regions =3D { - .type =3D "uint8", + .qapi_type =3D &uint8_type_info, .description =3D "num-pmp-regions", .get =3D prop_num_pmp_regions_get, .set =3D prop_num_pmp_regions_set, @@ -1873,7 +1873,7 @@ static void prop_pmp_granularity_get(Object *obj, Vis= itor *v, const char *name, } =20 static const PropertyInfo prop_pmp_granularity =3D { - .type =3D "uint32", + .qapi_type =3D &uint32_type_info, .description =3D "pmp-granularity", .get =3D prop_pmp_granularity_get, .set =3D prop_pmp_granularity_set, @@ -1949,7 +1949,7 @@ static void prop_priv_spec_get(Object *obj, Visitor *= v, const char *name, } =20 static const PropertyInfo prop_priv_spec =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "priv_spec", /* FIXME enum? */ .get =3D prop_priv_spec_get, @@ -1982,7 +1982,7 @@ static void prop_vext_spec_get(Object *obj, Visitor *= v, const char *name, } =20 static const PropertyInfo prop_vext_spec =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "vext_spec", /* FIXME enum? */ .get =3D prop_vext_spec_get, @@ -2025,7 +2025,7 @@ static void prop_vlen_get(Object *obj, Visitor *v, co= nst char *name, } =20 static const PropertyInfo prop_vlen =3D { - .type =3D "uint16", + .qapi_type =3D &uint16_type_info, .description =3D "vlen", .get =3D prop_vlen_get, .set =3D prop_vlen_set, @@ -2066,7 +2066,7 @@ static void prop_elen_get(Object *obj, Visitor *v, co= nst char *name, } =20 static const PropertyInfo prop_elen =3D { - .type =3D "uint16", + .qapi_type =3D &uint16_type_info, .description =3D "elen", .get =3D prop_elen_get, .set =3D prop_elen_set, @@ -2102,7 +2102,7 @@ static void prop_cbom_blksize_get(Object *obj, Visito= r *v, const char *name, } =20 static const PropertyInfo prop_cbom_blksize =3D { - .type =3D "uint16", + .qapi_type =3D &uint16_type_info, .description =3D "cbom_blocksize", .get =3D prop_cbom_blksize_get, .set =3D prop_cbom_blksize_set, @@ -2138,7 +2138,7 @@ static void prop_cbop_blksize_get(Object *obj, Visito= r *v, const char *name, } =20 static const PropertyInfo prop_cbop_blksize =3D { - .type =3D "uint16", + .qapi_type =3D &uint16_type_info, .description =3D "cbop_blocksize", .get =3D prop_cbop_blksize_get, .set =3D prop_cbop_blksize_set, @@ -2174,7 +2174,7 @@ static void prop_cboz_blksize_get(Object *obj, Visito= r *v, const char *name, } =20 static const PropertyInfo prop_cboz_blksize =3D { - .type =3D "uint16", + .qapi_type =3D &uint16_type_info, .description =3D "cboz_blocksize", .get =3D prop_cboz_blksize_get, .set =3D prop_cboz_blksize_set, @@ -2210,7 +2210,7 @@ static void prop_mvendorid_get(Object *obj, Visitor *= v, const char *name, } =20 static const PropertyInfo prop_mvendorid =3D { - .type =3D "uint32", + .qapi_type =3D &uint32_type_info, .description =3D "mvendorid", .get =3D prop_mvendorid_get, .set =3D prop_mvendorid_set, @@ -2246,7 +2246,7 @@ static void prop_mimpid_get(Object *obj, Visitor *v, = const char *name, } =20 static const PropertyInfo prop_mimpid =3D { - .type =3D "uint64", + .qapi_type =3D &uint64_type_info, .description =3D "mimpid", .get =3D prop_mimpid_get, .set =3D prop_mimpid_set, @@ -2303,7 +2303,7 @@ static void prop_marchid_get(Object *obj, Visitor *v,= const char *name, } =20 static const PropertyInfo prop_marchid =3D { - .type =3D "uint64", + .qapi_type =3D &uint64_type_info, .description =3D "marchid", .get =3D prop_marchid_get, .set =3D prop_marchid_set, --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144953; cv=none; d=zohomail.com; s=zohoarc; b=iDFS9ETCfSBwOiyoctzLlRIROsT44VbLoZ+Qpw3zGZ7qh/bMC6KCKgIacaEHtnb0kzTxg/rAUAVx/OohSwR4N1ETx4Thq+kUwHMpDtJ1dOXZztW9ia7YG6d6BAhpN76UUks5q8lHaPZbM01XRxS6tRBGzjbN/7apQJMGhv9/wPs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144953; h=Content-Type: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=PwaEdy8ZnQVC4f1U6iU1d1dziaG8puTh0bFfych/IvA=; b=lyD1RDMx50y24UQNLhN2u5MHywkUMiTfvyAc+7aqnTEeFWZNzOcJ4U0BccKWm0JEHqEgteqyrYhiUEz6gPYP2gEo/RLiSCSZcRN4uiQ/fFggWAdQbCZoTVPxxCwMk+L0HVMR/W/8fy91vf/O8AKHYeF3hr9BlJOHV7L7ubkcQio= 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 1789144953573629.4080593896839; Fri, 11 Sep 2026 09:42:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54JG-00076p-0n; Fri, 11 Sep 2026 12:41:06 -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 1x54JB-0006ra-JB for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:01 -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 1x54J9-0007D9-Qz for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:01 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-317-CZapvgRPMsixKST3U3zUDw-1; Fri, 11 Sep 2026 12:40:51 -0400 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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EB3811954B07; Fri, 11 Sep 2026 16:40:48 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9184E1956095; Fri, 11 Sep 2026 16:40:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144855; 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=PwaEdy8ZnQVC4f1U6iU1d1dziaG8puTh0bFfych/IvA=; b=RdD1b6fmNChcRwrrbasTWoFIzrlRY0InxNLAVEv0k0pEnEA8PKtbVypXvz1Ewb7tiGUh5/ hC2q6I2kLhux0GcbwHO8vAGxZ2YkvNJ+3x7FaQ8Org0GrgNWk+EtHS9P6kHuJZ8+coYNs8 rcdt9WpUyPEqz6u6O3Hj8klHrc2uBCE= X-MC-Unique: CZapvgRPMsixKST3U3zUDw-1 X-Mimecast-MFC-AGG-ID: CZapvgRPMsixKST3U3zUDw_1789144849 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:28 +0400 Subject: [PATCH v5 54/62] qdev: convert PropertyInfo definitions to use qapi_type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-54-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis , Tao Tang , Stefan Berger , Peter Xu , Fabiano Rosas , Mark Cave-Ayland , Artyom Tarasenko X-Developer-Signature: v=1; a=openpgp-sha256; l=3558; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=QHqeQMn/jmK1W7g0UftNgCE38XbzkODSG27/Of7QTCI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC28IjH3F0A9qPde/0skOIiUhL89PiFYSlyQI 9xLHcd7hIGJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtvAAKCRDa6OEJdZac 5QL+D/4hlhwqKR3E1wpeWRvMJrcLHGHp7i035OsyQornaD27pIVHxEG9QMjsy02p/Hv5/RkGHja WTh3aTxlD3g8k4r9pv434oT0LwTjxRKg3ET3M3cmvzhV15XgMUJyZLz/dJ4DJAjUw3Tw8hmwfsg IcegWp9uro7DZ1mW3yZ49WOXhydj/uQgXGGO8NAZXKlH5ZjbNN2+aCsBSWwkC1LyhaiQW0SepQG M/6yWss46RAxluNzZ7EyfK1MgHLPepcNHtTmP2d5aeYwBR4EMTI5bHlW6EHJn3HBOd3FevL1zsL qZYA9ja+nfBKmPMw+Uu5KXPw13DxpkY7fRrcVX9P3wqGIW3SsDKJ7n7d7+hPfM+tgQwydEnYXZn a0CYqgXzG+JuE3uvnzGWrjPtWhwYe/XLqzRRllkrqEMfMDB2D+d9u/qrwEwcRfvAzaXFy6VBo4r 8I2Kw3xboVa+DneNvXPdk8l3VAgfJjU+qORrn6/D9DHC4pdRZBl8vCARRTgdfInY26BsbsYILuf KvIP8+ko/5BnOP7YuDiHv7bI76zS2RutHkLA727cbmlepwgum/rhecQeg2DO5Po4sJEdPYWQGW3 9H1TPXPZ7BU0+Y0vEa9Nwe7hanujxgfUC6XfvooRIfCfbuE+sgdszpeRuq1j6fEFvOdW/D3zagr UW/Ls6QKWQzkPkw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144956471158500 Convert the remaining PropertyInfo definitions outside hw/ After this patch, all PropertyInfo definitions have .qapi_type set, except qdev_prop_link (uses .create) and qdev_prop_array (refactored in the next patches). Signed-off-by: Marc-Andr=C3=A9 Lureau --- backends/spdm-socket.c | 4 ++-- backends/tpm/tpm_util.c | 3 ++- migration/options.c | 4 +++- target/sparc/cpu.c | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/backends/spdm-socket.c b/backends/spdm-socket.c index 826efc276dcd..4a4307975965 100644 --- a/backends/spdm-socket.c +++ b/backends/spdm-socket.c @@ -17,6 +17,7 @@ #include "hw/core/qdev-properties.h" #include "hw/core/qdev-properties-system.h" #include "hw/core/qdev-prop-internal.h" +#include "qapi/qapi-type-infos-sockets.h" =20 static bool read_bytes(const int socket, uint8_t *buffer, size_t number_of_bytes) @@ -253,9 +254,8 @@ void spdm_socket_close(const int socket, SpdmTransportT= ype transport_type) } =20 const PropertyInfo qdev_prop_spdm_trans =3D { - .type =3D "SpdmTransportType", + .qapi_type =3D &SpdmTransportType_type_info, .description =3D "Spdm Transport, doe/nvme/mctp/scsi/unspecified", - .enum_table =3D &SpdmTransportType_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, .set_default_value =3D qdev_propinfo_set_default_value_enum, diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c index 264bff22a91a..ecbc771baa6f 100644 --- a/backends/tpm/tpm_util.c +++ b/backends/tpm/tpm_util.c @@ -30,6 +30,7 @@ #include "system/tpm_backend.h" #include "system/tpm_util.h" #include "trace.h" +#include "qapi/qapi-builtin-type-infos.h" =20 /* tpm backend property */ =20 @@ -77,7 +78,7 @@ static void release_tpm(Object *obj, const char *name, vo= id *opaque) } =20 const PropertyInfo qdev_prop_tpm =3D { - .type =3D "str", + .qapi_type =3D &str_type_info, .description =3D "ID of a tpm to use as a backend", .get =3D get_tpm, .set =3D set_tpm, diff --git a/migration/options.c b/migration/options.c index d2575edb6cbe..78d4d4818514 100644 --- a/migration/options.c +++ b/migration/options.c @@ -31,6 +31,8 @@ #include "ram.h" #include "options.h" #include "system/kvm.h" +#include "qapi/qapi-builtin-type-infos.h" +#include "qapi/qapi-type-infos-common.h" =20 /* Maximum migrate downtime set to 2000 seconds */ #define MAX_MIGRATE_DOWNTIME_SECONDS 2000 @@ -287,7 +289,7 @@ static void set_default_value_tls_opt(ObjectProperty *o= p, const Property *prop) * TYPE_MIGRATION's TLS options. */ const PropertyInfo qdev_prop_StrOrNull =3D { - .type =3D "StrOrNull", + .qapi_type =3D &StrOrNull_type_info, .get =3D get_StrOrNull, .set =3D set_StrOrNull, .release =3D release_StrOrNull, diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index ae9bdca9df82..d0354a4d02af 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -30,6 +30,7 @@ #include "tcg/tcg.h" #include "fpu/softfloat.h" #include "target/sparc/translate.h" +#include "qapi/qapi-builtin-type-infos.h" =20 //#define DEBUG_FEATURES =20 @@ -948,7 +949,7 @@ static void sparc_set_nwindows(Object *obj, Visitor *v,= const char *name, } =20 static const PropertyInfo qdev_prop_nwindows =3D { - .type =3D "int", + .qapi_type =3D &int_type_info, .description =3D "Number of register windows", .get =3D sparc_get_nwindows, .set =3D sparc_set_nwindows, --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144936; cv=none; d=zohomail.com; s=zohoarc; b=OqgGM6r9AhL/2ONLJZqVMJIm+e4UOZ/uteM3g5J0QYQKccpcvNuDetPQnWfK1Omyir2tLaBpXIjuultzZ6YSa8acxbEx6lIGM4hqbe6fWlndjWrwLj24RUeHrb7JVrtVu/FEJKLu7XIIE0SfXW0a80kvC23aTbr+tVIzw5YSLUU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144936; h=Content-Type: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=7LpeINFUNTZ5koNm091QNo6sDDf+Ig7OOqg3hQ3pSY8=; b=Gn/0DYidIqoaKPdWgkk77O77SKqC38hLJY+Ir4xMS2R7cTduuoQRGvg00nsVKlCCm8fe7CUJcswr281vzIdeZDPzGThUCYAK2JYBocF0GxBtis2gJiBWle8dbvpaqDEu58RASPxuq7KrCFpyPi4qY+zqowkOgUoVnkjUMVtOkE4= 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 1789144936503984.9168061196357; Fri, 11 Sep 2026 09:42:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54JG-00078a-Kj; Fri, 11 Sep 2026 12:41:06 -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 1x54JD-00070B-SD for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:04 -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 1x54J9-0007Dt-RN for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:03 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-135-wVYSAz8NOraGG0o-YNrBMA-1; Fri, 11 Sep 2026 12:40:53 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4658F195396B; Fri, 11 Sep 2026 16:40:52 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4A2FB300022B; Fri, 11 Sep 2026 16:40:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144857; 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=7LpeINFUNTZ5koNm091QNo6sDDf+Ig7OOqg3hQ3pSY8=; b=U/+Xn5UxADxARnCUQwgpFZ70//zJmf+6aoNxncQqYzyla91ANHw9/tJ1rdhmsnKVqV10j3 tFsv+pDNYQZbTG4oEyOaMfJcwte9Nd8dxnfSrhQHAy+k+dlUpBOXxQK7+WwrX0ivAVxYQ/ yL6UaysNJVwvIbrxDm3jGQIZp+p7BiI= X-MC-Unique: wVYSAz8NOraGG0o-YNrBMA-1 X-Mimecast-MFC-AGG-ID: wVYSAz8NOraGG0o-YNrBMA_1789144852 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:29 +0400 Subject: [PATCH v5 55/62] qdev: introduce typed array PropertyInfos MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-55-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=14553; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=DNY5OZOHcpCb+SjkUHihp/hTEf88oXTox51j/sLmNQc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC28Ew4V45mwHQFOKuZAG1gmLHEI6jURqt5K9 TknEdj9baCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtvAAKCRDa6OEJdZac 5b3CEACMnwn3zjJCuGeTPVGF/p1fn83VjUeInEi4iBFWOASptoKXcT/OaPPRuqpnvsZ4NGCoLDN PWGcDHAcR5jXn7R5UZVtZOem6UEScBXNj53yYuIx8vVMAcCE8zWKZnf+fTuZzNjoDkCJxY2NrE/ wMhyWXIUzEtYUqngtEX6FlyMF+BZDVFPeLPQ2KaOCrlj0sePpGG672n2srLhCxorUNG+pqoqNuF /VtpGi0lWA6PpdU+L99ZbLzHJuEqinjkeQgddIyyLDpyX/wy9TZuwhYWWOzuglKxhAoL9CSrT/a sOCmoY6NR99//Ke0hqjRNl0ZvxXFdvgqYyaRSVc9pGw3vFsH9R4D9bP5UKEAoTOIUkoAX1TAIJV wVaqq33svk9lzFTVtdVo4KZD9XLIMHTTisVlKHd6HA/d9I5CeLmcYsmgioE09pxDmvhUYwWjNbo kDSPU7e3/AHG2Bn6O0FlQsp1CE0t+II9ilgk02Xl28G3J6O22UF29EKR/PoeeQc/HnU3k11FXcR Xr7ZWLDtit/n90HOBYbO8/encLm/I6ZgkOyEEHMrYSvWkL7vXR5+9vPZ4K9Y5LeEQwQDpqSFQNo XWcvnv+ewmsL+g+UnLt5/DyI/kRfr3HG3SABMqbHcBYbGeqpUp5zk3tgsojPhWzRoKMGW/CV+sy Whd5v+4ShUAX3Pg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789144937416158500 Add element_info and element_size fields to PropertyInfo, and extend qdev_prop_qapi_type() to derive QAPI types for array properties via element_info->qapi_type->list. Add typed list PropertyInfo definitions that replace the generic qdev_prop_array. Each typed list PropertyInfo knows its element type at compile time through the element_info and element_size fields, which allows the QAPI type to be derived automatically. Infrastructure changes: - Add prop_array_info() and prop_array_elem_size() helpers that prefer the new element_info/element_size fields with fallback to the old arrayinfo/arrayfieldsize fields for compatibility - Make get_prop_array, set_prop_array, release_prop_array, and default_prop_array non-static so they can be used by DEFINE_PROP_ARRAY_INFO in other translation units - Add DEFINE_PROP_ARRAY_INFO macro in qdev-prop-internal.h The array of links needs special care for its "full type name" to follow the "linkList" pattern used by link properties ("link"). The old qdev_prop_array and DEFINE_PROP_ARRAY macro are preserved for compatibility; they will be replaced in the next patch. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/core/qdev-prop-internal.h | 18 ++++++ hw/core/qdev-properties-system.c | 5 ++ hw/core/qdev-properties.c | 103 ++++++++++++++++++++++++---= ---- include/hw/core/qdev-properties-system.h | 2 + include/hw/core/qdev-properties.h | 8 +++ 5 files changed, 115 insertions(+), 21 deletions(-) diff --git a/hw/core/qdev-prop-internal.h b/hw/core/qdev-prop-internal.h index c190b7b88cf4..b9d9812346d1 100644 --- a/hw/core/qdev-prop-internal.h +++ b/hw/core/qdev-prop-internal.h @@ -27,4 +27,22 @@ void qdev_propinfo_get_int32(Object *obj, Visitor *v, co= nst char *name, void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp); =20 +void get_prop_array(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp); +void set_prop_array(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp); +void release_prop_array(Object *obj, const char *name, void *opaque); +void default_prop_array(ObjectProperty *op, const Property *prop); + +/* .qapi_type is derived from element_info->qapi_type->list by qdev_prop_q= api_type() */ +#define DEFINE_PROP_ARRAY_INFO(_elem_prop_info, _elem_type) \ + { \ + .element_info =3D &(_elem_prop_info), \ + .element_size =3D sizeof(_elem_type), \ + .get =3D get_prop_array, \ + .set =3D set_prop_array, \ + .release =3D release_prop_array, \ + .set_default_value =3D default_prop_array, \ + } + #endif diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 8819a9a0b748..ad4a00f776e6 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -484,6 +484,8 @@ const PropertyInfo qdev_prop_netdev =3D { .set =3D set_netdev, }; =20 +const PropertyInfo qdev_prop_netdev_list =3D + DEFINE_PROP_ARRAY_INFO(qdev_prop_netdev, NICPeers); =20 /* --- audiodev --- */ static void get_audiodev(Object *obj, Visitor *v, const char* name, @@ -822,6 +824,9 @@ const PropertyInfo qdev_prop_reserved_region =3D { .set =3D set_reserved_region, }; =20 +const PropertyInfo qdev_prop_reserved_region_list =3D + DEFINE_PROP_ARRAY_INFO(qdev_prop_reserved_region, ReservedRegion); + /* --- pci address --- */ =20 /* diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index c2980c36afa2..a9ca8e4a03db 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -665,6 +665,22 @@ struct ArrayElementList { void *value; }; =20 +static const PropertyInfo *prop_array_info(const Property *prop) +{ + if (prop->info->element_info) { + return prop->info->element_info; + } + return prop->arrayinfo; +} + +static int prop_array_elem_size(const Property *prop) +{ + if (prop->info->element_size) { + return prop->info->element_size; + } + return prop->arrayfieldsize; +} + /* * Given an array property @parent_prop in @obj, return a Property for a * specific element of the array. Arrays are backed by an uint32_t length = field @@ -674,7 +690,7 @@ static Property array_elem_prop(Object *obj, const Prop= erty *parent_prop, const char *name, char *elem) { return (Property) { - .info =3D parent_prop->arrayinfo, + .info =3D prop_array_info(parent_prop), .name =3D name, /* * This ugly piece of pointer arithmetic sets up the offset so @@ -692,19 +708,21 @@ static Property array_elem_prop(Object *obj, const Pr= operty *parent_prop, * underlying element's property release hook for each element and free the * property array. */ -static void release_prop_array(Object *obj, const char *name, void *opaque) +void release_prop_array(Object *obj, const char *name, void *opaque) { const Property *prop =3D opaque; uint32_t *alenptr =3D object_field_prop_ptr(obj, prop); void **arrayptr =3D (void *)obj + prop->arrayoffset; char *elem =3D *arrayptr; int i; + const PropertyInfo *elem_info =3D prop_array_info(prop); + int elem_size =3D prop_array_elem_size(prop); =20 - if (prop->arrayinfo->release) { + if (elem_info->release) { for (i =3D 0; i < *alenptr; i++) { Property elem_prop =3D array_elem_prop(obj, prop, name, elem); - prop->arrayinfo->release(obj, NULL, &elem_prop); - elem +=3D prop->arrayfieldsize; + elem_info->release(obj, NULL, &elem_prop); + elem +=3D elem_size; } } =20 @@ -718,8 +736,8 @@ static void release_prop_array(Object *obj, const char = *name, void *opaque) * (a pointer to which is stored in the additional field described by * prop->arrayoffset). */ -static void set_prop_array(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +void set_prop_array(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { ERRP_GUARD(); const Property *prop =3D opaque; @@ -727,6 +745,8 @@ static void set_prop_array(Object *obj, Visitor *v, con= st char *name, void **arrayptr =3D (void *)obj + prop->arrayoffset; ArrayElementList *list, *elem, *next; const size_t size =3D sizeof(*list); + const PropertyInfo *elem_info =3D prop_array_info(prop); + int elem_size =3D prop_array_elem_size(prop); char *elemptr; bool ok =3D true; =20 @@ -745,9 +765,9 @@ static void set_prop_array(Object *obj, Visitor *v, con= st char *name, while (elem) { Property elem_prop; =20 - elem->value =3D g_malloc0(prop->arrayfieldsize); + elem->value =3D g_malloc0(elem_size); elem_prop =3D array_elem_prop(obj, prop, name, elem->value); - prop->arrayinfo->set(obj, v, NULL, &elem_prop, errp); + elem_info->set(obj, v, NULL, &elem_prop, errp); if (*errp) { ok =3D false; goto out_obj; @@ -769,8 +789,8 @@ out_obj: for (elem =3D list; elem; elem =3D next) { Property elem_prop =3D array_elem_prop(obj, prop, name, elem->value); - if (prop->arrayinfo->release) { - prop->arrayinfo->release(obj, NULL, &elem_prop); + if (elem_info->release) { + elem_info->release(obj, NULL, &elem_prop); } next =3D elem->next; g_free(elem->value); @@ -783,19 +803,19 @@ out_obj: * Now that we know how big the array has to be, move the data over to= a * linear array and free the temporary list. */ - *arrayptr =3D g_malloc_n(*alenptr, prop->arrayfieldsize); + *arrayptr =3D g_malloc_n(*alenptr, elem_size); elemptr =3D *arrayptr; for (elem =3D list; elem; elem =3D next) { - memcpy(elemptr, elem->value, prop->arrayfieldsize); - elemptr +=3D prop->arrayfieldsize; + memcpy(elemptr, elem->value, elem_size); + elemptr +=3D elem_size; next =3D elem->next; g_free(elem->value); g_free(elem); } } =20 -static void get_prop_array(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +void get_prop_array(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { ERRP_GUARD(); const Property *prop =3D opaque; @@ -805,6 +825,8 @@ static void get_prop_array(Object *obj, Visitor *v, con= st char *name, ArrayElementList *list =3D NULL, *elem; ArrayElementList **tail =3D &list; const size_t size =3D sizeof(*list); + const PropertyInfo *elem_info =3D prop_array_info(prop); + int elem_size =3D prop_array_elem_size(prop); int i; bool ok; =20 @@ -812,7 +834,7 @@ static void get_prop_array(Object *obj, Visitor *v, con= st char *name, for (i =3D 0; i < *alenptr; i++) { elem =3D g_new0(ArrayElementList, 1); elem->value =3D elemptr; - elemptr +=3D prop->arrayfieldsize; + elemptr +=3D elem_size; =20 *tail =3D elem; tail =3D &elem->next; @@ -825,7 +847,7 @@ static void get_prop_array(Object *obj, Visitor *v, con= st char *name, elem =3D list; while (elem) { Property elem_prop =3D array_elem_prop(obj, prop, name, elem->valu= e); - prop->arrayinfo->get(obj, v, NULL, &elem_prop, errp); + elem_info->get(obj, v, NULL, &elem_prop, errp); if (*errp) { goto out_obj; } @@ -847,7 +869,7 @@ out_obj: } } =20 -static void default_prop_array(ObjectProperty *op, const Property *prop) +void default_prop_array(ObjectProperty *op, const Property *prop) { object_property_set_default_list(op); } @@ -860,6 +882,38 @@ const PropertyInfo qdev_prop_array =3D { .set_default_value =3D default_prop_array, }; =20 +const PropertyInfo qdev_prop_uint8_list =3D + DEFINE_PROP_ARRAY_INFO(qdev_prop_uint8, uint8_t); +const PropertyInfo qdev_prop_uint16_list =3D + DEFINE_PROP_ARRAY_INFO(qdev_prop_uint16, uint16_t); +const PropertyInfo qdev_prop_uint32_list =3D + DEFINE_PROP_ARRAY_INFO(qdev_prop_uint32, uint32_t); +const PropertyInfo qdev_prop_uint64_list =3D + DEFINE_PROP_ARRAY_INFO(qdev_prop_uint64, uint64_t); +const PropertyInfo qdev_prop_string_list =3D + DEFINE_PROP_ARRAY_INFO(qdev_prop_string, char *); + +static ObjectProperty *create_link_list_property(ObjectClass *oc, + const char *name, + const Property *prop) +{ + g_autofree char *full_type =3D g_strdup_printf("link<%s>List", prop->l= ink_type); + + return object_class_property_add(oc, name, full_type, + get_prop_array, set_prop_array, + release_prop_array, (Property *)prop); +} + +const PropertyInfo qdev_prop_link_list =3D { + .element_info =3D &qdev_prop_link, + .element_size =3D sizeof(void *), + .create =3D create_link_list_property, + .get =3D get_prop_array, + .set =3D set_prop_array, + .release =3D release_prop_array, + .set_default_value =3D default_prop_array, +}; + /* --- public helpers --- */ =20 static const Property *qdev_prop_walk(DeviceClass *cls, const char *name) @@ -1158,8 +1212,15 @@ const PropertyInfo qdev_prop_link =3D { =20 static const QAPITypeInfo *qdev_prop_qapi_type(const Property *prop) { - /* this will be later extended to cope with QAPI array properties */ - return prop->info->qapi_type; + if (prop->info->qapi_type) { + return prop->info->qapi_type; + } + if (prop->info->element_info) { + assert(prop->info->element_info->qapi_type); + assert(prop->info->element_info->qapi_type->list); + return prop->info->element_info->qapi_type->list; + } + return NULL; } =20 void qdev_property_add_static(DeviceState *dev, const Property *prop) diff --git a/include/hw/core/qdev-properties-system.h b/include/hw/core/qde= v-properties-system.h index 2cbea16d615e..819dce7d5e5d 100644 --- a/include/hw/core/qdev-properties-system.h +++ b/include/hw/core/qdev-properties-system.h @@ -23,6 +23,8 @@ extern const PropertyInfo qdev_prop_fdc_drive_type; extern const PropertyInfo qdev_prop_drive; extern const PropertyInfo qdev_prop_drive_iothread; extern const PropertyInfo qdev_prop_netdev; +extern const PropertyInfo qdev_prop_netdev_list; +extern const PropertyInfo qdev_prop_reserved_region_list; extern const PropertyInfo qdev_prop_pci_devfn; extern const PropertyInfo qdev_prop_blocksize; extern const PropertyInfo qdev_prop_pci_host_devaddr; diff --git a/include/hw/core/qdev-properties.h b/include/hw/core/qdev-prope= rties.h index 1ea2ba66bb37..0c067170079d 100644 --- a/include/hw/core/qdev-properties.h +++ b/include/hw/core/qdev-properties.h @@ -35,6 +35,8 @@ struct PropertyInfo { const char *description; const QEnumLookup *enum_table; const QAPITypeInfo *qapi_type; + const struct PropertyInfo *element_info; + int element_size; bool realized_set_allowed; /* allow setting property on realized devic= e */ char *(*print)(Object *obj, const Property *prop); void (*set_default_value)(ObjectProperty *op, const Property *prop); @@ -75,7 +77,13 @@ extern const PropertyInfo qdev_prop_string; extern const PropertyInfo qdev_prop_on_off_auto; extern const PropertyInfo qdev_prop_size32; extern const PropertyInfo qdev_prop_array; +extern const PropertyInfo qdev_prop_uint8_list; +extern const PropertyInfo qdev_prop_uint16_list; +extern const PropertyInfo qdev_prop_uint32_list; +extern const PropertyInfo qdev_prop_uint64_list; +extern const PropertyInfo qdev_prop_string_list; extern const PropertyInfo qdev_prop_link; +extern const PropertyInfo qdev_prop_link_list; =20 #define DEFINE_PROP(_name, _state, _field, _prop, _type, ...) { \ .name =3D (_name), \ --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145073; cv=none; d=zohomail.com; s=zohoarc; b=AJ+EDlkwdC5UE2IsXb3sJ2PDxFy91N7V33FvLdH9CIc9nzXUrXmO9dvvYlDGp0fCv9IPTzLr3QQqP62M/IwIv8Q8tob4HwrrlH8WeP8pAg3v5q7ESfDrF8QTMiv5tj0hmqCkQlLmHA4WOoFigREKRgcDzKJNLGtQxSWRhXphRZI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145073; h=Content-Type: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=gKje9pSfHyyRsyz38yvzm39WFiogRTRYIHoL4KWrApI=; b=ii5YpeJCadHLLCxZ6AILs47GtlhlObwMw57ZpbZUb1W/r8Otnxlnu3hf7lez9N/xsAxhfDXPi+Gdq0bmWt5R6N6uk0GMSAarjSk5bBkQFvXEWZzaboHBLIRUajn0KCScQvUXc5s5cq70eevb25wesnsn9BjySO9/IozTOpDpJZE= 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 1789145073435506.2559902310635; Fri, 11 Sep 2026 09:44:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54JI-0007AT-6W; Fri, 11 Sep 2026 12:41:08 -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 1x54JG-00077n-8G for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:06 -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 1x54JD-0007FM-NP for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:05 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-311-FQJux409PRmoG3-IZIkvAQ-1; Fri, 11 Sep 2026 12:40:59 -0400 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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 74EEB1954202; Fri, 11 Sep 2026 16:40:56 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id ED7821956095; Fri, 11 Sep 2026 16:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144862; 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=gKje9pSfHyyRsyz38yvzm39WFiogRTRYIHoL4KWrApI=; b=dtNxiA630Wa2HLVU/8HkACXtFcpVZ3GOOGPJVyPesQfAFXgBpcxQw7M0xjNnfUnbF2B6sn zh0zXez7Ukw3Tic9ij5+Gt/n/lGA+D+4FluFcfE75kugkPwntRVs0EoPt+yENDTKVBkOds fx/cXAo041zN7ixO4fvaoxh0Ctipt3Q= X-MC-Unique: FQJux409PRmoG3-IZIkvAQ-1 X-Mimecast-MFC-AGG-ID: FQJux409PRmoG3-IZIkvAQ_1789144857 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:30 +0400 Subject: [PATCH v5 56/62] qdev: simplify DEFINE_PROP_ARRAY and remove generic array PropertyInfo MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-56-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , Peter Maydell , Yoshinori Sato , Jiri Pirko , Jason Wang , "Michael S. Tsirkin" , Alistair Francis , "Edgar E. Iglesias" , Palmer Dabbelt , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Eric Auger , qemu-arm@nongnu.org, qemu-riscv@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=18861; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=K6fclHUaQnZ9U5C2R6qYlvtUfm41Yo58eQId1qyju58=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC285+rwIKhh5y4qBBTVFkUNHI4zCVNkTpHWl rWQ2NGwa+CJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtvAAKCRDa6OEJdZac 5XoXD/4gmsMDpwpwEYb65XphyP10u19HXCdk4tKI8jwqW0eEGO+5qHVSm1MerwDbvz8JPMvDeOC JejcXiTI22gAqJftMrWFkOF5SvTNZ1VS4T6/SCXdqp/pD6gURTtWpSMNoESQsgIp+kLw9UbU77S 8/x52OMsDjJC9L67S+d8+m2cGHeCRuLBMtqfYFAJR1sI15qSNlwef202+0pum5btVikeaVyjAL/ RvFqwBoN4VyFErMeSfwS3IYaB9CEKKHSHJPNJdGLSkn7nrKU8Xtua5fSjB1Y2noLFGxRMN3gWje k3LBprRGlae40qyzG+sB35DWNuQkbLPoHJU3gnxOv7P44yoiJ+Sg7TXIOy5nJKdURKZNYYNnmZi QgcM4BAbAETSUtEiRITSkN3YWcDUiJS240sfErrKV1giO/Ixu3vhKuoSwB/dMKzxMMl1sTKnbLz FkzicC17fvnngncdLpTBSzyGCQvG41s9J5IUN4oOJ3BtOj1nmCEv2PB6Q+cfbdbrCcHPj408LIZ shz38BdJ0jDCi8Ob7Qqxdn6KXK3GFYfwr9FN+vU+4GXq/ECUYQLfx6Zx8oTlV81hqcMlkTI5YXZ jEp+bHMD4otFHlBGymDLBTlA7tKrM09lKT9J8CXVGPr+3kNdJPDhPqften8+U9rIP6eBCRGlclN NupmWpeSSTk1ocQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789145074364158500 Change DEFINE_PROP_ARRAY, the macro now uses _arrayprop##_list to resolve the typed list PropertyInfo (introduced in the previous patch) instead of the generic qdev_prop_array. This means the element type and size information is carried by the PropertyInfo itself rather than duplicated at each callsite. Since the typed list PropertyInfos encode element_info and element_size, the .arrayinfo and .arrayfieldsize fields are no longer set by the macro (they will be removed from the Property struct in the next patch). Remove qdev_prop_array, which is now unused. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/core/qdev-properties.c | 8 -------- hw/display/apple-gfx-mmio.m | 2 +- hw/display/apple-gfx-pci.m | 2 +- hw/display/apple-gfx.h | 1 + hw/display/apple-gfx.m | 4 ++++ hw/input/stellaris_gamepad.c | 2 +- hw/intc/arm_gicv3_common.c | 2 +- hw/intc/arm_gicv5_common.c | 4 ++-- hw/intc/rx_icu.c | 4 ++-- hw/misc/arm_sysctl.c | 4 ++-- hw/misc/mps2-scc.c | 2 +- hw/net/rocker/rocker.c | 2 +- hw/net/virtio-net.c | 2 +- hw/nvram/xlnx-efuse.c | 2 +- hw/nvram/xlnx-versal-efuse-ctrl.c | 2 +- hw/riscv/riscv_hart.c | 6 ++---- hw/virtio/virtio-iommu-pci.c | 2 +- include/hw/block/block.h | 2 +- include/hw/core/qdev-properties.h | 27 ++++++++++----------------- tests/unit/test-qdev.c | 2 +- 20 files changed, 35 insertions(+), 47 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index a9ca8e4a03db..b5a9eb97e7dd 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -874,14 +874,6 @@ void default_prop_array(ObjectProperty *op, const Prop= erty *prop) object_property_set_default_list(op); } =20 -const PropertyInfo qdev_prop_array =3D { - .type =3D "list", - .get =3D get_prop_array, - .set =3D set_prop_array, - .release =3D release_prop_array, - .set_default_value =3D default_prop_array, -}; - const PropertyInfo qdev_prop_uint8_list =3D DEFINE_PROP_ARRAY_INFO(qdev_prop_uint8, uint8_t); const PropertyInfo qdev_prop_uint16_list =3D diff --git a/hw/display/apple-gfx-mmio.m b/hw/display/apple-gfx-mmio.m index 58beaadd1f10..dcd04617eb87 100644 --- a/hw/display/apple-gfx-mmio.m +++ b/hw/display/apple-gfx-mmio.m @@ -258,7 +258,7 @@ static void apple_gfx_mmio_reset(Object *obj, ResetType= type) static const Property apple_gfx_mmio_properties[] =3D { DEFINE_PROP_ARRAY("display-modes", AppleGFXMMIOState, common.num_display_modes, common.display_modes, - qdev_prop_apple_gfx_display_mode, AppleGFXDisplayMod= e), + qdev_prop_apple_gfx_display_mode), }; =20 static void apple_gfx_mmio_class_init(ObjectClass *klass, const void *data) diff --git a/hw/display/apple-gfx-pci.m b/hw/display/apple-gfx-pci.m index b0694f4cb855..74f79c8b157b 100644 --- a/hw/display/apple-gfx-pci.m +++ b/hw/display/apple-gfx-pci.m @@ -118,7 +118,7 @@ static void apple_gfx_pci_reset(Object *obj, ResetType = type) static const Property apple_gfx_pci_properties[] =3D { DEFINE_PROP_ARRAY("display-modes", AppleGFXPCIState, common.num_display_modes, common.display_modes, - qdev_prop_apple_gfx_display_mode, AppleGFXDisplayMod= e), + qdev_prop_apple_gfx_display_mode), }; =20 static void apple_gfx_pci_class_init(ObjectClass *klass, const void *data) diff --git a/hw/display/apple-gfx.h b/hw/display/apple-gfx.h index 3197bd853dab..b7eef7b9b14a 100644 --- a/hw/display/apple-gfx.h +++ b/hw/display/apple-gfx.h @@ -69,6 +69,7 @@ void *apple_gfx_host_ptr_for_gpa_range(uint64_t guest_phy= sical, MemoryRegion **mapping_in_region); =20 extern const PropertyInfo qdev_prop_apple_gfx_display_mode; +extern const PropertyInfo qdev_prop_apple_gfx_display_mode_list; =20 #endif =20 diff --git a/hw/display/apple-gfx.m b/hw/display/apple-gfx.m index 77c420b30006..592d692d793d 100644 --- a/hw/display/apple-gfx.m +++ b/hw/display/apple-gfx.m @@ -16,6 +16,7 @@ #include "qemu/cutils.h" #include "qemu/log.h" #include "qapi/qapi-builtin-type-infos.h" +#include "hw/core/qdev-prop-internal.h" #include "qapi/visitor.h" #include "qapi/error.h" #include "qemu/aio-wait.h" @@ -879,3 +880,6 @@ static void apple_gfx_set_display_mode(Object *obj, Vis= itor *v, .get =3D apple_gfx_get_display_mode, .set =3D apple_gfx_set_display_mode, }; + +const PropertyInfo qdev_prop_apple_gfx_display_mode_list =3D + DEFINE_PROP_ARRAY_INFO(qdev_prop_apple_gfx_display_mode, AppleGFXDispl= ayMode); diff --git a/hw/input/stellaris_gamepad.c b/hw/input/stellaris_gamepad.c index 376d91abad70..20613f649977 100644 --- a/hw/input/stellaris_gamepad.c +++ b/hw/input/stellaris_gamepad.c @@ -80,7 +80,7 @@ static void stellaris_gamepad_reset_enter(Object *obj, Re= setType type) =20 static const Property stellaris_gamepad_properties[] =3D { DEFINE_PROP_ARRAY("keycodes", StellarisGamepad, num_buttons, - keycodes, qdev_prop_uint32, uint32_t), + keycodes, qdev_prop_uint32), }; =20 static void stellaris_gamepad_class_init(ObjectClass *klass, const void *d= ata) diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index f7ba74e6d52a..1298b6b735e9 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -615,7 +615,7 @@ static const Property arm_gicv3_common_properties[] =3D= { */ DEFINE_PROP_BOOL("force-8-bit-prio", GICv3State, force_8bit_prio, 0), DEFINE_PROP_ARRAY("redist-region-count", GICv3State, nb_redist_regions, - redist_region_count, qdev_prop_uint32, uint32_t), + redist_region_count, qdev_prop_uint32), DEFINE_PROP_LINK("sysmem", GICv3State, dma, TYPE_MEMORY_REGION, MemoryRegion *), DEFINE_PROP_UINT32("first-cpu-index", GICv3State, first_cpu_idx, 0), diff --git a/hw/intc/arm_gicv5_common.c b/hw/intc/arm_gicv5_common.c index b155486af65e..61c8ae493021 100644 --- a/hw/intc/arm_gicv5_common.c +++ b/hw/intc/arm_gicv5_common.c @@ -191,9 +191,9 @@ static void gicv5_common_realize(DeviceState *dev, Erro= r **errp) =20 static const Property arm_gicv5_common_properties[] =3D { DEFINE_PROP_LINK_ARRAY("cpus", GICv5Common, num_cpus, - cpus, TYPE_ARM_CPU, ARMCPU *), + cpus, TYPE_ARM_CPU), DEFINE_PROP_ARRAY("cpu-iaffids", GICv5Common, num_cpu_iaffids, - cpu_iaffids, qdev_prop_uint32, uint32_t), + cpu_iaffids, qdev_prop_uint32), DEFINE_PROP_UINT32("irsid", GICv5Common, irsid, 0), DEFINE_PROP_UINT32("spi-range", GICv5Common, spi_range, 0), DEFINE_PROP_UINT32("spi-base", GICv5Common, spi_base, 0), diff --git a/hw/intc/rx_icu.c b/hw/intc/rx_icu.c index 992b069ae245..125a6dcb6804 100644 --- a/hw/intc/rx_icu.c +++ b/hw/intc/rx_icu.c @@ -356,9 +356,9 @@ static const VMStateDescription vmstate_rxicu =3D { =20 static const Property rxicu_properties[] =3D { DEFINE_PROP_ARRAY("ipr-map", RXICUState, nr_irqs, map, - qdev_prop_uint8, uint8_t), + qdev_prop_uint8), DEFINE_PROP_ARRAY("trigger-level", RXICUState, nr_sense, init_sense, - qdev_prop_uint8, uint8_t), + qdev_prop_uint8), }; =20 static void rxicu_class_init(ObjectClass *klass, const void *data) diff --git a/hw/misc/arm_sysctl.c b/hw/misc/arm_sysctl.c index ebc95b9bb54c..1df85593a5cb 100644 --- a/hw/misc/arm_sysctl.c +++ b/hw/misc/arm_sysctl.c @@ -626,10 +626,10 @@ static const Property arm_sysctl_properties[] =3D { DEFINE_PROP_UINT32("proc_id", arm_sysctl_state, proc_id, 0), /* Daughterboard power supply voltages (as reported via SYS_CFG) */ DEFINE_PROP_ARRAY("db-voltage", arm_sysctl_state, db_num_vsensors, - db_voltage, qdev_prop_uint32, uint32_t), + db_voltage, qdev_prop_uint32), /* Daughterboard clock reset values (as reported via SYS_CFG) */ DEFINE_PROP_ARRAY("db-clock", arm_sysctl_state, db_num_clocks, - db_clock_reset, qdev_prop_uint32, uint32_t), + db_clock_reset, qdev_prop_uint32), }; =20 static void arm_sysctl_class_init(ObjectClass *klass, const void *data) diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c index 554b504c7203..32f9e166feed 100644 --- a/hw/misc/mps2-scc.c +++ b/hw/misc/mps2-scc.c @@ -464,7 +464,7 @@ static const Property mps2_scc_properties[] =3D { * motherboard configuration controller to suit the FPGA image. */ DEFINE_PROP_ARRAY("oscclk", MPS2SCC, num_oscclk, oscclk_reset, - qdev_prop_uint32, uint32_t), + qdev_prop_uint32), }; =20 static void mps2_scc_class_init(ObjectClass *klass, const void *data) diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c index 910dce901b67..afbc32e99d94 100644 --- a/hw/net/rocker/rocker.c +++ b/hw/net/rocker/rocker.c @@ -1466,7 +1466,7 @@ static const Property rocker_properties[] =3D { DEFINE_PROP_UINT64("switch_id", Rocker, switch_id, 0), DEFINE_PROP_ARRAY("ports", Rocker, fp_ports, - fp_ports_peers, qdev_prop_netdev, NICPeers), + fp_ports_peers, qdev_prop_netdev), }; =20 static const VMStateDescription rocker_vmsd =3D { diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 814b99a43d20..a4e633e54392 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -4260,7 +4260,7 @@ static const Property virtio_net_properties[] =3D { DEFINE_PROP_BIT64("hash", VirtIONet, host_features, VIRTIO_NET_F_HASH_REPORT, false), DEFINE_PROP_ARRAY("ebpf-rss-fds", VirtIONet, nr_ebpf_rss_fds, - ebpf_rss_fds, qdev_prop_string, char*), + ebpf_rss_fds, qdev_prop_string), DEFINE_PROP_BIT64("guest_rsc_ext", VirtIONet, host_features, VIRTIO_NET_F_RSC_EXT, false), DEFINE_PROP_UINT32("rsc_interval", VirtIONet, rsc_timeout, diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c index b1c9ee4980a0..99c16ce76f15 100644 --- a/hw/nvram/xlnx-efuse.c +++ b/hw/nvram/xlnx-efuse.c @@ -266,7 +266,7 @@ static const Property efuse_properties[] =3D { DEFINE_PROP_UINT32("efuse-size", XlnxEFuse, efuse_size, 64 * 32), DEFINE_PROP_BOOL("init-factory-tbits", XlnxEFuse, init_tbits, true), DEFINE_PROP_ARRAY("read-only", XlnxEFuse, ro_bits_cnt, ro_bits, - qdev_prop_uint32, uint32_t), + qdev_prop_uint32), }; =20 static void efuse_class_init(ObjectClass *klass, const void *data) diff --git a/hw/nvram/xlnx-versal-efuse-ctrl.c b/hw/nvram/xlnx-versal-efuse= -ctrl.c index f5d5587cb657..101320b82fd9 100644 --- a/hw/nvram/xlnx-versal-efuse-ctrl.c +++ b/hw/nvram/xlnx-versal-efuse-ctrl.c @@ -740,7 +740,7 @@ static const Property efuse_ctrl_props[] =3D { TYPE_XLNX_EFUSE, XlnxEFuse *), DEFINE_PROP_ARRAY("pg0-lock", XlnxVersalEFuseCtrl, extra_pg0_lock_n16, - extra_pg0_lock_spec, qdev_prop_uint16, uint16_t), + extra_pg0_lock_spec, qdev_prop_uint16), }; =20 static void efuse_ctrl_class_init(ObjectClass *klass, const void *data) diff --git a/hw/riscv/riscv_hart.c b/hw/riscv/riscv_hart.c index 32fd39737ff6..132cf8737001 100644 --- a/hw/riscv/riscv_hart.c +++ b/hw/riscv/riscv_hart.c @@ -48,11 +48,9 @@ static const Property riscv_harts_props[] =3D { * defined by "rnmi-exception-vector". */ DEFINE_PROP_ARRAY("rnmi-interrupt-vector", RISCVHartArrayState, - num_rnmi_irqvec, rnmi_irqvec, qdev_prop_uint64, - uint64_t), + num_rnmi_irqvec, rnmi_irqvec, qdev_prop_uint64), DEFINE_PROP_ARRAY("rnmi-exception-vector", RISCVHartArrayState, - num_rnmi_excpvec, rnmi_excpvec, qdev_prop_uint64, - uint64_t), + num_rnmi_excpvec, rnmi_excpvec, qdev_prop_uint64), DEFINE_PROP_LINK("memory", RISCVHartArrayState, memory, TYPE_MEMORY_REGION, MemoryRegion *), }; diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c index 7b5ffddc1e97..1f3a07c5d119 100644 --- a/hw/virtio/virtio-iommu-pci.c +++ b/hw/virtio/virtio-iommu-pci.c @@ -38,7 +38,7 @@ static const Property virtio_iommu_pci_properties[] =3D { DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0), DEFINE_PROP_ARRAY("reserved-regions", VirtIOIOMMUPCI, vdev.nr_prop_resv_regions, vdev.prop_resv_regions, - qdev_prop_reserved_region, ReservedRegion), + qdev_prop_reserved_region), }; =20 static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **err= p) diff --git a/include/hw/block/block.h b/include/hw/block/block.h index df941df19f26..70bf03a8de73 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -83,7 +83,7 @@ static inline unsigned int get_physical_block_exp(BlockCo= nf *conf) _conf.account_failed, ON_OFF_AUTO_AUTO), \ DEFINE_PROP_ARRAY("stats-intervals", _state, \ _conf.num_stats_intervals, _conf.stats_intervals, \ - qdev_prop_uint32, uint32_t) + qdev_prop_uint32) =20 #define DEFINE_BLOCK_PROPERTIES(_state, _conf) \ DEFINE_PROP_DRIVE("drive", _state, _conf.blk), \ diff --git a/include/hw/core/qdev-properties.h b/include/hw/core/qdev-prope= rties.h index 0c067170079d..39f95ce7a3c6 100644 --- a/include/hw/core/qdev-properties.h +++ b/include/hw/core/qdev-properties.h @@ -76,7 +76,6 @@ extern const PropertyInfo qdev_prop_size; extern const PropertyInfo qdev_prop_string; extern const PropertyInfo qdev_prop_on_off_auto; extern const PropertyInfo qdev_prop_size32; -extern const PropertyInfo qdev_prop_array; extern const PropertyInfo qdev_prop_uint8_list; extern const PropertyInfo qdev_prop_uint16_list; extern const PropertyInfo qdev_prop_uint32_list; @@ -148,15 +147,15 @@ extern const PropertyInfo qdev_prop_link_list; * @_name: name of the array * @_state: name of the device state structure type * @_field: uint32_t field in @_state to hold the array length - * @_arrayfield: field in @_state (of type '@_arraytype *') which - * will point to the array - * @_arrayprop: PropertyInfo defining what property the array elements have - * @_arraytype: C type of the array elements + * @_arrayfield: field in @_state which will point to the array + * @_arrayprop: PropertyInfo for the array elements (e.g. qdev_prop_uint32= ); + * a corresponding list PropertyInfo named @_arrayprop##_list + * must exist * * Define device properties for a variable-length array _name. The array = is * represented as a list in the visitor interface. * - * @_arraytype is required to be movable with memcpy(). + * The element type must be movable with memcpy(). * * When the array property is set, the @_field member of the device * struct is set to the array length, and @_arrayfield is set to point @@ -166,12 +165,10 @@ extern const PropertyInfo qdev_prop_link_list; * @_arrayfield memory. */ #define DEFINE_PROP_ARRAY(_name, _state, _field, \ - _arrayfield, _arrayprop, _arraytype) \ - DEFINE_PROP(_name, _state, _field, qdev_prop_array, uint32_t, \ + _arrayfield, _arrayprop) \ + DEFINE_PROP(_name, _state, _field, _arrayprop##_list, uint32_t, \ .set_default =3D true, \ .defval.u =3D 0, \ - .arrayinfo =3D &(_arrayprop), \ - .arrayfieldsize =3D sizeof(_arraytype), \ .arrayoffset =3D offsetof(_state, _arrayfield)) =20 #define DEFINE_PROP_LINK(_name, _state, _field, _type, _ptr_type) \ @@ -183,10 +180,8 @@ extern const PropertyInfo qdev_prop_link_list; * @_name: name of the array * @_state: name of the device state structure type * @_field: uint32_t field in @_state to hold the array length - * @_arrayfield: field in @_state (of type '@_arraytype *') which - * will point to the array + * @_arrayfield: field in @_state which will point to the array * @_linktype: QOM type name of the link type - * @_arraytype: C type of the array elements * * Define device properties for a variable-length array _name of links * (i.e. this is the array version of DEFINE_PROP_LINK). @@ -195,12 +190,10 @@ extern const PropertyInfo qdev_prop_link_list; * where each string is the QOM path of the object to be linked. */ #define DEFINE_PROP_LINK_ARRAY(_name, _state, _field, _arrayfield, \ - _linktype, _arraytype) \ - DEFINE_PROP(_name, _state, _field, qdev_prop_array, uint32_t, \ + _linktype) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_link_list, uint32_t, \ .set_default =3D true, \ .defval.u =3D 0, \ - .arrayinfo =3D &qdev_prop_link, \ - .arrayfieldsize =3D sizeof(_arraytype), \ .arrayoffset =3D offsetof(_state, _arrayfield), \ .link_type =3D _linktype) =20 diff --git a/tests/unit/test-qdev.c b/tests/unit/test-qdev.c index 77c3eee71713..8cd004b1efab 100644 --- a/tests/unit/test-qdev.c +++ b/tests/unit/test-qdev.c @@ -23,7 +23,7 @@ static const Property my_dev_props[] =3D { DEFINE_PROP_UINT32("u32", MyDev, prop_u32, 100), DEFINE_PROP_STRING("string", MyDev, prop_string), DEFINE_PROP_ARRAY("array-u32", MyDev, prop_array_u32_nb, prop_array_u3= 2, - qdev_prop_uint32, uint32_t), + qdev_prop_uint32), }; =20 static void my_dev_class_init(ObjectClass *oc, const void *data) --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144975; cv=none; d=zohomail.com; s=zohoarc; b=UBKcJqJ8Hyvr0N4d7fgRMHDYY9th3A32VHiJPehbk6CuckY0DAl/9QqMrv5e3tF95a/GZP8id/Q4C51aoeS4m6JrrKLS/8XtVQkZKmvJ/qPm2/Lzg4GSNZqMrBRjglUvSb+0b+vMyYvqliiPg+pXgZYPOVQdLw0twCwbkGTvHhQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144975; h=Content-Type: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=tH/IVOUnn1QB2ho+AwTZr7qddaicqiut7xSXNWVfk8U=; b=XSM2kXmKzvSyY/tTDgc2g83sc+R4pc7YKO+gMlrRNlsupQuppyRVR7JqS5X0oE+URzw940r8oOHzcdOH5m9K8UHy8NE5FOcV8ciKM4aELfJ5OXphAjwaME/JzmIOk3mL5huMRU2lpyj2t5+ulJd+keFMiBe6fFuS+UNWm5k+AUc= 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 1789144975052375.84954038910485; Fri, 11 Sep 2026 09:42:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54JK-0007Dr-EN; Fri, 11 Sep 2026 12:41:10 -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 1x54JG-00078k-JX for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:06 -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 1x54JE-0007Gh-Po for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:06 -0400 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-569-ptIpd1xjMCOHcNYuR0XqkQ-1; Fri, 11 Sep 2026 12:41:00 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 94A6F180065E; Fri, 11 Sep 2026 16:40:59 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C7868180034C; Fri, 11 Sep 2026 16:40:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144864; 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=tH/IVOUnn1QB2ho+AwTZr7qddaicqiut7xSXNWVfk8U=; b=iCST2tUb2PQ7wErg5xIyB1qfWJCnF3RXYIhpajqnr4OblLGrQczDwPUzT2FoyIuGJNu77M L8GZVkPgFLpsVdQsds5tgagVnl5InxWqeN+674bVQ6JMNpltN6dBO2rjZGOSzeL8T2LSs6 K+jITzmHCnkCc013t8luvt0Kjn82ov4= X-MC-Unique: ptIpd1xjMCOHcNYuR0XqkQ-1 X-Mimecast-MFC-AGG-ID: ptIpd1xjMCOHcNYuR0XqkQ_1789144859 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:31 +0400 Subject: [PATCH v5 57/62] qdev: remove deprecated PropertyInfo.type and .enum_table fields MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-57-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=5602; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=sOu4pogNVK6NpFHufCV3RH9LgNGQmgLKUI48lJjnLyQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC28IO1Xnxgx9piBec2uT0+BtTEOIGJbWFWei laqJh9GUvaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtvAAKCRDa6OEJdZac 5Yr4D/9pMW+Ctjeql4MeQewROI/Uq320zbhoEJoas43PpHMC7AX9P8nSnquG6Dn4Xp4m9kasprm zDWvEsN1sZAntZ+WAd8IbUyNDEo49bvfMl8aC/OL2nrTA2r7eIHo3KxOvxdFwnoOgxzSlSTvGZA 1030jBsdpF0UQlmIiC8W8ycKCKTCohi091rfEThpHqWVKP/2ORtUJmILwH12emygqtLwyKQV1hh Jtb0riVykK6jEuz/kO6ueJGhqk4BBraCvb5fCSaHFREMReeP6YqQ4GFzJxU3SZTp9FnPD9/PPIM HiqQexHeyUXDo7AUdTe8JvTN6Z3xCRK8UdoKrIETuJAyglQknlWjTgnWMTcfIMwP/7SPqiy1iHJ cXG9cOtcQMh3iikAxfTmV0iCuVLL+MoyWZgMgQdshBDiHRmB7qYseTjQod6VCxXJhQlX/hNHO15 QFZJ2rNmTSfPrkD4O5n/AX4oOL0vTFMVzf+rKNYbaWuXHVo3Ox7iuX9oow0pcmOeZuPXUoicpRc oIdzzSXdH0Q91DKukRQIwF8VlDG8aNfKvhoGIXUfNcPnftvglPKJiYbaUqTBZrQikO0GpHR3SFK UHGN7UKXc1ua6xJnzx5k2ImszMzG214cfgrf88wlBzwjKMCNT8wvyfmQXI+GL2UlPWshO8DdcqT xiS38/ofmtY+1GA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=marcandre.lureau@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_H2=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: 1789144975596158500 Now that all PropertyInfo definitions use .qapi_type, remove the legacy .type (string) and .enum_table fields from PropertyInfo, and the .arrayinfo/.arrayfieldsize fields from Property. Remove fallback branches in qdev_property_add_static() and qdev_class_add_property() that used object_property_add() with prop->info->type: these always use the QAPI-aware registration path now. Simplify qdev_propinfo_enum_lookup(), prop_array_info() and prop_array_elem_size() to use the new fields directly. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/core/qdev-properties.c | 58 ++++++++++++-----------------------= ---- include/hw/core/qdev-properties.h | 4 --- 2 files changed, 17 insertions(+), 45 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index b5a9eb97e7dd..585982f60f5a 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -103,11 +103,8 @@ static ObjectPropertyAccessor *field_prop_setter(const= PropertyInfo *info) =20 const QEnumLookup *qdev_propinfo_enum_lookup(const PropertyInfo *info) { - if (info->qapi_type) { - assert(info->qapi_type->lookup); - return info->qapi_type->lookup; - } - return info->enum_table; + assert(info->qapi_type->lookup); + return info->qapi_type->lookup; } =20 void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name, @@ -667,18 +664,12 @@ struct ArrayElementList { =20 static const PropertyInfo *prop_array_info(const Property *prop) { - if (prop->info->element_info) { - return prop->info->element_info; - } - return prop->arrayinfo; + return prop->info->element_info; } =20 static int prop_array_elem_size(const Property *prop) { - if (prop->info->element_size) { - return prop->info->element_size; - } - return prop->arrayfieldsize; + return prop->info->element_size; } =20 /* @@ -1222,20 +1213,13 @@ void qdev_property_add_static(DeviceState *dev, con= st Property *prop) const QAPITypeInfo *qapi_type =3D qdev_prop_qapi_type(prop); =20 assert(!prop->info->create); + assert(qapi_type); =20 - if (qapi_type) { - op =3D object_property_add_qapi(obj, prop->name, qapi_type, - field_prop_getter(prop->info), - field_prop_setter(prop->info), - prop->info->release, - (Property *)prop); - } else { - op =3D object_property_add(obj, prop->name, prop->info->type, - field_prop_getter(prop->info), - field_prop_setter(prop->info), - prop->info->release, - (Property *)prop); - } + op =3D object_property_add_qapi(obj, prop->name, qapi_type, + field_prop_getter(prop->info), + field_prop_setter(prop->info), + prop->info->release, + (Property *)prop); =20 object_property_set_description(obj, prop->name, prop->info->description); @@ -1259,21 +1243,13 @@ static void qdev_class_add_property(DeviceClass *kl= ass, const char *name, } else { const QAPITypeInfo *qapi_type =3D qdev_prop_qapi_type(prop); =20 - if (qapi_type) { - op =3D object_class_property_add_qapi(oc, - name, qapi_type, - field_prop_getter(prop->inf= o), - field_prop_setter(prop->inf= o), - prop->info->release, - (Property *)prop); - } else { - op =3D object_class_property_add(oc, - name, prop->info->type, - field_prop_getter(prop->info), - field_prop_setter(prop->info), - prop->info->release, - (Property *)prop); - } + assert(qapi_type); + op =3D object_class_property_add_qapi(oc, + name, qapi_type, + field_prop_getter(prop->info), + field_prop_setter(prop->info), + prop->info->release, + (Property *)prop); } if (prop->set_default) { prop->info->set_default_value(op, prop); diff --git a/include/hw/core/qdev-properties.h b/include/hw/core/qdev-prope= rties.h index 39f95ce7a3c6..2267e734d1fd 100644 --- a/include/hw/core/qdev-properties.h +++ b/include/hw/core/qdev-properties.h @@ -23,17 +23,13 @@ struct Property { int64_t i; uint64_t u; } defval; - const PropertyInfo *arrayinfo; int arrayoffset; - int arrayfieldsize; uint8_t bitnr; bool set_default; }; =20 struct PropertyInfo { - const char *type; const char *description; - const QEnumLookup *enum_table; const QAPITypeInfo *qapi_type; const struct PropertyInfo *element_info; int element_size; --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789144984; cv=none; d=zohomail.com; s=zohoarc; b=Ea4xvHX/rG9c05fF8Uep6a+1MCmeSUj5xI6m/cFjCZG7hnDlz4S1OUO/Km9ucJ/MY4oaIdT4ksM7998qvOtSV5ALxGohLrztX9j7Z+BwzdL9F7RQetlfeatX09GijR68SVRd0g0Qik4svsRIv3F/XvLOsx6yhsaPN8qPRY8+VGk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789144983; h=Content-Type: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=mVgRY8FyaQprluWH3eLEEY/EI8+otfrYvvNCkmcu2Fc=; b=l6uREIq22FJbPs+nBrvWI8qR6tiurSHKXrZ42fiN0o04nmOTH1jnbd3pU4d1NDCPIEoPvNz4tU8yFmz2I6dUvQRGBtxa10yEjGro5G+kWa+y9ETMyoatm+p8LWTKZskoJJMWxNpfreb2/aAJVKqNranq3bIXcPiHoOVxwNQnAmM= 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 1789144983992145.4713480757464; Fri, 11 Sep 2026 09:43:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54JY-0007SW-Ky; Fri, 11 Sep 2026 12:41:25 -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 1x54JL-0007Gc-PU for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:12 -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 1x54JK-0007Ka-07 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:11 -0400 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-103-_ix4OLAoMtG5NQpNmp0J3Q-1; Fri, 11 Sep 2026 12:41:04 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 6F50A1800878; Fri, 11 Sep 2026 16:41:03 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 44A4B195608F; Fri, 11 Sep 2026 16:41:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144869; 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=mVgRY8FyaQprluWH3eLEEY/EI8+otfrYvvNCkmcu2Fc=; b=GCeqa86GZwrQ8XwciHI9wumPhqRSc7RgQj4VjKXhFOO5It8+cTR2Lrw0MHb6TRJ6qeUZ0B hOWBs1pgSnMJxkVTUgMoWzcPCaqHrbj46oMxTuIdCtiEth+gucce3FL3P9yceom3LzopNI HDWKNxY6gCX8TswbOC4GGYmVK+nnDS0= X-MC-Unique: _ix4OLAoMtG5NQpNmp0J3Q-1 X-Mimecast-MFC-AGG-ID: _ix4OLAoMtG5NQpNmp0J3Q_1789144863 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:32 +0400 Subject: [PATCH v5 58/62] hw/i386: convert PCSouthBridgeOption to QAPI enum MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-58-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Zhao Liu , Eric Blake X-Developer-Signature: v=1; a=openpgp-sha256; l=5406; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=5rbqnyzNuiXenxsxKA8MfQROzgQKdBBd23brPgSs/+E=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC28vXlJv2zre6b7UdoE76qkLrgft1D6noCGX fZVYHvt79OJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtvAAKCRDa6OEJdZac 5VRfD/9Q0lgr/An4VKLgcVVFIGOPtQDlQeJc2LMJd/DmN4lAclKwc3Tm2FKPvpute0GRVqWIswM vWAoG825/wt9y7G4F/UCku3EmBGdbHCPheCRZRs7Fcb+Q2fTqOebuXdnAB2FtKWD1AUmPQMVour DCM/pi19X2Mny/6v3bZK2dbw/SbN0BO/DS0FR2LSeg9MLU1mGpQLINeGv5T3gZEBFwayi6tkYyr 27HxeLMCdS4xxj4M4oGEb7hlJCb0sJZEGJGMzjjDF2S1AYt9u5P4iABhb3qMUqWxf2R9IFMhRYA dmYvr0P6sTPzti4nvjIGM4ADBWVzS7vN5nyCU+2T22kmRZKoltLr1O8M7lRt9m+86sR0kJd45kR 1bLGYthtQdOdFGCRarQb8ZMz54NoeMRjVn3w9b8F3R5Oirjo8qTM7pg0zvVTcp70ete6inYcISB ysqfEp9bfzbEAGySqg43taxy2FBYbNVlcxoyIJjw0Ywmrsg/Y2e+rhwHfCNuNxHHhpjazlv8dn1 RUBqq28YkgmnsrcmF7PEjK/63c2GWENozodwiQU0HoBqmCqu2kt+fifnKXe2aYkoKKWdWciNRoM 5G7lgTAqLz3nz1+gS2/LHb43PJKXa+Hwa9g0xfu0eSWlmD/EbklfqT1Xp5K0zuZbVaqoQMoNej9 mul7aKC9T5ViGBw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=marcandre.lureau@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_H2=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: 1789144985654158500 Move PCSouthBridgeOption from a hand-rolled C enum with a manually constructed QAPITypeInfo to a proper QAPI enum in qapi/machine.json. This gives the x-south-bridge property a generated type_info with a valid masked_name, so it appears in query-qmp-schema introspection and the qapi-type field of qom-list-properties output. The south_bridge/default_south_bridge fields change from const char * to PCSouthBridgeOption, with an explicit mapping table from enum value to QOM device type name. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/i386/pc_piix.c | 53 +++++++++++-------------------------------------= ---- include/hw/i386/pc.h | 4 ++-- qapi/machine.json | 14 ++++++++++++++ 3 files changed, 27 insertions(+), 44 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index dac2bee88a2e..02d0f2917705 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -47,6 +47,7 @@ #include "hw/acpi/acpi.h" #include "hw/vfio/types.h" #include "qapi/error.h" +#include "qapi/qapi-type-infos-machine.h" #include "qemu/error-report.h" #include "system/xen.h" #ifdef CONFIG_XEN @@ -75,6 +76,11 @@ static GlobalProperty pc_piix_compat_defaults[] =3D { static const size_t pc_piix_compat_defaults_len =3D G_N_ELEMENTS(pc_piix_compat_defaults); =20 +static const char *pc_south_bridge_type[] =3D { + [PC_SOUTH_BRIDGE_OPTION_PIIX3] =3D TYPE_PIIX3_DEVICE, + [PC_SOUTH_BRIDGE_OPTION_PIIX4] =3D TYPE_PIIX4_PCI_DEVICE, +}; + /* * Return the global irq number corresponding to a given device irq * pin. We could also use the bus number to have a more precise mapping. @@ -236,7 +242,8 @@ static void pc_init1(MachineState *machine, const char = *pci_type) =20 gsi_state =3D pc_gsi_create(&x86ms->gsi, true); =20 - pci_dev =3D pci_new_multifunction(-1, pcms->south_bridge); + pci_dev =3D pci_new_multifunction(-1, + pc_south_bridge_type[pcms->south_bridg= e]); object_property_set_bool(OBJECT(pci_dev), "has-usb", machine_usb(machine), &error_abort); object_property_set_bool(OBJECT(pci_dev), "has-acpi", @@ -322,56 +329,18 @@ static void pc_init1(MachineState *machine, const cha= r *pci_type) } } =20 -typedef enum PCSouthBridgeOption { - PC_SOUTH_BRIDGE_OPTION_PIIX3, - PC_SOUTH_BRIDGE_OPTION_PIIX4, - PC_SOUTH_BRIDGE_OPTION_MAX, -} PCSouthBridgeOption; - -static const QEnumLookup PCSouthBridgeOption_lookup =3D { - .array =3D (const char *const[]) { - [PC_SOUTH_BRIDGE_OPTION_PIIX3] =3D TYPE_PIIX3_DEVICE, - [PC_SOUTH_BRIDGE_OPTION_PIIX4] =3D TYPE_PIIX4_PCI_DEVICE, - }, - .size =3D PC_SOUTH_BRIDGE_OPTION_MAX -}; - -static const QAPITypeInfo PCSouthBridgeOption_type_info =3D { - .name =3D "PCSouthBridgeOption", - .lookup =3D &PCSouthBridgeOption_lookup, -}; - static int pc_get_south_bridge(Object *obj, Error **errp) { PCMachineState *pcms =3D PC_MACHINE(obj); - int i; =20 - for (i =3D 0; i < PCSouthBridgeOption_lookup.size; i++) { - if (g_strcmp0(PCSouthBridgeOption_lookup.array[i], - pcms->south_bridge) =3D=3D 0) { - return i; - } - } - - error_setg(errp, "Invalid south bridge value set"); - return 0; + return pcms->south_bridge; } =20 static void pc_set_south_bridge(Object *obj, int value, Error **errp) { PCMachineState *pcms =3D PC_MACHINE(obj); =20 - if (value < 0) { - error_setg(errp, "Value can't be negative"); - return; - } - - if (value >=3D PCSouthBridgeOption_lookup.size) { - error_setg(errp, "Value too big"); - return; - } - - pcms->south_bridge =3D PCSouthBridgeOption_lookup.array[value]; + pcms->south_bridge =3D value; } =20 #ifdef CONFIG_XEN @@ -408,7 +377,7 @@ static void pc_i440fx_machine_options(MachineClass *m) { PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); ObjectClass *oc =3D OBJECT_CLASS(m); - pcmc->default_south_bridge =3D TYPE_PIIX3_DEVICE; + pcmc->default_south_bridge =3D PC_SOUTH_BRIDGE_OPTION_PIIX3; pcmc->pci_root_uid =3D 0; pcmc->default_cpu_version =3D 1; =20 diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index ac03da97b645..34806f16e6a6 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -42,7 +42,7 @@ typedef struct PCMachineState { uint64_t max_ram_below_4g; OnOffAuto vmport; SmbiosEntryPointType smbios_entry_point_type; - const char *south_bridge; + PCSouthBridgeOption south_bridge; =20 bool acpi_build_enabled; bool wdat_enabled; @@ -89,7 +89,7 @@ struct PCMachineClass { =20 /* Device configuration: */ bool pci_enabled; - const char *default_south_bridge; + PCSouthBridgeOption default_south_bridge; =20 /* Compat options: */ =20 diff --git a/qapi/machine.json b/qapi/machine.json index 0e0d85d0a76d..28ecb969bdb6 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -475,6 +475,20 @@ { 'enum': 'Pca9554PinState', 'data': ['low', 'high'] } =20 +## +# @PCSouthBridgeOption: +# +# South bridge chipset option for PC i440FX machines. +# +# @piix3: Intel PIIX3 (default) +# +# @piix4: Intel PIIX4 +# +# Since: 11.2 +## +{ 'enum': 'PCSouthBridgeOption', + 'data': ['piix3', 'piix4'] } + ## # @inject-nmi: # --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145004; cv=none; d=zohomail.com; s=zohoarc; b=WQ2dxnLKYV1ngKMz6PNddnHfmura6d+i1hX++4qnIwfY1aYPfbxrUfaY6b7HF1SC6IqWONwmtThKF8hdqt0Rx6ZqUpEe/fiSuEg5cBtFNhjY6/rqZsP5Ze2+pVX3SWm+hIKFYr5nQmdPcV+6jBtvbAB2x2JmPkFng0MtJdasGSY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145004; h=Content-Type: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=WeVOBHQkCvC0XwLo7TG2qrvX/rqsXNC28uR/Ps0fpcg=; b=F6plRTamcSI/JywUFsZLN0e4NtlRoT7blkFQeXlFZxIzm9LiwnhDzOjwbMp4xV56UQRWKinDQLKiP0zfk6RZRTjgEEQ27ml1vCy+ytif4ZNezkIhmFDscUUmQgO0SekCVXxxv5GeSTyXh1Zxcbz38jU6V0REkRIC3ILPQILvL94= 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 1789145004454954.1245258184009; Fri, 11 Sep 2026 09:43:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Je-0007eo-Ac; Fri, 11 Sep 2026 12:41:30 -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 1x54JQ-0007OT-90 for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:16 -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 1x54JO-0007LH-DB for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:15 -0400 Received: from mx-prod-mc-08.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-6-rcFW2ah9Noy68pnyUCa0KA-1; Fri, 11 Sep 2026 12:41:08 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CEE68180136D; Fri, 11 Sep 2026 16:41:06 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C1ECA180034C; Fri, 11 Sep 2026 16:41:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144872; 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=WeVOBHQkCvC0XwLo7TG2qrvX/rqsXNC28uR/Ps0fpcg=; b=hKBuu14MqgIjpBPNI1Aj2Y2BxKaKHtwECfjpf4d/0BFDAHhzA4vfXjVeUXmaOiCJgxq1oN ERnyEEFVYRuPO9h7i7uAguJE3x4dNe9jgdFozZuxEo7dI0QttelT1aRUmCGkfb3vcZw3H0 Oel48Iz4C5vpu7hLnmQKyGHh7DWK24U= X-MC-Unique: rcFW2ah9Noy68pnyUCa0KA-1 X-Mimecast-MFC-AGG-ID: rcFW2ah9Noy68pnyUCa0KA_1789144866 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:33 +0400 Subject: [PATCH v5 59/62] qom: use QAPITypeInfo in object_property_get_enum MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-59-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Zhao Liu X-Developer-Signature: v=1; a=openpgp-sha256; l=4675; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=mCUaQP+PMbwio8wO+Fb5G23JdGsVTJ0kQ84RxKYhKgs=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC28UuYSQ4M/qHrqyrG/nZa50FTpFGvPHG6tH D3TDrbjjPyJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtvAAKCRDa6OEJdZac 5S2wD/wM89NLkqgjdlSDVJZ9bcZOh0YusVzshKLG4hs6GH/As6w8a1k3adlFM7ObEAFZcZpSg8K UdytdHaOHNE1yf7PQKBQk9TQ5n0REf0Vzsl+wgYLc+cFiyUvd2cpdrLBxB4G1F/FGqIy1pE6Fks yhUfCzOH11mhFeQhb1LNA1lEBWQZouongzniyDg0lXH/ZZdfqQ9zCo6QnlbO1fS18htSgfri9nq r2Yl4Eh6irknOpKxjsZ6FpPESHvTGuJCZu0ggE3vulEJTvBFHv6F4CPZ5ob4GK278tGYE3SV3sQ F+oSlzR/9YWKS1B7DBbzUzgokpC+J40YH+Bl1LanXw/PDACpLiLtcedxkeltC4PCR44m4w+U/ml C/yh3buB89YX2R6eChmurppp6iNcUOkfp4X6EHt0P/u99xIS22Al+IyT+mvNaGIh57nZCGD8IOE 02YZqAfLmNWcU/PudZ+btDq/4mUyCkpDEEbeCPTlj9/rlQHM7eZ/L4I66cQGWgi/DeIL4B04jws gUgaPIr1aAjj4JkaB0+cq2P4NcQh7j0RW267jl8QNfSJxCdsJDwbdscGUIEHUtmck9yN+hraczZ f7/5Pryr6ANB8q+DtmADhS5HZLf2c6JmMqHcN2X7v6xV6swEBVP6I1dOQeQjOrc7Z68gdi/zyc5 IaXKyW/EashZSoA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=marcandre.lureau@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, 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: 1789145006034158500 The typename parameter becomes a QAPITypeInfo pointer, and the validation compares prop->qapi_type against it instead of matching prop->type strings. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/core/machine-qmp-cmds.c | 3 ++- include/qom/object.h | 4 ++-- qom/object.c | 8 ++++---- tests/unit/check-qom-proplist.c | 6 +++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index 543dd3201b5a..1c23ec8897f0 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -18,6 +18,7 @@ #include "qapi/qapi-commands-accelerator.h" #include "qapi/qapi-commands-machine.h" #include "qobject/qobject.h" +#include "qapi/qapi-type-infos-common.h" #include "qapi/qobject-input-visitor.h" #include "qapi/type-helpers.h" #include "qemu/uuid.h" @@ -219,7 +220,7 @@ static int query_memdev(Object *obj, void *opaque) } else { m->has_reserve =3D true; } - m->policy =3D object_property_get_enum(obj, "policy", "HostMemPoli= cy", + m->policy =3D object_property_get_enum(obj, "policy", &HostMemPoli= cy_type_info, &error_abort); host_nodes =3D object_property_get_qobject(obj, "host-nodes", diff --git a/include/qom/object.h b/include/qom/object.h index 4bedf17b6c8f..e09af481440d 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1532,7 +1532,7 @@ uint64_t object_property_get_uint(Object *obj, const = char *name, * object_property_get_enum: * @obj: the object * @name: the name of the property - * @typename: the name of the enum data type + * @type_info: the QAPITypeInfo of the enum * @errp: returns an error if this function fails * * Returns: the value of the property, converted to an integer (which @@ -1540,7 +1540,7 @@ uint64_t object_property_get_uint(Object *obj, const = char *name, * value is not an enum). */ int object_property_get_enum(Object *obj, const char *name, - const char *typename, Error **errp); + const QAPITypeInfo *type_info, Error **errp); =20 /** * object_property_set: diff --git a/qom/object.c b/qom/object.c index a0e3af61ae29..46c8e2f7c62d 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1765,7 +1765,7 @@ uint64_t object_property_get_uint(Object *obj, const = char *name, } =20 int object_property_get_enum(Object *obj, const char *name, - const char *typename, Error **errp) + const QAPITypeInfo *type_info, Error **errp) { char *str; int ret; @@ -1775,10 +1775,10 @@ int object_property_get_enum(Object *obj, const cha= r *name, return -1; } =20 - if (!g_str_equal(prop->type, typename)) { + if (prop->qapi_type !=3D type_info) { error_setg(errp, "Property %s on %s is not '%s' enum type", - name, object_class_get_name( - object_get_class(obj)), typename); + name, object_class_get_name(object_get_class(obj)), + type_info->name); return -1; } =20 diff --git a/tests/unit/check-qom-proplist.c b/tests/unit/check-qom-proplis= t.c index 69155e720751..1cb48c7490ef 100644 --- a/tests/unit/check-qom-proplist.c +++ b/tests/unit/check-qom-proplist.c @@ -582,14 +582,14 @@ static void test_dummy_getenum(void) =20 val =3D object_property_get_enum(OBJECT(dobj), "av", - "DummyAnimal", + &dummy_animal_qapi_type_info, &error_abort); g_assert(val =3D=3D DUMMY_PLATYPUS); =20 /* A bad enum type name */ val =3D object_property_get_enum(OBJECT(dobj), "av", - "BadAnimal", + &dummy_str_qapi_type_info, &err); g_assert(val =3D=3D -1); error_free_or_abort(&err); @@ -597,7 +597,7 @@ static void test_dummy_getenum(void) /* A non-enum property name */ val =3D object_property_get_enum(OBJECT(dobj), "iv", - "DummyAnimal", + &dummy_animal_qapi_type_info, &err); g_assert(val =3D=3D -1); error_free_or_abort(&err); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145146; cv=none; d=zohomail.com; s=zohoarc; b=YDOpGeOKVIQZ3PiXAJSusEcx2SgTldmV0txsNjMj5xjOoju81fqcuDuUIicq0kd/5YQUKWap8Mvjq+bedVHnEazsAmDgSq8EnueWBLjSbECRYOPqmZbiGhCdAHY1UXhy7Zac/8fSNQJpcuMFenaebC1/zPQlB1ZalNmbAire46k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145146; h=Content-Type: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=tVEqcWm0qmGrTdYv0ut5E0TOgGLwGMf0sJ5a2m4C7G0=; b=gXMjJDovvqLW8RSz1ypu9dyI5CXeJhJLinXE85H7Mu+0XnPliGvXLSHjw5hVurOWzYE65p3iBS4q3VyotiFaPfZpnpkXTOy2HHpeZOvvYARQeJ0HBdFgemCph0u1q2oUMuBjYVdnr+6I9DPijWHn4oH4xCMirpMHorc61dKzft4= 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 1789145146371697.0083040370747; Fri, 11 Sep 2026 09:45:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Jc-0007Z8-RU; Fri, 11 Sep 2026 12:41:29 -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 1x54JR-0007Og-Sy for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:18 -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 1x54JQ-0007LR-3m for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:17 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-322-INhKPXwdPBGB4uQFuRCIYA-1; Fri, 11 Sep 2026 12:41:12 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 044211955F14; Fri, 11 Sep 2026 16:41:11 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 09EDF180029C; Fri, 11 Sep 2026 16:41:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144875; 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=tVEqcWm0qmGrTdYv0ut5E0TOgGLwGMf0sJ5a2m4C7G0=; b=P8wDOWkGr63OWiL4oxQ2Mt6GM5C5V2PclJzty2WLY+zipH55qdzk1hNgKpaIuEIVsOUvc1 56FhT6XN93ZOFLoKC4C8bXt24u+hTbsH28Xf2d2QxLZfWHngPWtkU7tC53+cdn12NK+zOk c8XiTagdxQ2Q3OrXvPyetDXyBqyyctM= X-MC-Unique: INhKPXwdPBGB4uQFuRCIYA-1 X-Mimecast-MFC-AGG-ID: INhKPXwdPBGB4uQFuRCIYA_1789144871 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:34 +0400 Subject: [PATCH v5 60/62] qapi: expose integer signedness and width in introspection MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-60-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eric Blake X-Developer-Signature: v=1; a=openpgp-sha256; l=7727; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=2KmQlYMMKRf4yfohcWO2babcLQFJDLHQ8w1XzeZyyow=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC28kMTPdDd/NGgefpN204noC9h7Alevt6ub8 Wzd/sI/EXuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtvAAKCRDa6OEJdZac 5dBXEACdTSUFbw2xx4zlgRd5/iP+juSXdFlUpIeyx41QX4UTI7VJASTrtjAEQIF1ecDH61w8bgz AIk17qkb/yk0kHqKwHTzpJ4q/w0Jyj8JuHbqk1/WHLGHiFN6G4PZvf9xsrCqJr8N0WYfX36g2yy DCBwfF7dHU30qhX9Im8dtHV42gJyICqXerLtLdmg7mrYQFwfbH0kVMdUT05KcG+nC6is+PV1eKW IAwX4poNsSJ8kiNzL5u5t1P4PRSUTbVT689ggWOmbAqutblmNlFt4AED/NBe9LLiV7vqpeCPmj5 M+pVdZPQtjbQPouWxkwqt6VtEp+JCDSiqMwxxxHh/mu5u8RdPFkzNfn/eJR3jPaVv2SrFyk1iyI +DXS3+2a3UyxeGuFJRS+gpeW2dyduGmEi8vWWQ2PjUDYEec9OMlbPOxbPLwY6QAB/W47WtU151Q CDbMT2VutGv0+PTVR+RMoh6W+B2w93ScDzP1O/Cfnzd2ScxvyU2y2ukg5Rd0ZfM32U/wn8O+GQn Mc9dglf6DW+wB/0emUuiOHY6CNql0/x9gl4YGYnHxnZnD4xq2sL1Hq/llPybcsyumDXgcdJwOx6 hUsydCRhOJkNcmqwjK2DG6mu3H9Yv7LsKRZ1SvR12Cw96rZB78Tut6FDXX8jdmu8mFeD46nE9kC W2jtf5I7O7c8wWA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789145148757158500 Integer built-in types are currently canonicalized to "int" in query-qmp-schema. Consequently, clients cannot distinguish types such as int8, uint64, and size, even though they accept different ranges. Preserve the individual integer types during schema analysis and add an optional "integer" member to SchemaInfoBuiltin. It reports whether the type is signed and its width in bits. This also preserves the actual element type for arrays of integers. Teach the introspection generator to emit integer values and update the documentation to describe the extended schema information. For example for introspection, for all kind of int, before: {"name": "int", "json-type": "int", "meta-type": "builtin"} After, there are various int types such as: {"name": "int64", "integer": {"bits": 64, "signed": true}, "json-type": "int", "meta-type": "builtin"} Signed-off-by: Marc-Andr=C3=A9 Lureau --- docs/devel/qapi-code-gen.rst | 17 +++++++++++------ qapi/introspect.json | 20 +++++++++++++++++++- scripts/qapi/introspect.py | 29 ++++++++++++++++++++++++++--- scripts/qapi/schema_analysis.py | 16 ---------------- 4 files changed, 56 insertions(+), 26 deletions(-) diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst index 69d5c4af9874..512a885f75f8 100644 --- a/docs/devel/qapi-code-gen.rst +++ b/docs/devel/qapi-code-gen.rst @@ -1404,14 +1404,19 @@ Example: the SchemaInfo for str :: =20 { "name": "str", "meta-type": "builtin", "json-type": "string" } =20 -The QAPI schema supports a number of integer types that only differ in -how they map to C. They are identical as far as SchemaInfo is -concerned. Therefore, they get all mapped to a single type "int" in -SchemaInfo. +The QAPI schema supports a number of integer types with different widths +and signedness. Each has its own SchemaInfo with "json-type" "int" and +variant member "integer" specifying its "signed" flag and width in +"bits". + +Example: the SchemaInfo for uint8 :: + + { "name": "uint8", "meta-type": "builtin", "json-type": "int", + "integer": { "signed": false, "bits": 8 } } =20 As explained above, type names are not part of the wire ABI. Not even -the names of built-in types. Clients should examine member -"json-type" instead of hard-coding names of built-in types. +the names of built-in types. Clients should examine members "json-type" +and "integer" instead of hard-coding names of built-in types. =20 =20 Compatibility considerations diff --git a/qapi/introspect.json b/qapi/introspect.json index c8432c8ed8ec..8b5848862c4e 100644 --- a/qapi/introspect.json +++ b/qapi/introspect.json @@ -117,10 +117,28 @@ # # @json-type: the JSON type used for this type on the wire. # +# @integer: the integer type's representation. Present exactly when +# @json-type is 'int'. (since 11.2) +# # Since: 2.5 ## { 'struct': 'SchemaInfoBuiltin', - 'data': { 'json-type': 'JSONType' } } + 'data': { 'json-type': 'JSONType', + '*integer': 'SchemaInfoBuiltinInteger' } } + +## +# @SchemaInfoBuiltinInteger: +# +# Representation of an integer built-in type. +# +# @signed: whether the integer is signed. +# +# @bits: the integer's width in bits. +# +# Since: 11.2 +## +{ 'struct': 'SchemaInfoBuiltinInteger', + 'data': { 'signed': 'bool', 'bits': 'int' } } =20 ## # @JSONType: diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index ce37ce787567..e3749d38ced5 100644 --- a/scripts/qapi/introspect.py +++ b/scripts/qapi/introspect.py @@ -49,7 +49,7 @@ # A complexity over JSON is that our values may or may not be annotated. # # Un-annotated values may be: -# Scalar: str, bool, None. +# Scalar: str, bool, int, None. # Non-scalar: List, Dict # _value =3D Union[str, bool, None, Dict[str, JSONValue], List[JSONValue]] # @@ -59,11 +59,25 @@ # Sadly, mypy does not support recursive types; so the _Stub alias is used= to # mark the imprecision in the type model where we'd otherwise use JSONValu= e. _Stub =3D Any # pylint: disable=3Dinvalid-name -_Scalar =3D Union[str, bool, None] +_Scalar =3D Union[str, bool, int, None] _NonScalar =3D Union[Dict[str, _Stub], List[_Stub]] _Value =3D Union[_Scalar, _NonScalar] JSONValue =3D Union[_Value, 'Annotated[_Value]'] =20 + +_INTEGER_TYPE_INFO =3D { + 'int': (True, 64), + 'int8': (True, 8), + 'int16': (True, 16), + 'int32': (True, 32), + 'int64': (True, 64), + 'uint8': (False, 8), + 'uint16': (False, 16), + 'uint32': (False, 32), + 'uint64': (False, 64), + 'size': (False, 64), +} + # These types are based on structures defined in QEMU's schema, so we # lack precise types for them here. Python 3.6 does not offer # TypedDict constructs, so they are broadly typed here as simple @@ -135,6 +149,8 @@ def indent(level: int) -> str: ret +=3D f"QLIT_QSTR({to_c_string(obj)})" elif isinstance(obj, bool): ret +=3D f"QLIT_QBOOL({str(obj).lower()})" + elif isinstance(obj, int): + ret +=3D f"QLIT_QNUM({obj})" =20 # Non-scalars: elif isinstance(obj, list): @@ -271,7 +287,14 @@ def _gen_variant(self, variant: QAPISchemaVariant =20 def visit_builtin_type(self, name: str, info: Optional[QAPISourceInfo], json_type: str) -> None: - self._gen_tree(name, 'builtin', {'json-type': json_type}) + obj: Dict[str, object] =3D {'json-type': json_type} + if json_type =3D=3D 'int': + signed, bits =3D _INTEGER_TYPE_INFO[name] + obj['integer'] =3D { + 'signed': signed, + 'bits': bits, + } + self._gen_tree(name, 'builtin', obj) =20 def visit_enum_type(self, name: str, info: Optional[QAPISourceInfo], ifcond: QAPISchemaIfCond, diff --git a/scripts/qapi/schema_analysis.py b/scripts/qapi/schema_analysis= .py index 1d12306f61e2..1aad2dc80380 100644 --- a/scripts/qapi/schema_analysis.py +++ b/scripts/qapi/schema_analysis.py @@ -123,27 +123,12 @@ def visit_alternate_type( =20 def _register_type(self, typ: QAPISchemaType) -> None: """Record a type for introspection (idempotent).""" - typ =3D self._canonicalize_type(typ) if typ not in self._types_set: self._types.append(typ) self._types_set.add(typ) if isinstance(typ, QAPISchemaArrayType): self._register_type(typ.element_type) =20 - def _canonicalize_type(self, typ: QAPISchemaType) -> QAPISchemaType: - """Canonicalize integer types to plain int.""" - assert self._schema is not None - if typ.json_type() =3D=3D 'int': - type_int =3D self._schema.lookup_type('int') - assert type_int - return type_int - if (isinstance(typ, QAPISchemaArrayType) and - typ.element_type.json_type() =3D=3D 'int'): - type_intlist =3D self._schema.lookup_type('intList') - assert type_intlist - return type_intlist - return typ - def masked_name(self, name: str) -> str: """Return the masked name for a non-builtin, non-array type.""" assert name in self._name_map, \ @@ -152,7 +137,6 @@ def masked_name(self, name: str) -> str: =20 def introspection_name(self, typ: QAPISchemaType) -> str: """Return the introspection name for a type.""" - typ =3D self._canonicalize_type(typ) if isinstance(typ, QAPISchemaBuiltinType): return typ.name if isinstance(typ, QAPISchemaArrayType): --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145163; cv=none; d=zohomail.com; s=zohoarc; b=gXVECxzq5NZ/JmVnPSb89lk7sjUPB8yja++GxFAjzRNEHrGUieopR0KHhjTrxGoHiKQtsXgjOsqcFTMhnku0SQ9TFzXkvxa1L0Qj6WS6vpNqyR0wghiR46POTajRTlBns9PDmMAx7kplVF26uE8b7hG6/xDDIosCOC0O6aMfFqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145163; h=Content-Type: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=lNt+NcdfdrXTDAde4gaKYFts/kwAUEfykTyytEmPajw=; b=YD5GRwELdVZgVUzLHQ0+raTwfL3pD6PXUkQIib3q3CXynXwBmZoZGVCvG9haPp+B+D3gbBYkU/2VMrdj2tWioEhnsJWJuB+MvA4pS59e0ozbJ49U1aaWBG5/SK9QF4DNVWodhBTpC+PA6QW0TIEfzxV76pe+gk9JZfrY2AosY48= 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 1789145163454483.2794928669555; Fri, 11 Sep 2026 09:46:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Jh-0007pw-8A; Fri, 11 Sep 2026 12:41:33 -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 1x54JV-0007Sh-AH for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:24 -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 1x54JT-0007MA-Qb for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:21 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-564-mS_ymASiOxG4TozqyYTo9w-1; Fri, 11 Sep 2026 12:41:15 -0400 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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 829A21954B1D; Fri, 11 Sep 2026 16:41:14 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5AB321956095; Fri, 11 Sep 2026 16:41:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144879; 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=lNt+NcdfdrXTDAde4gaKYFts/kwAUEfykTyytEmPajw=; b=dJnSntP4qG7KHJEe0QNPHKm1aYbamlpSTcjDs7Upj/GKRCjLc0EYnql9hM5PqX/9Tr5hdl n+1b1rY2pj6jjmrmUw20WujU5mBK+r91zO8pc7ZCIjv4K1EkZiPJQZ0GJ0Ey9qkIZEcvKY Swjh7+kdAwCULLlAXG4dAbevUmq3syo= X-MC-Unique: mS_ymASiOxG4TozqyYTo9w-1 X-Mimecast-MFC-AGG-ID: mS_ymASiOxG4TozqyYTo9w_1789144874 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:35 +0400 Subject: [PATCH v5 61/62] tests/qmp-cmd-test: assert qapi-type resolves in query-qmp-schema MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-61-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Fabiano Rosas , Laurent Vivier X-Developer-Signature: v=1; a=openpgp-sha256; l=3468; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Mt67E9MU0ECVhSiFdrQC3amyYOINAVoLsnaOA5PKLXU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC290ksNehAvUIb0yu2n0PORNwr9iKo5JGHO0 6wvVXKm/rGJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtvQAKCRDa6OEJdZac 5RoDD/4qn5abF2P4cfEX2NoZhxPC6npkfqLqAwUKqZ3OQWgGNgR5rztWDyTscEjf+ToIl2Ro+We VV02RAa9djGnTGw577SJBo8ZDs2RiaY1HJTn/fkUunF/Kd7jaCoMdUTrhnuSq+4MF5Nb+aBqIdz TgcAXDlOdKMG4PPo9hoquAHi2+T0utWkMALFNSHo9O93hY37bTP8KeCfpVrf9uMvol/06Eu/j0a JShvckY6xzciLe5on7ZUCHQRYCq9JjvO7klaNACD4ZTFE/hVtfFUAEav9Xq9BI7UuZNMqusgM2P MfFnZiUNO+sw69qFiLkdADb9Q7l26AbEi5KET0XBgFBbwV+doJx22eKIz8fCZ+KXlnY34W/uGzu KmMA5bBX/WxoErl6ud0/VnInIN/LFfbortlNKwexinXTmpDnwCog6tBDAkq8UGGr7aQi9Q5RZ0+ oV7H6u/FGxi9t71fzRB35abGWRf7wV9ZmdRKD5NvvcCazqq9ge6PcJo5jbH74KRz+bYx8/B19wa 1++bKDJoQBvhGOpCPM/lYsq0Lj25h/bG6cKtVKJXIhaFRfsEeGBIrQHG999Jq5f40yhrxyJCMie xO0GiWHS2lGSw5LaQ29YxFj1bAdSLVitkuJLbuFQyIJ/zmSg7GaXt0gd4hTJ7yp4c76I9xmLwCa 3QgNlvpVp+v37cA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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.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: 1789145164716158500 For every QOM type returned by qom-list-types, call qom-list-properties and verify that each property's qapi-type value (when present) maps to a valid entry in the query-qmp-schema introspection output. The test is gated behind g_test_slow() since it iterates all registered QOM types. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/qmp-cmd-test.c | 55 ++++++++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c index 279a8f5614e9..acb7b0dd6a9f 100644 --- a/tests/qtest/qmp-cmd-test.c +++ b/tests/qtest/qmp-cmd-test.c @@ -15,6 +15,7 @@ #include "qapi/error.h" #include "qapi/qapi-visit-introspect.h" #include "qobject/qdict.h" +#include "qobject/qlist.h" #include "qapi/qobject-input-visitor.h" =20 const char common_args[] =3D "-nodefaults -machine none"; @@ -131,6 +132,8 @@ typedef struct { GHashTable *hash; } QmpSchema; =20 +static QmpSchema schema; + static void qmp_schema_init(QmpSchema *schema) { QDict *resp; @@ -343,9 +346,56 @@ static void test_object_add_failure_modes(void) qtest_quit(qts); } =20 +static void test_qapi_type(void) +{ + QTestState *qts; + g_autoptr(QDict) resp =3D NULL; + QList *types; + QListEntry *type_entry, *prop_entry; + + qts =3D qtest_init(common_args); + + resp =3D qtest_qmp(qts, + "{ 'execute': 'qom-list-types'," + " 'arguments': { 'abstract': true } }"); + g_assert(qdict_haskey(resp, "return")); + types =3D qdict_get_qlist(resp, "return"); + + QLIST_FOREACH_ENTRY(types, type_entry) { + QDict *type =3D qobject_to(QDict, qlist_entry_obj(type_entry)); + const char *name =3D qdict_get_str(type, "name"); + g_autoptr(QDict) props_resp =3D NULL; + QList *props; + + props_resp =3D qtest_qmp(qts, + "{ 'execute': 'qom-list-properties'," + " 'arguments': { 'typename': %s } }", + name); + if (!qdict_haskey(props_resp, "return")) { + continue; + } + props =3D qdict_get_qlist(props_resp, "return"); + + QLIST_FOREACH_ENTRY(props, prop_entry) { + QDict *prop =3D qobject_to(QDict, qlist_entry_obj(prop_entry)); + const char *qapi_type =3D qdict_get_try_str(prop, "qapi-type"); + const char *propname =3D qdict_get_str(prop, "name"); + const char *ty =3D qdict_get_str(prop, "type"); + + if (qapi_type) { + g_assert_nonnull(qmp_schema_lookup(&schema, qapi_type)); + } else if (!g_str_has_prefix(ty, "child<") && + !g_str_has_prefix(ty, "link<")) { + g_test_message("%s.%s %s has no associated qapi-type", + name, propname, ty); + } + } + } + qtest_quit(qts); +} + int main(int argc, char *argv[]) { - QmpSchema schema; int ret; =20 g_test_init(&argc, &argv, NULL); @@ -355,6 +405,9 @@ int main(int argc, char *argv[]) =20 qtest_add_func("qmp/object-add-failure-modes", test_object_add_failure_modes); + if (g_test_slow()) { + qtest_add_func("qmp/qapi-type", test_qapi_type); + } =20 ret =3D g_test_run(); =20 --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 20:01:29 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=1789145107; cv=none; d=zohomail.com; s=zohoarc; b=kXvGECNHsdkjxyUOM2ZeH2yaHIuRf1XqawYKbkjr6Gg8XZGDM0cQbqpkXlQ4frfZ5ZScAHD9FC3VqLro2aK8AWYhywD+lSEfZTmNNFkBaYZMmkWqemhUeWyxFwBKoWwJAtRj7XxLyTMhr/ELGXJE7ixbIqmqV/QUa9jmifCTdHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789145107; h=Content-Type: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=1wf+ZaNqzK9wfZCZMhyYKH8FlTyI6i370Yt222zEpII=; b=jMa3i/ult1aNu9iYGfeTrolvwoFmp78j+P0DlYPJxSvz2M06bc1WAAGrmFl6iBTy4dn/bfHsjclWUw2TQeXIBzv+SPSmt24ZXY1NDI7YhYzx412jsev5WhPuYvn1AIbqm4fcr8/MmRyGJ2Fp1aKywuP9+Vf7YopQ9/n8WalOPHA= 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 1789145107386689.0633492136881; Fri, 11 Sep 2026 09:45:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x54Jg-0007o7-GS; Fri, 11 Sep 2026 12:41:32 -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 1x54Jc-0007Xm-2x for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:28 -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 1x54JX-0007Mj-6K for qemu-devel@nongnu.org; Fri, 11 Sep 2026 12:41:25 -0400 Received: from mx-prod-mc-08.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-73-I6aaEsaDO6mGVxzAkSVKXA-1; Fri, 11 Sep 2026 12:41:19 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2155118011F6; Fri, 11 Sep 2026 16:41:18 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 56E4C180036E; Fri, 11 Sep 2026 16:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789144882; 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=1wf+ZaNqzK9wfZCZMhyYKH8FlTyI6i370Yt222zEpII=; b=HAUrMoFo7WEiaBTM4akUIhTkZJ853UO7sjvuP5VaTF5a5HYB+8OPG3qdyTbzy+SXUqa34I CVPAPmCX8XSaOkIUjGcIVHTTYt6Th3EWqBBV/LyALp3Vxh+9NZh9YzN7MxlJS68kNNazVV Cl3p4y2gQ/8pzAp2DoWw74UNh9VEx+4= X-MC-Unique: I6aaEsaDO6mGVxzAkSVKXA-1 X-Mimecast-MFC-AGG-ID: I6aaEsaDO6mGVxzAkSVKXA_1789144878 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 11 Sep 2026 20:35:36 +0400 Subject: [PATCH v5 62/62] qapi: select introspectable types directly MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-qom-qapi-v5-62-7732a55b7760@redhat.com> References: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> In-Reply-To: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com> To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Michael Roth , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=9672; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=3l7VhEaWRpQ+gnlEeTMg+ppu0Il4yvb3NhaK9k9PeXk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqpC29KHCofOlY5OUWdzaJIsTBpfL12FupyCABx 8FNwKzFvXqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaqQtvQAKCRDa6OEJdZac 5ag6D/4lYvIsK2XkzHc4vP/h00ldULp4Gf3/30l1u7iJ32PeZ+wXkpypita0hNEbdU0LJSuTsjM EvzDi+jPQkgbczBGMBz2aJ1lrdsW6EHYaOi5y3zLaBRkhO0uZcZo74XCqHECSoDJtWnaM8AnaEU r1h8u7Ce1l1t4Cu6dSpsUM3Ay2sqC4hPNYEBIb9Nhj9gJyKVk4k8Ip93m4NJD0FyI49XXvVTG7u tSPYveDC/t/D8+49pae03BkWEdqU1WQ61Ccmx/Nb6RWFr44AecUbkzpnYFmJGYxe2TyU2v+X9/y YoB3/8xNAIs5K+TQhB1qKDqfaPRANOL6wbYl2VKM4tmC3jsIgspVBq4JW8Gs0dLMLKv9k6iCwkZ PXzT8WQCtaR7jAuI+vh7P/441nQMHa6f+iySkyOvp0mD9xQ+OCo++JNFfGFfwkMVSqBzuB5KEUY eX0qd3tOAtseiDe2B/DvOKsSkqqYla9nfs7Lf/K0r2d3BczJeP9zS4ZgFPlSAqDEJbsupTuskAi zxv0UR5Ag9YVmBI4TWPpceoH68JSlODkHANN+YN2VOTqsy+C789EyMlo+EHxIWWkUvPBynEkFFT EdB674AhK28FqSgVGiWDDdE+qLnOgKVETBSj3h7qirmhVTVg1UvSbsLf6Yjpa8uzSXb+ED1oHxT bP1BJGc7K7QSXlA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=marcandre.lureau@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_H2=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: 1789145108467158500 With all explicit types exposed, introspection no longer needs a reachability walk. Mark the internal QType enum and inline union bases as non-introspectable where they are created, then collect eligible types and assign names in a single schema pass. Remove dependency traversal. Implicit argument objects and arrays remain included. Signed-off-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi/introspect.py | 4 +- scripts/qapi/schema.py | 16 ++++-- scripts/qapi/schema_analysis.py | 110 ++++++------------------------------= ---- 3 files changed, 29 insertions(+), 101 deletions(-) diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index e3749d38ced5..99eac5484528 100644 --- a/scripts/qapi/introspect.py +++ b/scripts/qapi/introspect.py @@ -202,7 +202,7 @@ def visit_begin(self, schema: QAPISchema) -> None: self._schema =3D schema =20 def visit_end(self) -> None: - # visit the types that are actually used + # Visit all introspectable types for typ in self._schema_types.types(): typ.visit(self) # generate C @@ -222,7 +222,7 @@ def visit_end(self) -> None: self._trees =3D [] =20 def visit_needed(self, entity: QAPISchemaEntity) -> bool: - # Ignore types on first pass; visit_end() will pick up used types + # Ignore types on first pass; visit_end() emits introspectable typ= es return not isinstance(entity, QAPISchemaType) =20 @staticmethod diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 8d88b40de2e1..10c5299bcf6d 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -323,6 +323,9 @@ def visit(self, visitor: QAPISchemaVisitor) -> None: =20 =20 class QAPISchemaType(QAPISchemaDefinition, ABC): + # Internal types without a separate wire representation opt out. + introspectable: bool =3D True + # Return the C type for common use. # For the types we commonly box, this is a pointer type. @abstractmethod @@ -1265,8 +1268,10 @@ def _def_predefineds(self) -> None: qtype_values =3D self._make_enum_members( [{'name': n} for n in qtypes], None) =20 - self._def_definition(QAPISchemaEnumType( - 'QType', None, None, None, None, qtype_values, None)) + qtype =3D QAPISchemaEnumType( + 'QType', None, None, None, None, qtype_values, None) + qtype.introspectable =3D False + self._def_definition(qtype) =20 def _make_features( self, @@ -1331,8 +1336,11 @@ def _make_implicit_object_type( # only be a duplicate definition, which will be flagged # later. else: - self._def_definition(QAPISchemaObjectType( - name, info, None, ifcond, None, None, members, None)) + typ =3D QAPISchemaObjectType( + name, info, None, ifcond, None, None, members, None) + # Inline union bases are flattened into the containing union. + typ.introspectable =3D role !=3D 'base' + self._def_definition(typ) return name =20 def _def_enum_type(self, expr: QAPIExpression) -> None: diff --git a/scripts/qapi/schema_analysis.py b/scripts/qapi/schema_analysis= .py index 1aad2dc80380..03804f60e0e0 100644 --- a/scripts/qapi/schema_analysis.py +++ b/scripts/qapi/schema_analysis.py @@ -10,129 +10,50 @@ Marc-Andr=C3=A9 Lureau """ =20 -from typing import ( - Dict, - List, - Optional, - Sequence, - Set, -) +from typing import Dict, List, Sequence =20 from .schema import ( QAPISchema, - QAPISchemaAlternatives, QAPISchemaArrayType, - QAPISchemaBranches, QAPISchemaBuiltinType, QAPISchemaEntity, - QAPISchemaFeature, - QAPISchemaIfCond, - QAPISchemaObjectType, - QAPISchemaObjectTypeMember, QAPISchemaType, QAPISchemaVisitor, ) -from .source import QAPISourceInfo =20 =20 class QAPISchemaTypeAnalysis(QAPISchemaVisitor): """Analyze types from a QAPI schema. =20 - Every non-builtin, non-array type is given a masked introspection - name (an integer string). + Every included non-builtin, non-array type is assigned an introspection + name. Names are masked as integer strings unless unmasking is requeste= d. """ =20 def __init__(self, unmask: bool): self._unmask =3D unmask - self._schema: Optional[QAPISchema] =3D None - # Ordered list + set: insert during iteration + O(1) check self._types: List[QAPISchemaType] =3D [] - self._types_set: Set[QAPISchemaType] =3D set() self._name_map: Dict[str, str] =3D {} =20 def visit_begin(self, schema: QAPISchema) -> None: - self._schema =3D schema self._types =3D [] - self._types_set =3D set() self._name_map =3D {} =20 - def visit_end(self) -> None: - assert self._schema is not None - # Discover type dependencies; the list grows as - # visiting each type registers the types it references. - for typ in self._types: - typ.visit(self) - - # Assign masked names now that all introspected types are known. - counter =3D 0 - for typ in self._types: - if isinstance(typ, (QAPISchemaBuiltinType, QAPISchemaArrayType= )): - continue - self._name_map[typ.name] =3D ( - typ.name if self._unmask else str(counter)) - counter +=3D 1 - def visit_needed(self, entity: QAPISchemaEntity) -> bool: - # Side effect: register all introspectable types now, so that - # visit_end() can traverse them to discover type dependencies. - if isinstance(entity, QAPISchemaType): - if (not entity.is_implicit() or - isinstance(entity, QAPISchemaArrayType)): - self._register_type(entity) - return False - return True - - def visit_command(self, name: str, info: Optional[QAPISourceInfo], - ifcond: QAPISchemaIfCond, - features: List[QAPISchemaFeature], - arg_type: Optional[QAPISchemaObjectType], - ret_type: Optional[QAPISchemaType], gen: bool, - success_response: bool, boxed: bool, allow_oob: bool, - allow_preconfig: bool, coroutine: bool) -> None: - assert self._schema is not None - self._register_type(arg_type or self._schema.the_empty_object_type) - self._register_type(ret_type or self._schema.the_empty_object_type) - - def visit_event(self, name: str, info: Optional[QAPISourceInfo], - ifcond: QAPISchemaIfCond, - features: List[QAPISchemaFeature], - arg_type: Optional[QAPISchemaObjectType], - boxed: bool) -> None: - assert self._schema is not None - self._register_type(arg_type or self._schema.the_empty_object_type) - - def visit_object_type_flat( - self, name: str, info: Optional[QAPISourceInfo], - ifcond: QAPISchemaIfCond, - features: List[QAPISchemaFeature], - members: List[QAPISchemaObjectTypeMember], - branches: Optional[QAPISchemaBranches]) -> None: - for m in members: - self._register_type(m.type) - if branches: - for v in branches.variants: - self._register_type(v.type) - - def visit_alternate_type( - self, name: str, info: Optional[QAPISourceInfo], - ifcond: QAPISchemaIfCond, - features: List[QAPISchemaFeature], - alternatives: QAPISchemaAlternatives) -> None: - for m in alternatives.variants: - self._register_type(m.type) - - def _register_type(self, typ: QAPISchemaType) -> None: - """Record a type for introspection (idempotent).""" - if typ not in self._types_set: - self._types.append(typ) - self._types_set.add(typ) - if isinstance(typ, QAPISchemaArrayType): - self._register_type(typ.element_type) + if isinstance(entity, QAPISchemaType) and entity.introspectable: + self._types.append(entity) + if not isinstance(entity, (QAPISchemaBuiltinType, + QAPISchemaArrayType)): + self._name_map[entity.name] =3D ( + entity.name if self._unmask else str(len(self._name_ma= p))) + return False =20 def masked_name(self, name: str) -> str: - """Return the masked name for a non-builtin, non-array type.""" + """Return a non-builtin, non-array type's assigned introspection n= ame. + + Return the original name when unmasking is requested. + """ assert name in self._name_map, \ - f"type '{name}' was not registered or is builtin/array" + f"type '{name}' has no assigned introspection name" return self._name_map[name] =20 def introspection_name(self, typ: QAPISchemaType) -> str: @@ -141,7 +62,6 @@ def introspection_name(self, typ: QAPISchemaType) -> str: return typ.name if isinstance(typ, QAPISchemaArrayType): return '[' + self.introspection_name(typ.element_type) + ']' - assert typ in self._types_set return self.masked_name(typ.name) =20 def types(self) -> Sequence[QAPISchemaType]: --=20 2.55.0.543.g5ebe2ebe4ea8