From nobody Tue Feb 10 19:23:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; 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=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1770692430; cv=none; d=zohomail.com; s=zohoarc; b=gwIq33TKg6GF4x2KcwfBD6aC/GnB0RJaBxAQu0QfsLKhwbBihTi8fRq78XV2F31M7T7nzmodqLFv85aWl064Nvj3V34JvcwDmjYHxAq9uHk7WzLKiiXck9ihLYF65cj2mkmjoZ8jHXykE7PV9XicrUo+WlU0gtkbc6W7m9AavhY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770692430; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ebfbHUYVeixhiBbjWRqUJRiVpGIifD9K1apjDFSuCLg=; b=hD1kAPb8pxtQMvhLzVdltLSEQRADwgrbMaweCBp043VshvfNyY69HwkdqVu3XN0o1RzAJQilLb5uF76eumOIQPyWhAKo7PCh8H4z27wfBFEPhTCqVta0fhF8Lbrt78tQWxt3ZraL/kYtdD0tsIfLY+964Fbkf7p7514E825n+o8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770692430945528.3295693006239; Mon, 9 Feb 2026 19:00:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vpdxs-000708-5K; Mon, 09 Feb 2026 21:59:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vpdxq-0006xL-0Y for qemu-devel@nongnu.org; Mon, 09 Feb 2026 21:58:58 -0500 Received: from mgamail.intel.com ([198.175.65.14]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vpdxo-00049n-7i for qemu-devel@nongnu.org; Mon, 09 Feb 2026 21:58:57 -0500 Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2026 18:58:53 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.39]) by orviesa008.jf.intel.com with ESMTP; 09 Feb 2026 18:58:48 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770692336; x=1802228336; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YNyb/e63nn9O7NosP48x3bb0jJDEX6gcU+lAI5zDmV0=; b=f1xZ6l/uqN5juZVhnGP93MSYObXwtABIA0TNQ3pQntJMU40FrRZKi/5q XmTSglYH/KjgYfsvPn1pdCJxnzwCTxcMcYCU49ZZb1Xub4fe1ZCyaLIrq Wlvk0H7+PmM/hd/zcYoZXfSwwL81TPX0kYtW3XLtUrG7YIyeevOsaxo81 bvFF+jg4QCpQOB7ewl6BEI/Q7nuJsXvkYoq+GaFN4BdAt4lddBl3Wo60H wUh6OjMANPeaEfgEx8yYdjeAj8j0kpQf4eQbLgruLG4vBcvTvvWtYapxP vVQG2UowbbiBt8F78U2fiozhxAGQIsQ1M7FaIaRz7fYAKEqITc2xZXPxB Q==; X-CSE-ConnectionGUID: 6nQEATuuQgO4X4bAqojWOQ== X-CSE-MsgGUID: WRqUruB7RVWKSr7Den66tg== X-IronPort-AV: E=McAfee;i="6800,10657,11696"; a="75659874" X-IronPort-AV: E=Sophos;i="6.21,283,1763452800"; d="scan'208";a="75659874" X-CSE-ConnectionGUID: oO+KYwW8RCqr4J9DDEk/fA== X-CSE-MsgGUID: sW9euM07SAeKSoWUTl8kcw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,283,1763452800"; d="scan'208";a="211800570" From: Zhao Liu To: Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Eduardo Habkost , Markus Armbruster , Thomas Huth , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Cc: Richard Henderson , Peter Maydell , "Michael S . Tsirkin" , BALATON Zoltan , Mark Cave-Ayland , Pierrick Bouvier , Zide Chen , Dapeng Mi , Zhao Liu , qemu-devel@nongnu.org, devel@lists.libvirt.org Subject: [PATCH v2 08/21] qom/object: add from_user argument in object_property_parse() Date: Tue, 10 Feb 2026 11:23:35 +0800 Message-Id: <20260210032348.987549-9-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260210032348.987549-1-zhao1.liu@intel.com> References: <20260210032348.987549-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=198.175.65.14; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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 @intel.com) X-ZM-MESSAGEID: 1770692432445154100 Content-Type: text/plain; charset="utf-8" Currently, object_property_parse() is used for both internal property settings and external user configurations (e.g., via HMP or global properties). To properly manage property flags (specifically OBJ_PROP_FLAG_USER_SET), it is necessary to identify the source of the property setting. Update object_property_parse() to accept a 'from_user' argument and set the USER_SET flag for the property if 'from_user=3Dtrue'. As a first step, all existing callers are updated to have 'from_user=3D false'. Next the cases set by specific external user will be identified (like HMP and global properties) and will update 'from_user' argument to 'true'. Signed-off-by: Zhao Liu --- hw/i386/sgx.c | 2 +- include/qom/object.h | 5 +++-- qom/object.c | 20 +++++++++++++++----- qom/qom-hmp-cmds.c | 2 +- system/vl.c | 2 +- target/i386/cpu.c | 4 ++-- 6 files changed, 23 insertions(+), 12 deletions(-) diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c index 5e792e8e6e96..8cb71be689ff 100644 --- a/hw/i386/sgx.c +++ b/hw/i386/sgx.c @@ -316,7 +316,7 @@ void pc_machine_init_sgx_epc(PCMachineState *pcms) =20 /* set the memdev link with memory backend */ object_property_parse(OBJECT(dev), SGX_EPC_MEMDEV_PROP, - list->value->memdev, &error_fatal); + list->value->memdev, false, &error_fatal); /* set the numa node property for sgx epc object */ object_property_set_uint(OBJECT(dev), SGX_EPC_NUMA_NODE_PROP, list->value->node, &error_fatal); diff --git a/include/qom/object.h b/include/qom/object.h index 1b77429aa28b..c78e1c03a106 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1655,14 +1655,15 @@ bool object_property_set(Object *obj, const char *n= ame, Visitor *v, * @obj: the object * @name: the name of the property * @string: the string that will be used to parse the property value. + * @from_user: whether the property is being set by a external user. * @errp: returns an error if this function fails * * Parses a string and writes the result into a property of an object. * * Returns: %true on success, %false on failure. */ -bool object_property_parse(Object *obj, const char *name, - const char *string, Error **errp); +bool object_property_parse(Object *obj, const char *name, const char *stri= ng, + bool from_user, Error **errp); =20 /** * object_property_print: diff --git a/qom/object.c b/qom/object.c index 75a1fe7ea1d3..7140e3f629aa 100644 --- a/qom/object.c +++ b/qom/object.c @@ -460,7 +460,7 @@ bool object_apply_global_props(Object *obj, const GPtrA= rray *props, continue; } p->used =3D true; - if (!object_property_parse(obj, p->property, p->value, &err)) { + if (!object_property_parse(obj, p->property, p->value, false, &err= )) { error_prepend(&err, "can't apply global %s.%s=3D%s: ", p->driver, p->property, p->value); /* @@ -882,7 +882,7 @@ bool object_set_propv(Object *obj, const char *value =3D va_arg(vargs, char *); =20 g_assert(value !=3D NULL); - if (!object_property_parse(obj, propname, value, errp)) { + if (!object_property_parse(obj, propname, value, false, errp)) { return false; } propname =3D va_arg(vargs, char *); @@ -1802,13 +1802,23 @@ int object_property_get_enum(Object *obj, const cha= r *name, return ret; } =20 -bool object_property_parse(Object *obj, const char *name, - const char *string, Error **errp) +bool object_property_parse(Object *obj, const char *name, const char *stri= ng, + bool from_user, Error **errp) { Visitor *v =3D string_input_visitor_new(string); - bool ok =3D object_property_set(obj, name, v, errp); + bool ok; =20 + ok =3D object_property_set(obj, name, v, errp); visit_free(v); + + if (!ok) { + return false; + } + + if (from_user) { + ok =3D object_property_set_flags(obj, name, + OBJ_PROP_FLAG_USER_SET, errp); + } return ok; } =20 diff --git a/qom/qom-hmp-cmds.c b/qom/qom-hmp-cmds.c index 32e40630c96a..6bdb241e54bd 100644 --- a/qom/qom-hmp-cmds.c +++ b/qom/qom-hmp-cmds.c @@ -58,7 +58,7 @@ void hmp_qom_set(Monitor *mon, const QDict *qdict) error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", path); } else { - object_property_parse(obj, property, value, &err); + object_property_parse(obj, property, value, false, &err); } } else { QObject *obj =3D qobject_from_json(value, &err); diff --git a/system/vl.c b/system/vl.c index aa9a15504174..6d8167a50006 100644 --- a/system/vl.c +++ b/system/vl.c @@ -1708,7 +1708,7 @@ static int object_parse_property_opt(Object *obj, return 0; } =20 - if (!object_property_parse(obj, name, value, errp)) { + if (!object_property_parse(obj, name, value, false, errp)) { return -1; } =20 diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 0a7b884528ea..94a9dcde1eb1 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -8089,7 +8089,7 @@ void x86_cpu_apply_props(X86CPU *cpu, PropValue *prop= s) continue; } object_property_parse(OBJECT(cpu), pv->prop, pv->value, - &error_abort); + false, &error_abort); } } =20 @@ -8112,7 +8112,7 @@ static void x86_cpu_apply_version_props(X86CPU *cpu, = const X86CPUModel *model) =20 for (p =3D vdef->props; p && p->prop; p++) { object_property_parse(OBJECT(cpu), p->prop, p->value, - &error_abort); + false, &error_abort); } =20 if (vdef->version =3D=3D version) { --=20 2.34.1