aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2024-12-19 15:41:04 +0100
committerDavid Hildenbrand <david@redhat.com>2024-12-21 15:59:59 +0100
commit6e9cc2da4e8b997fd6ff3249034f436b84fc7974 (patch)
treee607689a3d8aedeba47a620b8798a8a93c0bf1d5 /hw
parent4be0fce498d0a08f18b3a9accdb9ded79484d30a (diff)
downloadqemu-6e9cc2da4e8b997fd6ff3249034f436b84fc7974.zip
qemu-6e9cc2da4e8b997fd6ff3249034f436b84fc7974.tar.gz
qemu-6e9cc2da4e8b997fd6ff3249034f436b84fc7974.tar.bz2
s390x/s390-virtio-hcall: prepare for more diag500 hypercalls
Let's generalize, abstracting the virtio bits. diag500 is now a generic hypercall to handle QEMU/KVM specific things. Explicitly specify all already defined subcodes, including legacy ones (so we know what we can use for new hypercalls). Move the PGM_SPECIFICATION injection into the renamed function handle_diag_500(), so we can turn it into a void function. We'll rename the files separately, so git properly detects the rename. Message-ID: <20241219144115.2820241-4-david@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: David Hildenbrand <david@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/s390x/s390-virtio-hcall.c15
-rw-r--r--hw/s390x/s390-virtio-hcall.h11
2 files changed, 14 insertions, 12 deletions
diff --git a/hw/s390x/s390-virtio-hcall.c b/hw/s390x/s390-virtio-hcall.c
index ca49e3c..5fb78a7 100644
--- a/hw/s390x/s390-virtio-hcall.c
+++ b/hw/s390x/s390-virtio-hcall.c
@@ -1,5 +1,5 @@
/*
- * Support for virtio hypercalls on s390
+ * Support for QEMU/KVM hypercalls on s390
*
* Copyright 2012 IBM Corp.
* Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
@@ -57,18 +57,19 @@ static int handle_virtio_ccw_notify(uint64_t subch_id, uint64_t data)
return 0;
}
-int s390_virtio_hypercall(CPUS390XState *env)
+void handle_diag_500(S390CPU *cpu, uintptr_t ra)
{
+ CPUS390XState *env = &cpu->env;
const uint64_t subcode = env->regs[1];
switch (subcode) {
- case KVM_S390_VIRTIO_NOTIFY:
+ case DIAG500_VIRTIO_NOTIFY:
env->regs[2] = handle_virtio_notify(env->regs[2]);
- return 0;
- case KVM_S390_VIRTIO_CCW_NOTIFY:
+ break;
+ case DIAG500_VIRTIO_CCW_NOTIFY:
env->regs[2] = handle_virtio_ccw_notify(env->regs[2], env->regs[3]);
- return 0;
+ break;
default:
- return -EINVAL;
+ s390_program_interrupt(env, PGM_SPECIFICATION, ra);
}
}
diff --git a/hw/s390x/s390-virtio-hcall.h b/hw/s390x/s390-virtio-hcall.h
index 3d9fe14..dca456b 100644
--- a/hw/s390x/s390-virtio-hcall.h
+++ b/hw/s390x/s390-virtio-hcall.h
@@ -1,5 +1,5 @@
/*
- * Support for virtio hypercalls on s390x
+ * Support for QEMU/KVM hypercalls on s390x
*
* Copyright IBM Corp. 2012, 2017
* Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
@@ -12,12 +12,13 @@
#ifndef HW_S390_VIRTIO_HCALL_H
#define HW_S390_VIRTIO_HCALL_H
-#include "standard-headers/asm-s390/virtio-ccw.h"
#include "cpu.h"
-/* The only thing that we need from the old kvm_virtio.h file */
-#define KVM_S390_VIRTIO_NOTIFY 0
+#define DIAG500_VIRTIO_NOTIFY 0 /* legacy, implemented as a NOP */
+#define DIAG500_VIRTIO_RESET 1 /* legacy */
+#define DIAG500_VIRTIO_SET_STATUS 2 /* legacy */
+#define DIAG500_VIRTIO_CCW_NOTIFY 3 /* KVM_S390_VIRTIO_CCW_NOTIFY */
-int s390_virtio_hypercall(CPUS390XState *env);
+void handle_diag_500(S390CPU *cpu, uintptr_t ra);
#endif /* HW_S390_VIRTIO_HCALL_H */