From nobody Thu Nov 28 09:54:44 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1694153404; cv=none; d=zohomail.com; s=zohoarc; b=YKqHj6CSmGvTvIcu9xqrjrCEmgOGFAPsbvPP0DlRMwVbDK3f2UsFqDadS+Ppw2tvMQu4XqPori2qslp3jc2wrDfIJWKgOy8s+4qhIzvVFYD6CCTtutdEgh+XBm6tj4idjzh40Tw3DL4BBHoMJSTsVTkG6hDfzZDVR9B5ea4KR9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694153404; 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=Jr7URA9g3570blsLy4covRVzNAG6jd179YZF66T+Xds=; b=ahlY1u5ItA8X0YxWYI3BjCI2Y7KKnSMQ83KgAnfPgKSggF8Y1vk1Rtt7zXBJnTmCz9ZzCpulokbQw+4XYUo5NlXb5dhhsCKf6k5zCe9IeMuVXwI06ZHfrXWzGzUNESQvk+vCxj/iLvUDlXVMpERAJ7k/HKO8+6yA68VOJCSkP0U= 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; 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 1694153404121464.5268018985379; Thu, 7 Sep 2023 23:10:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qeUfY-0005tf-OK; Fri, 08 Sep 2023 02:08:40 -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 1qeUfW-0005hp-Vb for qemu-devel@nongnu.org; Fri, 08 Sep 2023 02:08:39 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qeUfU-0008ES-GQ for qemu-devel@nongnu.org; Fri, 08 Sep 2023 02:08:38 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1c1f8aaab9aso14781685ad.1 for ; Thu, 07 Sep 2023 23:08:36 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id q1-20020a170902dac100b001c3267ae31bsm715231plx.301.2023.09.07.23.08.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 23:08:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694153315; x=1694758115; darn=nongnu.org; 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=Jr7URA9g3570blsLy4covRVzNAG6jd179YZF66T+Xds=; b=JfSOwac5nxwKXIRfbK4DjsNMIMR58w2tV6H+Qwinh0rCLmIhcDr5WZa8p+tvkGzROh vzThxDL9vag+20z6EiASSAOglmrwgysFuEQKF9/7u7XfSo26aQ18KXPGiA2Vj5e4CdoQ G0VhuyZt56iSSobJd3n9A2cqm8I3oPo7tHodOEGqErlkMSXir+hZ5RQjqUhLVmJbg8jc EAYtTAXU3rBmciYtlWajnxh38a84GckZ2C1ATOF1RZKry4uoHhyOkkOwV1RT8x0rcmoC GbYPd4yQ6OP/TNBQEZ0UrqLcJ3lmOpekjm/FHW19vAq409mD11EHxppolikrJWTuTox6 T0Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694153315; x=1694758115; 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=Jr7URA9g3570blsLy4covRVzNAG6jd179YZF66T+Xds=; b=Isafh2ckJG8e445d81aMn3Ul8pRwTClEOGHXARFciZheB5jdh7TQj0IgFfdi/YfhrT OJGq9QCqgItT8ufPBRLramdHbZqD/SRyEtGihWUX12+h41oj+zApwtP0D8wK5I1yt5cR IYlNCPTbkLT35ZJn9xg/exhqJZ8+B8pXH/+Fn6I/CtqgkHh0DUmp2nmUTokExu0b8iGu 286VgN6xysxpL5Z2v67P8OajymbsmwwxgJAbKiK3LToaYovYXXrPdxIZ+0sNKjnaK5ek vmEj5LDeC2W5r5ZWc0ayXUrD42BmDbguMPImNFBOA5fGJAAlH7GUOkxfQuOl1Yznfv2M gC+Q== X-Gm-Message-State: AOJu0YwHmU5KCtOl2NqQlIQ+RKLqJ0RtNGzI4xVWCEWYOlS2q8oejywu A5QaPQ8FW17zsT6G0zvJZCXJzlDXGq/Y4ZNa X-Google-Smtp-Source: AGHT+IH/WMZP0wZJF2Pp1hscz6JVUjBJRmubFD6Gdv7BL8ngBVjEOlGKzD99q+eEQ1G/9oZBUX7yVw== X-Received: by 2002:a17:902:a5c7:b0:1c0:6dcd:453d with SMTP id t7-20020a170902a5c700b001c06dcd453dmr1545678plq.20.1694153314836; Thu, 07 Sep 2023 23:08:34 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Daniel Henrique Barboza , Alistair Francis , Andrew Jones Subject: [PULL 58/65] target/riscv/cpu.c: use offset in isa_ext_is_enabled/update_enabled Date: Fri, 8 Sep 2023 16:04:24 +1000 Message-ID: <20230908060431.1903919-59-alistair.francis@wdc.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230908060431.1903919-1-alistair.francis@wdc.com> References: <20230908060431.1903919-1-alistair.francis@wdc.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::630; envelope-from=alistair23@gmail.com; helo=mail-pl1-x630.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1694153405188100003 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza We'll have future usage for a function where, given an offset of the struct RISCVCPUConfig, the flag is updated to a certain val. Change all existing callers to use edata->ext_enable_offset instead of 'edata'. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Reviewed-by: Andrew Jones Message-ID: <20230901194627.1214811-14-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis --- target/riscv/cpu.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 0dae259e02..03e936348a 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -162,18 +162,17 @@ static const struct isa_ext_data isa_edata_arr[] =3D { ISA_EXT_DATA_ENTRY(xventanacondops, PRIV_VERSION_1_12_0, ext_XVentanaC= ondOps), }; =20 -static bool isa_ext_is_enabled(RISCVCPU *cpu, - const struct isa_ext_data *edata) +static bool isa_ext_is_enabled(RISCVCPU *cpu, uint32_t ext_offset) { - bool *ext_enabled =3D (void *)&cpu->cfg + edata->ext_enable_offset; + bool *ext_enabled =3D (void *)&cpu->cfg + ext_offset; =20 return *ext_enabled; } =20 -static void isa_ext_update_enabled(RISCVCPU *cpu, - const struct isa_ext_data *edata, bool = en) +static void isa_ext_update_enabled(RISCVCPU *cpu, uint32_t ext_offset, + bool en) { - bool *ext_enabled =3D (void *)&cpu->cfg + edata->ext_enable_offset; + bool *ext_enabled =3D (void *)&cpu->cfg + ext_offset; =20 *ext_enabled =3D en; } @@ -1045,9 +1044,10 @@ static void riscv_cpu_disable_priv_spec_isa_exts(RIS= CVCPU *cpu) =20 /* Force disable extensions if priv spec version does not match */ for (i =3D 0; i < ARRAY_SIZE(isa_edata_arr); i++) { - if (isa_ext_is_enabled(cpu, &isa_edata_arr[i]) && + if (isa_ext_is_enabled(cpu, isa_edata_arr[i].ext_enable_offset) && (env->priv_ver < isa_edata_arr[i].min_version)) { - isa_ext_update_enabled(cpu, &isa_edata_arr[i], false); + isa_ext_update_enabled(cpu, isa_edata_arr[i].ext_enable_offset, + false); #ifndef CONFIG_USER_ONLY warn_report("disabling %s extension for hart 0x" TARGET_FMT_lx " because privilege spec version does not match", @@ -2346,7 +2346,7 @@ static void riscv_isa_string_ext(RISCVCPU *cpu, char = **isa_str, int i; =20 for (i =3D 0; i < ARRAY_SIZE(isa_edata_arr); i++) { - if (isa_ext_is_enabled(cpu, &isa_edata_arr[i])) { + if (isa_ext_is_enabled(cpu, isa_edata_arr[i].ext_enable_offset)) { new =3D g_strconcat(old, "_", isa_edata_arr[i].name, NULL); g_free(old); old =3D new; --=20 2.41.0