From patchwork Mon Dec 18 11:32:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 755497 Delivered-To: patch@linaro.org Received: by 2002:adf:b181:0:b0:336:6142:bf13 with SMTP id q1csp829044wra; Mon, 18 Dec 2023 03:39:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IFvIhT6iTaZaaXTcn2SZZnks5mcTJmnCIdFFkur+bGOT6AdKoScVkyLj3nJTVjQ9ktZh0+Y X-Received: by 2002:a05:6102:208d:b0:464:9f88:831e with SMTP id h13-20020a056102208d00b004649f88831emr11700316vsr.52.1702899551999; Mon, 18 Dec 2023 03:39:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702899551; cv=none; d=google.com; s=arc-20160816; b=ZjPmNRGWqOmsp5tg48tGuxzPZBwpF/dyaWT/LEPGz3cqbUcccreyvleNHFcsCp7dLU lPhsYFvwGTAjFkmenvtIkbGkoDo1UUPtAXKKRtyLKj5g3/0aFjOQaU0xPhH+gqj/7Cuf /5sJSjAjvdajfdf2sO2RUIxmNRcs3kXyR9UWn8g7z0DvT8yCbvKIlPCFHE1XrZ3RUUOC 9+/KaQsbWm7bU5cO1GqaDzSvEWyQt8AIoHZlzG6ZQGZl5BuKFw/BtBlSvWP9oFb8Pliz Xf9sYzuYVlhinsmTmNfe3Af+if78voCKMUwAaK1QldjncNRjgkpyo2Mq7v7m+zualfs8 lcWg== 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=W8Km95/I79yd+g2RdegOUvHS7Z7Mlhpw+dHaXH+5iSw=; fh=H2AmuqulvQE+T5zu97MCEUC3z9wF9NssS7895NhR/+c=; b=JDHP87SP0EjTNkDp1yFRrjVuokXqVI6y8nWS4f6yR33/cXTl9QVOQO1kbFs+ejuqKr 8ByRre2uedfsTENK4BL49kzsgSl8tfpz6PZBeiuhv4Sp3lswTjQSCrfJPh/t4HOP8y42 +2MleKlacHSXMVB4NlpgGj3fI6pdZUJt0lM6VyhXdRTuA8/ecwibL1FZOi4dheU8jpyj AaumSfx9pJRvSPn0tVX6DuAaGE+aWYW/5/z36aKECZ2QttgRxDaWnwzxulcj7wj362AM 9YFVl27maPUzwYNHnRKugvuVoBZRQ2mIv0bdtck0gz/8h6Tqt8mZVjCu2CcSGBq5bXFL I22Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hREfcNlF; 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 do2-20020a05622a478200b0042393d2035esi22697782qtb.344.2023.12.18.03.39.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2023 03:39:11 -0800 (PST) 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=hREfcNlF; 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 1rFBsI-00074r-Et; Mon, 18 Dec 2023 06:33:30 -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 1rFBsG-000729-Of for qemu-devel@nongnu.org; Mon, 18 Dec 2023 06:33:28 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rFBs7-0003Md-OH for qemu-devel@nongnu.org; Mon, 18 Dec 2023 06:33:28 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40b5155e154so35158825e9.3 for ; Mon, 18 Dec 2023 03:33:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702899198; x=1703503998; 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=W8Km95/I79yd+g2RdegOUvHS7Z7Mlhpw+dHaXH+5iSw=; b=hREfcNlFY7opQZfj6oqpy+Gjmzvs6C0oVa+UcgH72cqxZFWR5yLoXPMK9jHau9y0va UCe4xG1xSnU1x1JMfziZFO36PQFhzFStHjYGgIDhmKA0JAaFSSj262mO2a7z/+Gtdc/Q uFCsgKRp7D7bW1mXtD89p7pi2IBGx/2s621QHL3xnQPOO5X1fzOQR6D091cDHh+xr3e6 s2oRtgK3nQ6OQV9HRaVA9cFKNAh8BA+woC3qH3FcxbR/APY/nDJRy2p4Zt1k1SPy6i5a MmC6zYgxnBXJjAESYPeL8Hsyd0pnoSFwpm2Z4jKM4gYaqYIABJmXC3gCuCYlYFLpb9dQ HuyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702899198; x=1703503998; 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=W8Km95/I79yd+g2RdegOUvHS7Z7Mlhpw+dHaXH+5iSw=; b=TliJpx6FiOYYjbkfcr2OaJo1d+5fNm3A2qIDoFspTdcR+vgAzC5xvZE0RUBtu6tfr0 EkfSV5S6rLwAJx3Xs/Uhh2/W21hnp2/XpPT2flSfXnU5zeqISpE1hJ2KydBHUjkS9GpP vwLzlI4YLpGWMbhkYsoHaAlHBub2cyh8dWIooSjMt90zMLi+iKYEiDPuq/wXxYqRn0cp DdlKhefbg+FYrRg377G9bt68T8iD1YKwp1w1zExlWE9Au/Mg9ZmkqMvFYebsKD2//+Hj E+nL5AaA4V9D6hLx2tOytviRCU2jl0LDP9ftXZoSeG/uK11yMQj9sU6ZIIVE/RD2TlRa ymeA== X-Gm-Message-State: AOJu0YxEpW+lp38bKhBzsYhh4MyrYEKhV4qgHldZVIVL9hKRHEc8IEvH GTyWWGqPGcroMQnmU5PkeSfvuA== X-Received: by 2002:a05:600c:319b:b0:40c:2fa2:f6e2 with SMTP id s27-20020a05600c319b00b0040c2fa2f6e2mr7536963wmp.190.1702899198319; Mon, 18 Dec 2023 03:33:18 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j18-20020adff012000000b003366da509ecsm671193wro.85.2023.12.18.03.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 03:33:17 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 24/35] target/arm: Handle FEAT_NV2 changes to when SPSR_EL1.M reports EL2 Date: Mon, 18 Dec 2023 11:32:54 +0000 Message-Id: <20231218113305.2511480-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231218113305.2511480-1-peter.maydell@linaro.org> References: <20231218113305.2511480-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org With FEAT_NV2, the condition for when SPSR_EL1.M should report that an exception was taken from EL2 changes. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/helper.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 45444360f95..38e16c2f8a5 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11405,10 +11405,18 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs) aarch64_save_sp(env, arm_current_el(env)); env->elr_el[new_el] = env->pc; - if (cur_el == 1 && new_el == 1 && - ((arm_hcr_el2_eff(env) & (HCR_NV | HCR_NV1)) == HCR_NV)) { - /* I_ZJRNN: report EL2 in the SPSR by setting M[3:2] to 0b10 */ - old_mode = deposit32(old_mode, 2, 2, 2); + if (cur_el == 1 && new_el == 1) { + uint64_t hcr = arm_hcr_el2_eff(env); + if ((hcr & (HCR_NV | HCR_NV1 | HCR_NV2)) == HCR_NV || + (hcr & (HCR_NV | HCR_NV2)) == (HCR_NV | HCR_NV2)) { + /* + * FEAT_NV, FEAT_NV2 may need to report EL2 in the SPSR + * by setting M[3:2] to 0b10. + * If NV2 is disabled, change SPSR when NV,NV1 == 1,0 (I_ZJRNN) + * If NV2 is enabled, change SPSR when NV is 1 (I_DBTLM) + */ + old_mode = deposit32(old_mode, 2, 2, 2); + } } } else { old_mode = cpsr_read_for_spsr_elx(env);