From patchwork Sun May 1 05:49:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 568547 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp7693016map; Sat, 30 Apr 2022 23:08:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSEtwFkZmD310iEheVoM2HrZ6PuiqdeznmdQHyjr9SnNHp/26eQr2sDlexyUWsg/J/PsqD X-Received: by 2002:a05:622a:548:b0:2f3:61ee:781d with SMTP id m8-20020a05622a054800b002f361ee781dmr5817485qtx.373.1651385290893; Sat, 30 Apr 2022 23:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651385290; cv=none; d=google.com; s=arc-20160816; b=pzenJMkiaWnE86FjXySyFOlmkxH3slF+/+iHiHFCmrRvzpj6VHGvIiWNJg903KVOfs 7qi6GdoUJGMq2hhL3ZvLZzzHcrt7jswiRBoB73DdhwflgPzDA4eXZe7oHNQi05awmVGm k62o1XOUWn+4LbP7atuQi1YUvOHGTg9ktatFzfY4bhG1yhgXyeEUR1MJTFfAhQYeCHcI 2LkWWHpdOloG+icZ1/U5WHuWtm7MqanpsdemXHGE/cZdXsDUDAudtZGzEineh0JAESAa qPidUyMkeabP0EogisWP2pol3hnPYYi4wkuFG2HX2VdFmQdPr6aBgXvAGy6R36Q3pG+W sBsg== 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=7dAjLdTZkl7TID6iGw+1xQMd9kdTMVThmu014u7vMDQ=; b=L7aiG/5lVYIRiLTGI4ZwUzFB2SDtNBc/UvAu4M6hFrpTzoI21juRb7ZdSdHfpKYwXK 09ySUSeHFTkZt8OUcOHN2+LefUwM2BARcQoz2HMYgAnl1lD58aAx+Z94KgC5r+mCWr2h dqgC2qDS5aShYrT7lUbXvm48FS7kBeKGOoXrZq2zE6hYGoqosAVkeK+L6+v5NJSmNoWE x3CIfJoT2rRRdjzQa/UpaG53P+66vBrhAW4pVg/Rt3gulQI3n+PN6+ARtXTfJ5RTpaB5 SyrUxh9YL4MSMF50Hb+uYaXbZacXwNTYFfqV+JLM794+APu0a4PGfpm5m8mQ10nm8xwk p7GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n75sJf5x; 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 h19-20020ac85e13000000b002f3a0164978si1031183qtx.604.2022.04.30.23.08.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 30 Apr 2022 23:08:10 -0700 (PDT) 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=n75sJf5x; 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]:33082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nl2kb-0003vc-Gg for patch@linaro.org; Sun, 01 May 2022 02:08:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nl2Tn-0006t1-CY for qemu-devel@nongnu.org; Sun, 01 May 2022 01:50:52 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:44849) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nl2Tk-0001Gd-Cw for qemu-devel@nongnu.org; Sun, 01 May 2022 01:50:46 -0400 Received: by mail-pj1-x1029.google.com with SMTP id m14-20020a17090a34ce00b001d5fe250e23so10458799pjf.3 for ; Sat, 30 Apr 2022 22:50:40 -0700 (PDT) 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=7dAjLdTZkl7TID6iGw+1xQMd9kdTMVThmu014u7vMDQ=; b=n75sJf5xK2h9Le32WX0ruVufYI4OSQykxtXdUuSwrd8SppuA7gbZukcNvwjaHf01tJ keE0i9JkY3nABySd09/+eWfMl0vzrmtDjveiSCX7boRJ8+v6VuL1yrKjxY3ylc011grM ShjXaOEFlgRX7flwNlwwCCupZiWakLQwEW51MHejex09fLYnucPKTW3FejlBsScTuJ2u hXKYwB8t4Xe1O6wM5p/zV02xyLzDVdBbldy7+QAlNVjogZ9WNrAxYQvJjR327mhj0Fv9 NdQhkWU8+IcNJBsgNw9DdtT5ELqDxv4zDW4X85lgVv7iecFBn4NERLnqvm2+92XWW6sD XSfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7dAjLdTZkl7TID6iGw+1xQMd9kdTMVThmu014u7vMDQ=; b=TWPWhU1AUtXlfNkEW7Z1VH6+IXM+MzukAjQPJ7d8Bp82bgq4vt1zGGW7/CrQ/T0nYL MJU5FSVdhtKSucBLwg8jKPSy2NVaGHqvM0QF6C7JmXxTLEfNmELzVrBN78drIriyv+R5 RTBu1vWlvQExMLCPEiR+dQwgxbC2uzzA/4BMXkjwt4sFY5JSZ/LUsXfGeZHKgibkoLmI mfv+ln+/oC+NTc/sgbtB9Ou96xZV9TPSOtX13kWegAkBRbssGj4ISQLrojccwhINgBx5 Tx19wfZZfOEiVCmJ0Kpd8Exm8fMOzM5sY+i0tU14IRxraKfMhXa8xcClHiLLa6JNbMgq ddfQ== X-Gm-Message-State: AOAM532tK1S90m4XqHMBRdOaLFqQS6foCqBvpgH5amZr4H1twtDBzSnJ JAHrgt9CkEwTrI9QkHKKisXUSgVRKJxsGw== X-Received: by 2002:a17:90b:3851:b0:1dc:4f70:1cb with SMTP id nl17-20020a17090b385100b001dc4f7001cbmr1366825pjb.167.1651384239772; Sat, 30 Apr 2022 22:50:39 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id cm18-20020a17090afa1200b001cd8e9ea22asm17310342pjb.52.2022.04.30.22.50.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Apr 2022 22:50:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 10/45] target/arm: Drop always-true test in define_arm_vh_e2h_redirects_aliases Date: Sat, 30 Apr 2022 22:49:52 -0700 Message-Id: <20220501055028.646596-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220501055028.646596-1-richard.henderson@linaro.org> References: <20220501055028.646596-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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, T_SCC_BODY_TEXT_LINE=-0.01 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: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The new_key field is always non-zero -- drop the if. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- v4: Drop change to crn et al. --- target/arm/helper.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 50ad2e3e37..e5fc22bb69 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -5914,7 +5914,9 @@ static void define_arm_vh_e2h_redirects_aliases(ARMCPU *cpu) for (i = 0; i < ARRAY_SIZE(aliases); i++) { const struct E2HAlias *a = &aliases[i]; - ARMCPRegInfo *src_reg, *dst_reg; + ARMCPRegInfo *src_reg, *dst_reg, *new_reg; + uint32_t *new_key; + bool ok; if (a->feature && !a->feature(&cpu->isar)) { continue; @@ -5933,19 +5935,16 @@ static void define_arm_vh_e2h_redirects_aliases(ARMCPU *cpu) g_assert(src_reg->opaque == NULL); /* Create alias before redirection so we dup the right data. */ - if (a->new_key) { - ARMCPRegInfo *new_reg = g_memdup(src_reg, sizeof(ARMCPRegInfo)); - uint32_t *new_key = g_memdup(&a->new_key, sizeof(uint32_t)); - bool ok; + new_reg = g_memdup(src_reg, sizeof(ARMCPRegInfo)); + new_key = g_memdup(&a->new_key, sizeof(uint32_t)); - new_reg->name = a->new_name; - new_reg->type |= ARM_CP_ALIAS; - /* Remove PL1/PL0 access, leaving PL2/PL3 R/W in place. */ - new_reg->access &= PL2_RW | PL3_RW; + new_reg->name = a->new_name; + new_reg->type |= ARM_CP_ALIAS; + /* Remove PL1/PL0 access, leaving PL2/PL3 R/W in place. */ + new_reg->access &= PL2_RW; - ok = g_hash_table_insert(cpu->cp_regs, new_key, new_reg); - g_assert(ok); - } + ok = g_hash_table_insert(cpu->cp_regs, new_key, new_reg); + g_assert(ok); src_reg->opaque = dst_reg; src_reg->orig_readfn = src_reg->readfn ?: raw_read;