Skip to contentSkip to conversation

ARM aarch64 TCG tlb fast lookup

PATCH In review Jani Kokkonen 3 participants 4 messages Jul 10, 2013 – Jul 15, 2013

lore
Share & tools
lore
#0 lore raw

v2 cover ARM aarch64 TCG tlb fast lookup

This patch implements the TCG tlb fast lookup in
tcg_out_qemu_ld/st for the aarch64 TCG target.
Supports also CONFIG_QEMU_LDST_OPTIMIZATION.

Tested running on a x86-64 physical machine running Foundation v8, running a linux 3.2.0 minimal host system based on linaro v8 image build 0.8.4423 for user space.

Tested guests: arm v5, PPC64, sparc, i386 linux test images. Also tested on x86-64/linux built with buildroot.

Changes in v2:
-Fix whitespace and indentation
-Pass mem_index into tcg_out_tlb_read() and calculate tlb_offset inside
tcg_out_tlb_read()
-Add comments in tcg_out_tlb_read()
-Change parameter type from int to TCGREg for data_reg and addr_reg parameters
in add_qemu_ldst_label()
-Use extended register for tcg_out_cmp() in tcg_out_tlb_read() only if needed

Jani Kokkonen (1):
tcg/aarch64: Implement tlb lookup fast path

 configure                |    2 +-
 include/exec/exec-all.h  |   14 +++
 tcg/aarch64/tcg-target.c |  224 +++++++++++++++++++++++++++++++++++-----------
 3 files changed, 189 insertions(+), 51 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

Re: [Qemu-devel] [PATCH V2 1/1] tcg/aarch64: Implement tlb lookup fast path

Supports CONFIG_QEMU_LDST_OPTIMIZATION

---
 configure                |    2 +-
 include/exec/exec-all.h  |   14 +++
 tcg/aarch64/tcg-target.c |  224 +++++++++++++++++++++++++++++++++++-----------
 3 files changed, 189 insertions(+), 51 deletions(-)
configure +1 -1
index bed0104..6a36682 100755
@@ -3599,7 +3599,7 @@ echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
 echo "ARCH=$ARCH" >> $config_host_mak
 
 case "$cpu" in
-  arm|i386|x86_64|ppc)
+  arm|i386|x86_64|ppc|aarch64)
     # The TCG interpreter currently does not support ld/st optimization.
     if test "$tcg_interpreter" = "no" ; then
         echo "CONFIG_QEMU_LDST_OPTIMIZATION=y" >> $config_host_mak
include/exec/exec-all.h +14 -0
index 5c31863..47f066a 100644
@@ -358,6 +358,20 @@ static inline uintptr_t tcg_getpc_ldst(uintptr_t ra)
                                    not the start of the next opcode  */
     return ra;
 }
+#elif defined(__aarch64__)
+#  define GETRA()       ((uintptr_t)__builtin_return_address(0))
+#  define GETPC_LDST()  tcg_getpc_ldst(GETRA())
+static inline uintptr_t tcg_getpc_ldst(uintptr_t ra)
+{
+    int32_t b;
+    ra += 4;                    /* skip one instruction */
+    b = *(int32_t *)ra;         /* load the branch insn */
+    b = (b << 6) >> (6 - 2);    /* extract the displacement */
+    ra += b;                    /* apply the displacement  */
+    ra -= 4;                    /* return a pointer into the current opcode,
+                                   not the start of the next opcode  */
+    return ra;
+}
 # else
 #  error "CONFIG_QEMU_LDST_OPTIMIZATION needs GETPC_LDST() implementation!"
 # endif
tcg/aarch64/tcg-target.c +174 -50

272 lines not on this page · raw message

Signature · 1 line
1.7.9.5
Reviewed-by on the v2 series
#2 lore raw
In reply to Jani Kokkonen
Quoted 22 lines · Jani Kokkonen

This patch implements the TCG tlb fast lookup in
tcg_out_qemu_ld/st for the aarch64 TCG target.
Supports also CONFIG_QEMU_LDST_OPTIMIZATION.

Tested running on a x86-64 physical machine running Foundation v8, running a linux 3.2.0 minimal host system based on linaro v8 image build 0.8.4423 for user space.

Tested guests: arm v5, PPC64, sparc, i386 linux test images. Also tested on x86-64/linux built with buildroot.

Changes in v2:

(quoted diff) +0 -5
-Fix whitespace and indentation
-Pass mem_index into tcg_out_tlb_read() and calculate tlb_offset inside  
 tcg_out_tlb_read() 
-Add comments in tcg_out_tlb_read() 
-Change parameter type from int to TCGREg for data_reg and addr_reg parameters
 in add_qemu_ldst_label()
-Use extended register for tcg_out_cmp() in tcg_out_tlb_read() only if needed  
Quoted 8 lines

Jani Kokkonen (1):
tcg/aarch64: Implement tlb lookup fast path

 configure                |    2 +-
 include/exec/exec-all.h  |   14 +++
 tcg/aarch64/tcg-target.c |  224 +++++++++++++++++++++++++++++++++++-----------
 3 files changed, 189 insertions(+), 51 deletions(-)

r~

Reviewed-by on the v2 series
#3 lore raw
In reply to Jani Kokkonen
Quoted 22 lines · Jani Kokkonen

This patch implements the TCG tlb fast lookup in
tcg_out_qemu_ld/st for the aarch64 TCG target.
Supports also CONFIG_QEMU_LDST_OPTIMIZATION.

Tested running on a x86-64 physical machine running Foundation v8, running a linux 3.2.0 minimal host system based on linaro v8 image build 0.8.4423 for user space.

Tested guests: arm v5, PPC64, sparc, i386 linux test images. Also tested on x86-64/linux built with buildroot.

Changes in v2:

(quoted diff) +0 -5
-Fix whitespace and indentation
-Pass mem_index into tcg_out_tlb_read() and calculate tlb_offset inside  
 tcg_out_tlb_read() 
-Add comments in tcg_out_tlb_read() 
-Change parameter type from int to TCGREg for data_reg and addr_reg parameters
 in add_qemu_ldst_label()
-Use extended register for tcg_out_cmp() in tcg_out_tlb_read() only if needed  
Quoted 8 lines

Jani Kokkonen (1):
tcg/aarch64: Implement tlb lookup fast path

 configure                |    2 +-
 include/exec/exec-all.h  |   14 +++
 tcg/aarch64/tcg-target.c |  224 +++++++++++++++++++++++++++++++++++-----------
 3 files changed, 189 insertions(+), 51 deletions(-)

It's good for me, thank you Jani.