[RFC PATCH v2 3/5] hw/vfio/ap: store object indicating AP config changed in a queue

Rorie Reyes posted 5 patches 1 month, 1 week ago
There is a newer version of this series
[RFC PATCH v2 3/5] hw/vfio/ap: store object indicating AP config changed in a queue
Posted by Rorie Reyes 1 month, 1 week ago
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 <rreyes@linux.ibm.com>
---
 hw/vfio/ap.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
index a2b3735349..396fcf87de 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,16 @@ 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);
 
     if (!event_notifier_test_and_clear(&vapdev->cfg_notifier)) {
-        css_generate_css_crws(0);
+        return;
     }
 
+    QTAILQ_INSERT_TAIL(&cfg_chg_events, cfg_chg_event, next);
+
+    css_generate_css_crws(0);
+
 }
 
 static bool vfio_ap_register_irq_notifier(VFIOAPDevice *vapdev,
-- 
2.39.5 (Apple Git-154)
Re: [RFC PATCH v2 3/5] hw/vfio/ap: store object indicating AP config changed in a queue
Posted by Anthony Krowiak 1 week ago

On 2/4/25 12:07 PM, 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 <rreyes@linux.ibm.com>
> ---
>   hw/vfio/ap.c | 14 +++++++++++++-
>   1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
> index a2b3735349..396fcf87de 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,16 @@ 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);
>   
>       if (!event_notifier_test_and_clear(&vapdev->cfg_notifier)) {
> -        css_generate_css_crws(0);
> +        return;

As I stated in my review of patch 2/5, the change above should have
been done there.

>       }
>   
> +    QTAILQ_INSERT_TAIL(&cfg_chg_events, cfg_chg_event, next);
> +
> +    css_generate_css_crws(0);

Ditto.

> +
>   }
>   
>   static bool vfio_ap_register_irq_notifier(VFIOAPDevice *vapdev,