From patchwork Mon Jan 11 23:57:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 360692 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp3292849jai; Mon, 11 Jan 2021 16:01:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyofX0yIHNrqBjI2oBIfrQKjkhFHQqsOGSKBBIKCF3v6W6toGHr7U81Neo+aXpBUgJTOeiW X-Received: by 2002:a25:6902:: with SMTP id e2mr3178143ybc.97.1610409691340; Mon, 11 Jan 2021 16:01:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610409691; cv=none; d=google.com; s=arc-20160816; b=Q7t6gr9NdgwoyKTobXHRsTHIKpo1P43PrsIn1Pv/rjF4LcgTNWwEkVQSZmHxwYU2z7 sp2HhgzULQCoyyhlGT5k+WK14dxMokMbhTeAuyeXR8D6VC6yMnZa51AUQmAhV3R7L5Dv qR74Qc18+XQ+mvO5K73LTqzHwPyBQTTr0WD66ZkiFXWYw9bdvCvbna6QDPI2wwxDRk73 k5i1BVaw9JN6UwNh47sVSOboJkh3uSb3n4wUlRkMSBAD/knWB/tOfa7i70HCtqpIOed6 qHQT738H+EOUROpaqZ1csvPajqTlV74qbK2daCVyNstUc3YmFYYfUO6KbpqauLXMCLVY 56/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=uSqBlmmaV2nVJPAfpMvtZ9TuNPcVPPBGEyURqCr9eR8=; b=ukKYZUvbcLRkqJtHG4RZAdAH3K3dxVwWt5gD9CrTkZQW0QzdZBFE+IbAioN2f/kUjm dLWZcs5cj6rZRvAfHhmaQNTMmY+ogopP3OXbE3+hVRm31bm21vjL7lRitUcl/oKfRhHV m4QANMo+rIRDZgo9tWeNcsIKJXBmdVg800nLA5gcVaCx5dufashdJ6x0N/IeYJ0Xp+SO rOIzDddUnLnypyDmsIIj7Hlr1FGkJQAzhfA22okphmi7IYjuD92WHE/QLIu5zwKyGhSe zfvr2UZBhpuhZ67cICcNSCeRPShSsGN0owL87jY0vBwBRaEy5f55CeMYdIHh3EFARyoE Ph1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CRTRbErT; 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=fail (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 y16si1224468ybr.22.2021.01.11.16.01.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jan 2021 16:01:31 -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=fail header.i=@linaro.org header.s=google header.b=CRTRbErT; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kz77q-0000ts-Qr for patch@linaro.org; Mon, 11 Jan 2021 19:01:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kz74M-0005Tj-NN for qemu-devel@nongnu.org; Mon, 11 Jan 2021 18:57:55 -0500 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:39654) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kz74K-0003W3-3H for qemu-devel@nongnu.org; Mon, 11 Jan 2021 18:57:54 -0500 Received: by mail-pg1-x532.google.com with SMTP id 30so218665pgr.6 for ; Mon, 11 Jan 2021 15:57:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uSqBlmmaV2nVJPAfpMvtZ9TuNPcVPPBGEyURqCr9eR8=; b=CRTRbErTNODBug8HUhEufRXM0LFFPOgyd/FFOsAp7DwXzHbzeAzvFbUQl617faWuVZ vCXGHbzXUYk8qGLXh49EdFtGADBs70lUXjCI4PrMvSBqa79QLzH5+4YsubK0ywK+g3Rg /xJf43mRWig5c+nrC1j0GZlFPiVNgwAfjquXn3Q2qOytJWZLbbE9DQYiRkqoSI0bOsUR KlffeN9RokTJOV/94dPahkIBOVugEIPePSYzA0eXfTBDRnHf7ZMqim/ha6n+bFPXjkOn zKflrdLKSJNJtnnVYka3iwbHueQrDkZrHgI4QvEjdMlv9cLWPLwotFLEnFXeX83lQdpk SBuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uSqBlmmaV2nVJPAfpMvtZ9TuNPcVPPBGEyURqCr9eR8=; b=Fh2tEqvbXaMaQe9NgNjM7Z+yTs4DQzelZK8T1CKP6/9uOgedrePMFGv0uPe4ovN9Pk W8/PmzZWTPEtKR7nr4Y2cAkz51ENqVGwmNITPH5mjoVwQ37xTH6U9z348khVogl3ark/ CqILt1uZxuPMcZOtNlHhN9V6LSIMZ+axIP+Q5mOjh7i+oTeYcUw62opWBPvm60L5wlxk e5Y47fO5mBp+DCOtmS/rV7wYGu/gCRoB7DLvjiXoWMWS1t80o8p7GuptaLLzY5YvdfEp X0bBuE8q1mri0l22eO2YDVm0ikp+tQdRUoOCqjIpvoIi5Lyase86y/9W+5IAtpuv2e/6 gfFA== X-Gm-Message-State: AOAM532r/OGTMeNxLsix7WHmRm9R8uECwslYOkkTFEmlpZaSyNpnlgvx uAn+90762peiM46RlL483j1A3Cb7wPUsKw== X-Received: by 2002:aa7:9706:0:b029:19d:a2c6:aeb with SMTP id a6-20020aa797060000b029019da2c60aebmr1788490pfg.36.1610409469678; Mon, 11 Jan 2021 15:57:49 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id s67sm872220pgb.60.2021.01.11.15.57.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 15:57:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 3/3] target/arm: Use object_property_add_bool for "sve" property Date: Mon, 11 Jan 2021 13:57:40 -1000 Message-Id: <20210111235740.462469-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210111235740.462469-1-richard.henderson@linaro.org> References: <20210111235740.462469-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Andrew Jones , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The interface for object_property_add_bool is simpler, making the code easier to understand. Reviewed-by: Andrew Jones Signed-off-by: Richard Henderson --- target/arm/cpu64.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) -- 2.25.1 diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index d9feaa9cdb..8e1fad00bb 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -488,6 +488,12 @@ static void cpu_max_set_sve_max_vq(Object *obj, Visitor *v, const char *name, cpu->sve_max_vq = max_vq; } +/* + * Note that cpu_arm_get/set_sve_vq cannot use the simpler + * object_property_add_bool interface because they make use + * of the contents of "name" to determine which bit on which + * to operate. + */ static void cpu_arm_get_sve_vq(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { @@ -529,26 +535,17 @@ static void cpu_arm_set_sve_vq(Object *obj, Visitor *v, const char *name, set_bit(vq - 1, cpu->sve_vq_init); } -static void cpu_arm_get_sve(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static bool cpu_arm_get_sve(Object *obj, Error **errp) { ARMCPU *cpu = ARM_CPU(obj); - bool value = cpu_isar_feature(aa64_sve, cpu); - - visit_type_bool(v, name, &value, errp); + return cpu_isar_feature(aa64_sve, cpu); } -static void cpu_arm_set_sve(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void cpu_arm_set_sve(Object *obj, bool value, Error **errp) { ARMCPU *cpu = ARM_CPU(obj); - bool value; uint64_t t; - if (!visit_type_bool(v, name, &value, errp)) { - return; - } - if (value && kvm_enabled() && !kvm_arm_sve_supported()) { error_setg(errp, "'sve' feature not supported by KVM on this host"); return; @@ -563,8 +560,7 @@ void aarch64_add_sve_properties(Object *obj) { uint32_t vq; - object_property_add(obj, "sve", "bool", cpu_arm_get_sve, - cpu_arm_set_sve, NULL, NULL); + object_property_add_bool(obj, "sve", cpu_arm_get_sve, cpu_arm_set_sve); for (vq = 1; vq <= ARM_MAX_VQ; ++vq) { char name[8];