From nobody Fri May 17 05:54:46 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=1654811568; cv=none; d=zohomail.com; s=zohoarc; b=SqF1s/aVZ4CboVUFN4DmD68fJhlPlmXFd4/ibhEoqKGiGdGgQ/nTDL/znfatSZKjnjZTMC1C6anfXdfrg7pB4hAOamIiEo3t3uk9i6TA9D6w51oN5RK8E2wbmL7m2ZkrGMPY9q5CECD1wylkta5qPAuMS7brQosSjb9/18mXBhI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654811568; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Z2nY90WUsKFnNetakqOAHrGjM16SH+ECu66ryRheE1s=; b=h4gqtkwuCLDgODKveu91C+kdMFqyEo1F0Blgbnf3bDNQNCYz7AeIUuhQbuTavlA4YXlc3Fw+z1RKR8JCz9zSg/uAYkT5C6k1ilZ8LWOCql8HpglrSQ51k04VYcDyvHoqs7Z/HjrVlD9jTdZBaZgnJspm5e1TkYswpCuX0+yHKnk= 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 1654811568715146.5483156900426; Thu, 9 Jun 2022 14:52:48 -0700 (PDT) Received: from localhost ([::1]:52582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzQ59-0006cm-Kc for importer@patchew.org; Thu, 09 Jun 2022 17:52:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzPzc-0001sY-Ac for qemu-devel@nongnu.org; Thu, 09 Jun 2022 17:47:04 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:38756) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzPzZ-0003of-FL for qemu-devel@nongnu.org; Thu, 09 Jun 2022 17:47:04 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 123so12659659pgb.5 for ; Thu, 09 Jun 2022 14:47:00 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id gw9-20020a17090b0a4900b001e2f6c7b6f6sm179167pjb.10.2022.06.09.14.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 14:46:58 -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=Z2nY90WUsKFnNetakqOAHrGjM16SH+ECu66ryRheE1s=; b=cPMe0a3lZu/7Ifu8djXBN8HWj8JP5bMk0ioF0HFRfkghojF215SJG1I8IfvudChrAV dL0h2/DhI5/UkNV0OXHHnTd7ZOZqtx/Uwg7BV8VOPbIW8BCfPu5qT11LCzKWDG4KHIxW /C0iw1616xIzvQcVL3tk7UHe5iFQ/1/DXk5nl7YCULOG6ym2toHX03HEPYkjDvUvNWTx M9RziZS3royCbwrhlxNXKgNkbh82fYnfMTMgPPlpVFjh+WaF1JSwPaJ8VSrPRy0fzgk5 ecrbI/ie5ClzEige/0g8QQ8sNCwtexEBe7canNFcacjlN9Iq2peZ8IBsrM6pOVxDgAWw NeUg== 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=Z2nY90WUsKFnNetakqOAHrGjM16SH+ECu66ryRheE1s=; b=6JW3Lbgj5ucl+oHBJ/DSLx66aMVlX6X5O8apIUIOkSdZ71so79k/ejpgDH/hQTR+3L 7+unncVa/mW4cSWGgmd9hjECR1h+3hN6fHZa8ll7zSgYmDzauDe5f9ZXw9Kv/1xKKAMz EtlcgnnCO/bg4KmrBB4ABjjd8Fs8g6SQQCWISVCdBdqJFWnuW/wgZxYPZSo8FIulS1yl GHKtXOxy9lsy9KJy2ATtL6+Fm7AeDMd+/h4ebpmvTHOSYKtssOD8gBdBmSEPjJhLlKs1 JYcZbLKdEk7uo5ZlVoipSHumhshfeaUEnHqN3N5b3FI3SSUXbIoVa2yjseJ/uoiTT0h+ JKIw== X-Gm-Message-State: AOAM530GlEWf0Pg2fhhSCj2s7YtOtyTj2BaU2kctGIg6tEB1e82cSUiS fybD1AWWjHpNSJYiZMCjc6HroXmxxSx2gQ== X-Google-Smtp-Source: ABdhPJwYbu0lXL6NaQaxL/wRWr8p9NbFjgPh+aKAqKNc4+CL7M1z5BEKof0zSwVLmXWY+eYxyoLQig== X-Received: by 2002:a05:6a00:2349:b0:51c:29c0:82f6 with SMTP id j9-20020a056a00234900b0051c29c082f6mr20155487pfj.32.1654811219207; Thu, 09 Jun 2022 14:46:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 1/2] target/arm: Adjust format test in scr_write Date: Thu, 9 Jun 2022 14:46:56 -0700 Message-Id: <20220609214657.1217913-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609214657.1217913-1-richard.henderson@linaro.org> References: <20220609214657.1217913-1-richard.henderson@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=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654811569363100001 Content-Type: text/plain; charset="utf-8" Because reset always initializes the AA64 version, SCR_EL3, test the mode of EL3 instead of the type of the cpreg. Signed-off-by: Richard Henderson --- target/arm/helper.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index ac9942d750..d6818f281a 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1738,12 +1738,14 @@ static void scr_write(CPUARMState *env, const ARMCP= RegInfo *ri, uint64_t value) uint32_t valid_mask =3D 0x3fff; ARMCPU *cpu =3D env_archcpu(env); =20 - if (ri->state =3D=3D ARM_CP_STATE_AA64) { - if (arm_feature(env, ARM_FEATURE_AARCH64) && - !cpu_isar_feature(aa64_aa32_el1, cpu)) { - value |=3D SCR_FW | SCR_AW; /* these two bits are RES1. = */ - } - valid_mask &=3D ~SCR_NET; + /* + * Because SCR_EL3 is the "real" cpreg and SCR is the alias, reset alw= ays + * passes the reginfo for SCR_EL3, which has type ARM_CP_STATE_AA64. + * Instead, choose the format based on the mode of EL3. + */ + if (arm_el_is_aa64(env, 3)) { + value |=3D SCR_FW | SCR_AW; /* RES1 */ + valid_mask &=3D ~SCR_NET; /* RES0 */ =20 if (cpu_isar_feature(aa64_ras, cpu)) { valid_mask |=3D SCR_TERR; --=20 2.34.1 From nobody Fri May 17 05:54:46 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=1654811450; cv=none; d=zohomail.com; s=zohoarc; b=F0uB5L/laQFpLoZIwZKJIChkfTz04llI94NpAseRIBsfksUWal1f3ohCHAkVq17bR2OJ/Ap4Uons92SBKUJEcr4JK4uWtLQ6G+sUwk6Lp6Smm36zZ74LdjjU/tNp7YgdQlaI8I+xSYViM3jXrInn+jmTMW4ZIPW6xOkMtlvLGSA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654811450; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LBl5lC6+BEWBx9CDz/ugV2RwSxtDzpdW2uqAoTk2bvo=; b=bCkPTAyXqcO5Y3DznH9nMdxMPsEt0MB8/2XIKw69GgxZZ6rZD8yxwckm8rLHOdMWpQDZcrKICSdXxXuj5dFkOZk8ogXvLJ7c7CUP5JjZHViAF0IM33uRfSQDJRDbp8ocFP2pPe3PxhiKBqkz+JpALwx6van6Bg85Y3bH50aBWbE= 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 165481145048258.225495234874074; Thu, 9 Jun 2022 14:50:50 -0700 (PDT) Received: from localhost ([::1]:49650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzQ3E-0004UU-Uo for importer@patchew.org; Thu, 09 Jun 2022 17:50:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzPzd-0001to-2a for qemu-devel@nongnu.org; Thu, 09 Jun 2022 17:47:05 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:35707) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzPzZ-0003ov-Ei for qemu-devel@nongnu.org; Thu, 09 Jun 2022 17:47:04 -0400 Received: by mail-pf1-x42b.google.com with SMTP id u2so22206377pfc.2 for ; Thu, 09 Jun 2022 14:47:00 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id gw9-20020a17090b0a4900b001e2f6c7b6f6sm179167pjb.10.2022.06.09.14.46.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 14:46:59 -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=LBl5lC6+BEWBx9CDz/ugV2RwSxtDzpdW2uqAoTk2bvo=; b=wFfk04we4VvoPTKrJt5HbLxAAM28fGHfwb6GIhejSnkXgbHpj8KjPtDixTcJpwMjWj J/8gtAcLfTne5Jk7+43rX0Ys2KXx2GIq75m07Bk123G2ZiC08zou50ogJVefdNbFmeht OWYm5mFsTFwf6pxjG06X8LhlF0XtaU1Zhkgyd23o02YmszbkQIqn69NaN+KTzrvaJU6E waIbI6ZC2XItwQvgZPSIsYZ51rrcVEnSZ6vismD6GfNzbAkP5RWSILiW1JaYU+eijuMc rLpAGB9n78CgyiNtofsg92hjYiN/oC+ZMIm9wf8RP3V8/S9WtFDTaccu5yDmCgnjf1+J 6Ekg== 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=LBl5lC6+BEWBx9CDz/ugV2RwSxtDzpdW2uqAoTk2bvo=; b=FNfKfz1FtncYkohj6Ll9ysQNvEgkGdbK0Dk5Hgi8r16NtI0WLDIu3my+Ol2rNOl3Tt ejjwOK3qMGIQrmv3i1rojJXrTscipPT95Hp9TkhLJffPvtQTvgxlYnIZqrz83q86H9tl F77JQiDrS7F3b5R47m6BqFbexbjhe05q9Uj0xPh9w+5hxGq1VQwp6+/kgGvZPn5tIUWg kQ4sR4v2qYVY7WrAsGvY1dwwlFG2nUW1eDF579kk5OhYqFI5WHmuTvGA7CyIhOWJwuUk jZ0bV83iCnbQJLHytAi+GkXSei4aNCzz5pbUelLw55tZlYgc2OS48dhlH3KZ1HDXqfM/ iPMg== X-Gm-Message-State: AOAM532q94uWtEHtuYFGGBtz2N2ZxUzOZOfz84gUZO9lWkLGF87wao0A MMj4CAjBf3I4wbk1R5wWmqVdUQZfTi6T7A== X-Google-Smtp-Source: ABdhPJwRQDoq7Hc8nUydGZJccXxVe+nnn4YkKKMlnU1vgW5esV4UYZhQakmPuO6gV7O8y12RmHy1wg== X-Received: by 2002:a65:6044:0:b0:3fc:674:8f5a with SMTP id a4-20020a656044000000b003fc06748f5amr36606074pgp.436.1654811219951; Thu, 09 Jun 2022 14:46:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 2/2] target/arm: SCR_EL3.RW is RAO/WI without AArch32 EL[12] Date: Thu, 9 Jun 2022 14:46:57 -0700 Message-Id: <20220609214657.1217913-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609214657.1217913-1-richard.henderson@linaro.org> References: <20220609214657.1217913-1-richard.henderson@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=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654811452807100003 Content-Type: text/plain; charset="utf-8" Since DDI0487F.a, the RW bit is RAO/WI. When specifically targeting such a cpu, e.g. cortex-a76, it is legitimate to ignore the bit within the secure monitor. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1062 Signed-off-by: Richard Henderson --- target/arm/cpu.h | 5 +++++ target/arm/helper.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 78dbcb5592..c489519923 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3978,6 +3978,11 @@ static inline bool isar_feature_aa64_aa32_el1(const = ARMISARegisters *id) return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL1) >=3D 2; } =20 +static inline bool isar_feature_aa64_aa32_el2(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL2) >=3D 2; +} + static inline bool isar_feature_aa64_ras(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RAS) !=3D 0; diff --git a/target/arm/helper.c b/target/arm/helper.c index d6818f281a..0d1670f89b 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1747,6 +1747,10 @@ static void scr_write(CPUARMState *env, const ARMCPR= egInfo *ri, uint64_t value) value |=3D SCR_FW | SCR_AW; /* RES1 */ valid_mask &=3D ~SCR_NET; /* RES0 */ =20 + if (!cpu_isar_feature(aa64_aa32_el1, cpu) && + !cpu_isar_feature(aa64_aa32_el2, cpu)) { + value |=3D SCR_RW; /* RAO/WI*/ + } if (cpu_isar_feature(aa64_ras, cpu)) { valid_mask |=3D SCR_TERR; } --=20 2.34.1