diff mbox

[2/2] target-arm: Correct condition for taking VIRQ and VFIQ

Message ID 1414414687-14265-3-git-send-email-peter.maydell@linaro.org
State Superseded
Headers show

Commit Message

Peter Maydell Oct. 27, 2014, 12:58 p.m. UTC
The VIRQ and VFIQ exceptions are (as the comments say) only
taken if the CPU is in Non-secure state and the IMO/FMO bits
are set to enable virtualized interrupts. Correct the code
to actually implement this by using '||' rather than '&&'.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/cpu.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Edgar E. Iglesias Oct. 27, 2014, 11:25 p.m. UTC | #1
On Mon, Oct 27, 2014 at 12:58:07PM +0000, Peter Maydell wrote:
> The VIRQ and VFIQ exceptions are (as the comments say) only
> taken if the CPU is in Non-secure state and the IMO/FMO bits
> are set to enable virtualized interrupts. Correct the code
> to actually implement this by using '||' rather than '&&'.

Hi Peter,

Shouldn't this be:

if (secure || ....

?

Cheers,
Edgar

> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  target-arm/cpu.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target-arm/cpu.h b/target-arm/cpu.h
> index 97eaf79..6145403 100644
> --- a/target-arm/cpu.h
> +++ b/target-arm/cpu.h
> @@ -1269,13 +1269,13 @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx)
>          }
>          return !(env->daif & PSTATE_I);
>      case EXCP_VFIQ:
> -        if (!secure && !(env->cp15.hcr_el2 & HCR_FMO)) {
> +        if (!secure || !(env->cp15.hcr_el2 & HCR_FMO)) {
>              /* VFIQs are only taken when hypervized and non-secure.  */
>              return false;
>          }
>          return !(env->daif & PSTATE_F);
>      case EXCP_VIRQ:
> -        if (!secure && !(env->cp15.hcr_el2 & HCR_IMO)) {
> +        if (!secure || !(env->cp15.hcr_el2 & HCR_IMO)) {
>              /* VIRQs are only taken when hypervized and non-secure.  */
>              return false;
>          }
> -- 
> 1.9.1
>
Peter Maydell Oct. 27, 2014, 11:37 p.m. UTC | #2
On 27 October 2014 23:25, Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote:
> On Mon, Oct 27, 2014 at 12:58:07PM +0000, Peter Maydell wrote:
>> The VIRQ and VFIQ exceptions are (as the comments say) only
>> taken if the CPU is in Non-secure state and the IMO/FMO bits
>> are set to enable virtualized interrupts. Correct the code
>> to actually implement this by using '||' rather than '&&'.
>
> Hi Peter,
>
> Shouldn't this be:
>
> if (secure || ....
>
> ?

Heh, you're right. I didn't look closely enough...

-- PMM
diff mbox

Patch

diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 97eaf79..6145403 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -1269,13 +1269,13 @@  static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx)
         }
         return !(env->daif & PSTATE_I);
     case EXCP_VFIQ:
-        if (!secure && !(env->cp15.hcr_el2 & HCR_FMO)) {
+        if (!secure || !(env->cp15.hcr_el2 & HCR_FMO)) {
             /* VFIQs are only taken when hypervized and non-secure.  */
             return false;
         }
         return !(env->daif & PSTATE_F);
     case EXCP_VIRQ:
-        if (!secure && !(env->cp15.hcr_el2 & HCR_IMO)) {
+        if (!secure || !(env->cp15.hcr_el2 & HCR_IMO)) {
             /* VIRQs are only taken when hypervized and non-secure.  */
             return false;
         }