From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQS6Y-0000Yd-K2 for qemu-devel@nongnu.org; Wed, 19 Mar 2014 21:49:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQS6O-0003xq-Ju for qemu-devel@nongnu.org; Wed, 19 Mar 2014 21:49:10 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 20 Mar 2014 02:48:44 +0100 Message-Id: <1395280135-10644-3-git-send-email-afaerber@suse.de> In-Reply-To: <1395280135-10644-1-git-send-email-afaerber@suse.de> References: <1395280135-10644-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL for-2.0 02/13] spapr_hcall: Fix h_enter to loop correctly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-ppc@nongnu.org, "Aneesh Kumar K.V" , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: "Aneesh Kumar K.V" We wanted to loop till index is 8. On 8 we return with H_PTEG_FULL. If we are successful in loading hpte with any other index, we continue with tha= t index value. Reported-by: Paolo Bonzini Signed-off-by: Aneesh Kumar K.V Reviewed-by: Paolo Bonzini Signed-off-by: Andreas F=C3=A4rber --- hw/ppc/spapr_hcall.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index e999bba..2ab55d5 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -110,16 +110,15 @@ static target_ulong h_enter(PowerPCCPU *cpu, sPAPRE= nvironment *spapr, if (likely((flags & H_EXACT) =3D=3D 0)) { pte_index &=3D ~7ULL; token =3D ppc_hash64_start_access(cpu, pte_index); - do { - if (index =3D=3D 8) { - ppc_hash64_stop_access(token); - return H_PTEG_FULL; - } + for (; index < 8; index++) { if ((ppc_hash64_load_hpte0(env, token, index) & HPTE64_V_VAL= ID) =3D=3D 0) { break; } - } while (index++); + } ppc_hash64_stop_access(token); + if (index =3D=3D 8) { + return H_PTEG_FULL; + } } else { token =3D ppc_hash64_start_access(cpu, pte_index); if (ppc_hash64_load_hpte0(env, token, 0) & HPTE64_V_VALID) { --=20 1.8.4.5