Merge tag 'pull-request-2024-02-06' of https://gitlab.com/thuth/qemu into staging
* Emulate CVB, CVBY, CVBG and CVDG s390x instructions
* Fix bug in lsi53c895a reentrancy counter
* Deprecate the "power5+" and "power7+" CPU names
* Fix problems in the freebsd VM test
# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmXCCXURHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbXtEA/9HKWMHbWqDAdlrpmfW8lCFaBHgV0+Fqsy
# GlxJykni2BxIWNoR7J6SdAqbgx3E2/7i8IMIUwYXlNBjEs/UQ0ZcnI5k6OfUS24p
# qfbdH717SgsaB9R1vCBhmOGGWYBfe/RqPGIcni/eg+jSxB5cn2XvEv3+ZBckvDsh
# KFuuAa6vvuBVhyXLbkP8Z+LEe27ttIYi5v1dvJ1an4UbFESqxVb0knyuFYpZpY8Y
# h7dZ0hyCid7YT03zVmSADK7anO+epBdzUU3SsKXj2dB9nebSjmkav6lQQBKYHHUg
# THojcWKwFPNK0AojhBuBCqFYgkGGt/9kjwlUt7jfm1TcSemN65XLNYHThRekPuAJ
# Jcze8dcEerbj1xsNWYh4hPvB92laEiyVR5BYFfUkJ9m2IAamPQLHvOT7jzhC3Y9k
# 4wvVcf9QKVtKW0QO54SQjD4A/qQu/4777oH5w83nGuxjUthmHDqZmjDlIRe6lKJt
# gsA+mKn+w9HrtiXOSkoMhK8PAyvCoAef/N7kvHZoHmp6TtfQAjPs4/v2uZMpnd60
# z7Cw50giHpo9lmiZ1Ey2fQvw9orYhNoXAc4XfYGHuYdQFWpCGz1PB2Km8uTPTEUe
# as364ULBqWoFBCRuRndy2+z2e3zhK5THTPCAyHf48M6teMEPa4KTsTCk7MzmfVfx
# C8RsLcmrFPI=
# =eQNc
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 06 Feb 2024 10:27:01 GMT
# gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg: issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg: aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5
* tag 'pull-request-2024-02-06' of https://gitlab.com/thuth/qemu:
meson: Link with libinotify on FreeBSD
test-util-filemonitor: Adapt to the FreeBSD inotify rename semantics
tests/vm/freebsd: Reload the sshd configuration
tests/vm: Set UseDNS=no in the sshd configuration
target/s390x: Prefer fast cpu_env() over slower CPU QOM cast macro
tests/tcg/s390x: Test CONVERT TO BINARY
tests/tcg/s390x: Test CONVERT TO DECIMAL
target/s390x: Emulate CVB, CVBY and CVBG
target/s390x: Emulate CVDG
docs/about: Deprecate the old "power5+" and "power7+" CPU names
target/ppc/cpu-models: Rename power5+ and power7+ for new QOM naming rules
hw/scsi/lsi53c895a: add missing decrement of reentrancy counter
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index d4492b9..c7b95e6 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -183,6 +183,15 @@
The Nios II architecture is orphan. The ``nios2`` guest CPU support is
deprecated and will be removed in a future version of QEMU.
+``power5+`` and ``power7+`` CPU names (since 9.0)
+'''''''''''''''''''''''''''''''''''''''''''''''''
+
+The character "+" in device (and thus also CPU) names is not allowed
+in the QEMU object model anymore. ``power5+``, ``power5+_v2.1``,
+``power7+`` and ``power7+_v2.1`` are currently still supported via
+an alias, but for consistency these will get removed in a future
+release, too. Use ``power5p_v2.1`` and ``power7p_v2.1`` instead.
+
System emulator machines
------------------------
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 5aa1ed4..0c0fb3f 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -389,9 +389,9 @@
DEFINE_SPAPR_CPU_CORE_TYPE("970_v2.2"),
DEFINE_SPAPR_CPU_CORE_TYPE("970mp_v1.0"),
DEFINE_SPAPR_CPU_CORE_TYPE("970mp_v1.1"),
- DEFINE_SPAPR_CPU_CORE_TYPE("power5+_v2.1"),
+ DEFINE_SPAPR_CPU_CORE_TYPE("power5p_v2.1"),
DEFINE_SPAPR_CPU_CORE_TYPE("power7_v2.3"),
- DEFINE_SPAPR_CPU_CORE_TYPE("power7+_v2.1"),
+ DEFINE_SPAPR_CPU_CORE_TYPE("power7p_v2.1"),
DEFINE_SPAPR_CPU_CORE_TYPE("power8_v2.0"),
DEFINE_SPAPR_CPU_CORE_TYPE("power8e_v2.1"),
DEFINE_SPAPR_CPU_CORE_TYPE("power8nvl_v1.0"),
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 34e3b89..d607a5f 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -1159,6 +1159,7 @@
lsi_script_scsi_interrupt(s, LSI_SIST0_UDC, 0);
lsi_disconnect(s);
trace_lsi_execute_script_stop();
+ reentrancy_level--;
return;
}
insn = read_dword(s, s->dsp);
diff --git a/meson.build b/meson.build
index b5d6dc9..e5d6f2d 100644
--- a/meson.build
+++ b/meson.build
@@ -2384,6 +2384,22 @@
endif
config_host_data.set('CONFIG_ASAN_IFACE_FIBER', have_asan_fiber)
+have_inotify_init = cc.has_header_symbol('sys/inotify.h', 'inotify_init')
+have_inotify_init1 = cc.has_header_symbol('sys/inotify.h', 'inotify_init1')
+inotify = not_found
+if (have_inotify_init or have_inotify_init1) and host_os == 'freebsd'
+ # libinotify-kqueue
+ inotify = cc.find_library('inotify')
+ if have_inotify_init
+ have_inotify_init = inotify.found()
+ endif
+ if have_inotify_init1
+ have_inotify_init1 = inotify.found()
+ endif
+endif
+config_host_data.set('CONFIG_INOTIFY', have_inotify_init)
+config_host_data.set('CONFIG_INOTIFY1', have_inotify_init1)
+
# has_header_symbol
config_host_data.set('CONFIG_BLKZONED',
cc.has_header_symbol('linux/blkzoned.h', 'BLKOPENZONE'))
@@ -2400,10 +2416,6 @@
config_host_data.set('CONFIG_GETRANDOM',
cc.has_function('getrandom') and
cc.has_header_symbol('sys/random.h', 'GRND_NONBLOCK'))
-config_host_data.set('CONFIG_INOTIFY',
- cc.has_header_symbol('sys/inotify.h', 'inotify_init'))
-config_host_data.set('CONFIG_INOTIFY1',
- cc.has_header_symbol('sys/inotify.h', 'inotify_init1'))
config_host_data.set('CONFIG_PRCTL_PR_SET_TIMERSLACK',
cc.has_header_symbol('sys/prctl.h', 'PR_SET_TIMERSLACK'))
config_host_data.set('CONFIG_RTNETLINK',
@@ -4407,6 +4419,9 @@
summary_info += {'FUSE lseek': fuse_lseek.found()}
summary_info += {'selinux': selinux}
summary_info += {'libdw': libdw}
+if host_os == 'freebsd'
+ summary_info += {'libinotify-kqueue': inotify}
+endif
summary(summary_info, bool_yn: true, section: 'Dependencies')
if host_arch == 'unknown'
diff --git a/qom/object.c b/qom/object.c
index 654e1af..2c4c64d 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -160,10 +160,6 @@
/* Allow some legacy names with '+' in it for compatibility reasons */
if (name[plen] == '+') {
- if (plen == 6 && g_str_has_prefix(name, "power")) {
- /* Allow "power5+" and "power7+" CPU names*/
- return true;
- }
if (plen >= 17 && g_str_has_prefix(name, "Sun-UltraSparc-I")) {
/* Allow "Sun-UltraSparc-IV+" and "Sun-UltraSparc-IIIi+" */
return true;
diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c
index 7dbb47d..36e465b 100644
--- a/target/ppc/cpu-models.c
+++ b/target/ppc/cpu-models.c
@@ -716,11 +716,11 @@
"PowerPC 970MP v1.0")
POWERPC_DEF("970mp_v1.1", CPU_POWERPC_970MP_v11, 970,
"PowerPC 970MP v1.1")
- POWERPC_DEF("power5+_v2.1", CPU_POWERPC_POWER5P_v21, POWER5P,
+ POWERPC_DEF("power5p_v2.1", CPU_POWERPC_POWER5P_v21, POWER5P,
"POWER5+ v2.1")
POWERPC_DEF("power7_v2.3", CPU_POWERPC_POWER7_v23, POWER7,
"POWER7 v2.3")
- POWERPC_DEF("power7+_v2.1", CPU_POWERPC_POWER7P_v21, POWER7,
+ POWERPC_DEF("power7p_v2.1", CPU_POWERPC_POWER7P_v21, POWER7,
"POWER7+ v2.1")
POWERPC_DEF("power8e_v2.1", CPU_POWERPC_POWER8E_v21, POWER8,
"POWER8E v2.1")
@@ -902,10 +902,12 @@
{ "970", "970_v2.2" },
{ "970fx", "970fx_v3.1" },
{ "970mp", "970mp_v1.1" },
- { "power5+", "power5+_v2.1" },
+ { "power5+", "power5p_v2.1" },
+ { "power5+_v2.1", "power5p_v2.1" },
{ "power5gs", "power5+_v2.1" },
{ "power7", "power7_v2.3" },
- { "power7+", "power7+_v2.1" },
+ { "power7+", "power7p_v2.1" },
+ { "power7+_v2.1", "power7p_v2.1" },
{ "power8e", "power8e_v2.1" },
{ "power8", "power8_v2.0" },
{ "power8nvl", "power8nvl_v1.0" },
diff --git a/target/s390x/cpu-dump.c b/target/s390x/cpu-dump.c
index ffa9e94..69cc9f7 100644
--- a/target/s390x/cpu-dump.c
+++ b/target/s390x/cpu-dump.c
@@ -27,8 +27,7 @@
void s390_cpu_dump_state(CPUState *cs, FILE *f, int flags)
{
- S390CPU *cpu = S390_CPU(cs);
- CPUS390XState *env = &cpu->env;
+ CPUS390XState *env = cpu_env(cs);
int i;
qemu_fprintf(f, "PSW=mask %016" PRIx64 " addr %016" PRIx64,
diff --git a/target/s390x/gdbstub.c b/target/s390x/gdbstub.c
index 6fbfd41..f02fa31 100644
--- a/target/s390x/gdbstub.c
+++ b/target/s390x/gdbstub.c
@@ -30,8 +30,7 @@
int s390_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
{
- S390CPU *cpu = S390_CPU(cs);
- CPUS390XState *env = &cpu->env;
+ CPUS390XState *env = cpu_env(cs);
switch (n) {
case S390_PSWM_REGNUM:
@@ -46,8 +45,7 @@
int s390_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
{
- S390CPU *cpu = S390_CPU(cs);
- CPUS390XState *env = &cpu->env;
+ CPUS390XState *env = cpu_env(cs);
target_ulong tmpl = ldtul_p(mem_buf);
switch (n) {
diff --git a/target/s390x/helper.c b/target/s390x/helper.c
index d76c063..00d5d40 100644
--- a/target/s390x/helper.c
+++ b/target/s390x/helper.c
@@ -139,8 +139,7 @@
void s390_cpu_recompute_watchpoints(CPUState *cs)
{
const int wp_flags = BP_CPU | BP_MEM_WRITE | BP_STOP_BEFORE_ACCESS;
- S390CPU *cpu = S390_CPU(cs);
- CPUS390XState *env = &cpu->env;
+ CPUS390XState *env = cpu_env(cs);
/* We are called when the watchpoints have changed. First
remove them all. */
diff --git a/target/s390x/helper.h b/target/s390x/helper.h
index 0510257..cc1c20e 100644
--- a/target/s390x/helper.h
+++ b/target/s390x/helper.h
@@ -88,7 +88,10 @@
DEF_HELPER_FLAGS_2(sqeb, TCG_CALL_NO_WG, i64, env, i64)
DEF_HELPER_FLAGS_2(sqdb, TCG_CALL_NO_WG, i64, env, i64)
DEF_HELPER_FLAGS_2(sqxb, TCG_CALL_NO_WG, i128, env, i128)
+DEF_HELPER_3(cvb, void, env, i32, i64)
+DEF_HELPER_FLAGS_2(cvbg, TCG_CALL_NO_WG, i64, env, i128)
DEF_HELPER_FLAGS_1(cvd, TCG_CALL_NO_RWG_SE, i64, s32)
+DEF_HELPER_FLAGS_1(cvdg, TCG_CALL_NO_RWG_SE, i128, s64)
DEF_HELPER_FLAGS_4(pack, TCG_CALL_NO_WG, void, env, i32, i64, i64)
DEF_HELPER_FLAGS_4(pka, TCG_CALL_NO_WG, void, env, i64, i64, i32)
DEF_HELPER_FLAGS_4(pku, TCG_CALL_NO_WG, void, env, i64, i64, i32)
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
index 888d6c1..4ce809c 100644
--- a/target/s390x/kvm/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -474,8 +474,7 @@
int kvm_arch_put_registers(CPUState *cs, int level)
{
- S390CPU *cpu = S390_CPU(cs);
- CPUS390XState *env = &cpu->env;
+ CPUS390XState *env = cpu_env(cs);
struct kvm_fpu fpu = {};
int r;
int i;
@@ -601,8 +600,7 @@
int kvm_arch_get_registers(CPUState *cs)
{
- S390CPU *cpu = S390_CPU(cs);
- CPUS390XState *env = &cpu->env;
+ CPUS390XState *env = cpu_env(cs);
struct kvm_fpu fpu;
int i, r;
diff --git a/target/s390x/tcg/excp_helper.c b/target/s390x/tcg/excp_helper.c
index b875bf1..f1c33f7 100644
--- a/target/s390x/tcg/excp_helper.c
+++ b/target/s390x/tcg/excp_helper.c
@@ -90,10 +90,7 @@
static G_NORETURN
void do_unaligned_access(CPUState *cs, uintptr_t retaddr)
{
- S390CPU *cpu = S390_CPU(cs);
- CPUS390XState *env = &cpu->env;
-
- tcg_s390_program_interrupt(env, PGM_SPECIFICATION, retaddr);
+ tcg_s390_program_interrupt(cpu_env(cs), PGM_SPECIFICATION, retaddr);
}
#if defined(CONFIG_USER_ONLY)
@@ -146,8 +143,7 @@
MMUAccessType access_type, int mmu_idx,
bool probe, uintptr_t retaddr)
{
- S390CPU *cpu = S390_CPU(cs);
- CPUS390XState *env = &cpu->env;
+ CPUS390XState *env = cpu_env(cs);
target_ulong vaddr, raddr;
uint64_t asc, tec;
int prot, excp;
@@ -600,8 +596,7 @@
void s390x_cpu_debug_excp_handler(CPUState *cs)
{
- S390CPU *cpu = S390_CPU(cs);
- CPUS390XState *env = &cpu->env;
+ CPUS390XState *env = cpu_env(cs);
CPUWatchpoint *wp_hit = cs->watchpoint_hit;
if (wp_hit && wp_hit->flags & BP_CPU) {
diff --git a/target/s390x/tcg/insn-data.h.inc b/target/s390x/tcg/insn-data.h.inc
index 2f07f39..e7d61cd 100644
--- a/target/s390x/tcg/insn-data.h.inc
+++ b/target/s390x/tcg/insn-data.h.inc
@@ -293,9 +293,14 @@
D(0xec73, CLFIT, RIE_a, GIE, r1_32u, i2_16u, 0, 0, ct, 0, 1)
D(0xec71, CLGIT, RIE_a, GIE, r1_o, i2_16u, 0, 0, ct, 0, 1)
+/* CONVERT TO BINARY */
+ C(0x4f00, CVB, RX_a, Z, la2, 0, 0, 0, cvb, 0)
+ C(0xe306, CVBY, RXY_a, LD, la2, 0, 0, 0, cvb, 0)
+ C(0xe30e, CVBG, RXY_a, Z, la2, 0, r1, 0, cvbg, 0)
/* CONVERT TO DECIMAL */
C(0x4e00, CVD, RX_a, Z, r1_o, a2, 0, 0, cvd, 0)
C(0xe326, CVDY, RXY_a, LD, r1_o, a2, 0, 0, cvd, 0)
+ C(0xe32e, CVDG, RXY_a, Z, r1_o, a2, 0, 0, cvdg, 0)
/* CONVERT TO FIXED */
F(0xb398, CFEBR, RRF_e, Z, 0, e2, new, r1_32, cfeb, 0, IF_BFP)
F(0xb399, CFDBR, RRF_e, Z, 0, f2, new, r1_32, cfdb, 0, IF_BFP)
diff --git a/target/s390x/tcg/int_helper.c b/target/s390x/tcg/int_helper.c
index eb8e6dd..2af970f 100644
--- a/target/s390x/tcg/int_helper.c
+++ b/target/s390x/tcg/int_helper.c
@@ -25,6 +25,7 @@
#include "exec/exec-all.h"
#include "qemu/host-utils.h"
#include "exec/helper-proto.h"
+#include "exec/cpu_ldst.h"
/* #define DEBUG_HELPER */
#ifdef DEBUG_HELPER
@@ -98,6 +99,81 @@
tcg_s390_program_interrupt(env, PGM_FIXPT_DIVIDE, GETPC());
}
+void HELPER(cvb)(CPUS390XState *env, uint32_t r1, uint64_t dec)
+{
+ int64_t pow10 = 1, bin = 0;
+ int digit, sign;
+
+ sign = dec & 0xf;
+ if (sign < 0xa) {
+ tcg_s390_data_exception(env, 0, GETPC());
+ }
+ dec >>= 4;
+
+ while (dec) {
+ digit = dec & 0xf;
+ if (digit > 0x9) {
+ tcg_s390_data_exception(env, 0, GETPC());
+ }
+ dec >>= 4;
+ bin += digit * pow10;
+ pow10 *= 10;
+ }
+
+ if (sign == 0xb || sign == 0xd) {
+ bin = -bin;
+ }
+
+ /* R1 is updated even on fixed-point-divide exception. */
+ env->regs[r1] = (env->regs[r1] & 0xffffffff00000000ULL) | (uint32_t)bin;
+ if (bin != (int32_t)bin) {
+ tcg_s390_program_interrupt(env, PGM_FIXPT_DIVIDE, GETPC());
+ }
+}
+
+uint64_t HELPER(cvbg)(CPUS390XState *env, Int128 dec)
+{
+ uint64_t dec64[] = {int128_getlo(dec), int128_gethi(dec)};
+ int64_t bin = 0, pow10, tmp;
+ int digit, i, sign;
+
+ sign = dec64[0] & 0xf;
+ if (sign < 0xa) {
+ tcg_s390_data_exception(env, 0, GETPC());
+ }
+ dec64[0] >>= 4;
+ pow10 = (sign == 0xb || sign == 0xd) ? -1 : 1;
+
+ for (i = 1; i < 20; i++) {
+ digit = dec64[i >> 4] & 0xf;
+ if (digit > 0x9) {
+ tcg_s390_data_exception(env, 0, GETPC());
+ }
+ dec64[i >> 4] >>= 4;
+ /*
+ * Prepend the next digit and check for overflow. The multiplication
+ * cannot overflow, since, conveniently, the int64_t limits are
+ * approximately +-9.2E+18. If bin is zero, the addition cannot
+ * overflow. Otherwise bin is known to have the same sign as the rhs
+ * addend, in which case overflow happens if and only if the result
+ * has a different sign.
+ */
+ tmp = bin + pow10 * digit;
+ if (bin && ((tmp ^ bin) < 0)) {
+ tcg_s390_program_interrupt(env, PGM_FIXPT_DIVIDE, GETPC());
+ }
+ bin = tmp;
+ pow10 *= 10;
+ }
+
+ g_assert(!dec64[0]);
+ if (dec64[1]) {
+ tcg_s390_program_interrupt(env, PGM_FIXPT_DIVIDE, GETPC());
+ }
+
+ return bin;
+}
+
uint64_t HELPER(cvd)(int32_t reg)
{
/* positive 0 */
@@ -118,6 +194,27 @@
return dec;
}
+Int128 HELPER(cvdg)(int64_t reg)
+{
+ /* positive 0 */
+ Int128 dec = int128_make64(0x0c);
+ Int128 bin = int128_makes64(reg);
+ Int128 base = int128_make64(10);
+ int shift;
+
+ if (!int128_nonneg(bin)) {
+ bin = int128_neg(bin);
+ dec = int128_make64(0x0d);
+ }
+
+ for (shift = 4; (shift < 128) && int128_nz(bin); shift += 4) {
+ dec = int128_or(dec, int128_lshift(int128_remu(bin, base), shift));
+ bin = int128_divu(bin, base);
+ }
+
+ return dec;
+}
+
uint64_t HELPER(popcnt)(uint64_t val)
{
/* Note that we don't fold past bytes. */
diff --git a/target/s390x/tcg/misc_helper.c b/target/s390x/tcg/misc_helper.c
index 89b5268..8764846 100644
--- a/target/s390x/tcg/misc_helper.c
+++ b/target/s390x/tcg/misc_helper.c
@@ -214,9 +214,7 @@
void tcg_s390_tod_updated(CPUState *cs, run_on_cpu_data opaque)
{
- S390CPU *cpu = S390_CPU(cs);
-
- update_ckc_timer(&cpu->env);
+ update_ckc_timer(cpu_env(cs));
}
/* Set Clock */
diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index a5fd9cc..6e4e1f2 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -2223,6 +2223,22 @@
}
#endif
+static DisasJumpType op_cvb(DisasContext *s, DisasOps *o)
+{
+ TCGv_i64 t = tcg_temp_new_i64();
+ tcg_gen_qemu_ld_i64(t, o->addr1, get_mem_index(s), MO_TEUQ);
+ gen_helper_cvb(tcg_env, tcg_constant_i32(get_field(s, r1)), t);
+ return DISAS_NEXT;
+}
+
+static DisasJumpType op_cvbg(DisasContext *s, DisasOps *o)
+{
+ TCGv_i128 t = tcg_temp_new_i128();
+ tcg_gen_qemu_ld_i128(t, o->addr1, get_mem_index(s), MO_TE | MO_128);
+ gen_helper_cvbg(o->out, tcg_env, t);
+ return DISAS_NEXT;
+}
+
static DisasJumpType op_cvd(DisasContext *s, DisasOps *o)
{
TCGv_i64 t1 = tcg_temp_new_i64();
@@ -2233,6 +2249,14 @@
return DISAS_NEXT;
}
+static DisasJumpType op_cvdg(DisasContext *s, DisasOps *o)
+{
+ TCGv_i128 t = tcg_temp_new_i128();
+ gen_helper_cvdg(t, o->in1);
+ tcg_gen_qemu_st_i128(t, o->in2, get_mem_index(s), MO_TE | MO_128);
+ return DISAS_NEXT;
+}
+
static DisasJumpType op_ct(DisasContext *s, DisasOps *o)
{
int m3 = get_field(s, m3);
@@ -6558,8 +6582,7 @@
const TranslationBlock *tb,
const uint64_t *data)
{
- S390CPU *cpu = S390_CPU(cs);
- CPUS390XState *env = &cpu->env;
+ CPUS390XState *env = cpu_env(cs);
int cc_op = data[1];
env->psw.addr = data[0];
diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
index 30994dc..e2aba2e 100644
--- a/tests/tcg/s390x/Makefile.target
+++ b/tests/tcg/s390x/Makefile.target
@@ -45,6 +45,8 @@
TESTS+=laalg
TESTS+=add-logical-with-carry
TESTS+=lae
+TESTS+=cvd
+TESTS+=cvb
cdsg: CFLAGS+=-pthread
cdsg: LDFLAGS+=-pthread
diff --git a/tests/tcg/s390x/cvb.c b/tests/tcg/s390x/cvb.c
new file mode 100644
index 0000000..e1735f6
--- /dev/null
+++ b/tests/tcg/s390x/cvb.c
@@ -0,0 +1,102 @@
+/*
+ * Test the CONVERT TO BINARY instruction.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include <assert.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+static int signum;
+
+static void signal_handler(int n)
+{
+ signum = n;
+}
+
+#define FAIL 0x1234567887654321
+#define OK32(x) (0x1234567800000000 | (uint32_t)(x))
+
+static int64_t cvb(uint64_t x)
+{
+ int64_t ret = FAIL;
+
+ signum = -1;
+ asm("cvb %[ret],%[x]" : [ret] "+r" (ret) : [x] "R" (x));
+
+ return ret;
+}
+
+static int64_t cvby(uint64_t x)
+{
+ int64_t ret = FAIL;
+
+ signum = -1;
+ asm("cvby %[ret],%[x]" : [ret] "+r" (ret) : [x] "T" (x));
+
+ return ret;
+}
+
+static int64_t cvbg(__uint128_t x)
+{
+ int64_t ret = FAIL;
+
+ signum = -1;
+ asm("cvbg %[ret],%[x]" : [ret] "+r" (ret) : [x] "T" (x));
+
+ return ret;
+}
+
+int main(void)
+{
+ __uint128_t m = (((__uint128_t)0x9223372036854775) << 16) | 0x8070;
+ struct sigaction act;
+ int err;
+
+ memset(&act, 0, sizeof(act));
+ act.sa_handler = signal_handler;
+ err = sigaction(SIGFPE, &act, NULL);
+ assert(err == 0);
+ err = sigaction(SIGILL, &act, NULL);
+ assert(err == 0);
+
+ assert(cvb(0xc) == OK32(0) && signum == -1);
+ assert(cvb(0x1c) == OK32(1) && signum == -1);
+ assert(cvb(0x25594c) == OK32(25594) && signum == -1);
+ assert(cvb(0x1d) == OK32(-1) && signum == -1);
+ assert(cvb(0x2147483647c) == OK32(0x7fffffff) && signum == -1);
+ assert(cvb(0x2147483648d) == OK32(-0x80000000) && signum == -1);
+ assert(cvb(0x7) == FAIL && signum == SIGILL);
+ assert(cvb(0x2147483648c) == OK32(0x80000000) && signum == SIGFPE);
+ assert(cvb(0x3000000000c) == OK32(0xb2d05e00) && signum == SIGFPE);
+ assert(cvb(0x2147483649d) == OK32(0x7fffffff) && signum == SIGFPE);
+ assert(cvb(0x3000000000d) == OK32(0x4d2fa200) && signum == SIGFPE);
+
+ assert(cvby(0xc) == OK32(0));
+ assert(cvby(0x1c) == OK32(1));
+ assert(cvby(0x25594c) == OK32(25594));
+ assert(cvby(0x1d) == OK32(-1));
+ assert(cvby(0x2147483647c) == OK32(0x7fffffff));
+ assert(cvby(0x2147483648d) == OK32(-0x80000000));
+ assert(cvby(0x7) == FAIL && signum == SIGILL);
+ assert(cvby(0x2147483648c) == OK32(0x80000000) && signum == SIGFPE);
+ assert(cvby(0x3000000000c) == OK32(0xb2d05e00) && signum == SIGFPE);
+ assert(cvby(0x2147483649d) == OK32(0x7fffffff) && signum == SIGFPE);
+ assert(cvby(0x3000000000d) == OK32(0x4d2fa200) && signum == SIGFPE);
+
+ assert(cvbg(0xc) == 0);
+ assert(cvbg(0x1c) == 1);
+ assert(cvbg(0x25594c) == 25594);
+ assert(cvbg(0x1d) == -1);
+ assert(cvbg(m + 0xc) == 0x7fffffffffffffff);
+ assert(cvbg(m + 0x1d) == -0x8000000000000000);
+ assert(cvbg(0x7) == FAIL && signum == SIGILL);
+ assert(cvbg(m + 0x1c) == FAIL && signum == SIGFPE);
+ assert(cvbg(m + 0x2d) == FAIL && signum == SIGFPE);
+ assert(cvbg(((__uint128_t)1 << 80) + 0xc) == FAIL && signum == SIGFPE);
+ assert(cvbg(((__uint128_t)1 << 80) + 0xd) == FAIL && signum == SIGFPE);
+
+ return EXIT_SUCCESS;
+}
diff --git a/tests/tcg/s390x/cvd.c b/tests/tcg/s390x/cvd.c
new file mode 100644
index 0000000..d776688
--- /dev/null
+++ b/tests/tcg/s390x/cvd.c
@@ -0,0 +1,63 @@
+/*
+ * Test the CONVERT TO DECIMAL instruction.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include <assert.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+static uint64_t cvd(int32_t x)
+{
+ uint64_t ret;
+
+ asm("cvd %[x],%[ret]" : [ret] "=R" (ret) : [x] "r" (x));
+
+ return ret;
+}
+
+static uint64_t cvdy(int32_t x)
+{
+ uint64_t ret;
+
+ asm("cvdy %[x],%[ret]" : [ret] "=T" (ret) : [x] "r" (x));
+
+ return ret;
+}
+
+static __uint128_t cvdg(int64_t x)
+{
+ __uint128_t ret;
+
+ asm("cvdg %[x],%[ret]" : [ret] "=T" (ret) : [x] "r" (x));
+
+ return ret;
+}
+
+int main(void)
+{
+ __uint128_t m = (((__uint128_t)0x9223372036854775) << 16) | 0x8070;
+
+ assert(cvd(0) == 0xc);
+ assert(cvd(1) == 0x1c);
+ assert(cvd(25594) == 0x25594c);
+ assert(cvd(-1) == 0x1d);
+ assert(cvd(0x7fffffff) == 0x2147483647c);
+ assert(cvd(-0x80000000) == 0x2147483648d);
+
+ assert(cvdy(0) == 0xc);
+ assert(cvdy(1) == 0x1c);
+ assert(cvdy(25594) == 0x25594c);
+ assert(cvdy(-1) == 0x1d);
+ assert(cvdy(0x7fffffff) == 0x2147483647c);
+ assert(cvdy(-0x80000000) == 0x2147483648d);
+
+ assert(cvdg(0) == 0xc);
+ assert(cvdg(1) == 0x1c);
+ assert(cvdg(25594) == 0x25594c);
+ assert(cvdg(-1) == 0x1d);
+ assert(cvdg(0x7fffffffffffffff) == (m + 0xc));
+ assert(cvdg(-0x8000000000000000) == (m + 0x1d));
+
+ return EXIT_SUCCESS;
+}
diff --git a/tests/unit/test-util-filemonitor.c b/tests/unit/test-util-filemonitor.c
index a22de27..02e67fc 100644
--- a/tests/unit/test-util-filemonitor.c
+++ b/tests/unit/test-util-filemonitor.c
@@ -360,6 +360,14 @@
{ .type = QFILE_MONITOR_TEST_OP_EVENT,
.filesrc = "one.txt", .watchid = &watch4,
.eventid = QFILE_MONITOR_EVENT_DELETED },
+#ifdef __FreeBSD__
+ { .type = QFILE_MONITOR_TEST_OP_EVENT,
+ .filesrc = "two.txt", .watchid = &watch0,
+ .eventid = QFILE_MONITOR_EVENT_DELETED },
+ { .type = QFILE_MONITOR_TEST_OP_EVENT,
+ .filesrc = "two.txt", .watchid = &watch2,
+ .eventid = QFILE_MONITOR_EVENT_DELETED },
+#endif
{ .type = QFILE_MONITOR_TEST_OP_EVENT,
.filesrc = "two.txt", .watchid = &watch0,
.eventid = QFILE_MONITOR_EVENT_CREATED },
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 61725b8..c0d62c0 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -423,6 +423,8 @@ def console_ssh_init(self, prompt, user, pw):
def console_sshd_config(self, prompt):
self.console_wait(prompt)
self.console_send("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n")
+ self.console_wait(prompt)
+ self.console_send("echo 'UseDNS no' >> /etc/ssh/sshd_config\n")
for var in self.envvars:
self.console_wait(prompt)
self.console_send("echo 'AcceptEnv %s' >> /etc/ssh/sshd_config\n" % var)
diff --git a/tests/vm/freebsd b/tests/vm/freebsd
index b581bd1..1247f40 100755
--- a/tests/vm/freebsd
+++ b/tests/vm/freebsd
@@ -108,6 +108,7 @@
prompt = "root@freebsd:~ #"
self.console_ssh_init(prompt, "root", self._config["root_pass"])
self.console_sshd_config(prompt)
+ self.console_wait_send(prompt, "service sshd reload\n")
# setup virtio-blk #1 (tarfile)
self.console_wait(prompt)
diff --git a/util/meson.build b/util/meson.build
index af3bf56..0ef9886 100644
--- a/util/meson.build
+++ b/util/meson.build
@@ -104,7 +104,11 @@
util_ss.add(files('throttle.c'))
util_ss.add(files('timed-average.c'))
if config_host_data.get('CONFIG_INOTIFY1')
- util_ss.add(files('filemonitor-inotify.c'))
+ freebsd_dep = []
+ if host_os == 'freebsd'
+ freebsd_dep = inotify
+ endif
+ util_ss.add(files('filemonitor-inotify.c'), freebsd_dep)
else
util_ss.add(files('filemonitor-stub.c'))
endif