From patchwork Mon Aug 22 15:26:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 599120 Delivered-To: patch@linaro.org Received: by 2002:a05:6918:5e84:b0:d4:ea33:5523 with SMTP id nd4csp1795105ysb; Mon, 22 Aug 2022 08:33:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR6F+gfm+IUPMiKAhoUyKuLRayjjIMFMP12GuuLOBzVvwYwYasDa7HKJHGaxc9GbLdgTi9Pw X-Received: by 2002:a05:622a:10d:b0:343:5ebc:a9f3 with SMTP id u13-20020a05622a010d00b003435ebca9f3mr15992650qtw.383.1661182386564; Mon, 22 Aug 2022 08:33:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661182386; cv=none; d=google.com; s=arc-20160816; b=u12L+k/ITL41rkSVjR/oXXETwRoLGCYb8ycYqKC34Bvzt5ekRA8ivKDIsczTv90uhf iwUdbRQspMps2Mns+WlsJp9gbo16Ylz+DfqW6xmX8v0CejtGk4RIcMLGSkJr+8jbK9EM Gyt5j4ecNQ2ND17Ez5cEtdovMR9hmMFad+WI39IgK11ApedHwgwzPu4tIdn1AFsDL79M Mp7onQ8A+lC/OwI8ur+UyJpnrhSjb/kxlEdNrLZ5eKuB7w4jtcTrs2eFEtLOHk4+5iWQ bYyiImwpKdZE6tWlwITtuIIQuHUa4z+4671CT6k+7Eb5JHWX9MbaJjpCBaCVujI8B0Nz t3cA== 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=Qgb+9tm2qJZiaV7ObM3Kp5VKd2kY2geHHlay7myc1Lo=; b=AvBHa64ok4ZnOZTOOQoGxk45dJasyhd74j4l6rK+ZWiJC0ZHwPLRF91YWF8qiKFvWK GlTa7s0seGU5paIdAXu1VeHBpyBmaj6m5NkplkbKAjJyS7QjIrJGDXIdzlv+0yLcSehg 0fxs9gYmj/FC0+pKOV6wAW3ZRiw2+8KW/pjV+FfuCB4tyEZjFhTqmByYMJ7DI8fLIdyh lBOLUyVnn3L6DbJpi87EXtsZIxC72JxB4gCEjMUepMEzYLYQATVkM0hpj/kuAW0q5l8i wwtV4WTBGlWwhCv99yO+/UikNZnb1GNktEMzbvJIY4LNPy1dhCdiUqK0lIzteuM8L0L9 chAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BdvkrmNK; 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 bb12-20020a05622a1b0c00b0034455769c4csi4640792qtb.523.2022.08.22.08.33.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Aug 2022 08:33:06 -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=BdvkrmNK; 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]:40568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQ9QI-0002ex-3p for patch@linaro.org; Mon, 22 Aug 2022 11:33:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQ9LP-0007ec-Jz for qemu-devel@nongnu.org; Mon, 22 Aug 2022 11:28:03 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:33436) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQ9LI-0000dc-CI for qemu-devel@nongnu.org; Mon, 22 Aug 2022 11:28:03 -0400 Received: by mail-pl1-x631.google.com with SMTP id 2so10268530pll.0 for ; Mon, 22 Aug 2022 08:27:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=Qgb+9tm2qJZiaV7ObM3Kp5VKd2kY2geHHlay7myc1Lo=; b=BdvkrmNKjWAL38fOCA7Viz1NU1Sb7U8NKOCigP2Gyk36OKdgBFtpy9t6gRnuNW/qc8 RH+n4pZ2V7FjcypVfW0nKZihdHsxWOROIuO4m++AnbdeUMfQmaMqIyXxxEPv5UgB3j1j DZ0wi0qew4G5h2dTRix9/Yzyf6hsJktfUST//ImTGxW39GXgSC7jpsDqPRwp5kFHfxx9 zzqngs2qlxKvPwPsAwVQpTYilbsP/a87N20y9h/rtzACxxhDlRqL3Ev8zGgiCYMSh7kc cO/stD4UsXs6mMGvpWI16Li4wwQQ3KeTLQpTTTTjWz3MJsXb+F7eREdvW50H/RdsXaXi AXXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Qgb+9tm2qJZiaV7ObM3Kp5VKd2kY2geHHlay7myc1Lo=; b=xn42bcbH2hSBKw7YnQrNrTVw9bUWtUJhwFD4pSFSyrOZUhvKraDOPG6QRsizRM85rN o3pahw39v+uZYnY3YLeeTOSusGVoqwcvgCNb/lOacNlvwQBkb4mFOVvFn5In7VWzsAib fFnYu4O7mZNNJhdZHAMDUWzU0iAyvYh8xvaDwH5v9sGzFKzd+R3pIlPho+Y9yzG5WUQr K455ZKwHCu8aPtqOLNl1cMfFIky8qHZ5tNITDJucnEpEBrRf9EuuaJhXo9PleihrhW90 Pc6o/jLwmG71vwWw/sefZmKI4+oFWDNHCAYX+CeZ6KKP2hw74XyPUlz/CpXsYLRRDh4y m5OA== X-Gm-Message-State: ACgBeo0hClYnvCo8QI5l22TaRyO1TIDZlj7m8f6IuKPsPjsErJrTNdxh q23vA5ip4MO0kOinbIhwSZlN1gGLQ74NnQ== X-Received: by 2002:a17:902:d714:b0:170:c27c:d4a with SMTP id w20-20020a170902d71400b00170c27c0d4amr20347705ply.18.1661182075611; Mon, 22 Aug 2022 08:27:55 -0700 (PDT) Received: from stoup.. ([71.212.157.236]) by smtp.gmail.com with ESMTPSA id q7-20020a17090311c700b0016bffc59718sm8665222plh.58.2022.08.22.08.27.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 08:27:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH v2 16/66] target/arm: Add is_secure parameter to pmsav7_use_background_region Date: Mon, 22 Aug 2022 08:26:51 -0700 Message-Id: <20220822152741.1617527-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220822152741.1617527-1-richard.henderson@linaro.org> References: <20220822152741.1617527-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Remove the use of regime_is_secure from pmsav7_use_background_region, using the new parameter instead. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/ptw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index fccac2d71f..b7911e88c1 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -1489,7 +1489,7 @@ static bool m_is_system_region(CPUARMState *env, uint32_t address) } static bool pmsav7_use_background_region(ARMCPU *cpu, ARMMMUIdx mmu_idx, - bool is_user) + bool is_secure, bool is_user) { /* * Return true if we should use the default memory map as a @@ -1502,8 +1502,7 @@ static bool pmsav7_use_background_region(ARMCPU *cpu, ARMMMUIdx mmu_idx, } if (arm_feature(env, ARM_FEATURE_M)) { - return env->v7m.mpu_ctrl[regime_is_secure(env, mmu_idx)] - & R_V7M_MPU_CTRL_PRIVDEFENA_MASK; + return env->v7m.mpu_ctrl[is_secure] & R_V7M_MPU_CTRL_PRIVDEFENA_MASK; } else { return regime_sctlr(env, mmu_idx) & SCTLR_BR; } @@ -1516,6 +1515,7 @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, { ARMCPU *cpu = env_archcpu(env); int n; + bool secure = regime_is_secure(env, mmu_idx); bool is_user = regime_is_user(env, mmu_idx); result->phys = address; @@ -1618,7 +1618,7 @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, } if (n == -1) { /* no hits */ - if (!pmsav7_use_background_region(cpu, mmu_idx, is_user)) { + if (!pmsav7_use_background_region(cpu, mmu_idx, secure, is_user)) { /* background fault */ fi->type = ARMFault_Background; return true; @@ -1738,7 +1738,7 @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, } else if (m_is_ppb_region(env, address)) { hit = true; } else { - if (pmsav7_use_background_region(cpu, mmu_idx, is_user)) { + if (pmsav7_use_background_region(cpu, mmu_idx, secure, is_user)) { hit = true; }