From patchwork Sun Aug 11 18:16:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 266379 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E5FEF2C007A for ; Mon, 12 Aug 2013 04:17:19 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754688Ab3HKSRP (ORCPT ); Sun, 11 Aug 2013 14:17:15 -0400 Received: from e23smtp01.au.ibm.com ([202.81.31.143]:50029 "EHLO e23smtp01.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754687Ab3HKSRP (ORCPT ); Sun, 11 Aug 2013 14:17:15 -0400 Received: from /spool/local by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 12 Aug 2013 04:07:04 +1000 Received: from d23dlp02.au.ibm.com (202.81.31.213) by e23smtp01.au.ibm.com (202.81.31.207) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 12 Aug 2013 04:07:02 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id 2382D2BB0051 for ; Mon, 12 Aug 2013 04:17:10 +1000 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r7BI1Nbo6488482 for ; Mon, 12 Aug 2013 04:01:24 +1000 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r7BIH920015828 for ; Mon, 12 Aug 2013 04:17:09 +1000 Received: from skywalker.in.ibm.com ([9.124.221.177]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r7BIH792015817; Mon, 12 Aug 2013 04:17:08 +1000 From: "Aneesh Kumar K.V" To: agraf@suse.de Cc: kvm-ppc@vger.kernel.org, "Aneesh Kumar K.V" Subject: [PATCH] target-ppc: Update slb array with correct index values. Date: Sun, 11 Aug 2013 23:46:51 +0530 Message-Id: <1376245011-20008-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.1.2 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13081118-1618-0000-0000-0000046EF8D5 Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org From: "Aneesh Kumar K.V" Without this, a value of rb=0 and rs=0, result in us replacing the 0th index Signed-off-by: Aneesh Kumar K.V --- target-ppc/kvm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 30a870e..5d4e613 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -1034,8 +1034,18 @@ int kvm_arch_get_registers(CPUState *cs) /* Sync SLB */ #ifdef TARGET_PPC64 for (i = 0; i < 64; i++) { - ppc_store_slb(env, sregs.u.s.ppc64.slb[i].slbe, - sregs.u.s.ppc64.slb[i].slbv); + target_ulong rb = sregs.u.s.ppc64.slb[i].slbe; + /* + * KVM_GET_SREGS doesn't retun slb entry with slot information + * same as index. So don't depend on the slot information in + * the returned value. + */ + rb &= ~0xfff; + /* + * use the array index as the slot + */ + rb |= i; + ppc_store_slb(env, rb, sregs.u.s.ppc64.slb[i].slbv); } #endif