From patchwork Tue Oct 24 17:24:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 737568 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp2152520wrl; Tue, 24 Oct 2023 10:25:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFg3nEtKhdxyXFphFuVpQDrjzqgbGjiO3Yev6yusFd1U63COvQmNqCXbFHMrJsHNX0qfVcE X-Received: by 2002:a05:6870:3b0f:b0:1ea:1e74:c377 with SMTP id gh15-20020a0568703b0f00b001ea1e74c377mr15719241oab.36.1698168344395; Tue, 24 Oct 2023 10:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698168344; cv=none; d=google.com; s=arc-20160816; b=A06uudhbXdkpYaPlDE/k/9EyoWN33XWA8q/jClXBYh3KDV5kSFP5vviWaUhAue7N52 /oXKh1HrfbBAOi0leD0PGAY+sxm3KpX5NwqfKsPFQhJegloqR72xEL+md8NFQnUKabRo +RDWs0ow6cFn78n4oj1oLsFuX4+H+Y4cYVqESUoY8+qiwJlyOXc3UGmAJveOBWkeTgAb T6ZSZAuH9XTIZlgoeH5Sw84ya0PjdUR/UZTYd2u6prqz/WeQ3zOSROQG5UwdgGmnTlqH t+Wmnmb1IhbKbfhCElXsDgvdHHPH7EoNrY6orW6HlA98SgquDRnvkRjLA+KiJFvnz6/w JHjg== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=whe7VhM1QRrMglSRu5qWCi/P7ekDVJP9PS80iqT8NDE=; fh=spbD1uAOw2hCQBb83uSlqZAKTOl6wvNX+k1rxl9UBCg=; b=zft5bbFJ5C6UYHoGKM0Q+5E2xoSFtGk04p3sSgT2cQNU4R0NnVqr96+sAaxwNnjd1Y 7TYi8K0oUFTF8tydO6hPyUUCIp+Fs20gAofJtOEA3MYCTilSGblmc5s2Xhu1SV450V4p qWYJzK2vODZeRBqAFkFjKz9yerOnMHhoSkgmftRyEYTLXeEcFx8RjMVsadh62OvTB2XY gS5lqQqjz1Qm9hSQbgmGm3QQzbSIGchXcmh+CFW0nGHPLjQEUNCSX7jcrIkfF2A1sHlS OAhp3wmILHZXxEBE/95SBSACODhQXu33DTyBPDccRpTsLWosz42gF81zLIoXAUQNndp/ HZTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NJ+VHedB; 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 u22-20020a05622a011600b00403bfdaa607si7795143qtw.777.2023.10.24.10.25.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Oct 2023 10:25:44 -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=NJ+VHedB; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvL97-0001VR-DL; Tue, 24 Oct 2023 13:24:49 -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 1qvL91-0001Kc-JP for qemu-devel@nongnu.org; Tue, 24 Oct 2023 13:24:46 -0400 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvL8z-0000qr-Vx for qemu-devel@nongnu.org; Tue, 24 Oct 2023 13:24:43 -0400 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2c509d5ab43so72294591fa.0 for ; Tue, 24 Oct 2023 10:24:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698168280; x=1698773080; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=whe7VhM1QRrMglSRu5qWCi/P7ekDVJP9PS80iqT8NDE=; b=NJ+VHedBJ4QLSYxKt2OhOyWrO9WiZP2TojcDbETa6eR9/0/N2io94rp9FNQDg2T3ZH qhslUyKDGtDjGcjnWBSloB+iFJfVZFcYrN0+cpOIfXD6Kg5O+GhKcUK6dsksYN7pGu9b SaHcXc0TOh/p1YPVm/FN8a2TY/GOilwVLdSRwyApkiBNnWIAwXDMkaTvOFi5nQiF6BwU wb/yS3ta0M+ZYOVUO3K2xiDUWf/dVwHIYvTbNfjCuQS+5S1nz1V07K8lw3RqGXg/AIMd 5IrZpTrcH05QfLbsVaDRD4folEfrI5HbF1CUNgEZUnttA947NCXiLf30AEeQEyjKNYEr nN6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698168280; x=1698773080; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=whe7VhM1QRrMglSRu5qWCi/P7ekDVJP9PS80iqT8NDE=; b=DpwmbIbvOGf1N+nWmSZOuPE+oDMjP6C8mVDyBL5IAnoYvzlKwdXOIrhO25bvZbdbbq fOhZU0DhLrbQlrO5QPeOJgHBP+BF/FC2zBnKRLehXXPZfL4lkaCqwS03iYBe3Z/fP/OK 4CaSIvfguvyUsQ+xCpatTsniYluZY9cYsOd+QO6CgUqU9vREQ5RKVhmYEoVrxXe5ahdD 0vZd3kJbw8vPRWGeINqXgaCER89glf0SE6qlVA7gWOJkavXGd3KBG51RRDWGDHky8y+A KEdpk86gQ5lcJHnBFsJYtkeklHRbZ+kI5EQx6sIltY+9q6xJ9PF6s71vKSwrod48qjKT k18w== X-Gm-Message-State: AOJu0YyI+TlKE3fXv5RL8olxl5hXtJjNB8Rk7w3t9L4vpgaOq9mimHFE A2uFNFlVnSy8WZanaSHg9mJAIA== X-Received: by 2002:a05:651c:447:b0:2c5:18a9:620b with SMTP id g7-20020a05651c044700b002c518a9620bmr9223152ljg.23.1698168279521; Tue, 24 Oct 2023 10:24:39 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id h14-20020a05600c314e00b003fbe4cecc3bsm17371755wmo.16.2023.10.24.10.24.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 10:24:39 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org Subject: [PATCH] target/arm: Fix syndrome for FGT traps on ERET Date: Tue, 24 Oct 2023 18:24:38 +0100 Message-Id: <20231024172438.2990945-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::235; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x235.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.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-bounces+patch=linaro.org@nongnu.org In commit 442c9d682c94fc2 when we converted the ERET, ERETAA, ERETAB instructions to decodetree, the conversion accidentally lost the correct setting of the syndrome register when taking a trap because of the FEAT_FGT HFGITR_EL1.ERET bit. Instead of reporting a correct full syndrome value with the EC and IL bits, we only reported the low two bits of the syndrome, because the call to syn_erettrap() got dropped. Fix the syndrome values for these traps by reinstating the syn_erettrap() calls. Fixes: 442c9d682c94fc2 ("target/arm: Convert ERET, ERETAA, ERETAB to decodetree") Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- Spotted by code inspection when I was looking at putting in the ERET trap for FEAT_NV... --- target/arm/tcg/translate-a64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index ad78b8b1202..41484d8ae54 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -1606,7 +1606,7 @@ static bool trans_ERET(DisasContext *s, arg_ERET *a) return false; } if (s->fgt_eret) { - gen_exception_insn_el(s, 0, EXCP_UDEF, 0, 2); + gen_exception_insn_el(s, 0, EXCP_UDEF, syn_erettrap(0), 2); return true; } dst = tcg_temp_new_i64(); @@ -1633,7 +1633,7 @@ static bool trans_ERETA(DisasContext *s, arg_reta *a) } /* The FGT trap takes precedence over an auth trap. */ if (s->fgt_eret) { - gen_exception_insn_el(s, 0, EXCP_UDEF, a->m ? 3 : 2, 2); + gen_exception_insn_el(s, 0, EXCP_UDEF, syn_erettrap(a->m ? 3 : 2), 2); return true; } dst = tcg_temp_new_i64();