qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/4] TCG MIPS and S390 fixes for 2.4
@ 2015-08-03  8:20 Aurelien Jarno
  2015-08-03  8:20 ` [Qemu-devel] [PULL 1/4] tcg/mips: fix TLB loading for BE host with 32-bit guests Aurelien Jarno
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Aurelien Jarno @ 2015-08-03  8:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno, Richard Henderson

[ Note that Richard Henderson agreed to get the single S390 fix in this
pull request. ]

The following changes since commit 7008d580acad326148a725bd20695882ba10247a:

  Update version for v2.4.0-rc3 release (2015-07-29 18:50:11 +0100)

are available in the git repository at:

  git://git.aurel32.net/qemu.git tags/pull-tcg-mips-s390-20150803

for you to fetch changes up to c99d69694af4ed15b33e3f7c2e3ef6972c14358d:

  tcg/mips: fix add2 (2015-08-01 09:39:50 +0200)

----------------------------------------------------------------
TCG MIPS and S390 fixes for 2.4.

----------------------------------------------------------------
Aurelien Jarno (4):
      tcg/mips: fix TLB loading for BE host with 32-bit guests
      tcg/mips: Mask TCGMemOp appropriately for indexing
      tcg/s390x: Mask TCGMemOp appropriately for indexing
      tcg/mips: fix add2

 tcg/mips/tcg-target.c | 11 ++++++++---
 tcg/s390/tcg-target.c |  4 ++--
 2 files changed, 10 insertions(+), 5 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PULL 1/4] tcg/mips: fix TLB loading for BE host with 32-bit guests
  2015-08-03  8:20 [Qemu-devel] [PULL 0/4] TCG MIPS and S390 fixes for 2.4 Aurelien Jarno
@ 2015-08-03  8:20 ` Aurelien Jarno
  2015-08-03  8:20 ` [Qemu-devel] [PULL 2/4] tcg/mips: Mask TCGMemOp appropriately for indexing Aurelien Jarno
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Aurelien Jarno @ 2015-08-03  8:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Aurelien Jarno, Richard Henderson

For 32-bit guest, we load a 32-bit address from the TLB, so there is no
need to compensate for the low or high part. This fixes 32-bit guests on
big-endian hosts.

Cc: qemu-stable@nongnu.org
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 tcg/mips/tcg-target.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c
index 6680299..8dce19c 100644
--- a/tcg/mips/tcg-target.c
+++ b/tcg/mips/tcg-target.c
@@ -963,9 +963,11 @@ static void tcg_out_tlb_load(TCGContext *s, TCGReg base, TCGReg addrl,
     }
 
     /* Load the tlb comparator.  */
-    tcg_out_opc_imm(s, OPC_LW, TCG_TMP0, TCG_REG_A0, cmp_off + LO_OFF);
     if (TARGET_LONG_BITS == 64) {
+        tcg_out_opc_imm(s, OPC_LW, TCG_TMP0, TCG_REG_A0, cmp_off + LO_OFF);
         tcg_out_opc_imm(s, OPC_LW, base, TCG_REG_A0, cmp_off + HI_OFF);
+    } else {
+        tcg_out_opc_imm(s, OPC_LW, TCG_TMP0, TCG_REG_A0, cmp_off);
     }
 
     /* Mask the page bits, keeping the alignment bits to compare against.
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PULL 2/4] tcg/mips: Mask TCGMemOp appropriately for indexing
  2015-08-03  8:20 [Qemu-devel] [PULL 0/4] TCG MIPS and S390 fixes for 2.4 Aurelien Jarno
  2015-08-03  8:20 ` [Qemu-devel] [PULL 1/4] tcg/mips: fix TLB loading for BE host with 32-bit guests Aurelien Jarno
@ 2015-08-03  8:20 ` Aurelien Jarno
  2015-08-03  8:20 ` [Qemu-devel] [PULL 3/4] tcg/s390x: " Aurelien Jarno
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Aurelien Jarno @ 2015-08-03  8:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno, Richard Henderson

Commit 2b7ec66f fixed TCGMemOp masking following the MO_AMASK addition,
but two cases were forgotten in the TCG MIPS backend.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 tcg/mips/tcg-target.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c
index 8dce19c..064db46 100644
--- a/tcg/mips/tcg-target.c
+++ b/tcg/mips/tcg-target.c
@@ -1105,7 +1105,7 @@ static void tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
 static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg datalo, TCGReg datahi,
                                    TCGReg base, TCGMemOp opc)
 {
-    switch (opc) {
+    switch (opc & (MO_SSIZE | MO_BSWAP)) {
     case MO_UB:
         tcg_out_opc_imm(s, OPC_LBU, datalo, base, 0);
         break;
@@ -1195,7 +1195,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is_64)
 static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg datalo, TCGReg datahi,
                                    TCGReg base, TCGMemOp opc)
 {
-    switch (opc) {
+    switch (opc & (MO_SIZE | MO_BSWAP)) {
     case MO_8:
         tcg_out_opc_imm(s, OPC_SB, datalo, base, 0);
         break;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PULL 3/4] tcg/s390x: Mask TCGMemOp appropriately for indexing
  2015-08-03  8:20 [Qemu-devel] [PULL 0/4] TCG MIPS and S390 fixes for 2.4 Aurelien Jarno
  2015-08-03  8:20 ` [Qemu-devel] [PULL 1/4] tcg/mips: fix TLB loading for BE host with 32-bit guests Aurelien Jarno
  2015-08-03  8:20 ` [Qemu-devel] [PULL 2/4] tcg/mips: Mask TCGMemOp appropriately for indexing Aurelien Jarno
@ 2015-08-03  8:20 ` Aurelien Jarno
  2015-08-03  8:20 ` [Qemu-devel] [PULL 4/4] tcg/mips: fix add2 Aurelien Jarno
  2015-08-03 12:08 ` [Qemu-devel] [PULL 0/4] TCG MIPS and S390 fixes for 2.4 Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Aurelien Jarno @ 2015-08-03  8:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno, Richard Henderson

Commit 2b7ec66f fixed TCGMemOp masking following the MO_AMASK addition,
but two cases were forgotten in the TCG S390 backend.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 tcg/s390/tcg-target.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c
index 921991e..aa718ec 100644
--- a/tcg/s390/tcg-target.c
+++ b/tcg/s390/tcg-target.c
@@ -1390,7 +1390,7 @@ static void tcg_out_call(TCGContext *s, tcg_insn_unit *dest)
 static void tcg_out_qemu_ld_direct(TCGContext *s, TCGMemOp opc, TCGReg data,
                                    TCGReg base, TCGReg index, int disp)
 {
-    switch (opc) {
+    switch (opc & (MO_SSIZE | MO_BSWAP)) {
     case MO_UB:
         tcg_out_insn(s, RXY, LLGC, data, base, index, disp);
         break;
@@ -1449,7 +1449,7 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGMemOp opc, TCGReg data,
 static void tcg_out_qemu_st_direct(TCGContext *s, TCGMemOp opc, TCGReg data,
                                    TCGReg base, TCGReg index, int disp)
 {
-    switch (opc) {
+    switch (opc & (MO_SIZE | MO_BSWAP)) {
     case MO_UB:
         if (disp >= 0 && disp < 0x1000) {
             tcg_out_insn(s, RX, STC, data, base, index, disp);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PULL 4/4] tcg/mips: fix add2
  2015-08-03  8:20 [Qemu-devel] [PULL 0/4] TCG MIPS and S390 fixes for 2.4 Aurelien Jarno
                   ` (2 preceding siblings ...)
  2015-08-03  8:20 ` [Qemu-devel] [PULL 3/4] tcg/s390x: " Aurelien Jarno
@ 2015-08-03  8:20 ` Aurelien Jarno
  2015-08-03 12:08 ` [Qemu-devel] [PULL 0/4] TCG MIPS and S390 fixes for 2.4 Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Aurelien Jarno @ 2015-08-03  8:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Aurelien Jarno, Richard Henderson

The add2 code in the tcg_out_addsub2 function doesn't take into account
the case where rl == al == bl. In that case we can't compute the carry
after the addition. As it corresponds to a multiplication by 2, the
carry bit is the bit 31.

While this is a corner case, this prevents x86-64 guests to boot on a
MIPS host.

Cc: qemu-stable@nongnu.org
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 tcg/mips/tcg-target.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c
index 064db46..e97980d 100644
--- a/tcg/mips/tcg-target.c
+++ b/tcg/mips/tcg-target.c
@@ -1271,6 +1271,9 @@ static void tcg_out_addsub2(TCGContext *s, TCGReg rl, TCGReg rh, TCGReg al,
         if (cbl) {
             tcg_out_opc_imm(s, OPC_ADDIU, rl, al, bl);
             tcg_out_opc_imm(s, OPC_SLTIU, TCG_TMP0, rl, bl);
+        } else if (rl == al && rl == bl) {
+            tcg_out_opc_sa(s, OPC_SRL, TCG_TMP0, al, 31);
+            tcg_out_opc_reg(s, OPC_ADDU, rl, al, bl);
         } else {
             tcg_out_opc_reg(s, OPC_ADDU, rl, al, bl);
             tcg_out_opc_reg(s, OPC_SLTU, TCG_TMP0, rl, (rl == bl ? al : bl));
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PULL 0/4] TCG MIPS and S390 fixes for 2.4
  2015-08-03  8:20 [Qemu-devel] [PULL 0/4] TCG MIPS and S390 fixes for 2.4 Aurelien Jarno
                   ` (3 preceding siblings ...)
  2015-08-03  8:20 ` [Qemu-devel] [PULL 4/4] tcg/mips: fix add2 Aurelien Jarno
@ 2015-08-03 12:08 ` Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2015-08-03 12:08 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: QEMU Developers, Richard Henderson

On 3 August 2015 at 09:20, Aurelien Jarno <aurelien@aurel32.net> wrote:
> [ Note that Richard Henderson agreed to get the single S390 fix in this
> pull request. ]
>
> The following changes since commit 7008d580acad326148a725bd20695882ba10247a:
>
>   Update version for v2.4.0-rc3 release (2015-07-29 18:50:11 +0100)
>
> are available in the git repository at:
>
>   git://git.aurel32.net/qemu.git tags/pull-tcg-mips-s390-20150803
>
> for you to fetch changes up to c99d69694af4ed15b33e3f7c2e3ef6972c14358d:
>
>   tcg/mips: fix add2 (2015-08-01 09:39:50 +0200)
>
> ----------------------------------------------------------------
> TCG MIPS and S390 fixes for 2.4.

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-08-03 12:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-03  8:20 [Qemu-devel] [PULL 0/4] TCG MIPS and S390 fixes for 2.4 Aurelien Jarno
2015-08-03  8:20 ` [Qemu-devel] [PULL 1/4] tcg/mips: fix TLB loading for BE host with 32-bit guests Aurelien Jarno
2015-08-03  8:20 ` [Qemu-devel] [PULL 2/4] tcg/mips: Mask TCGMemOp appropriately for indexing Aurelien Jarno
2015-08-03  8:20 ` [Qemu-devel] [PULL 3/4] tcg/s390x: " Aurelien Jarno
2015-08-03  8:20 ` [Qemu-devel] [PULL 4/4] tcg/mips: fix add2 Aurelien Jarno
2015-08-03 12:08 ` [Qemu-devel] [PULL 0/4] TCG MIPS and S390 fixes for 2.4 Peter Maydell

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