[PATCH v2 32/58] target/arm/hvf/hvf: Document $pc adjustment in HVF & SMC

Philippe Mathieu-Daudé posted 58 patches 3 weeks, 1 day ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Cameron Esfahani <dirty@apple.com>, Roman Bolshakov <rbolshakov@ddn.com>, Phil Dennis-Jordan <phil@philjordan.eu>, Mads Ynddal <mads@ynddal.dk>, Peter Maydell <peter.maydell@linaro.org>, Alexander Graf <agraf@csgraf.de>, Stefan Hajnoczi <stefanha@redhat.com>
There is a newer version of this series
[PATCH v2 32/58] target/arm/hvf/hvf: Document $pc adjustment in HVF & SMC
Posted by Philippe Mathieu-Daudé 3 weeks, 1 day ago
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/arm/hvf/hvf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index b5fdd86837e..a045f83c9e2 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -1947,6 +1947,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp)
     case EC_AA64_HVC:
         cpu_synchronize_state(cpu);
         if (arm_is_psci_call(arm_cpu, EXCP_HVC)) {
+            /* Do NOT advance $pc for HVC */
             if (!hvf_handle_psci_call(cpu)) {
                 trace_hvf_unknown_hvc(env->pc, env->xregs[0]);
                 /* SMCCC 1.3 section 5.2 says every unknown SMCCC call returns -1 */
@@ -1960,6 +1961,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp)
     case EC_AA64_SMC:
         cpu_synchronize_state(cpu);
         if (arm_is_psci_call(arm_cpu, EXCP_SMC)) {
+            /* Secure Monitor Call exception, we need to advance $pc */
             advance_pc = true;
 
             if (!hvf_handle_psci_call(cpu)) {
-- 
2.51.0


Re: [PATCH v2 32/58] target/arm/hvf/hvf: Document $pc adjustment in HVF & SMC
Posted by Richard Henderson 2 weeks, 6 days ago
On 10/23/25 13:52, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   target/arm/hvf/hvf.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
> index b5fdd86837e..a045f83c9e2 100644
> --- a/target/arm/hvf/hvf.c
> +++ b/target/arm/hvf/hvf.c
> @@ -1947,6 +1947,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp)
>       case EC_AA64_HVC:
>           cpu_synchronize_state(cpu);
>           if (arm_is_psci_call(arm_cpu, EXCP_HVC)) {
> +            /* Do NOT advance $pc for HVC */
>               if (!hvf_handle_psci_call(cpu)) {
>                   trace_hvf_unknown_hvc(env->pc, env->xregs[0]);
>                   /* SMCCC 1.3 section 5.2 says every unknown SMCCC call returns -1 */
> @@ -1960,6 +1961,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp)
>       case EC_AA64_SMC:
>           cpu_synchronize_state(cpu);
>           if (arm_is_psci_call(arm_cpu, EXCP_SMC)) {
> +            /* Secure Monitor Call exception, we need to advance $pc */
>               advance_pc = true;
>   
>               if (!hvf_handle_psci_call(cpu)) {

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~