Alexey Kardashevskiy <a...@ozlabs.ru> writes:

> This adds handling of the RESOURCE_ADDR_TRANS_MODE resource from
> the H_SET_MODE, for POWER8 (PowerISA 2.07) only.
>
> Signed-off-by: Alexey Kardashevskiy <a...@ozlabs.ru>
> ---
>  hw/ppc/spapr_hcall.c | 26 ++++++++++++++++++++++++++
>  target-ppc/cpu.h     |  2 ++
>  2 files changed, 28 insertions(+)
>
> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> index b21d74b..7e4fc5f 100644
> --- a/hw/ppc/spapr_hcall.c
> +++ b/hw/ppc/spapr_hcall.c
> @@ -721,6 +721,32 @@ static target_ulong h_set_mode(PowerPCCPU *cpu, 
> sPAPREnvironment *spapr,
>          default:
>              ret = H_UNSUPPORTED_FLAG;
>          }
> +    } else if (resource == H_SET_MODE_RESOURCE_ADDR_TRANS_MODE) {
> +        PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
> +
> +        if (!(pcc->insns_flags2 & PPC2_ISA207S)) {
> +            return H_P2;
> +        }
> +        if (value1) {
> +            ret = H_P3;
> +            goto out;
> +        }
> +        if (value2) {
> +            ret = H_P4;
> +            goto out;
> +        }
> +        switch (mflags) {
> +        case 0:

Shouldn't case 0 clear the LPCR_AIL bit ?

> +        case 2:
> +        case 3:
> +            CPU_FOREACH(cs) {
> +                set_spr(cs, SPR_LPCR, mflags << LPCR_AIL_SH, LPCR_AIL);
> +            }
> +            return H_SUCCESS;
> +
> +        default:
> +            return H_UNSUPPORTED_FLAG;
> +        }
>      }
>  

-aneesh


Reply via email to