From nobody Wed Nov 27 10:33:38 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1699897673; cv=none; d=zohomail.com; s=zohoarc; b=OcsA0azrC+ZgfZ1EZctH0htht/lBQw+pReOpPJ8UpmzRfR/ZZYmzjGmJEVyItEIpmJeuDIG3/NZZptn5U1UTJG1fG+jqeh4RVfV9eRTWMcYeuxQUaLL6MuGW7XIUNffOdUcrsqzvpG56Wk+3dd3yEkd55DkkaqIeCDMKpN4U1To= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699897673; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=KnY4HIPw6PCJOFctLWZTvnAUbilKXxg/CSm+3MzKwSQ=; b=dj56f3Wrn5YHQZMjI45fJ38KF2htyXRWAzzJocVxbxS/NGU8nNVK2tFENUOwCvZY9nowozHL90+NY2vkkL8Z/osbl3yxLuBYEGLtB7WBORjqKyiRTtAMDqz4A0DQd1qnKrMOg1gmtQt4rJBbZiWibdYSlebX8OYWo+4IOE0vgHs= 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 1699897673357418.59166701689264; Mon, 13 Nov 2023 09:47:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2b1V-0007HZ-IE; Mon, 13 Nov 2023 12:46:57 -0500 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 1r2b1K-0006y0-8l for qemu-devel@nongnu.org; Mon, 13 Nov 2023 12:46:47 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r2b1E-0003Jv-S7 for qemu-devel@nongnu.org; Mon, 13 Nov 2023 12:46:46 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-408382da7f0so39268245e9.0 for ; Mon, 13 Nov 2023 09:46:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 8-20020a05600c22c800b0040303a9965asm14391110wmg.40.2023.11.13.09.46.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 09:46:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699897598; x=1700502398; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=KnY4HIPw6PCJOFctLWZTvnAUbilKXxg/CSm+3MzKwSQ=; b=P0aYTjqciBSA2H4dAZOpdzmoOiT+RAqufN/qFV/hteM9okyFufE1JUiYumYWdszYYJ 4kOiqI5AWD18gBSMYwHk+3tBvCEKtOYBdLbKP3D4Das1Hqi+kfYn+9rI2bcB7fHawcDm Klnr+KCegzpQZ/zoUEgNHSym5RvTtKHLE9eIyOEgyTUpcjriP0hFQ1mUdcrX9H7uHDqv w7i7mrqSulhszqALLpNOTZfWquop7nch1UP8fxnfBVFJ30QwAZ7sWkwjj/HN0977vlD6 3DrfPMg+72Vm7UZmIrGtkWiCRe2T20Fp7HKIBvBI3fREbzFud8Bi37c8r6UT/IhiER/W WgaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699897598; x=1700502398; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KnY4HIPw6PCJOFctLWZTvnAUbilKXxg/CSm+3MzKwSQ=; b=l9iFlG5ea+fol2q3n27NTuuokiYWru4hy4P5rLf0+GdHpSVxQ+OJuBXw1565JRsJen uxIKZqikk/vegfpWTlWbh4RM80+Jge4XlzJmjR787MPQ4fTf5kCNvOs4RiFJf017fwwr JCG8zMfkN4IixK7oLVLzh+z5Y0X1Qvj3YlE7k4tVOU3FM/IAcVLwvVFeQfAhXUZC75jJ /u/S9OOObKKIEyMUNlBmmEF9fPa6zfDptzRHY5LUkAnfxTwUskp8Q+Eju8RvzbUswx0g rtpBiaBLs9IVYSKRfDynPAb+1PpROrc3cKUKCDUW79lBzpAq/RsozYNLs+tk7Uq6twHY udwA== X-Gm-Message-State: AOJu0Yye46nPnMwQDsDA/RJK4efyaLiIJwz0vGmKv+Z4ZJm4SLEWk2v0 2E6MMtl73J0MlAOMHqPWbDzsl+igw3ghcOeMYBg= X-Google-Smtp-Source: AGHT+IG16HnBSK1K6jsR+STuT2bCdFzzaBwibOUQ6gYoBsDtVtwuRbQep4NQYOaUkD9vU2v0pAejxg== X-Received: by 2002:a05:600c:4f47:b0:405:34e4:14e3 with SMTP id m7-20020a05600c4f4700b0040534e414e3mr5517848wmq.3.1699897598163; Mon, 13 Nov 2023 09:46:38 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 2/4] target/arm: HVC at EL3 should go to EL3, not EL2 Date: Mon, 13 Nov 2023 17:46:33 +0000 Message-Id: <20231113174635.2540484-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231113174635.2540484-1-peter.maydell@linaro.org> References: <20231113174635.2540484-1-peter.maydell@linaro.org> 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=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1699897673895100001 Content-Type: text/plain; charset="utf-8" AArch64 permits code at EL3 to use the HVC instruction; however the exception we take should go to EL3, not down to EL2 (see the pseudocode AArch64.CallHypervisor()). Fix the target EL. Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Reviewed-by: Edgar E. Iglesias Message-id: 20231109151917.1925107-1-peter.maydell@linaro.org --- target/arm/tcg/translate-a64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 41484d8ae54..a2e49c39f9f 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -2351,6 +2351,8 @@ static bool trans_SVC(DisasContext *s, arg_i *a) =20 static bool trans_HVC(DisasContext *s, arg_i *a) { + int target_el =3D s->current_el =3D=3D 3 ? 3 : 2; + if (s->current_el =3D=3D 0) { unallocated_encoding(s); return true; @@ -2363,7 +2365,7 @@ static bool trans_HVC(DisasContext *s, arg_i *a) gen_helper_pre_hvc(tcg_env); /* Architecture requires ss advance before we do the actual work */ gen_ss_advance(s); - gen_exception_insn_el(s, 4, EXCP_HVC, syn_aa64_hvc(a->imm), 2); + gen_exception_insn_el(s, 4, EXCP_HVC, syn_aa64_hvc(a->imm), target_el); return true; } =20 --=20 2.34.1