qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH-for-4.1] target/arm: Add missing break statement for Hypervisor Trap Exception
@ 2019-07-19 11:14 Philippe Mathieu-Daudé
  2019-07-19 11:47 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-07-19 11:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Edgar E . Iglesias, Peter Maydell, Richard Henderson, qemu-arm,
	Philippe Mathieu-Daudé, Luc Michel

Reported by GCC9 when building with  -Wimplicit-fallthrough=2:

  target/arm/helper.c: In function ‘arm_cpu_do_interrupt_aarch32_hyp’:
  target/arm/helper.c:7958:14: error: this statement may fall through [-Werror=implicit-fallthrough=]
   7958 |         addr = 0x14;
        |         ~~~~~^~~~~~
  target/arm/helper.c:7959:5: note: here
   7959 |     default:
        |     ^~~~~~~
  cc1: all warnings being treated as errors

Fixes: b9bc21ff9f9
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 target/arm/helper.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 20f8728be1..b74c23a9bc 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -7956,6 +7956,7 @@ static void arm_cpu_do_interrupt_aarch32_hyp(CPUState *cs)
         break;
     case EXCP_HYP_TRAP:
         addr = 0x14;
+        break;
     default:
         cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index);
     }
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH-for-4.1] target/arm: Add missing break statement for Hypervisor Trap Exception
  2019-07-19 11:14 [Qemu-devel] [PATCH-for-4.1] target/arm: Add missing break statement for Hypervisor Trap Exception Philippe Mathieu-Daudé
@ 2019-07-19 11:47 ` Peter Maydell
  2019-07-19 12:59   ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2019-07-19 11:47 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Edgar E . Iglesias, qemu-arm, Richard Henderson, QEMU Developers,
	Luc Michel

On Fri, 19 Jul 2019 at 12:15, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> Reported by GCC9 when building with  -Wimplicit-fallthrough=2:
>
>   target/arm/helper.c: In function ‘arm_cpu_do_interrupt_aarch32_hyp’:
>   target/arm/helper.c:7958:14: error: this statement may fall through [-Werror=implicit-fallthrough=]
>    7958 |         addr = 0x14;
>         |         ~~~~~^~~~~~
>   target/arm/helper.c:7959:5: note: here
>    7959 |     default:
>         |     ^~~~~~~
>   cc1: all warnings being treated as errors
>
> Fixes: b9bc21ff9f9
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  target/arm/helper.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/target/arm/helper.c b/target/arm/helper.c
> index 20f8728be1..b74c23a9bc 100644
> --- a/target/arm/helper.c
> +++ b/target/arm/helper.c
> @@ -7956,6 +7956,7 @@ static void arm_cpu_do_interrupt_aarch32_hyp(CPUState *cs)
>          break;
>      case EXCP_HYP_TRAP:
>          addr = 0x14;
> +        break;
>      default:
>          cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index);
>      }

I think this is right, but EXCP_HYP_TRAP is a bit odd -- we appear
to use this only for the case of "SMC instruction is trapped from
NS EL1 to EL2 by HCR.TSC". I was expecting more traps-to-EL2
to use this EXCP_ variable... Mostly we seem to use EXCP_UDEF,
eg for CP_ACCESS_TRAP_UNCATEGORIZED_EL2 coprocessor/sysreg accesses:
this has the same behaviour as EXCP_HYP_TRAP as long as we know
we are going from an EL below 2 to EL2. Which I think we could
also use in the one place we use EXCP_HYP_TRAP; or we could make
wider use of EXCP_HYP_TRAP, since feeding everything through
EXCP_UDEF is rather confusing.

Anyway, for 4.1 we should do this.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH-for-4.1] target/arm: Add missing break statement for Hypervisor Trap Exception
  2019-07-19 11:47 ` Peter Maydell
@ 2019-07-19 12:59   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-07-19 12:59 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Edgar E . Iglesias, qemu-arm, Richard Henderson, QEMU Developers,
	Luc Michel

On 7/19/19 1:47 PM, Peter Maydell wrote:
> On Fri, 19 Jul 2019 at 12:15, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>
>> Reported by GCC9 when building with  -Wimplicit-fallthrough=2:
>>
>>   target/arm/helper.c: In function ‘arm_cpu_do_interrupt_aarch32_hyp’:
>>   target/arm/helper.c:7958:14: error: this statement may fall through [-Werror=implicit-fallthrough=]
>>    7958 |         addr = 0x14;
>>         |         ~~~~~^~~~~~
>>   target/arm/helper.c:7959:5: note: here
>>    7959 |     default:
>>         |     ^~~~~~~
>>   cc1: all warnings being treated as errors
>>
>> Fixes: b9bc21ff9f9
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>  target/arm/helper.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/target/arm/helper.c b/target/arm/helper.c
>> index 20f8728be1..b74c23a9bc 100644
>> --- a/target/arm/helper.c
>> +++ b/target/arm/helper.c
>> @@ -7956,6 +7956,7 @@ static void arm_cpu_do_interrupt_aarch32_hyp(CPUState *cs)
>>          break;
>>      case EXCP_HYP_TRAP:
>>          addr = 0x14;
>> +        break;
>>      default:
>>          cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index);
>>      }
> 
> I think this is right, but EXCP_HYP_TRAP is a bit odd -- we appear
> to use this only for the case of "SMC instruction is trapped from
> NS EL1 to EL2 by HCR.TSC". I was expecting more traps-to-EL2
> to use this EXCP_ variable... Mostly we seem to use EXCP_UDEF,
> eg for CP_ACCESS_TRAP_UNCATEGORIZED_EL2 coprocessor/sysreg accesses:
> this has the same behaviour as EXCP_HYP_TRAP as long as we know
> we are going from an EL below 2 to EL2. Which I think we could
> also use in the one place we use EXCP_HYP_TRAP; or we could make
> wider use of EXCP_HYP_TRAP, since feeding everything through
> EXCP_UDEF is rather confusing.
> 
> Anyway, for 4.1 we should do this.
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Thanks, if you take this I forgot to mention:
Reported-by: Stefan Weil <sw@weilnetz.de>

Regards,

Phil.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-19 12:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-19 11:14 [Qemu-devel] [PATCH-for-4.1] target/arm: Add missing break statement for Hypervisor Trap Exception Philippe Mathieu-Daudé
2019-07-19 11:47 ` Peter Maydell
2019-07-19 12:59   ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).