aboutsummaryrefslogtreecommitdiff
path: root/hw/s390x
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2023-02-27 11:58:43 +0000
committerPeter Maydell <peter.maydell@linaro.org>2023-02-27 11:58:43 +0000
commit3db629f03e8caf39526cd0415dac16a6a6484107 (patch)
tree217a8b39edd0cbe9bfba9c7a25f8f8b7ccb4ad06 /hw/s390x
parentb11728dc3ae67ddedf34b7a4f318170e7092803c (diff)
parentfffa36b68e2f266c8b03ef3fdd242aa9a9181a87 (diff)
downloadqemu-3db629f03e8caf39526cd0415dac16a6a6484107.zip
qemu-3db629f03e8caf39526cd0415dac16a6a6484107.tar.gz
qemu-3db629f03e8caf39526cd0415dac16a6a6484107.tar.bz2
Merge tag 'pull-request-2023-02-27' of https://gitlab.com/thuth/qemu into staging
* Simplify device casting in w/vfio/ccw.c * Fix memory corruption in the s390x dump code * Various s390x TCG clean-ups * s390x PV support for asynchronous teardown for reboot * qemu-keymap related fixes * Improvements for the duration of the gitlab-CI * Deprecate the "-no-acpi" command line switch # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmP8lVURHHRodXRoQHJl # ZGhhdC5jb20ACgkQLtnXdP5wLbWYkg//RTKsG0+HGMtnKvjTA5NzLIJrWAQfSPfh # ABkxNHoscReae8LGquFfeTy9cN/uA051e/P06WfPXAkg3Uj72JKHHs/ncm5VhApY # 7moOCIHlvFRAsy5TKYoInM+Yo0jov7vgKqqJcS3AL3hwhmvEwPwKr0cpZLNfKV8p # GD+XM453g0AFn2jDFoXDsnHX3zco+7sd4dQN4olSrkd/gDel2UQ5JE4gJ/o6Qgys # GW4vb+NpxQ6W3mSlU+ClTr03ZljPkascBS7tZO8Fwn+J3Wv4UTNLlM1JFXQhC3v8 # x9HpVpk4HW6C/hiPcsMpZRlXBb/HklkAhDxZ6tjTnQLRvbJ/o2uISJt+ZgeH9zeQ # Ae4Ap7yPxsuGbx2twzbGoyEPAJj18hW7EUd6KromFqy877svmyRYs3NXQqSJOEmh # Pv7VriUe6esyyVSXWjA6g2imo5pIhWxxRlsNVrrp8vOJNYT+ygBIFqu28ngwk86H # jZOLqekEkQrNkwZZLuoxm8FyCAvzfMBeHQFlDnL4a3114dlC6X3/cJqCZ5htTaO+ # t7CL6QcepRh0NQPw1jRlUCARZK+WocjwwcmzgVzSKKzGpdg/EJC8Sg54l7wdVQCp # jY3HEUWHHHmrqe3IefrzadRQhsB9xKcNdUaZmetRUm+ohgSc9S0cfpVXNwT+G3+M # a47dp9ueI6Q= # =wDFZ # -----END PGP SIGNATURE----- # gpg: Signature made Mon 27 Feb 2023 11:34:45 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-2023-02-27' of https://gitlab.com/thuth/qemu: (33 commits) Deprecate the "-no-acpi" command line switch gitlab-ci.d/base: Mark jobs as interruptible by default gitlab-ci.d: Build with --enable-fdt=system by default gitlab-ci.d/buildtest-template: Simplify the configure step gitlab-ci.d/buildtest: Disintegrate the build-coroutine-sigaltstack job gitlab-ci.d/buildtest: Remove aarch64-softmmu from the build-system-ubuntu job Updated the FSF address to <https://www.gnu.org/licenses/> meson: fix dependency on qemu-keymap qemu-keymap: Silence memory leak warning from Clang's sanitizer configure: Add 'mkdir build' check tests/tcg/s390x: Add sam.S tests/tcg/s390x: Add bal.S target/s390x: Use tcg_constant_* in translate_vx.c.inc target/s390x: Use tcg_constant_i32 for fpinst_extract_m34 target/s390x: Use tcg_constant_* for DisasCompare target/s390x: Use tcg_constant_* in local contexts s390x/pv: Add support for asynchronous teardown for reboot target/s390x: Hoist some computation in access_memmove target/s390x: Inline do_access_{get,set}_byte target/s390x: Remove TLB_NOTDIRTY workarounds ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/s390x')
-rw-r--r--hw/s390x/pv.c28
-rw-r--r--hw/s390x/s390-virtio-ccw.c5
2 files changed, 32 insertions, 1 deletions
diff --git a/hw/s390x/pv.c b/hw/s390x/pv.c
index 8a1c714..49ea382 100644
--- a/hw/s390x/pv.c
+++ b/hw/s390x/pv.c
@@ -16,6 +16,7 @@
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "sysemu/kvm.h"
+#include "sysemu/cpus.h"
#include "qom/object_interfaces.h"
#include "exec/confidential-guest-support.h"
#include "hw/s390x/ipl.h"
@@ -108,6 +109,33 @@ void s390_pv_vm_disable(void)
s390_pv_cmd_exit(KVM_PV_DISABLE, NULL);
}
+static void *s390_pv_do_unprot_async_fn(void *p)
+{
+ s390_pv_cmd_exit(KVM_PV_ASYNC_CLEANUP_PERFORM, NULL);
+ return NULL;
+}
+
+bool s390_pv_vm_try_disable_async(void)
+{
+ /*
+ * t is only needed to create the thread; once qemu_thread_create
+ * returns, it can safely be discarded.
+ */
+ QemuThread t;
+
+ if (!kvm_check_extension(kvm_state, KVM_CAP_S390_PROTECTED_ASYNC_DISABLE)) {
+ return false;
+ }
+ if (s390_pv_cmd(KVM_PV_ASYNC_CLEANUP_PREPARE, NULL) != 0) {
+ return false;
+ }
+
+ qemu_thread_create(&t, "async_cleanup", s390_pv_do_unprot_async_fn, NULL,
+ QEMU_THREAD_DETACHED);
+
+ return true;
+}
+
int s390_pv_set_sec_parms(uint64_t origin, uint64_t length)
{
struct kvm_s390_pv_sec_parm args = {
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index f22f61b..503f212 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -41,6 +41,7 @@
#include "hw/qdev-properties.h"
#include "hw/s390x/tod.h"
#include "sysemu/sysemu.h"
+#include "sysemu/cpus.h"
#include "hw/s390x/pv.h"
#include "migration/blocker.h"
#include "qapi/visitor.h"
@@ -329,7 +330,9 @@ static inline void s390_do_cpu_ipl(CPUState *cs, run_on_cpu_data arg)
static void s390_machine_unprotect(S390CcwMachineState *ms)
{
- s390_pv_vm_disable();
+ if (!s390_pv_vm_try_disable_async()) {
+ s390_pv_vm_disable();
+ }
ms->pv = false;
migrate_del_blocker(pv_mig_blocker);
error_free_or_abort(&pv_mig_blocker);