From patchwork Thu Jun 9 20:28:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 580326 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp1138026max; Thu, 9 Jun 2022 13:52:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyIRAoMwyQ3JbMmO7mGNRhQOFDu/XhHe6KcWZ5wK38CJ7Q7jq6Em8J2tbp/HAZrgbFz00b X-Received: by 2002:a05:620a:4312:b0:6a6:5b66:5b9b with SMTP id u18-20020a05620a431200b006a65b665b9bmr29080639qko.224.1654807959401; Thu, 09 Jun 2022 13:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654807959; cv=none; d=google.com; s=arc-20160816; b=OhW5SYacSRSe62yov15jRmxm7MeDkxqipuNLNNqNTQPJMOI1ZkIh8yGJhMsQ3gqzV5 +4Q3y7dQKjDWuqhI7zZbUVoLsNpy0wxK40kWNwcyr8ADfwhAJGlF5xK2bjF36Sq5W/En 7EwLJNO8Ylo1rDlcp32uk0NLbKd/MEDqgJX6tb6GedHIXqgF2Ppeds4OIOveDuFfs3z3 /Gj9ZEuPfLFu/nDOFOXWH9T0vApwNgl7q1i/DsZZUADiH5Dp32lkYaP78pM89lHaaZEq PQPRetGVL6hbbZAt5lv4I6haoCBwrFS/Dd5246xStx9dF/qRL/7xV604vH4Xa30VpA9w tPdA== 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:cc:to :from:dkim-signature; bh=or4hVFMgSgQ4bkROq2u2MyvWBg+YN6u3/ulE0jHiq7E=; b=jobAg4jR3SZfRRco2X0YfxdKIUFqhphCrsDboOwum0T5s9BIaKbCTMTwLo49g7cnXl VPOg4KeOC6SIbW4pBMgSAVix/f7qFySMVLDEtQqc2B7hONx0WVg3uwpYFdfd0BB0VXpq f22Ppyr3m7V0HgH4RXc0vMFAc0gvYsoqRgm+PBLVylawJfaet0aGsN0p9aGZgF30PZ+E 33hNYlpuI4kQOf3hf3l8cTSGZYRb8N7kzV8+gnnvFUI7Z8xMKeAAY8elxU2EQl+ydYKz +d0zpFB9EVAhIF4kh+wEvo67x/MLx3FfsA4oNm72OdEbaHRdh3YQHMRSdHWrF/S8mL6B sVdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d7qOLqSz; 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 y10-20020a05622a004a00b00304f4d49bd1si5613019qtw.574.2022.06.09.13.52.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jun 2022 13:52:39 -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=d7qOLqSz; 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]:36326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzP8x-0008L3-04 for patch@linaro.org; Thu, 09 Jun 2022 16:52:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42988) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmC-0003Td-Q9 for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:08 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:39626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmA-0008Qj-Ku for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:08 -0400 Received: by mail-pl1-x62a.google.com with SMTP id o17so21146793pla.6 for ; Thu, 09 Jun 2022 13:29:06 -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=or4hVFMgSgQ4bkROq2u2MyvWBg+YN6u3/ulE0jHiq7E=; b=d7qOLqSzGe3SlYCLMEVqsHC5BKw1lZfzjDZEXGYVdzvtks8WDH/nZQMAQuTo9YsgWh oL03qUF+wtt50SOLayegK2xisGzfOlh0xpjfWRTWwn5EFTv46vYcI6suN0DCgjnSoKTv 8DPVisZcIx3x45aA4xMIIWYAIA3ft627At2+zhkegA7QGaHLQOzL27QByfvYsspPEDUv HzGaeo1QFAHdjUAI+bxkC7/IyzXQpdIGtyx0WTd95nT2SPAu00NFYasPLFeLc709FxPf dtCZPMeXu9t+pdWGnsCmS718PGOv4tqHrVAMPJeFE69SM2LbJQv1tebYluvlDmmsIOhT geBQ== 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=or4hVFMgSgQ4bkROq2u2MyvWBg+YN6u3/ulE0jHiq7E=; b=xl3XAH+FW7EskUIjxHc79zsHVCcLDlEGMamavATlQEDthrjjvkBWIVNtn7EPbqUYvQ 7YQly/NERzf87UVAp1w5sJyzabrRVbN7k0wVEk31qtjgrPreM8jKmW/4PXl5e9JDkB0m +atkv9npimnG6EgTQf3gpTW9ln2arGdoH09vVRgcuvEIQ3Ipoxv17vVqzL2HRfVTE6Re 8qzm1VFPSyOJK7HEIwGqEQ7BOsDDbcc4vdwy/VUdd4iZPmly6wjbZwJneQ+VRRe4NUVH pT3VZiMIeeUzjSIChtSiRimYPcqHgSUXGGRC1oyjHS8qx5RXyqwMoM+aIToYjNyGRO4+ YpCQ== X-Gm-Message-State: AOAM5320dfyKkollCyuCaCprqH3riUePfD/dao/5jJRyzWUJQAHq1q48 VDBFcU/dTH1rnTMiXsLrPAG/mR44Nj7NNA== X-Received: by 2002:a17:90a:5c84:b0:1dc:9b42:f2cf with SMTP id r4-20020a17090a5c8400b001dc9b42f2cfmr5033134pji.123.1654806545247; Thu, 09 Jun 2022 13:29:05 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 03/23] target/arm: Move exception_target_el out of line Date: Thu, 9 Jun 2022 13:28:41 -0700 Message-Id: <20220609202901.1177572-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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" Move the function to op_helper.c, near raise_exception. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/internals.h | 16 +--------------- target/arm/op_helper.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index a1bae4588a..af9de2dbe5 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1098,21 +1098,6 @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va, int aa64_va_parameter_tbi(uint64_t tcr, ARMMMUIdx mmu_idx); int aa64_va_parameter_tbid(uint64_t tcr, ARMMMUIdx mmu_idx); -static inline int exception_target_el(CPUARMState *env) -{ - int target_el = MAX(1, arm_current_el(env)); - - /* - * No such thing as secure EL1 if EL3 is aarch32, - * so update the target EL to EL3 in this case. - */ - if (arm_is_secure(env) && !arm_el_is_aa64(env, 3) && target_el == 1) { - target_el = 3; - } - - return target_el; -} - /* Determine if allocation tags are available. */ static inline bool allocation_tag_access_enabled(CPUARMState *env, int el, uint64_t sctlr) @@ -1339,6 +1324,7 @@ void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu); bool el_is_in_host(CPUARMState *env, int el); void aa32_max_features(ARMCPU *cpu); +int exception_target_el(CPUARMState *env); /* Powers of 2 for sve_vq_map et al. */ #define SVE_VQ_POW2_MAP \ diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index c4bd668870..97c8c9ec77 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -28,6 +28,21 @@ #define SIGNBIT (uint32_t)0x80000000 #define SIGNBIT64 ((uint64_t)1 << 63) +int exception_target_el(CPUARMState *env) +{ + int target_el = MAX(1, arm_current_el(env)); + + /* + * No such thing as secure EL1 if EL3 is aarch32, + * so update the target EL to EL3 in this case. + */ + if (arm_is_secure(env) && !arm_el_is_aa64(env, 3) && target_el == 1) { + target_el = 3; + } + + return target_el; +} + void raise_exception(CPUARMState *env, uint32_t excp, uint32_t syndrome, uint32_t target_el) {