diff mbox series

[07/13] arm: Remove unnecessary check on cpu->pmsav7_dregion

Message ID 1493122030-32191-8-git-send-email-peter.maydell@linaro.org
State Superseded
Headers show
Series armv7m: Implement MPU support | expand

Commit Message

Peter Maydell April 25, 2017, 12:07 p.m. UTC
Now that we enforce both:
 * pmsav7_dregion == 0 implies has_mpu == false
 * PMSA with has_mpu == false means SCTLR.M cannot be set
we can remove a check on pmsav7_dregion from get_phys_addr_pmsav7(),
because we can only reach this code path if the MPU is enabled
(and so region_translation_disabled() returned false).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

---
 target/arm/helper.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
2.7.4

Comments

Philippe Mathieu-Daudé May 13, 2017, 10:41 p.m. UTC | #1
On 04/25/2017 09:07 AM, Peter Maydell wrote:
> Now that we enforce both:

>  * pmsav7_dregion == 0 implies has_mpu == false

>  * PMSA with has_mpu == false means SCTLR.M cannot be set

> we can remove a check on pmsav7_dregion from get_phys_addr_pmsav7(),

> because we can only reach this code path if the MPU is enabled

> (and so region_translation_disabled() returned false).

>

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


> ---

>  target/arm/helper.c | 3 +--

>  1 file changed, 1 insertion(+), 2 deletions(-)

>

> diff --git a/target/arm/helper.c b/target/arm/helper.c

> index f0f25c8..5c044d0 100644

> --- a/target/arm/helper.c

> +++ b/target/arm/helper.c

> @@ -8227,8 +8227,7 @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address,

>          }

>

>          if (n == -1) { /* no hits */

> -            if (cpu->pmsav7_dregion &&

> -                (is_user || !(regime_sctlr(env, mmu_idx) & SCTLR_BR))) {

> +            if (is_user || !(regime_sctlr(env, mmu_idx) & SCTLR_BR)) {

>                  /* background fault */

>                  *fsr = 0;

>                  return true;

>
diff mbox series

Patch

diff --git a/target/arm/helper.c b/target/arm/helper.c
index f0f25c8..5c044d0 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -8227,8 +8227,7 @@  static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address,
         }
 
         if (n == -1) { /* no hits */
-            if (cpu->pmsav7_dregion &&
-                (is_user || !(regime_sctlr(env, mmu_idx) & SCTLR_BR))) {
+            if (is_user || !(regime_sctlr(env, mmu_idx) & SCTLR_BR)) {
                 /* background fault */
                 *fsr = 0;
                 return true;