Re: [PATCH v2 26/30] vfio-pci/zdev: wire up zPCI adapter interrupt forwarding support

Matthew Rosato
2022-01-19T17:21:00Z

On 1/19/22 12:10 PM, Pierre Morel wrote:
>
>
> On 1/14/22 21:31, Matthew Rosato wrote:
...
>> diff --git a/include/uapi/linux/vfio_zdev.h
>> b/include/uapi/linux/vfio_zdev.h
>> index 575f0410dc66..c574e23f9385 100644
>> --- a/include/uapi/linux/vfio_zdev.h
>> +++ b/include/uapi/linux/vfio_zdev.h
>> @@ -90,4 +90,24 @@ struct vfio_device_zpci_interp {
>>       __u32 fh;        /* Host device function handle */
>>   };
>> +/**
>> + * VFIO_DEVICE_FEATURE_ZPCI_AIF
>> + *
>> + * This feature is used for enabling forwarding of adapter interrupts
>> directly
>> + * from firmware to the guest.  When setting this feature, the flags
>> indicate
>> + * whether to enable/disable the feature and the structure defined
>> below is
>> + * used to setup the forwarding structures.  When getting this
>> feature, only
>> + * the flags are used to indicate the current state.
>> + */
>> +struct vfio_device_zpci_aif {
>> +    __u64 flags;
>> +#define VFIO_DEVICE_ZPCI_FLAG_AIF_FLOAT 1
>> +#define VFIO_DEVICE_ZPCI_FLAG_AIF_HOST 2
>
> Generaly it looks good to me but I miss some explanation on these flags.

I can add a small line comment for each, like:

AIF_FLOAT 1 /* Floating interrupts enabled */
AIF_HOST 2 /* Host delivery forced */

But here's a bit more detail:

On SET:
AIF_FLOAT = 1 means enable the interrupt forwarding assist for floating
interrupt delivery
AIF_FLOAT = 0 means to disable it.
AIF_HOST = 1 means the assist will always deliver the interrupt to the
host and let the host inject it
AIF_HOST = 0 host only gets interrupts when firmware can't deliver

on GET, we just indicate the current settings from the most recent SET,
meaning:
AIF_FLOAT = 1 interrupt forwarding assist is currently active
AIF_FLOAT = 0 interrupt forwarding assist is not currently active
AIF_HOST = 1 interrupt forwarding will always go through host
AIF_HOST = 0 interrupt forwarding will only go through the host when
necessary

>
> Which makes me realize that a more complete documentation under
> Documentation/S390 for VFIO zPCI as we have for VFIO AP and VFIO CCW
> would be of great interest.

You're not wrong -- a similar comment came up for QEMU. I will add this
to my todo list as a follow-on.