[RFC PATCH v9 2/4] hw/vfio/ap: store object indicating AP config changed in a queue

Rorie Reyes posted 4 patches 7 months, 1 week ago
Maintainers: Thomas Huth <thuth@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Alex Williamson <alex.williamson@redhat.com>, "Cédric Le Goater" <clg@redhat.com>, Tony Krowiak <akrowiak@linux.ibm.com>, Jason Herne <jjherne@linux.ibm.com>
There is a newer version of this series
[RFC PATCH v9 2/4] hw/vfio/ap: store object indicating AP config changed in a queue
Posted by Rorie Reyes 7 months, 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 | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
index 3d0af7a54a..5ea5dd9cca 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)
@@ -74,12 +81,17 @@ static void vfio_ap_req_notifier_handler(void *opaque)
 
 static void vfio_ap_cfg_chg_notifier_handler(void *opaque)
 {
+    APConfigChgEvent *cfg_chg_event;
     VFIOAPDevice *vapdev = opaque;
 
     if (!event_notifier_test_and_clear(&vapdev->cfg_notifier)) {
         return;
     }
 
+    cfg_chg_event = g_new0(APConfigChgEvent, 1);
+
+    QTAILQ_INSERT_TAIL(&cfg_chg_events, cfg_chg_event, next);
+
     css_generate_css_crws(0);
 
 }
-- 
2.48.1
Re: [RFC PATCH v9 2/4] hw/vfio/ap: store object indicating AP config changed in a queue
Posted by Cédric Le Goater 7 months ago
On 5/12/25 20:02, 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 | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
> index 3d0af7a54a..5ea5dd9cca 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);
> +

Could cfg_chg_events be static ?


Thanks,

C.



>   OBJECT_DECLARE_SIMPLE_TYPE(VFIOAPDevice, VFIO_AP_DEVICE)
>   
>   static void vfio_ap_compute_needs_reset(VFIODevice *vdev)
> @@ -74,12 +81,17 @@ static void vfio_ap_req_notifier_handler(void *opaque)
>   
>   static void vfio_ap_cfg_chg_notifier_handler(void *opaque)
>   {
> +    APConfigChgEvent *cfg_chg_event;
>       VFIOAPDevice *vapdev = opaque;
>   
>       if (!event_notifier_test_and_clear(&vapdev->cfg_notifier)) {
>           return;
>       }
>   
> +    cfg_chg_event = g_new0(APConfigChgEvent, 1);
> +
> +    QTAILQ_INSERT_TAIL(&cfg_chg_events, cfg_chg_event, next);
> +
>       css_generate_css_crws(0);
>   
>   }
Re: [RFC PATCH v9 2/4] hw/vfio/ap: store object indicating AP config changed in a queue
Posted by Rorie Reyes 7 months ago
On 5/22/25 9:27 AM, Cédric Le Goater wrote:
> On 5/12/25 20:02, 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 | 12 ++++++++++++
>>   1 file changed, 12 insertions(+)
>>
>> diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
>> index 3d0af7a54a..5ea5dd9cca 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);
>> +
>
> Could cfg_chg_events be static ?
>
>
> Thanks,
>
> C.
>
You make a good point, Cedric. I'm only using this variable in ap.c. 
Having it as a static would prevent it from being modified anywhere else

Re: [RFC PATCH v9 2/4] hw/vfio/ap: store object indicating AP config changed in a queue
Posted by Cédric Le Goater 7 months ago
On 5/22/25 16:28, Rorie Reyes wrote:
> 
> On 5/22/25 9:27 AM, Cédric Le Goater wrote:
>> On 5/12/25 20:02, 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 | 12 ++++++++++++
>>>   1 file changed, 12 insertions(+)
>>>
>>> diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
>>> index 3d0af7a54a..5ea5dd9cca 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);
>>> +
>>
>> Could cfg_chg_events be static ?
>>
>>
>> Thanks,
>>
>> C.
>>
> You make a good point, Cedric. I'm only using this variable in ap.c. Having it as a static would prevent it from being modified anywhere else
> 

Good. Would you have time to send a v10 ?


Thanks,

C.



Re: [RFC PATCH v9 2/4] hw/vfio/ap: store object indicating AP config changed in a queue
Posted by Rorie Reyes 7 months ago
On 5/22/25 11:36 AM, Cédric Le Goater wrote:
> On 5/22/25 16:28, Rorie Reyes wrote:
>>
>> On 5/22/25 9:27 AM, Cédric Le Goater wrote:
>>> On 5/12/25 20:02, 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 | 12 ++++++++++++
>>>>   1 file changed, 12 insertions(+)
>>>>
>>>> diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
>>>> index 3d0af7a54a..5ea5dd9cca 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);
>>>> +
>>>
>>> Could cfg_chg_events be static ?
>>>
>>>
>>> Thanks,
>>>
>>> C.
>>>
>> You make a good point, Cedric. I'm only using this variable in ap.c. 
>> Having it as a static would prevent it from being modified anywhere else
>>
>
> Good. Would you have time to send a v10 ?
>
>
> Thanks,
>
> C.
>
Hey Cedric, I thought I'd be able to send out a v10 earlier but hit some 
bugs when working on the patch 3 comments. I'm working on it now and 
I'll try to get it out ASAP. Thanks

Re: [RFC PATCH v9 2/4] hw/vfio/ap: store object indicating AP config changed in a queue
Posted by Rorie Reyes 7 months ago
On 5/22/25 11:36 AM, Cédric Le Goater wrote:
> On 5/22/25 16:28, Rorie Reyes wrote:
>>
>> On 5/22/25 9:27 AM, Cédric Le Goater wrote:
>>> On 5/12/25 20:02, 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 | 12 ++++++++++++
>>>>   1 file changed, 12 insertions(+)
>>>>
>>>> diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
>>>> index 3d0af7a54a..5ea5dd9cca 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);
>>>> +
>>>
>>> Could cfg_chg_events be static ?
>>>
>>>
>>> Thanks,
>>>
>>> C.
>>>
>> You make a good point, Cedric. I'm only using this variable in ap.c. 
>> Having it as a static would prevent it from being modified anywhere else
>>
>
> Good. Would you have time to send a v10 ?
>
>
> Thanks,
>
> C.
>
>
I should be able to send a v10 by today. I'm currently working on the 
other two comments you left for patch 3

Re: [RFC PATCH v9 2/4] hw/vfio/ap: store object indicating AP config changed in a queue
Posted by Anthony Krowiak 7 months, 1 week ago


On 5/12/25 2:02 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>

Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com>

> ---
>   hw/vfio/ap.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
>
> diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
> index 3d0af7a54a..5ea5dd9cca 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)
> @@ -74,12 +81,17 @@ static void vfio_ap_req_notifier_handler(void *opaque)
>   
>   static void vfio_ap_cfg_chg_notifier_handler(void *opaque)
>   {
> +    APConfigChgEvent *cfg_chg_event;
>       VFIOAPDevice *vapdev = opaque;
>   
>       if (!event_notifier_test_and_clear(&vapdev->cfg_notifier)) {
>           return;
>       }
>   
> +    cfg_chg_event = g_new0(APConfigChgEvent, 1);
> +
> +    QTAILQ_INSERT_TAIL(&cfg_chg_events, cfg_chg_event, next);
> +
>       css_generate_css_crws(0);
>   
>   }