From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCtiK-00066v-0q for qemu-devel@nongnu.org; Mon, 10 Feb 2014 11:28:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCti4-0000so-Qc for qemu-devel@nongnu.org; Mon, 10 Feb 2014 11:28:07 -0500 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:56365) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCti4-0000sa-BY for qemu-devel@nongnu.org; Mon, 10 Feb 2014 11:27:52 -0500 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 10 Feb 2014 16:27:51 -0000 Date: Mon, 10 Feb 2014 17:27:43 +0100 From: Greg Kurz Message-ID: <20140210172743.00349f59@bahia.local> In-Reply-To: <1390896003-3195-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1390896003-3195-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1390896003-3195-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH V9 3/5] target-ppc: Fix page table lookup with kvm enabled 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 Tue, 28 Jan 2014 13:30:01 +0530 "Aneesh Kumar K.V" wrote: > With kvm enabled, we store the hash page table information in the > hypervisor. Use ioctl to read the htab contents. Without this we get the > below error when trying to read the guest address >=20 > (gdb) x/10 do_fork > 0xc000000000098660 : Cannot access memory at address > 0xc000000000098660 (gdb) >=20 > Signed-off-by: Aneesh Kumar K.V > --- > hw/ppc/spapr.c | 1 + > hw/ppc/spapr_hcall.c | 50 +++++++++++++++++++------------ > target-ppc/kvm.c | 53 +++++++++++++++++++++++++++++++++ > target-ppc/kvm_ppc.h | 19 ++++++++++++ > target-ppc/mmu-hash64.c | 78 > ++++++++++++++++++++++++++++++++++++++++--------- target-ppc/mmu-hash64.h > | 19 ++++++++---- 6 files changed, 181 insertions(+), 39 deletions(-) >=20 > [... snip ...] > > diff --git a/target-ppc/mmu-hash64.h b/target-ppc/mmu-hash64.h > index 55f5a230fd20..dc027f6d5264 100644 > --- a/target-ppc/mmu-hash64.h > +++ b/target-ppc/mmu-hash64.h > @@ -75,23 +75,30 @@ int ppc_hash64_handle_mmu_fault(CPUPPCState *env, > target_ulong address, int rw, #define HPTE64_V_1TB_SEG > 0x4000000000000000ULL #define HPTE64_V_VRMA_MASK > 0x4001ffffff000000ULL >=20 > + > +extern bool kvmppc_kern_htab; > +uint64_t ppc_hash64_start_access(PowerPCCPU *cpu, target_ulong > pte_index); +void ppc_hash64_stop_access(uint64_t token); > + > static inline target_ulong ppc_hash64_load_hpte0(CPUPPCState *env, > - hwaddr pte_offset) > + uint64_t token, int > index) { > + index *=3D HASH_PTE_SIZE_64; > if (env->external_htab) { > - return ldq_p(env->external_htab + pte_offset); > + return ldq_p((const void *)(token + index)); This does not compile on 32 bit: target-ppc/mmu-hash64.h: In function =E2=80=98ppc_hash64_load_hpte0=E2=80= =99: target-ppc/mmu-hash64.h:90:23: error: cast to pointer from integer of=20 different size=20 > } else { > - return ldq_phys(env->htab_base + pte_offset); > + return ldq_phys(token + index); > } > } >=20 > static inline target_ulong ppc_hash64_load_hpte1(CPUPPCState *env, > - hwaddr pte_offset) > + uint64_t token, int > index) { > + index *=3D HASH_PTE_SIZE_64; > if (env->external_htab) { > - return ldq_p(env->external_htab + pte_offset + > HASH_PTE_SIZE_64/2); > + return ldq_p((const void *)(token + index + Same error: target-ppc/mmu-hash64.h: In function =E2=80=98ppc_hash64_load_hpte1=E2=80= =99: target-ppc/mmu-hash64.h:101:23: error: cast to pointer from integer of diff= erent size > HASH_PTE_SIZE_64/2)); } else { > - return ldq_phys(env->htab_base + pte_offset + > HASH_PTE_SIZE_64/2); > + return ldq_phys(token + index + HASH_PTE_SIZE_64/2); > } > } >=20 ^ --=20 Gregory Kurz kurzgreg@fr.ibm.com gkurz@linux.vnet.ibm.com Software Engineer @ IBM/Meiosys http://www.ibm.com Tel +33 (0)562 165 496 "Anarchy is about taking complete responsibility for yourself." Alan Moore.