qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <gkurz@linux.vnet.ibm.com>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: qemu-ppc@nongnu.org, paulus@samba.org, agraf@suse.de,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH V9 3/5] target-ppc: Fix page table lookup with	kvm enabled
Date: Mon, 10 Feb 2014 17:27:43 +0100	[thread overview]
Message-ID: <20140210172743.00349f59@bahia.local> (raw)
In-Reply-To: <1390896003-3195-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

On Tue, 28 Jan 2014 13:30:01 +0530
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> 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
> 
>  (gdb) x/10 do_fork
>  0xc000000000098660 <do_fork>:   Cannot access memory at address
> 0xc000000000098660 (gdb)
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  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(-)
> 
> [... 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
> 
> +
> +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 *= 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 ‘ppc_hash64_load_hpte0’:
target-ppc/mmu-hash64.h:90:23: error: cast to pointer from integer of 
different size 

>      } else {
> -        return ldq_phys(env->htab_base + pte_offset);
> +        return ldq_phys(token + index);
>      }
>  }
> 
>  static inline target_ulong ppc_hash64_load_hpte1(CPUPPCState *env,
> -                                                 hwaddr pte_offset)
> +                                                 uint64_t token, int
> index) {
> +    index *= 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 ‘ppc_hash64_load_hpte1’:
target-ppc/mmu-hash64.h:101:23: error: cast to pointer from integer of different 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);
>      }
>  }
> 


                           ^

-- 
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.

  reply	other threads:[~2014-02-10 16:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-28  7:59 [Qemu-devel] [PATCH V9 0/5] target-ppc: Add support for dumping guest memory using qemu gdb server Aneesh Kumar K.V
2014-01-28  7:59 ` [Qemu-devel] [PATCH V9 1/5] target-ppc: Update external_htab even when HTAB is managed by kernel Aneesh Kumar K.V
2014-01-28  8:00 ` [Qemu-devel] [PATCH V9 2/5] target-ppc: Fix htab_mask calculation Aneesh Kumar K.V
2014-02-11 18:46   ` Aneesh Kumar K.V
2014-02-12 10:32     ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2014-02-13  2:59   ` [Qemu-devel] [PATCH V10] " Aneesh Kumar K.V
2014-02-13 10:40     ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2014-02-13 14:51       ` Alexander Graf
2014-02-14 13:06         ` Alexander Graf
2014-02-14 13:54           ` Alexander Graf
2014-02-14 14:28             ` Alexander Graf
2014-02-14 14:42               ` Alexander Graf
2014-02-15 11:02                 ` Greg Kurz
2014-01-28  8:00 ` [Qemu-devel] [PATCH V9 3/5] target-ppc: Fix page table lookup with kvm enabled Aneesh Kumar K.V
2014-02-10 16:27   ` Greg Kurz [this message]
2014-02-12 15:24     ` [Qemu-devel] [PATCH] target-ppc: fix 32 bit build break in the page table lookup code Greg Kurz
2014-02-13  3:00       ` Aneesh Kumar K.V
2014-02-13 14:53         ` Alexander Graf
2014-02-13 16:54           ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2014-02-14  9:25             ` Alexander Graf
2014-01-28  8:00 ` [Qemu-devel] [PATCH V9 4/5] target-ppc: Change the hpte sore API Aneesh Kumar K.V
2014-01-28  8:00 ` [Qemu-devel] [PATCH V9 5/5] target-ppc: Update ppc_hash64_store_hpte to support updating in-kernel htab Aneesh Kumar K.V
2014-02-10 15:25   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2014-02-12 15:40     ` [Qemu-devel] [PATCH] target-ppc: fix warn_unused_result build break with in-kernel HTAB support Greg Kurz
2014-02-13  3:00       ` Aneesh Kumar K.V
2014-02-13 14:51         ` Alexander Graf
2014-02-06 14:58 ` [Qemu-devel] [PATCH V9 0/5] target-ppc: Add support for dumping guest memory using qemu gdb server Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140210172743.00349f59@bahia.local \
    --to=gkurz@linux.vnet.ibm.com \
    --cc=agraf@suse.de \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=paulus@samba.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).