From patchwork Thu Mar 12 19:41:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 184512 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp956102ile; Thu, 12 Mar 2020 12:48:12 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtGMTGfV/OS0IdC2njB4stVInPBBRbIynvChjO8gggRBT2Wae9DQ3GcyK7xFkDFeBRJQwA2 X-Received: by 2002:a0c:e98c:: with SMTP id z12mr9203445qvn.64.1584042492192; Thu, 12 Mar 2020 12:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584042492; cv=none; d=google.com; s=arc-20160816; b=EJUMg7bZbjwQSlDvpAkzQOX933B61HhD1WLjCHwGEVJ0Pu3LB+EdpLkelauxUjxKOE PQqEdoneZv1W3TRae9tRh7pjqNwnTwW/UWg9E9B5JAUjkCazUHd6htdJlcrk1OEQ/r2Y rXE4QDJVY9xzcDUXM22DnF/qltObLKRYQUnZs1VrI7WCIk6FkZSuidn4jkkgj6Dh0Lbj 0JhrHlY5mY+cPZfu9YLAthg9PCVo6teGsYCTeVEwNFJA9VCJkgjm0imOnjMeKAwT8OrQ qdQTZArKb04jgXCSK7ZgAJrXl3oI8YlmJxaOeoTlA3ZpU4QRVAUx9aKlnVRTPzkxWdCi NpvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=KKlja8O+mQ8iXiIKMzNB9d94+lPcoNwMRA3J2mjKmq8=; b=kAaZq0uURg9MZ224dkOXuOYkWefZhzsrMlKXPNFT5iQp4mhmj9junu1NRstjEZc90D 3PT+FYS718aaa8Uol7p1zcU4dJjX7iX1H31oc7LLrCRQ0sNHCwx2IFxlvJAH4ZXdC4no 3p1IQxU4p7AHSsgfBt4Ql4nUAeAUFMxJdMjEPBLDcKA74/9Az+cXH/PwhGYcDPmWncCk ocr5cTGy/tbAvz+NZokYvIwu1TWXWHCNLXY0UQdzDkUD/oGIv4ov0hRbf/J6X1KsHgHI 4aelLnn+tq4q8fpwNuHeJ1l2UxVMvmgUbsqglxxS1e4pfY6j7R4T25zglsE5+xa7xAqu hVwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wYhN8mA6; 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 z6si3522674qti.271.2020.03.12.12.48.12 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Mar 2020 12:48:12 -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=wYhN8mA6; 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]:49314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCToR-0004nd-LM for patch@linaro.org; Thu, 12 Mar 2020 15:48:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45526) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCTjI-0005cH-7k for qemu-devel@nongnu.org; Thu, 12 Mar 2020 15:42:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCTjG-0002AE-WA for qemu-devel@nongnu.org; Thu, 12 Mar 2020 15:42:52 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:40647) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jCTjG-00029c-RE for qemu-devel@nongnu.org; Thu, 12 Mar 2020 15:42:50 -0400 Received: by mail-pl1-x643.google.com with SMTP id h11so3063744plk.7 for ; Thu, 12 Mar 2020 12:42:50 -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=KKlja8O+mQ8iXiIKMzNB9d94+lPcoNwMRA3J2mjKmq8=; b=wYhN8mA6uSPm/Tx4/2l4L5fu4AxfqE+D69Qh2Mv9sNEgcEPsjyvSVG7yT4lP3WoeqS lIPWEZi5xhy+6/NtpLZ82XQocewuKlNS93sBMktampoMCIfv2XEHmeusiVpowLEi9l8e xScvoOeYkM7xU3yBTNJnrBdcTlBJ4nCoTrMcSe0S72GesaHL71yeELFRDODhqDR5v4y5 qQ3wVOZH57QeVzzR0mLHGUxs5JLlM1F0rcY7VOeUiftZuS9PdCmxxQe19fQrxea1nQc2 3GoTibt0QglDQMcWrbgJrVAINinOpL7N+pflPQSrfv2WevPKI+RkW7TQ+t0tgTjAsSWY y/CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KKlja8O+mQ8iXiIKMzNB9d94+lPcoNwMRA3J2mjKmq8=; b=MsV/N4/kuVk9xFuSz4GJBY0gmlW7Q544YrEoVRxxNfKHjlJ97uFvmSpOkUBjPcHvYj QWV3z0HhzdbQzae8cryVkublak2VqTW4sq4NciARhql9AkP8ETUoLC7ROfjfSAGhTveQ xUMyyIXZa1jzdShFfuitxGe4XTZtVvW7bJGDVxZx1LZbR1TdH56NjRoq1Tr8ZXUd3XXG bZ6grUaOkhXWX84JM4zuggkF3bI1N/mSw6Hp1dH2R9z2upFoZSBFO8N6DIMyOCPX462o KdJbhqFjQMINM7EWQa5k/jiE2yffX8ObQCgpHrH8rPtCf0tm0OK53KKzUarZmh8vwg3T i6ZA== X-Gm-Message-State: ANhLgQ0++jrlzeEaoEmTO3O5tUlcMZptJrOmM3huxrNLqz6wfgJ9m7fZ 2GIR+6FiDTT1nW3jsU6FZ2lp1BL+SdQ= X-Received: by 2002:a17:90a:7348:: with SMTP id j8mr4584415pjs.63.1584042169514; Thu, 12 Mar 2020 12:42:49 -0700 (PDT) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id g69sm6824842pje.34.2020.03.12.12.42.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 12:42:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 21/42] target/arm: Move regime_el to internals.h Date: Thu, 12 Mar 2020 12:41:58 -0700 Message-Id: <20200312194219.24406-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200312194219.24406-1-richard.henderson@linaro.org> References: <20200312194219.24406-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We will shortly need this in mte_helper.c as well. Signed-off-by: Richard Henderson --- target/arm/internals.h | 36 ++++++++++++++++++++++++++++++++++++ target/arm/helper.c | 36 ------------------------------------ 2 files changed, 36 insertions(+), 36 deletions(-) -- 2.20.1 diff --git a/target/arm/internals.h b/target/arm/internals.h index 3190fc40fc..f091891312 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -912,6 +912,42 @@ static inline bool regime_is_pan(CPUARMState *env, ARMMMUIdx mmu_idx) } } +/* Return the exception level which controls this address translation regime */ +static inline uint32_t regime_el(CPUARMState *env, ARMMMUIdx mmu_idx) +{ + switch (mmu_idx) { + case ARMMMUIdx_E20_0: + case ARMMMUIdx_E20_2: + case ARMMMUIdx_E20_2_PAN: + case ARMMMUIdx_Stage2: + case ARMMMUIdx_E2: + return 2; + case ARMMMUIdx_SE3: + return 3; + case ARMMMUIdx_SE10_0: + return arm_el_is_aa64(env, 3) ? 1 : 3; + case ARMMMUIdx_SE10_1: + case ARMMMUIdx_SE10_1_PAN: + case ARMMMUIdx_Stage1_E0: + case ARMMMUIdx_Stage1_E1: + case ARMMMUIdx_Stage1_E1_PAN: + case ARMMMUIdx_E10_0: + case ARMMMUIdx_E10_1: + case ARMMMUIdx_E10_1_PAN: + case ARMMMUIdx_MPrivNegPri: + case ARMMMUIdx_MUserNegPri: + case ARMMMUIdx_MPriv: + case ARMMMUIdx_MUser: + case ARMMMUIdx_MSPrivNegPri: + case ARMMMUIdx_MSUserNegPri: + case ARMMMUIdx_MSPriv: + case ARMMMUIdx_MSUser: + return 1; + default: + g_assert_not_reached(); + } +} + /* Return the FSR value for a debug exception (watchpoint, hardware * breakpoint or BKPT insn) targeting the specified exception level. */ diff --git a/target/arm/helper.c b/target/arm/helper.c index f9daeec1f4..2a50d4e9a2 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -9753,42 +9753,6 @@ void arm_cpu_do_interrupt(CPUState *cs) } #endif /* !CONFIG_USER_ONLY */ -/* Return the exception level which controls this address translation regime */ -static uint32_t regime_el(CPUARMState *env, ARMMMUIdx mmu_idx) -{ - switch (mmu_idx) { - case ARMMMUIdx_E20_0: - case ARMMMUIdx_E20_2: - case ARMMMUIdx_E20_2_PAN: - case ARMMMUIdx_Stage2: - case ARMMMUIdx_E2: - return 2; - case ARMMMUIdx_SE3: - return 3; - case ARMMMUIdx_SE10_0: - return arm_el_is_aa64(env, 3) ? 1 : 3; - case ARMMMUIdx_SE10_1: - case ARMMMUIdx_SE10_1_PAN: - case ARMMMUIdx_Stage1_E0: - case ARMMMUIdx_Stage1_E1: - case ARMMMUIdx_Stage1_E1_PAN: - case ARMMMUIdx_E10_0: - case ARMMMUIdx_E10_1: - case ARMMMUIdx_E10_1_PAN: - case ARMMMUIdx_MPrivNegPri: - case ARMMMUIdx_MUserNegPri: - case ARMMMUIdx_MPriv: - case ARMMMUIdx_MUser: - case ARMMMUIdx_MSPrivNegPri: - case ARMMMUIdx_MSUserNegPri: - case ARMMMUIdx_MSPriv: - case ARMMMUIdx_MSUser: - return 1; - default: - g_assert_not_reached(); - } -} - uint64_t arm_sctlr(CPUARMState *env, int el) { /* Only EL0 needs to be adjusted for EL1&0 or EL2&0. */