diff mbox series

[RFC,04/13] target/ppc: prepare to split ppc_interrupt_pending by excp_model

Message ID 20220815162020.2420093-5-matheus.ferst@eldorado.org.br
State Changes Requested
Headers show
Series PowerPC interrupt rework | expand

Commit Message

Matheus K. Ferst Aug. 15, 2022, 4:20 p.m. UTC
Rename the method to ppc_interrupt_pending_legacy and create a new
ppc_interrupt_pending that will call the appropriate interrupt masking
method based on env->excp_model.

Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
---
 target/ppc/excp_helper.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Fabiano Rosas Aug. 15, 2022, 8:25 p.m. UTC | #1
Matheus Ferst <matheus.ferst@eldorado.org.br> writes:

> Rename the method to ppc_interrupt_pending_legacy and create a new
> ppc_interrupt_pending that will call the appropriate interrupt masking
> method based on env->excp_model.
>
> Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
> ---
>  target/ppc/excp_helper.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
> index 8690017c70..59981efd16 100644
> --- a/target/ppc/excp_helper.c
> +++ b/target/ppc/excp_helper.c
> @@ -1678,7 +1678,7 @@ void ppc_cpu_do_interrupt(CPUState *cs)
>      powerpc_excp(cpu, cs->exception_index);
>  }
>  
> -static int ppc_pending_interrupt(CPUPPCState *env)
> +static int ppc_pending_interrupt_legacy(CPUPPCState *env)

Won't this code continue to be used for the older CPUs? If so, I don't
think the term legacy is appropriate. It ends up being dependent on
context and what people's definitions of "legacy" are.

(if this function is removed in a later patch, then that's ok).

>  {
>      bool async_deliver;
>  
> @@ -1790,6 +1790,14 @@ static int ppc_pending_interrupt(CPUPPCState *env)
>      return 0;
>  }
>  
> +static int ppc_pending_interrupt(CPUPPCState *env)
> +{
> +    switch (env->excp_model) {
> +    default:
> +        return ppc_pending_interrupt_legacy(env);
> +    }
> +}
> +
>  static void ppc_hw_interrupt(CPUPPCState *env, int pending_interrupt)
>  {
>      PowerPCCPU *cpu = env_archcpu(env);
Matheus K. Ferst Aug. 17, 2022, 1:42 p.m. UTC | #2
On 15/08/2022 17:25, Fabiano Rosas wrote:
> Matheus Ferst <matheus.ferst@eldorado.org.br> writes:
> 
>> Rename the method to ppc_interrupt_pending_legacy and create a new
>> ppc_interrupt_pending that will call the appropriate interrupt masking
>> method based on env->excp_model.
>>
>> Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
>> ---
>>   target/ppc/excp_helper.c | 10 +++++++++-
>>   1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
>> index 8690017c70..59981efd16 100644
>> --- a/target/ppc/excp_helper.c
>> +++ b/target/ppc/excp_helper.c
>> @@ -1678,7 +1678,7 @@ void ppc_cpu_do_interrupt(CPUState *cs)
>>       powerpc_excp(cpu, cs->exception_index);
>>   }
>>
>> -static int ppc_pending_interrupt(CPUPPCState *env)
>> +static int ppc_pending_interrupt_legacy(CPUPPCState *env)
> 
> Won't this code continue to be used for the older CPUs? If so, I don't
> think the term legacy is appropriate. It ends up being dependent on
> context and what people's definitions of "legacy" are.
> 
> (if this function is removed in a later patch, then that's ok).
> 

For this RFC, I created methods for CPUs that change the interrupt 
masking logic when cs->halted is set. If the way we split the 
interruption code in the following patches is acceptable, I'm planning 
to add methods for all CPUs and remove ppc_pending_interrupt_legacy in 
future versions of this patch series.

Thanks,
Matheus K. Ferst
Instituto de Pesquisas ELDORADO <http://www.eldorado.org.br/>
Analista de Software
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>
diff mbox series

Patch

diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index 8690017c70..59981efd16 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -1678,7 +1678,7 @@  void ppc_cpu_do_interrupt(CPUState *cs)
     powerpc_excp(cpu, cs->exception_index);
 }
 
-static int ppc_pending_interrupt(CPUPPCState *env)
+static int ppc_pending_interrupt_legacy(CPUPPCState *env)
 {
     bool async_deliver;
 
@@ -1790,6 +1790,14 @@  static int ppc_pending_interrupt(CPUPPCState *env)
     return 0;
 }
 
+static int ppc_pending_interrupt(CPUPPCState *env)
+{
+    switch (env->excp_model) {
+    default:
+        return ppc_pending_interrupt_legacy(env);
+    }
+}
+
 static void ppc_hw_interrupt(CPUPPCState *env, int pending_interrupt)
 {
     PowerPCCPU *cpu = env_archcpu(env);