From patchwork Tue Apr 16 12:57:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 162336 Delivered-To: patch@linaro.org Received: by 2002:ac9:2a84:0:0:0:0:0 with SMTP id p4csp4029708oca; Tue, 16 Apr 2019 06:15:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLkVxizATUbJdlQcUcjGoOjt5TO09At2cgw07GY6+YzwGB/9SlRYQZemd80EHjacrjAYWz X-Received: by 2002:adf:edca:: with SMTP id v10mr23678575wro.157.1555420541624; Tue, 16 Apr 2019 06:15:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555420541; cv=none; d=google.com; s=arc-20160816; b=nTM+roxRwsF3NGNyrcLnGgkb7v9KngzEL9jqFWcR+nXotdCm5gVZ1Qqh9yrxLsipFM xIOExwaDH+13uaepreGmo06ZW33pN9m3zO/30XkniH5g/QxF9da7p+Uyrib0XDHijEus sGkhKpMZMUihLLCob8gJ1YgVP3aBij2dYZ2raC8Ki+GBTthJefCuMbCRmtqZeLQXAwhq qATHcFmKFlL8D4hMisO8wwcw6jQ6BfFYhMkwrdy/PzqLwk9e/vOMDY43OkMLf5zwbwPJ fDmmRVjZM/O20uwcM25UMQD1pyT/7cpq1H5cEuSe57MhkTHx3ilLBzPk98hP/uqjKXPE uo7A== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Bad+ohxUQ2aXQF4pfMXnuYXIWQ2Nayau0QYhuZSUXeA=; b=M1VsiTEp7mk2G8ro9fKm14KjQEwAW9c9jAATIeyzPZ93KLk9Aq/Homa64h1hfmSMY1 BXubI9sObP+Y8vp8D4BCrrZfvq1RrgXvDygx8WnSXAwKmzY+vg5IfenOb9ki/qLtx9lp dRHxN7zYfiiuIkBCMqc68vB8PS0LNIR3dw7F19vVIJWMjvxZHXvaJHszVFmDybIWoXxn YSIQm70ENnTcRxLtVplEQx2vTb1U0XDV4HmjMyEs8zYhIKxVqBoURtukVlkRhp6/Rbk9 Uh5rN+Bqx7SwsBZi5LFCFNawSAM8fPnAnRl1UV4KTwIz8x4/2kHU4sXwyOC6tZcLJzjV q4xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xQh+F+4A; 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=fail (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 w15si12939675wmi.34.2019.04.16.06.15.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 16 Apr 2019 06:15:41 -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=fail header.i=@linaro.org header.s=google header.b=xQh+F+4A; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:36603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGNw4-0002DS-J0 for patch@linaro.org; Tue, 16 Apr 2019 09:15:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGNfY-00055v-KR for qemu-devel@nongnu.org; Tue, 16 Apr 2019 08:58:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hGNfW-0001V6-JC for qemu-devel@nongnu.org; Tue, 16 Apr 2019 08:58:36 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:39344) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hGNfU-0001Qs-Fy for qemu-devel@nongnu.org; Tue, 16 Apr 2019 08:58:33 -0400 Received: by mail-wm1-x343.google.com with SMTP id n25so25318242wmk.4 for ; Tue, 16 Apr 2019 05:58:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Bad+ohxUQ2aXQF4pfMXnuYXIWQ2Nayau0QYhuZSUXeA=; b=xQh+F+4AbZ+JCj/OZ/rPi5WMngHxfn7bzPGmvSBmXWAksdoKPWFbXxpRxG+ubwvYzr xMuGppCtKP8bU2c0rfGv0rB6FmHFLCP8kPXniXAgn/uOVyapMzSBZq0nUbQPmUwTIFyO 9j9i/9aWuzWeNIJfun9jaWvbNk89jz9Dv7EJZAzAYMwIPEKHFMtG3vp7LlOOepW7dP5G AyFEn8yODfKJ6LtFT6c2+gumefP6ofHSDDUXhySESONyYP9IjaAAOWtbY/nHCW2N5QRh WFciEQN+3hqik5lXeP/HwyyHv0Ffyb63k54R3JCI+aiMclp3aZDgh8VjNOZZ9kcryJzT yyiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Bad+ohxUQ2aXQF4pfMXnuYXIWQ2Nayau0QYhuZSUXeA=; b=juPA5JVBqcogd6FvuCDwqGKWCRHlXGxXSZ7HNBLvTZHKSfv/00WZG1xOF4f936Soip pr0rIFuf1ucD8dgI3lMQih8xBJKPPgx//gF8YhNNbO8y6Lc5Pbywx18PYJMrsCM5RLYC +Udkifxhsk9YhUDTQxsr/6MZyiKoX89VNij9wl0oXXKOHbM+kshHk0TsE04UN8AIM2bP ZifjgjLu/Ya5vlYiVffq7+AR/gdwvoD0c4Ry5uNVy3v/wyeCQMtTGONav1C48OJ9mWBm UN9J3paea2SEJuUyy1viz9eWicqjSqD7PZ21gowtXys+uWCb/iQMYUQ8/iOS0hdLN+aJ H/VQ== X-Gm-Message-State: APjAAAVSrS4Qnxn2tF6eXBH1yRp6j+orLZEP1/limjFq5U9ATf7rw2to 3/WmC6tZbjnKc4R8a93tGxpDaw== X-Received: by 2002:a1c:80cd:: with SMTP id b196mr26034521wmd.84.1555419507531; Tue, 16 Apr 2019 05:58:27 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id v184sm39476572wma.6.2019.04.16.05.58.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Apr 2019 05:58:26 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 16 Apr 2019 13:57:38 +0100 Message-Id: <20190416125744.27770-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190416125744.27770-1-peter.maydell@linaro.org> References: <20190416125744.27770-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PATCH 20/26] target/arm: New helper function arm_v7m_mmu_idx_all() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" Add a new helper function which returns the MMU index to use for v7M, where the caller specifies all of the security state, privilege level and whether the execution priority is negative, and reimplement the existing arm_v7m_mmu_idx_for_secstate_and_priv() in terms of it. We are going to need this for the lazy-FP-stacking code. Signed-off-by: Peter Maydell --- Suggestions for better function name welcome. arm_v7m_mmu_idx_for_secstate_and_priv_and_negpri() just seems way too long and unwieldy... --- target/arm/cpu.h | 7 +++++++ target/arm/helper.c | 14 +++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 500e0ab4c5d..0a1b82dc996 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2912,6 +2912,13 @@ static inline int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx) } } +/* + * Return the MMU index for a v7M CPU with all relevant information + * manually specified. + */ +ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env, + bool secstate, bool priv, bool negpri); + /* Return the MMU index for a v7M CPU in the specified security and * privilege state. */ diff --git a/target/arm/helper.c b/target/arm/helper.c index 2feb3f664fe..c8e30b40366 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -13235,8 +13235,8 @@ int fp_exception_el(CPUARMState *env, int cur_el) return 0; } -ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, - bool secstate, bool priv) +ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env, + bool secstate, bool priv, bool negpri) { ARMMMUIdx mmu_idx = ARM_MMU_IDX_M; @@ -13244,7 +13244,7 @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, mmu_idx |= ARM_MMU_IDX_M_PRIV; } - if (armv7m_nvic_neg_prio_requested(env->nvic, secstate)) { + if (negpri) { mmu_idx |= ARM_MMU_IDX_M_NEGPRI; } @@ -13255,6 +13255,14 @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, return mmu_idx; } +ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, + bool secstate, bool priv) +{ + bool negpri = armv7m_nvic_neg_prio_requested(env->nvic, secstate); + + return arm_v7m_mmu_idx_all(env, secstate, priv, negpri); +} + /* Return the MMU index for a v7M CPU in the specified security state */ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate) {