[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-ppc] [PATCH V9 2/5] target-ppc: Fix htab_mask cal
From: |
Greg Kurz |
Subject: |
Re: [Qemu-devel] [Qemu-ppc] [PATCH V9 2/5] target-ppc: Fix htab_mask calculation |
Date: |
Wed, 12 Feb 2014 11:32:07 +0100 |
On Wed, 12 Feb 2014 00:16:25 +0530
"Aneesh Kumar K.V" <address@hidden> wrote:
>
> Hi Greg,
>
> can you try the below patch and see if it fix the TCG mode failure ?
>
> -aneesh
>
Hi Aneesh,
The patche fixes the issue indeed. Maybe a helper could be factored out
since we have 4 times the same magic formula :)
Cheers.
--
Greg
> commit d98b5098bc04f44ef4e175f689345e92cf469231
> Author: Aneesh Kumar K.V <address@hidden>
> Date: Tue Feb 11 23:43:12 2014 +0530
>
> tcg fixes
>
> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> index e1f778faf3ae..d3aca706fdc9 100644
> --- a/hw/ppc/spapr_hcall.c
> +++ b/hw/ppc/spapr_hcall.c
> @@ -91,7 +91,10 @@ static target_ulong h_enter(PowerPCCPU *cpu,
> sPAPREnvironment *spapr,
>
> pteh &= ~0x60ULL;
>
> - if ((pte_index * HASH_PTE_SIZE_64) & ~env->htab_mask) {
> + /*
> + * hash value/pteg group index is normalized by htab_mask
> + */
> + if (((pte_index & ~7ULL) / HPTES_PER_GROUP) & ~env->htab_mask) {
> return H_PARAMETER;
> }
>
> @@ -140,7 +143,10 @@ static RemoveResult remove_hpte(CPUPPCState *env,
> target_ulong ptex, uint64_t token;
> target_ulong v, r, rb;
>
> - if ((ptex * HASH_PTE_SIZE_64) & ~env->htab_mask) {
> + /*
> + * hash value/pteg group index is normalized by htab_mask
> + */
> + if (((ptex & ~7ULL) / HPTES_PER_GROUP) & ~env->htab_mask) {
> return REMOVE_PARM;
> }
>
> @@ -266,7 +272,10 @@ static target_ulong h_protect(PowerPCCPU *cpu,
> sPAPREnvironment *spapr, uint64_t token;
> target_ulong v, r, rb;
>
> - if ((pte_index * HASH_PTE_SIZE_64) & ~env->htab_mask) {
> + /*
> + * hash value/pteg group index is normalized by htab_mask
> + */
> + if (((pte_index & ~7ULL) / HPTES_PER_GROUP) & ~env->htab_mask) {
> return H_PARAMETER;
> }
>
> @@ -303,7 +312,10 @@ static target_ulong h_read(PowerPCCPU *cpu,
> sPAPREnvironment *spapr, uint8_t *hpte;
> int i, ridx, n_entries = 1;
>
> - if ((pte_index * HASH_PTE_SIZE_64) & ~env->htab_mask) {
> + /*
> + * hash value/pteg group index is normalized by htab_mask
> + */
> + if (((pte_index & ~7ULL) / HPTES_PER_GROUP) & ~env->htab_mask) {
> return H_PARAMETER;
> }
>
>
>