From nobody Thu Nov 14 07:15:28 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1692139160; cv=none; d=zohomail.com; s=zohoarc; b=Q1LxA1RwWi+jusOepZJDhpuzBkX8n04O4NtmItKVyturyv5i/6HB5+Meo5eP4eyTfTvY0/bed1Zt1y/De9Jjitv4lwih1z5NBWw9pu9A7GZIPedeHgYjKJdTfgqdvo+hEo7Mdn4LI13rjhHObyju/HLs7G6PwU72L1xaf9+UQhY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692139160; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SBT3xPmW4aLd290yWQMEvBlcruF1kLAk2oFCE88UVBQ=; b=VbmE9mEMx+eQljoJ4nicazfO9avxo+f0Dt+p/CYFWiPaFHOfJT5WYaBIsVLLPQ2Gfp+YIBGsj+oyWPkUUf0jhvKnG1kpp822c8jeIBlfzfePHMHDqOb5N3jCb9DlENKrdsTwj5w2EIiqZhw8lXVc+oVQMd8UugmBgiwp4qd9b18= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1692139160797316.56481733004375; Tue, 15 Aug 2023 15:39:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW2g8-00054X-GP; Tue, 15 Aug 2023 18:38:20 -0400 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 1qW2g6-00050v-VF for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:18 -0400 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW2g3-0006FY-QB for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:18 -0400 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3a7f74134e7so2331866b6e.1 for ; Tue, 15 Aug 2023 15:38:13 -0700 (PDT) Received: from grind.. (189-69-160-189.dial-up.telesp.net.br. [189.69.160.189]) by smtp.gmail.com with ESMTPSA id be15-20020a056808218f00b003a40b3fce01sm5903418oib.10.2023.08.15.15.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 15:38:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692139092; x=1692743892; 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=SBT3xPmW4aLd290yWQMEvBlcruF1kLAk2oFCE88UVBQ=; b=nso7y5GY/rZYBgLZTkjBR1EQW/uSFZwnLy2mL1Ebs+XVojAXg4/VdYknWjNzxKhGmQ HdIZ41VtgSFnmLKGed6LKC5hZWbpSwhx1UAnN3Kdc23F5RpMMTblVqaN6sye2mY6C/qO OQgApCb5JNLCfQz7PQBQ6datA1gDVOw4lY0Jdy34oO3+1unXgxD24qs8e6bGrtuu3nsk bwak86G/tGROH5OJvKpN7Fd23pvuhLq2CgYcOgqLzcrJDInTwGAUPJyMcb+ejFn/bBZl 9PtEOYeiTlirZLAZoMG4g8eW+0M8pI4dx2AfBVkFcvPhfL7XvLz1ZLmlclw6+LWtDFUY C7tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692139092; x=1692743892; 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=SBT3xPmW4aLd290yWQMEvBlcruF1kLAk2oFCE88UVBQ=; b=DbMJkcZqPY/dw1SUFV+G+UsOrddLx6c1hkOXFJUQ5zNpv1LcZKwlyCqRDLm5IiyMzq Rlt9y0Mq773awIecuVide+isbsp16cXJbUFFoYUTFF7nAX9tK5fcbaJ2MJoaIKiqpyiN X1Yis8GR3nSPWfF8VWkGU5pWjwoYRlZoRKwWpZR+oqwPi+UdifqwiMwA2LksyQUogGNq GoMZUdnG7wGvcrLRhezrUOtMjhlWqfHIXcIZu22FiWJV/bKW1axwYfaTrxlv9ztHWj5B MBBJNkoEukJ/OjK3ZiLioeVj1mecsUzZ0gYYiLTgRdOSvqSrHd9ws+i724h58M5JMYUo UzKg== X-Gm-Message-State: AOJu0YziPQnrtBVseWjUsroSxQaFFAhlaCYMSxY/Vy5yScC3wE+WQ7xe 6TzlQwk/vkXeKvoX/1CIgfgUTUfEIrKSOk3c4iE= X-Google-Smtp-Source: AGHT+IEFOYm/eojdn+ocGQ9ZgNpyBHFlBhWh1I/ym4wWuGtNw9qz4afzVSprMP700cXWg+fqPH3ntA== X-Received: by 2002:a05:6808:bd2:b0:3a7:44a1:512c with SMTP id o18-20020a0568080bd200b003a744a1512cmr69382oik.5.1692139092784; Tue, 15 Aug 2023 15:38:12 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v8 08/12] target/riscv/cpu.c: add riscv_cpu_add_kvm_unavail_prop_array() Date: Tue, 15 Aug 2023 19:37:37 -0300 Message-ID: <20230815223741.433763-9-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815223741.433763-1-dbarboza@ventanamicro.com> References: <20230815223741.433763-1-dbarboza@ventanamicro.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=2607:f8b0:4864:20::22e; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x22e.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.29 Precedence: list List-Id: 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 @ventanamicro.com) X-ZM-MESSAGEID: 1692139162192100002 Content-Type: text/plain; charset="utf-8" Use a helper in riscv_cpu_add_kvm_properties() to eliminate some of its code repetition. Signed-off-by: Daniel Henrique Barboza --- target/riscv/cpu.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index a0c14d1a0c..3636cfaf2f 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1908,6 +1908,14 @@ static void riscv_cpu_add_kvm_unavail_prop(Object *o= bj, const char *prop_name) NULL, (void *)prop_name); } =20 +static void riscv_cpu_add_kvm_unavail_prop_array(Object *obj, + Property *array) +{ + for (Property *prop =3D array; prop && prop->name; prop++) { + riscv_cpu_add_kvm_unavail_prop(obj, prop->name); + } +} + static void riscv_cpu_add_kvm_properties(Object *obj) { Property *prop; @@ -1916,17 +1924,9 @@ static void riscv_cpu_add_kvm_properties(Object *obj) kvm_riscv_init_user_properties(obj); riscv_cpu_add_misa_properties(obj); =20 - for (prop =3D riscv_cpu_extensions; prop && prop->name; prop++) { - riscv_cpu_add_kvm_unavail_prop(obj, prop->name); - } - - for (prop =3D riscv_cpu_vendor_exts; prop && prop->name; prop++) { - riscv_cpu_add_kvm_unavail_prop(obj, prop->name); - } - - for (prop =3D riscv_cpu_experimental_exts; prop && prop->name; prop++)= { - riscv_cpu_add_kvm_unavail_prop(obj, prop->name); - } + riscv_cpu_add_kvm_unavail_prop_array(obj, riscv_cpu_extensions); + riscv_cpu_add_kvm_unavail_prop_array(obj, riscv_cpu_vendor_exts); + riscv_cpu_add_kvm_unavail_prop_array(obj, riscv_cpu_experimental_exts); =20 for (prop =3D riscv_cpu_options; prop && prop->name; prop++) { /* Check if KVM created the property already */ --=20 2.41.0