From patchwork Tue Jan 3 18:16:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 638734 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp1391284pvb; Tue, 3 Jan 2023 10:19:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXtxUbWiNK7xhfCuuiGRCKa0pFDIoEjeRdVQX2+zbZM+aEbXu2qt2Kx/BzcYZbfPTnmP0FCJ X-Received: by 2002:a05:622a:489b:b0:3ab:7391:28b with SMTP id fc27-20020a05622a489b00b003ab7391028bmr51729973qtb.6.1672769994324; Tue, 03 Jan 2023 10:19:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672769994; cv=none; d=google.com; s=arc-20160816; b=BBxBlOeBm3vT/azVoaSDEqbLoORoU2On5n23sHs0SYByi8VYqu9auVzLNWLWz/Lm7q Tqo9Ebzyw2x4j+5a8p4eOyLr6dzlK9ozWphU8fyZ83CbohgQz9AJlC+42P5vqzUZBPqp jKTjpXBGfgCkQaoLmcGKoxv4NDnSTyBPklteIhklCg7bz4yNxO4wG37vcz8vbq9UYFv+ xaScvg3pAWQBZdvFKpXDrp73i02vI0Gj/ZthAz2w6obRt3y80sO71TnpziLraMIJh75l +TApisfx+DJmgKTd2+gE9sCFCUp0WMFeFyJYd93+6hfJAbTTkf1RlhtV6Tv7AmOD9A0f sX6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0vUlG5Ud9gfVE8ISNFj2vMxvaEfoXG4adPrIDOgAWpM=; b=Y7gHoZKN7nxaKXNQ3cgoDRC59MlcFE0Z8Vf56e5bOJ7lKlCmUHsfo7TvSapQ3calcp m3PZA6msn9CiUTVF5mgP6jPuEDTL5TIZfgt16bi4m8fkuL8Y0rpfMokclQK3F+G1QC9k 35i+wCqJfAy+v7xGHrrEViwqBGdDu2V0LERhMxREiQQz0Gj4GLH+kdCWSu3LpahL1+LK cGy4acQ6X5ASvfru/JWgifmpZBngqMxVcCgCUGA///CpaURRybslbeBhjsCMBpWB0Hd/ SZ+zSGElXgeqiw5gQpegOMMZ9BxA8ST4tv2QiTQv2XcZ+qw3A0kDESQa3DBCAZ1jRLN8 q3QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qb5JqUdO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id cg10-20020a05622a408a00b003a51fd42972si17271374qtb.184.2023.01.03.10.19.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Jan 2023 10:19:54 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qb5JqUdO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pClrn-0000h9-MN; Tue, 03 Jan 2023 13:18:27 -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 1pClrk-0000cJ-Ua for qemu-devel@nongnu.org; Tue, 03 Jan 2023 13:18:24 -0500 Received: from mail-qt1-x829.google.com ([2607:f8b0:4864:20::829]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pClrj-0005Me-BL for qemu-devel@nongnu.org; Tue, 03 Jan 2023 13:18:24 -0500 Received: by mail-qt1-x829.google.com with SMTP id j16so25184737qtv.4 for ; Tue, 03 Jan 2023 10:18:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0vUlG5Ud9gfVE8ISNFj2vMxvaEfoXG4adPrIDOgAWpM=; b=Qb5JqUdO+0jgMkLu9NdZScsS6ukOhvJm5ypSYKijz+bPpBayRdDJl0XwKuoOVSTueu d73jeLtqc/jJSfGsNzrPZrr2SuBbBvHske3nycV/SkHxjGUAxZNWGtubj6RoXMHob/yT kQAE4oOHyMg97ROv627d7yAde/PVliFZzOKBXVQZ6w7dC4KMr1UjcA3OO7B4fzKZZunD NPOrWr9df7Pt+hjnDBF67q6BLIjJO/RYdVUJ6/HqdmapACLX/+E/wm3wXrwg6thQB0vM UDi6yOqitKpMF3kr7u7ocBMo/Yx6z8E4ysb/y73l5UZ9+CI+INJ7xvmlv61FWkMDZHUN Trsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0vUlG5Ud9gfVE8ISNFj2vMxvaEfoXG4adPrIDOgAWpM=; b=3L6+ezkGp7uCJTjTObyc+ThwCi+fs/kURrsOIXdQ35BLwkehRplmwZ2UBgPNFt2lJX xdqUGsCn08Hz+XAfXOrc28KTq7Y8eD9jbH4Q1/xRztFfAZTbNDmHPwTE/klKjOvLPCLi UivohRBWzPe/Ou+rO2Gk1Q2ynoUf1lc+X37GR1/EIpGqSZV5XHWhT2i95tF0xjO9Z/Xg snTZk44k2cgaLwZ03CkbLc0hPs0EDcdr0Us+8l8dXK9w4k8FuefNkBrystRaoUA/p5Ub wg/SiOvg8WerWfvH1XZrq80u6BFTLEMvZ/mXBM18r9wCOV176ESlJ9rOLZcpPcQ3VwRn haig== X-Gm-Message-State: AFqh2kowWBK6uGwDORpl6nI0xD10Bzm4Z3gsPZ/6RcpMZEyg/z8kTMEK 2/hjj6qJ0cAWiVo9wlDMs31YMLEuSuPAIYJgzqY= X-Received: by 2002:ac8:7513:0:b0:3a8:2e90:f7d4 with SMTP id u19-20020ac87513000000b003a82e90f7d4mr64999218qtq.27.1672769902261; Tue, 03 Jan 2023 10:18:22 -0800 (PST) Received: from stoup.. ([2607:fb90:8060:51a2:184b:6e49:c396:be2]) by smtp.gmail.com with ESMTPSA id v2-20020a05620a440200b006fed2788751sm23042354qkp.76.2023.01.03.10.18.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 10:18:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, berrange@redhat.com, eduardo@habkost.net, armbru@redhat.com, ajones@ventanamicro.com, alex.bennee@linaro.org Subject: [RFC PATCH 31/40] target/arm: Get and set class properties in the monitor Date: Tue, 3 Jan 2023 10:16:37 -0800 Message-Id: <20230103181646.55711-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230103181646.55711-1-richard.henderson@linaro.org> References: <20230103181646.55711-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::829; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x829.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Setting is not actually functional here, because it is always done after the creation of the first object, and so will generate an error. But at least it's a different error than 'Property not found'. Signed-off-by: Richard Henderson --- target/arm/monitor.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/target/arm/monitor.c b/target/arm/monitor.c index ecdd5ee817..262785e713 100644 --- a/target/arm/monitor.c +++ b/target/arm/monitor.c @@ -89,7 +89,7 @@ QEMU_BUILD_BUG_ON(ARM_MAX_VQ > 16); * will attempt to set them. If there are dependencies between features, * then the order that considers those dependencies must be used. */ -static const char *cpu_model_advertised_features[] = { +static const char * const cpu_model_advertised_features[] = { "aarch64", "pmu", "sve", "sve128", "sve256", "sve384", "sve512", "sve640", "sve768", "sve896", "sve1024", "sve1152", "sve1280", @@ -159,7 +159,7 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, } } - obj = object_new(object_class_get_name(oc)); + obj = object_new_with_class(oc); if (qdict_in) { Visitor *visitor; @@ -175,7 +175,10 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, i = 0; while ((name = cpu_model_advertised_features[i++]) != NULL) { if (qdict_get(qdict_in, name)) { - if (!object_property_set(obj, name, visitor, &err)) { + ClassProperty *cp = class_property_find(oc, name); + if (cp + ? !class_property_set(oc, cp, visitor, &err) + : !object_property_set(obj, name, visitor, &err)) { break; } } @@ -207,12 +210,20 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, i = 0; while ((name = cpu_model_advertised_features[i++]) != NULL) { ObjectProperty *prop = object_property_find(obj, name); - if (prop) { - QObject *value; + QObject *value = NULL; + if (prop) { assert(prop->get); value = object_property_get_qobject(obj, name, &error_abort); + } else { + ClassProperty *cprop = class_property_find(oc, name); + if (cprop) { + assert(cprop->get); + value = class_property_get_qobject(oc, name, &error_abort); + } + } + if (value) { qdict_put_obj(qdict_out, name, value); } }