From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDX7O-0005zm-Hb for qemu-devel@nongnu.org; Wed, 12 Feb 2014 05:32:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WDX7B-0003Fj-Bm for qemu-devel@nongnu.org; Wed, 12 Feb 2014 05:32:38 -0500 Received: from e06smtp18.uk.ibm.com ([195.75.94.114]:37788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDX7B-0003FV-3x for qemu-devel@nongnu.org; Wed, 12 Feb 2014 05:32:25 -0500 Received: from /spool/local by e06smtp18.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Feb 2014 10:32:22 -0000 Date: Wed, 12 Feb 2014 11:32:07 +0100 From: Greg Kurz Message-ID: <20140212113207.0d8fb3f9@bahia.local> In-Reply-To: <87lhxhtrlq.fsf@linux.vnet.ibm.com> References: <1390896003-3195-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1390896003-3195-3-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <87lhxhtrlq.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH V9 2/5] target-ppc: Fix htab_mask calculation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Aneesh Kumar K.V" Cc: qemu-ppc@nongnu.org, paulus@samba.org, agraf@suse.de, qemu-devel@nongnu.org On Wed, 12 Feb 2014 00:16:25 +0530 "Aneesh Kumar K.V" 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 > 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; > } > > >