From: Pierre Morel <pmorel@linux.ibm.com>
To: borntraeger@de.ibm.com
Cc: cohuck@redhat.com, agraf@suse.de, rth@twiddle.net,
david@redhat.com, qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
peter.maydell@linaro.org, pbonzini@redhat.com, mst@redhat.com,
eric.auger@redhat.com, akrowiak@linux.ibm.com,
pasic@linux.ibm.com
Subject: [Qemu-devel] [PATCH v1 4/5] s390x/vfio: ap: Intercepting AP Queue Interrupt Control
Date: Fri, 2 Nov 2018 11:30:20 +0100 [thread overview]
Message-ID: <1541154621-22423-5-git-send-email-pmorel@linux.ibm.com> (raw)
In-Reply-To: <1541154621-22423-1-git-send-email-pmorel@linux.ibm.com>
From: Pierre Morel <pmorel@linux.vnet.ibm.com>
We intercept the PQAP(AQIC) instruction.
Until we implement AQIC we return a PGM_OPERATION.
Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
hw/vfio/ap.c | 10 ++++++++++
include/hw/s390x/ap-device.h | 9 +++++++++
target/s390x/kvm.c | 20 ++++++++++++++++++++
3 files changed, 39 insertions(+)
diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
index 3962bb74e5..d8d9cadc46 100644
--- a/hw/vfio/ap.c
+++ b/hw/vfio/ap.c
@@ -38,6 +38,16 @@ typedef struct VFIOAPDevice {
#define VFIO_AP_DEVICE(obj) \
OBJECT_CHECK(VFIOAPDevice, (obj), VFIO_AP_DEVICE_TYPE)
+/*
+ * ap_pqap
+ * @env: environment pointing to registers
+ * return value: Code Condition
+ */
+int ap_pqap(CPUS390XState *env)
+{
+ return -PGM_OPERATION;
+}
+
static void vfio_ap_compute_needs_reset(VFIODevice *vdev)
{
vdev->needs_reset = false;
diff --git a/include/hw/s390x/ap-device.h b/include/hw/s390x/ap-device.h
index 765e9082a3..a83ea096c7 100644
--- a/include/hw/s390x/ap-device.h
+++ b/include/hw/s390x/ap-device.h
@@ -19,4 +19,13 @@ typedef struct APDevice {
#define AP_DEVICE(obj) \
OBJECT_CHECK(APDevice, (obj), AP_DEVICE_TYPE)
+#define AP_DEVICE_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(APDeviceClass, (obj), AP_DEVICE_TYPE)
+
+#define AP_DEVICE_CLASS(klass) \
+ OBJECT_CLASS_CHECK(APDeviceClass, (klass), AP_DEVICE_TYPE)
+
+#include "cpu.h"
+int ap_pqap(CPUS390XState *env);
+
#endif /* HW_S390X_AP_DEVICE_H */
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
index 2ebf26adfe..3eac59549d 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm.c
@@ -45,6 +45,7 @@
#include "trace.h"
#include "hw/s390x/s390-pci-inst.h"
#include "hw/s390x/s390-pci-bus.h"
+#include "hw/s390x/ap-device.h"
#include "hw/s390x/ipl.h"
#include "hw/s390x/ebcdic.h"
#include "exec/memattrs.h"
@@ -88,6 +89,7 @@
#define PRIV_B2_CHSC 0x5f
#define PRIV_B2_SIGA 0x74
#define PRIV_B2_XSCH 0x76
+#define PRIV_B2_PQAP 0xaf
#define PRIV_EB_SQBS 0x8a
#define PRIV_EB_PCISTB 0xd0
@@ -1154,6 +1156,21 @@ static int kvm_sclp_service_call(S390CPU *cpu, struct kvm_run *run,
return 0;
}
+static int kvm_ap_pqap(S390CPU *cpu, uint16_t ipbh0)
+{
+ int r;
+
+ r = ap_pqap(&cpu->env);
+
+ if (r < 0) {
+ kvm_s390_program_interrupt(cpu, -r);
+ } else {
+ setcc(cpu, r);
+ }
+
+ return 0;
+}
+
static int handle_b2(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)
{
CPUS390XState *env = &cpu->env;
@@ -1216,6 +1233,9 @@ static int handle_b2(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)
case PRIV_B2_SCLP_CALL:
rc = kvm_sclp_service_call(cpu, run, ipbh0);
break;
+ case PRIV_B2_PQAP:
+ rc = kvm_ap_pqap(cpu, ipbh0);
+ break;
default:
rc = -1;
DPRINTF("KVM: unhandled PRIV: 0xb2%x\n", ipa1);
--
2.17.0
next prev parent reply other threads:[~2018-11-02 10:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-02 10:30 [Qemu-devel] [PATCH v1 0/5] s390x/vfio: VFIO-AP interrupt control interception Pierre Morel
2018-11-02 10:30 ` [Qemu-devel] [PATCH v1 1/5] s390x/vfio: ap: Linux uapi VFIO place holder Pierre Morel
2018-11-02 10:30 ` [Qemu-devel] [PATCH v1 2/5] s390x/cpumodel: Set up CPU model for AQIC interception Pierre Morel
2018-11-02 10:30 ` [Qemu-devel] [PATCH v1 3/5] s390x/vfio: ap: Definition for AP Adapter type Pierre Morel
2018-11-02 10:30 ` Pierre Morel [this message]
2018-11-07 12:40 ` [Qemu-devel] [PATCH v1 4/5] s390x/vfio: ap: Intercepting AP Queue Interrupt Control Cornelia Huck
2018-11-07 22:44 ` Pierre Morel
2018-11-02 10:30 ` [Qemu-devel] [PATCH v1 5/5] s390x/vfio: ap: Implementing " Pierre Morel
2018-11-07 13:39 ` Cornelia Huck
2018-11-07 23:02 ` Pierre Morel
2018-11-02 12:53 ` [Qemu-devel] [PATCH v1 0/5] s390x/vfio: VFIO-AP interrupt control interception David Hildenbrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1541154621-22423-5-git-send-email-pmorel@linux.ibm.com \
--to=pmorel@linux.ibm.com \
--cc=agraf@suse.de \
--cc=akrowiak@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=eric.auger@redhat.com \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).