All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rorie Reyes <rreyes@linux.ibm.com>
To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org
Cc: pbonzini@redhat.com, cohuck@redhat.com, pasic@linux.ibm.com,
	jjherne@linux.ibm.com, borntraeger@linux.ibm.com,
	alex.williamson@redhat.com, clg@redhat.com, thuth@redhat.com,
	akrowiak@linux.ibm.com, rreyes@linux.ibm.com
Subject: [PATCH v7 6/6] s390: implementing CHSC SEI for AP config change
Date: Fri, 25 Apr 2025 01:24:01 -0400	[thread overview]
Message-ID: <20250425052401.8287-7-rreyes@linux.ibm.com> (raw)
In-Reply-To: <20250425052401.8287-1-rreyes@linux.ibm.com>

Handle interception of the CHSC SEI instruction for requests
indicating the guest's AP configuration has changed.

If configuring -without-defaul-devices, hw/vfio/ap-sub.c
was created to handle such circumstance. Also added if
CONFIG_VFIO_AP is false, it will use the stub file.

Signed-off-by: Rorie Reyes <rreyes@linux.ibm.com>
Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com>
Tested-by: Anthony Krowiak <akrowiak@linux.ibm.com>
---
 MAINTAINERS           |  1 +
 hw/vfio/ap-stub.c     | 23 +++++++++++++++++++++++
 hw/vfio/meson.build   |  1 +
 target/s390x/ioinst.c | 11 +++++++++--
 4 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 hw/vfio/ap-stub.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 661a47db5a..ad85d081e3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -112,6 +112,7 @@ F: hw/intc/s390_flic.c
 F: hw/intc/s390_flic_kvm.c
 F: hw/s390x/
 F: hw/vfio/ap.c
+F: hw/vfio/ap-stub.c
 F: hw/vfio/ccw.c
 F: hw/watchdog/wdt_diag288.c
 F: include/hw/s390x/
diff --git a/hw/vfio/ap-stub.c b/hw/vfio/ap-stub.c
new file mode 100644
index 0000000000..9d2c4c2e67
--- /dev/null
+++ b/hw/vfio/ap-stub.c
@@ -0,0 +1,23 @@
+/*
+ * VFIO based AP matrix device assignment
+ *
+ * Copyright 2025 IBM Corp.
+ * Author(s): Rorie Reyes <rreyes@linux.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or (at
+ * your option) any later version. See the COPYING file in the top-level
+ * directory.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/s390x/ap-bridge.h"
+
+int ap_chsc_sei_nt0_get_event(void *res)
+{
+    return 0;
+}
+
+int ap_chsc_sei_nt0_have_event(void)
+{
+    return 0;
+}
diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
index a8939c8386..28f4c959b8 100644
--- a/hw/vfio/meson.build
+++ b/hw/vfio/meson.build
@@ -11,6 +11,7 @@ vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
 vfio_ss.add(when: 'CONFIG_VFIO_CCW', if_true: files('ccw.c'))
 vfio_ss.add(when: 'CONFIG_VFIO_PLATFORM', if_true: files('platform.c'))
 vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
+vfio_ss.add(when: 'CONFIG_VFIO_AP', if_false: files('ap-stub.c'))
 vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
 
 specific_ss.add_all(when: 'CONFIG_VFIO', if_true: vfio_ss)
diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c
index fe62ba5b06..2320dd4c12 100644
--- a/target/s390x/ioinst.c
+++ b/target/s390x/ioinst.c
@@ -18,6 +18,7 @@
 #include "trace.h"
 #include "hw/s390x/s390-pci-bus.h"
 #include "target/s390x/kvm/pv.h"
+#include "hw/s390x/ap-bridge.h"
 
 /* All I/O instructions but chsc use the s format */
 static uint64_t get_address_from_regs(CPUS390XState *env, uint32_t ipb,
@@ -574,13 +575,19 @@ out:
 
 static int chsc_sei_nt0_get_event(void *res)
 {
-    /* no events yet */
+    if (s390_has_feat(S390_FEAT_AP)) {
+        return ap_chsc_sei_nt0_get_event(res);
+    }
+
     return 1;
 }
 
 static int chsc_sei_nt0_have_event(void)
 {
-    /* no events yet */
+    if (s390_has_feat(S390_FEAT_AP)) {
+        return ap_chsc_sei_nt0_have_event();
+    }
+
     return 0;
 }
 
-- 
2.48.1



  parent reply	other threads:[~2025-04-25  5:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-25  5:23 [PATCH v7 0/6] Report vfio-ap configuration changes Rorie Reyes
2025-04-25  5:23 ` [PATCH v7 1/6] linux-header: update-linux-header script changes Rorie Reyes
2025-04-25 12:22   ` Cédric Le Goater
2025-04-25  5:23 ` [PATCH v7 2/6] linux-headers: Update to Linux v6.15-rc3 Rorie Reyes
2025-04-28 21:05   ` Cédric Le Goater
2025-04-25  5:23 ` [PATCH v7 3/6] hw/vfio/ap: notification handler for AP config changed event Rorie Reyes
2025-04-25  5:23 ` [PATCH v7 4/6] hw/vfio/ap: store object indicating AP config changed in a queue Rorie Reyes
2025-04-25  5:24 ` [PATCH v7 5/6] hw/vfio/ap: Storing event information for an AP configuration change event Rorie Reyes
2025-04-25  5:24 ` Rorie Reyes [this message]
2025-04-28 21:29 ` [PATCH v7 0/6] Report vfio-ap configuration changes Cédric Le Goater
2025-04-30 20:55   ` Rorie Reyes
2025-05-01  7:40     ` Cédric Le Goater
2025-05-05  9:09       ` Cédric Le Goater
2025-05-06  7:00   ` Cédric Le Goater
2025-05-06 13:12     ` Rorie Reyes

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=20250425052401.8287-7-rreyes@linux.ibm.com \
    --to=rreyes@linux.ibm.com \
    --cc=akrowiak@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=clg@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=jjherne@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=thuth@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.