On 3/10/25 11:35 AM, Rorie Reyes wrote:
Creates an object indicating that an AP configuration change event
has been received and stores it in a queue. These objects will later
be used to store event information for an AP configuration change
when the CHSC instruction is intercepted.
Signed-off-by: Rorie Reyes <rre...@linux.ibm.com>
---
hw/vfio/ap.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
index 3614657218..ddab764ab4 100644
--- a/hw/vfio/ap.c
+++ b/hw/vfio/ap.c
@@ -41,6 +41,13 @@ struct VFIOAPDevice {
EventNotifier cfg_notifier;
};
+typedef struct APConfigChgEvent {
+ QTAILQ_ENTRY(APConfigChgEvent) next;
+} APConfigChgEvent;
+
+QTAILQ_HEAD(, APConfigChgEvent) cfg_chg_events =
+ QTAILQ_HEAD_INITIALIZER(cfg_chg_events);
+
OBJECT_DECLARE_SIMPLE_TYPE(VFIOAPDevice, VFIO_AP_DEVICE)
static void vfio_ap_compute_needs_reset(VFIODevice *vdev)
@@ -75,11 +82,14 @@ static void vfio_ap_req_notifier_handler(void *opaque)
static void vfio_ap_cfg_chg_notifier_handler(void *opaque)
{
VFIOAPDevice *vapdev = opaque;
+ APConfigChgEvent *cfg_chg_event = g_new0(APConfigChgEvent, 1);
It doesn't make sense to allocate this before the check below. If the
event_notifier_test_and_clear() fails, you'll have allocated this for no
reason. Allocate cfg_cgh_event prior to inserting it into the queue
below.
if (!event_notifier_test_and_clear(&vapdev->cfg_notifier)) {
return;
}
+ QTAILQ_INSERT_TAIL(&cfg_chg_events, cfg_chg_event, next);
+
css_generate_css_crws(0);
}