aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-10-22 13:45:09 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-10-22 13:45:09 +0100
commitf9bec781379dd7ccf9d01b4b6a79a9ec82c192e5 (patch)
tree49e8265ccc572f5f8b991151730ad5d9f1e98e79
parent2152e740a8938b3bad73bfe1a01f8b94dab02d41 (diff)
parentde60a92ea7b7977854420c58fd98f38cb6de6de6 (diff)
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20191022' into staging
s390x fixes in tcg vector instruction handling and in the cpu model code # gpg: Signature made Tue 22 Oct 2019 10:51:07 BST # gpg: using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF # gpg: issuer "cohuck@redhat.com" # gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" [unknown] # gpg: aka "Cornelia Huck <huckc@linux.vnet.ibm.com>" [full] # gpg: aka "Cornelia Huck <cornelia.huck@de.ibm.com>" [full] # gpg: aka "Cornelia Huck <cohuck@kernel.org>" [unknown] # gpg: aka "Cornelia Huck <cohuck@redhat.com>" [unknown] # Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0 18CE DECF 6B93 C6F0 2FAF * remotes/cohuck/tags/s390x-20191022: s390x/kvm: Set default cpu model for all machine classes s390x/tcg: Fix VECTOR SUBTRACT WITH BORROW COMPUTE BORROW INDICATION s390x/tcg: Fix VECTOR SUBTRACT WITH BORROW INDICATION s390x/tcg: Fix VECTOR SUBTRACT COMPUTE BORROW INDICATION s390x/tcg: Fix VECTOR SHIFT RIGHT ARITHMETIC BY BYTE s390x/tcg: Fix VECTOR MULTIPLY AND ADD * s390x/tcg: Fix VECTOR MULTIPLY LOGICAL ODD s390x/mmu: Remove duplicate check for MMU_DATA_STORE s390x/cpumodel: Add missing visit_free Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--target/s390x/cpu_models.c1
-rw-r--r--target/s390x/kvm.c10
-rw-r--r--target/s390x/mmu_helper.c4
-rw-r--r--target/s390x/translate_vx.inc.c30
-rw-r--r--target/s390x/vec_int_helper.c18
5 files changed, 32 insertions, 31 deletions
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 009afc38b9..7e92fb2e15 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -515,6 +515,7 @@ static void cpu_model_from_info(S390CPUModel *model, const CpuModelInfo *info,
visitor = qobject_input_visitor_new(info->props);
visit_start_struct(visitor, NULL, NULL, 0, errp);
if (*errp) {
+ visit_free(visitor);
object_unref(obj);
return;
}
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
index c24c869e77..0c9d14b4b1 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm.c
@@ -320,11 +320,17 @@ void kvm_s390_set_max_pagesize(uint64_t pagesize, Error **errp)
cap_hpage_1m = 1;
}
-int kvm_arch_init(MachineState *ms, KVMState *s)
+static void ccw_machine_class_foreach(ObjectClass *oc, void *opaque)
{
- MachineClass *mc = MACHINE_GET_CLASS(ms);
+ MachineClass *mc = MACHINE_CLASS(oc);
mc->default_cpu_type = S390_CPU_TYPE_NAME("host");
+}
+
+int kvm_arch_init(MachineState *ms, KVMState *s)
+{
+ object_class_foreach(ccw_machine_class_foreach, TYPE_S390_CCW_MACHINE,
+ false, NULL);
if (!kvm_check_extension(kvm_state, KVM_CAP_DEVICE_CTRL)) {
error_report("KVM is missing capability KVM_CAP_DEVICE_CTRL - "
diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c
index 90b81335f9..c9f3f34750 100644
--- a/target/s390x/mmu_helper.c
+++ b/target/s390x/mmu_helper.c
@@ -556,9 +556,7 @@ int mmu_translate_real(CPUS390XState *env, target_ulong raddr, int rw,
*flags |= PAGE_WRITE_INV;
if (is_low_address(raddr) && rw == MMU_DATA_STORE) {
/* LAP sets bit 56 */
- *tec = (raddr & TARGET_PAGE_MASK)
- | (rw == MMU_DATA_STORE ? FS_WRITE : FS_READ)
- | 0x80;
+ *tec = (raddr & TARGET_PAGE_MASK) | FS_WRITE | 0x80;
return PGM_PROTECTION;
}
}
diff --git a/target/s390x/translate_vx.inc.c b/target/s390x/translate_vx.inc.c
index 5ce7bfb0af..71059f9ca0 100644
--- a/target/s390x/translate_vx.inc.c
+++ b/target/s390x/translate_vx.inc.c
@@ -2132,12 +2132,12 @@ static DisasJumpType op_vs(DisasContext *s, DisasOps *o)
static void gen_scbi_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b)
{
- tcg_gen_setcond_i32(TCG_COND_LTU, d, a, b);
+ tcg_gen_setcond_i32(TCG_COND_GEU, d, a, b);
}
static void gen_scbi_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b)
{
- tcg_gen_setcond_i64(TCG_COND_LTU, d, a, b);
+ tcg_gen_setcond_i64(TCG_COND_GEU, d, a, b);
}
static void gen_scbi2_i64(TCGv_i64 dl, TCGv_i64 dh, TCGv_i64 al,
@@ -2151,7 +2151,8 @@ static void gen_scbi2_i64(TCGv_i64 dl, TCGv_i64 dh, TCGv_i64 al,
tcg_gen_andi_i64(th, th, 1);
tcg_gen_sub2_i64(tl, th, ah, zero, th, zero);
tcg_gen_sub2_i64(tl, th, tl, th, bh, zero);
- tcg_gen_andi_i64(dl, th, 1);
+ /* "invert" the result: -1 -> 0; 0 -> 1 */
+ tcg_gen_addi_i64(dl, th, 1);
tcg_gen_mov_i64(dh, zero);
tcg_temp_free_i64(th);
@@ -2186,13 +2187,13 @@ static void gen_sbi2_i64(TCGv_i64 dl, TCGv_i64 dh, TCGv_i64 al, TCGv_i64 ah,
TCGv_i64 bl, TCGv_i64 bh, TCGv_i64 cl, TCGv_i64 ch)
{
TCGv_i64 tl = tcg_temp_new_i64();
- TCGv_i64 zero = tcg_const_i64(0);
+ TCGv_i64 th = tcg_temp_new_i64();
- tcg_gen_andi_i64(tl, cl, 1);
- tcg_gen_sub2_i64(dl, dh, al, ah, bl, bh);
- tcg_gen_sub2_i64(dl, dh, dl, dh, tl, zero);
+ tcg_gen_not_i64(tl, bl);
+ tcg_gen_not_i64(th, bh);
+ gen_ac2_i64(dl, dh, al, ah, tl, th, cl, ch);
tcg_temp_free_i64(tl);
- tcg_temp_free_i64(zero);
+ tcg_temp_free_i64(th);
}
static DisasJumpType op_vsbi(DisasContext *s, DisasOps *o)
@@ -2213,20 +2214,13 @@ static void gen_sbcbi2_i64(TCGv_i64 dl, TCGv_i64 dh, TCGv_i64 al, TCGv_i64 ah,
{
TCGv_i64 th = tcg_temp_new_i64();
TCGv_i64 tl = tcg_temp_new_i64();
- TCGv_i64 zero = tcg_const_i64(0);
- tcg_gen_andi_i64(tl, cl, 1);
- tcg_gen_sub2_i64(tl, th, al, zero, tl, zero);
- tcg_gen_sub2_i64(tl, th, tl, th, bl, zero);
- tcg_gen_andi_i64(th, th, 1);
- tcg_gen_sub2_i64(tl, th, ah, zero, th, zero);
- tcg_gen_sub2_i64(tl, th, tl, th, bh, zero);
- tcg_gen_andi_i64(dl, th, 1);
- tcg_gen_mov_i64(dh, zero);
+ tcg_gen_not_i64(tl, bl);
+ tcg_gen_not_i64(th, bh);
+ gen_accc2_i64(dl, dh, al, ah, tl, th, cl, ch);
tcg_temp_free_i64(tl);
tcg_temp_free_i64(th);
- tcg_temp_free_i64(zero);
}
static DisasJumpType op_vsbcbi(DisasContext *s, DisasOps *o)
diff --git a/target/s390x/vec_int_helper.c b/target/s390x/vec_int_helper.c
index 68eaae407b..0d6bc13dd6 100644
--- a/target/s390x/vec_int_helper.c
+++ b/target/s390x/vec_int_helper.c
@@ -70,15 +70,17 @@ static void s390_vec_sar(S390Vector *d, const S390Vector *a, uint64_t count)
d->doubleword[0] = a->doubleword[0];
d->doubleword[1] = a->doubleword[1];
} else if (count == 64) {
+ tmp = (int64_t)a->doubleword[0] >> 63;
d->doubleword[1] = a->doubleword[0];
- d->doubleword[0] = 0;
+ d->doubleword[0] = tmp;
} else if (count < 64) {
tmp = a->doubleword[1] >> count;
d->doubleword[1] = deposit64(tmp, 64 - count, count, a->doubleword[0]);
d->doubleword[0] = (int64_t)a->doubleword[0] >> count;
} else {
+ tmp = (int64_t)a->doubleword[0] >> 63;
d->doubleword[1] = (int64_t)a->doubleword[0] >> (count - 64);
- d->doubleword[0] = 0;
+ d->doubleword[0] = tmp;
}
}
@@ -336,7 +338,7 @@ void HELPER(gvec_vmae##BITS)(void *v1, const void *v2, const void *v3, \
for (i = 0, j = 0; i < (128 / TBITS); i++, j += 2) { \
int##TBITS##_t a = (int##BITS##_t)s390_vec_read_element##BITS(v2, j); \
int##TBITS##_t b = (int##BITS##_t)s390_vec_read_element##BITS(v3, j); \
- int##TBITS##_t c = (int##BITS##_t)s390_vec_read_element##BITS(v4, j); \
+ int##TBITS##_t c = s390_vec_read_element##TBITS(v4, i); \
\
s390_vec_write_element##TBITS(v1, i, a * b + c); \
} \
@@ -354,7 +356,7 @@ void HELPER(gvec_vmale##BITS)(void *v1, const void *v2, const void *v3, \
for (i = 0, j = 0; i < (128 / TBITS); i++, j += 2) { \
uint##TBITS##_t a = s390_vec_read_element##BITS(v2, j); \
uint##TBITS##_t b = s390_vec_read_element##BITS(v3, j); \
- uint##TBITS##_t c = s390_vec_read_element##BITS(v4, j); \
+ uint##TBITS##_t c = s390_vec_read_element##TBITS(v4, i); \
\
s390_vec_write_element##TBITS(v1, i, a * b + c); \
} \
@@ -372,7 +374,7 @@ void HELPER(gvec_vmao##BITS)(void *v1, const void *v2, const void *v3, \
for (i = 0, j = 1; i < (128 / TBITS); i++, j += 2) { \
int##TBITS##_t a = (int##BITS##_t)s390_vec_read_element##BITS(v2, j); \
int##TBITS##_t b = (int##BITS##_t)s390_vec_read_element##BITS(v3, j); \
- int##TBITS##_t c = (int##BITS##_t)s390_vec_read_element##BITS(v4, j); \
+ int##TBITS##_t c = s390_vec_read_element##TBITS(v4, i); \
\
s390_vec_write_element##TBITS(v1, i, a * b + c); \
} \
@@ -390,7 +392,7 @@ void HELPER(gvec_vmalo##BITS)(void *v1, const void *v2, const void *v3, \
for (i = 0, j = 1; i < (128 / TBITS); i++, j += 2) { \
uint##TBITS##_t a = s390_vec_read_element##BITS(v2, j); \
uint##TBITS##_t b = s390_vec_read_element##BITS(v3, j); \
- uint##TBITS##_t c = s390_vec_read_element##BITS(v4, j); \
+ uint##TBITS##_t c = s390_vec_read_element##TBITS(v4, i); \
\
s390_vec_write_element##TBITS(v1, i, a * b + c); \
} \
@@ -488,7 +490,7 @@ void HELPER(gvec_vmlo##BITS)(void *v1, const void *v2, const void *v3, \
{ \
int i, j; \
\
- for (i = 0, j = 0; i < (128 / TBITS); i++, j += 2) { \
+ for (i = 0, j = 1; i < (128 / TBITS); i++, j += 2) { \
const uint##TBITS##_t a = s390_vec_read_element##BITS(v2, j); \
const uint##TBITS##_t b = s390_vec_read_element##BITS(v3, j); \
\
@@ -591,7 +593,7 @@ void HELPER(gvec_vscbi##BITS)(void *v1, const void *v2, const void *v3, \
const uint##BITS##_t a = s390_vec_read_element##BITS(v2, i); \
const uint##BITS##_t b = s390_vec_read_element##BITS(v3, i); \
\
- s390_vec_write_element##BITS(v1, i, a < b); \
+ s390_vec_write_element##BITS(v1, i, a >= b); \
} \
}
DEF_VSCBI(8)