From patchwork Thu May 5 09:11:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 569943 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp624318mal; Thu, 5 May 2022 03:22:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxygDR0hfkDyLPkyaVMK0T2F4nyW8Qt8Ar7jbACoHzIma32Q+EFgdZck/OSNfesg31iiLUe X-Received: by 2002:a37:a584:0:b0:69f:be15:92ba with SMTP id o126-20020a37a584000000b0069fbe1592bamr18985101qke.99.1651746158090; Thu, 05 May 2022 03:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651746158; cv=none; d=google.com; s=arc-20160816; b=dqtavSnjaeTzT07wJN2XtODZQK0qeZF8uMxhAnc3CItyJbfgTveGBmlGkE8BM9MPeq zqD4IruabZvBr1pxbxa4ux2qeqNlTdmBNbd2o+GmGgKYf7UgmA0/sZsvRll5WKLihSX7 3QGJoy4MN0TPl6eGYRgNT2bh79lKK23+Y+qYY1ompeXGTdwymLkKKXE3PrNexIx8jagy /xiFiK/vDTnoDR5AtnhQCBZmPxBx84NJuzcuvcLfKoK4/3AORnX8s7cfQ3o964AbJY+u V8jBAJWZwIAOKv6OCWFW5f+Gyrz7XLi47KxZugOSPEWV9J1HEPm+xAOt/p16QrcIht49 1tdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=WcGb4SYoeOpCKBA3Iri0N3zedF8sXwlwuq0AwAakMGQ=; b=H5mKtDaSfw9ucj8l9yUSV4MJoeIVOBcR6lVT57Zy8N43c08eADOFG/LTKXXt/vyiF6 c/EQYtvyPWHDQ4AHva5U7uUWBqpb+biGWxNiW5jyBw8VUXI/lqvCiAD9l8/w/yo7QB6v 9A+KVpA6PmYCHdFUP+Xl54vFOQEYVkYYdhvQve1lw8A6VXwkQ8+lWzcwYCzc0vF9zIel jct4b0u517MrYejJg73FCTHbXm5sGz4JP61kX4Bwzzl1Nqfzwmj+VLy//Y78oGd52u2P TyGKKageWqscjVt8Q+Gpj8p+pI6WuaTeYnH3P2kc4N3jCZRigDxsvB/f4yXhGK6MiHmC Q3iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o9gsUH2d; 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 m16-20020a05622a119000b002f3983ee1b3si582512qtk.204.2022.05.05.03.22.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 May 2022 03:22:38 -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=o9gsUH2d; 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]:53196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nmYd3-0000gZ-Li for patch@linaro.org; Thu, 05 May 2022 06:22:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nmXWl-00059P-Qb for qemu-devel@nongnu.org; Thu, 05 May 2022 05:12:03 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:37490) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nmXWk-0003IE-62 for qemu-devel@nongnu.org; Thu, 05 May 2022 05:12:03 -0400 Received: by mail-wm1-x32e.google.com with SMTP id o12-20020a1c4d0c000000b00393fbe2973dso4709153wmh.2 for ; Thu, 05 May 2022 02:12:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=WcGb4SYoeOpCKBA3Iri0N3zedF8sXwlwuq0AwAakMGQ=; b=o9gsUH2dezjCiILvHhVjOm5314mwxH8xeSLTI+qdjVJCYlb//n03U7T51rsB90XEz2 nQPlrPyfNrE78sE6f0uA/rls0lzTkbQlU157F0/EZF1c42A8Dpad7dTUAjh8iF2517gJ 7iqIjGTv9a0qQTu31NUNU64qp9hBWiyHJl56IdeFbUyhHeyq/w2cKd7w1MnqKu8DcVTS Qtvu9iQwLWF7oROSLEJi8nXNUQ0Uk0qJ3mWhyoCbYq3F6B8ofwPOl6KEPvkm3bjWlSWs ELCy1o3z7FRzuKFG0Kt/AGoYW19E8lpGw2P1vdHZa/7QxXnyBcmtja4U6vxQeD6UI8Nu gcPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WcGb4SYoeOpCKBA3Iri0N3zedF8sXwlwuq0AwAakMGQ=; b=TTP2eJiL5EFQLeiKYvLr4kjDJKo54Gc85wqoPkRtOLnb01n01yTxmpBS0YoeybTAE1 vw/nFbg7+SBQ9wpffSeU8TwExyEjzkZX8OfBxoQxNlDe7tXtAlMBTFmEt2zRJQXq0NtP uoZFymyxCX5FmG+0KqwnUMgMM+WG1ktz8RMby0nQDWQCNgDA7Hks8y5vvHrcNWbJooWX +uIMxQ1+IDSgxBtNyU7uwgsV4YhEg2rGZhbg9rZ4hSqoLrrH0Jqo5ls9HP5cnXlYvyGQ XytEBzVCbN4R4zFFxexJb4PeZJO/sNxrcGyl7UXCumqGWSgvql9UFtYYicVCwThs7SwY IEcQ== X-Gm-Message-State: AOAM530CVnCqCb5g4ssUY+CD/LAQ6ijWdJu3DsSvOfGhpBILramMT4JP OkBWqvx4gq7UlK46TDQMN2ndfnGsv6hV0w== X-Received: by 2002:a05:600c:4ecc:b0:394:3222:23be with SMTP id g12-20020a05600c4ecc00b00394322223bemr3517218wmq.175.1651741920685; Thu, 05 May 2022 02:12:00 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020adfe50e000000b0020c6a524fd5sm841612wrm.99.2022.05.05.02.12.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 May 2022 02:12:00 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/23] target/arm: Drop always-true test in define_arm_vh_e2h_redirects_aliases Date: Thu, 5 May 2022 10:11:35 +0100 Message-Id: <20220505091147.2657652-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220505091147.2657652-1-peter.maydell@linaro.org> References: <20220505091147.2657652-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The new_key field is always non-zero -- drop the if. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-id: 20220501055028.646596-11-richard.henderson@linaro.org [PMM: reinstated dropped PL3_RW mask] Signed-off-by: Peter Maydell --- 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 50ad2e3e37b..70dc1482dd7 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 | PL3_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;