qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 6/7] target/ppc: Use ppc_interrupts_little_endian in power


From: David Gibson
Subject: Re: [PATCH v2 6/7] target/ppc: Use ppc_interrupts_little_endian in powerpc_excp
Date: Thu, 6 Jan 2022 16:31:27 +1100

On Wed, Jan 05, 2022 at 05:40:28PM -0300, Fabiano Rosas wrote:
> The ppc_interrupts_little_endian function is now suitable for
> determining the endianness of interrupts for all CPUs.
> 
> Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>

Nice!

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  target/ppc/excp_helper.c | 29 +----------------------------
>  1 file changed, 1 insertion(+), 28 deletions(-)
> 
> diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
> index 92953af896..d16bdf9283 100644
> --- a/target/ppc/excp_helper.c
> +++ b/target/ppc/excp_helper.c
> @@ -833,36 +833,9 @@ static void powerpc_excp(PowerPCCPU *cpu, int excp)
>       * Sort out endianness of interrupt, this differs depending on the
>       * CPU, the HV mode, etc...
>       */
> -#ifdef TARGET_PPC64
> -    if (excp_model == POWERPC_EXCP_POWER7) {
> -        if (!(new_msr & MSR_HVB) && (env->spr[SPR_LPCR] & LPCR_ILE)) {
> -            new_msr |= (target_ulong)1 << MSR_LE;
> -        }
> -    } else if (excp_model == POWERPC_EXCP_POWER8) {
> -        if (new_msr & MSR_HVB) {
> -            if (env->spr[SPR_HID0] & HID0_HILE) {
> -                new_msr |= (target_ulong)1 << MSR_LE;
> -            }
> -        } else if (env->spr[SPR_LPCR] & LPCR_ILE) {
> -            new_msr |= (target_ulong)1 << MSR_LE;
> -        }
> -    } else if (excp_model == POWERPC_EXCP_POWER9 ||
> -               excp_model == POWERPC_EXCP_POWER10) {
> -        if (new_msr & MSR_HVB) {
> -            if (env->spr[SPR_HID0] & HID0_POWER9_HILE) {
> -                new_msr |= (target_ulong)1 << MSR_LE;
> -            }
> -        } else if (env->spr[SPR_LPCR] & LPCR_ILE) {
> -            new_msr |= (target_ulong)1 << MSR_LE;
> -        }
> -    } else if (msr_ile) {
> +    if (ppc_interrupts_little_endian(cpu, !!(new_msr & MSR_HVB))) {
>          new_msr |= (target_ulong)1 << MSR_LE;
>      }
> -#else
> -    if (msr_ile) {
> -        new_msr |= (target_ulong)1 << MSR_LE;
> -    }
> -#endif
>  
>  #if defined(TARGET_PPC64)
>      if (excp_model == POWERPC_EXCP_BOOKE) {

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]