From patchwork Wed Dec 16 22:12:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 344529 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp651318jai; Wed, 16 Dec 2020 14:18:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJyckOZa3P9T9QSdXuFyey0JkPSvdVG+m98xYwYWT4UXNFFao2h99z8T1pO/KeNJpjFTD+Gj X-Received: by 2002:a25:ab30:: with SMTP id u45mr31592180ybi.516.1608157103950; Wed, 16 Dec 2020 14:18:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608157103; cv=none; d=google.com; s=arc-20160816; b=0wwO5n8hyHWlv1t/bUjA2qjxdqrD9gkpDeAT5f8Fo87IMo1TjXmOe3UShJThkWDuPb O+R43xmH7D4TsSsuUiLNFOO48lSVe0qU5ECC0W+QwxCvEdpNhEnbSu7pfnxi20ubV0at DJC7q6w8/hGTkcNz+QvjrBCFwruWKWGCgJtKY5RLeYjf9Hf6xtZsPLgUdiyA8LqOaQgA cqD9B/yd8ED0fr542J7ByErEm2l0rR0hM6/ZSOmqjE0yfUeBh20MuqVKa7GU25hxjvym sxKRgBFQyrpbWZ9URLOQ59LFywISFLqf1imtxOFftNFXbBEntaQKtcN8yxmcWc+MeofA qwnQ== 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=OlcGKUC/BTsSJC/H2XV4cjb+IwaobCXiJwWyzAjFBAkiSRTMBfuTIPu6X4fCVG61Aa C32bVwlQ3GA8TZeWsgGXLAVDyjM0hLnQv6nIZlpHkmVYKbgUInKE4wSmeoMcu9vUY2cw cNLt7mLDdM0w+3Le1fgiMLI/qzV3DSXnfT5RiPk57CxPspijYzJnEEWB58q/m2e5NLnO 7w5u0Tz/JJ8rrrumytBN6wUcziulS9w4xQCOum4oDlbcZlczC91Ed7zkoaym+bvrEDPi s0175aTH8o68A4mQqBgq5eTTo7N7Y6WolfLemRkb+olLLmc1UxC/PVJtwElt14gUwtO+ wT0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dxIOMBqK; 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 q4si2476011ybc.259.2020.12.16.14.18.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Dec 2020 14:18:23 -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=dxIOMBqK; 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]:60396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpf7n-00062S-Bq for patch@linaro.org; Wed, 16 Dec 2020 17:18:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpf2c-000396-1H for qemu-devel@nongnu.org; Wed, 16 Dec 2020 17:13:03 -0500 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]:32823) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpf2V-0006D6-1t for qemu-devel@nongnu.org; Wed, 16 Dec 2020 17:13:00 -0500 Received: by mail-ot1-x32b.google.com with SMTP id b24so7452205otj.0 for ; Wed, 16 Dec 2020 14:12:54 -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=dxIOMBqKO4N9R61S6AxF8v+m7P/6y+HQXgn3JZPl3QG6O29um/a5KZ3aSQqGBfX7H6 o/UaRPzhrpF3RlDMY1REFd/GViPEt64E5KrHTNW7v7qSj/8DdH6aJxLsSic/4s4kk1HP lbEOFSEfy9+IXZMyaQ/UFCn0Y2k22oi3i+rhkXsjESL5LxB8Q4fADjI2ZupIFZ1DGzgi 4D616msUMuwLOZ9i3r6iIftqznGBLI3H3AVg/Fqm+zI/ECo8BfLBlpf3fOXEk7nq60h3 d426sKQKnGFS1PGkuKErLBeWKP1Dicy9pVjzZnua669PtO9K8WsCy8a6atphuneO+wHb 2usQ== 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=fLEWUykEhSfajKe/cxorLdm0oC0huo2l0nQilq6aqazGhSvooGSmGHBHPSxO1Vs9CQ IwuhFXDaqUnueCFO1rvFi7JGRpT0OZZaIL1QqCjq031XgDLMeNY/VzUASgr4WPSSvOHq cXnodGcDeL/UWbbbWD5k0wWe+Lub/Y3mj8zW/UYTvArIZzxYLFJhvntcm/GcxQCKOWS4 XXBWyWdLekZYuJSXDTR9mYlzwXfuu5Kz7DtL5MxmAvxMM5YGsSZ8VYruemoKHN6elfBh K7y/cPVyytfeMqVlDpSfxylrRxflIRqhKCd7BQgpNwGnPQ768SaPpIeBfUeSKEkrEjPU sx1A== X-Gm-Message-State: AOAM531rwokPhjENEGN0C7SvgAX3lFJKTXjWD6O9kZSYa/VOdcGazrXe 9R2ZZ3Kg1gC4siHVKuWwhQE1xrFs6DgO3cuO X-Received: by 2002:a05:6830:90f:: with SMTP id v15mr26891399ott.223.1608156773666; Wed, 16 Dec 2020 14:12:53 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id z9sm758965ote.13.2020.12.16.14.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Dec 2020 14:12:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 3/3] target/arm: Use object_property_add_bool for "sve" property Date: Wed, 16 Dec 2020 16:12:47 -0600 Message-Id: <20201216221247.522686-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201216221247.522686-1-richard.henderson@linaro.org> References: <20201216221247.522686-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32b.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.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 Reviewed-by: Philippe Mathieu-Daudé 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];