2017-12-02 01:30:32

by Tony Krowiak

[permalink] [raw]
Subject: Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

On 11/03/2017 04:47 AM, Christian Borntraeger wrote:
>
> On 11/02/2017 07:49 PM, Tony Krowiak wrote:
>> On 11/02/2017 11:53 AM, Christian Borntraeger wrote:
>>> On 11/02/2017 04:36 PM, Tony Krowiak wrote:
>>>> On 11/02/2017 08:08 AM, Christian Borntraeger wrote:
>>>>> On 10/16/2017 11:25 AM, Martin Schwidefsky wrote:
>>>>>> On Fri, 13 Oct 2017 13:39:04 -0400
>>>>>> Tony Krowiak <[email protected]> wrote:
>>>>>>
>>>>>>> Sets up the following facilities bits to enable the specified AP
>>>>>>> facilities for the guest VM:
>>>>>>> * STFLE.12: Enables the AP Query Configuration Information
>>>>>>> facility. The AP bus running in the guest uses
>>>>>>> the information returned from this instruction
>>>>>>> to configure AP adapters and domains for the
>>>>>>> guest machine.
>>>>>>> * STFLE.15: Indicates the AP facilities test is available.
>>>>>>> The AP bus running in the guest uses the
>>>>>>> information.
>>>>>>>
>>>>>>> Signed-off-by: Tony Krowiak <[email protected]>
>>>>>>> ---
>>>>>>> arch/s390/tools/gen_facilities.c | 2 ++
>>>>>>> 1 files changed, 2 insertions(+), 0 deletions(-)
>>>>>>>
>>>>>>> diff --git a/arch/s390/tools/gen_facilities.c b/arch/s390/tools/gen_facilities.c
>>>>>>> index 70dd8f1..eeaa7db 100644
>>>>>>> --- a/arch/s390/tools/gen_facilities.c
>>>>>>> +++ b/arch/s390/tools/gen_facilities.c
>>>>>>> @@ -74,8 +74,10 @@ struct facility_def {
>>>>>>> 8, /* enhanced-DAT 1 */
>>>>>>> 9, /* sense-running-status */
>>>>>>> 10, /* conditional sske */
>>>>>>> + 12, /* AP query configuration */
>>>>>>> 13, /* ipte-range */
>>>>>>> 14, /* nonquiescing key-setting */
>>>>>>> + 15, /* AP special-command facility */
>>>>>>> 73, /* transactional execution */
>>>>>>> 75, /* access-exception-fetch/store indication */
>>>>>>> 76, /* msa extension 3 */
>>>>>> With this all KVM guests will always have the AP instructions available, no?
>>>>>> In principles I like this approach, but it differs from the way z/VM does things,
>>>>>> there the guest will get an exception if it tries to execute an AP instruction
>>>>>> if there are no AP devices assigned to the guest. I wonder if there is a reason
>>>>>> why z/VM does it the way it does.
>>>>> A good question. For LPAR it seems that you have AP instructions even if you have
>>>>> no crypto cards.
>>>>>
>>>> I don't believe these facilities control whether or not AP instructions will be available
>>>>
>>>> to the guest.
>>> This is actually handled by your patch2 enabling the ECA bit.
>>> I think we must decide if we want to be able to disable these instructions
>>> via the cpu model. If yes we must then couple the facilities with the enablement.
>> The ECA.28 bit controls whether instructions are intercepted or interpreted - i.e., handled via hardware
>> virtualization. If set, as is done in patch2, then instructions will be interpreted. I don't see how
>> that affects enabling or disabling AP instructions, unless we don't set ECA.28, intercept every instruction
>> and program check. Am I missing something here?
> If we do not set ECA.28 these instructions intercept and we (the hypervisor) can then
> decide what to do. For example we can give an PIC01 operation exception (illegal
> instruction) - thats what we do today.
>
> Now: if we want to be able to migrate a guest from a new kernel back to an old kernel,
> there must be a way to disable the new behaviour so that the user can configure a guest
> that does NOT have these 3 instructions. That means, I want to bind the ap instruction
> to a cpu model feature, so that we only enable ECA.28 and the facility bits, if the
> feature is enabled in the CPU model. Otherwise we have no control on what happens
> when the guest issues these instructions.
>
> Imagine what happens if we not do this and you migrate from an identical hw with an
> identical libvirt/qemu but from a new kernel to an old kernel:
>
> The guest boots starts up on the new kernel
> guest kernel: drivers/s390/crypto/ap_bus.c ap_module_init -> ap_instructions_available
> checks if the instructions work. They do and now the guest driver assumes that all
> instructions will continue to work.
>
> Now the guest is migrated back to an old kernel
> sooner or later the ap_scan_bus kthread will run to scan the bus (or some crypto operation
> is started) and the instruction will be rejected with a PIC01. kernel oops.
There are several scenarios that have to be accounted for, such as:
* Migrating from a linux host where both the KVM/kernel and QEMU support
AP matrix
devices to a guest host where neither the KVM/kernel nor QEMU support
AP matrix
devices;
* Migrating from a linux host where both the KVM/kernel and QEMU support
AP matrix
devices to a guest host where the KVM/kernel does not support AP
matrix devices
but QEMU does;
* Starting a guest on a linux host where QEMU supports AP matrix devices
and
the KVM/kernel does not;
* etc.

I agree with your suggestion that defining a new CPU model feature is
probably
the best way to resolve this issue. The question is, should we define a
single
feature indicating whether AP instructions are installed and set
features bits
for the guest based on whether or not they are set in the linux host, or
should
we define additional CPU model features for turning features bits on and
off?
I guess it boils down to what behavior is expected for the AP bus
running on
the linux guest. Here is a rundown of the facilities bits associated
with AP
and how they affect the behavior of the AP bus:

* STFLE.12 indicates whether the AP query function is available. If this
bit
is not set, then the AP bus scan will only test domains 0-15. For
example,
if adapters 4, 5, and 6 and domains 12 and 71 (0x47) are installed,
then AP
queues 04.0047, 05.0047 and 06.0047 will not be made available.

* STFLE.15 indicates whether the AP facilities test function is
available. If
this bit is not set, then the CEX4, CEX5 and CEX6 device drivers
discovered
by the AP bus scan will not get bound to any AP device drivers. Since
the
AP matrix model supports only CEX4 and greater, no devices will be bound
to any driver for a guest.

* STFLE.65 indicates whether AP interrupts are available. If this bit is not
set, then the AP bus will use polling instead of using interrupt handlers
to process AP events.

If the AP bus running on the guest is expected to mimic the behavior of an
AP bus running on the host, then I think we need a CPU model feature for
each
facility. Otherwise, I think we can group them within a CPU model feature
that indicates AP matrix devices are supported. What say you?
>
>


2017-12-05 07:53:26

by Harald Freudenberger

[permalink] [raw]
Subject: Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

On 12/02/2017 02:30 AM, Tony Krowiak wrote:
> On 11/03/2017 04:47 AM, Christian Borntraeger wrote:
>>
>> On 11/02/2017 07:49 PM, Tony Krowiak wrote:
>>> On 11/02/2017 11:53 AM, Christian Borntraeger wrote:
>>>> On 11/02/2017 04:36 PM, Tony Krowiak wrote:
>>>>> On 11/02/2017 08:08 AM, Christian Borntraeger wrote:
>>>>>> On 10/16/2017 11:25 AM, Martin Schwidefsky wrote:
>>>>>>> On Fri, 13 Oct 2017 13:39:04 -0400
>>>>>>> Tony Krowiak <[email protected]> wrote:
>>>>>>>
>>>>>>>> Sets up the following facilities bits to enable the specified AP
>>>>>>>> facilities for the guest VM:
>>>>>>>>       * STFLE.12: Enables the AP Query Configuration Information
>>>>>>>>                   facility. The AP bus running in the guest uses
>>>>>>>>                   the information returned from this instruction
>>>>>>>>                   to configure AP adapters and domains for the
>>>>>>>>                   guest machine.
>>>>>>>>       * STFLE.15: Indicates the AP facilities test is available.
>>>>>>>>                   The AP bus running in the guest uses the
>>>>>>>>                   information.
>>>>>>>>
>>>>>>>> Signed-off-by: Tony Krowiak <[email protected]>
>>>>>>>> ---
>>>>>>>>    arch/s390/tools/gen_facilities.c |    2 ++
>>>>>>>>    1 files changed, 2 insertions(+), 0 deletions(-)
>>>>>>>>
>>>>>>>> diff --git a/arch/s390/tools/gen_facilities.c b/arch/s390/tools/gen_facilities.c
>>>>>>>> index 70dd8f1..eeaa7db 100644
>>>>>>>> --- a/arch/s390/tools/gen_facilities.c
>>>>>>>> +++ b/arch/s390/tools/gen_facilities.c
>>>>>>>> @@ -74,8 +74,10 @@ struct facility_def {
>>>>>>>>                8,  /* enhanced-DAT 1 */
>>>>>>>>                9,  /* sense-running-status */
>>>>>>>>                10, /* conditional sske */
>>>>>>>> +            12, /* AP query configuration */
>>>>>>>>                13, /* ipte-range */
>>>>>>>>                14, /* nonquiescing key-setting */
>>>>>>>> +            15, /* AP special-command facility */
>>>>>>>>                73, /* transactional execution */
>>>>>>>>                75, /* access-exception-fetch/store indication */
>>>>>>>>                76, /* msa extension 3 */
>>>>>>> With this all KVM guests will always have the AP instructions available, no?
>>>>>>> In principles I like this approach, but it differs from the way z/VM does things,
>>>>>>> there the guest will get an exception if it tries to execute an AP instruction
>>>>>>> if there are no AP devices assigned to the guest. I wonder if there is a reason
>>>>>>> why z/VM does it the way it does.
>>>>>> A good question. For LPAR it seems that you have AP instructions even if you have
>>>>>> no crypto cards.
>>>>>>
>>>>> I don't believe these facilities control whether or not AP instructions will be available
>>>>>
>>>>> to the guest.
>>>> This is actually handled by your patch2 enabling the ECA bit.
>>>> I think we must decide if we want to be able to disable these instructions
>>>> via the cpu model. If yes we must then couple the facilities with the enablement.
>>> The ECA.28 bit controls whether instructions are intercepted or interpreted - i.e., handled via hardware
>>> virtualization. If set, as is done in patch2, then instructions will be interpreted. I don't see how
>>> that affects enabling or disabling AP instructions, unless we don't set ECA.28, intercept every instruction
>>> and program check. Am I missing something here?
>> If we do not set ECA.28 these instructions intercept and we (the hypervisor) can then
>> decide what to do. For example we can give an PIC01 operation exception (illegal
>> instruction) - thats what we do today.
>>
>> Now: if we want to be able to migrate a guest from a new kernel back to an old kernel,
>> there must be a way to disable the new behaviour so that the user can configure a guest
>> that does NOT have these 3 instructions. That means, I want to bind the ap instruction
>> to a cpu model feature, so that we only enable ECA.28 and the facility bits, if the
>> feature is enabled in the CPU model. Otherwise we have no control on what happens
>> when the guest issues these instructions.
>>
>> Imagine what happens if we not do this and you migrate from an identical hw with an
>> identical libvirt/qemu but from a new kernel to an old kernel:
>>
>> The guest boots starts up on the new kernel
>> guest kernel: drivers/s390/crypto/ap_bus.c  ap_module_init -> ap_instructions_available
>> checks if the instructions work. They do and now the guest driver assumes that all
>> instructions will continue to work.
>>
>> Now the guest is migrated back to an old kernel
>> sooner or later the ap_scan_bus kthread will run to scan the bus (or some crypto operation
>> is started) and the instruction will be rejected with a PIC01. kernel oops.
> There are several scenarios that have to be accounted for, such as:
> * Migrating from a linux host where both the KVM/kernel and QEMU support AP matrix
>   devices to a guest host where neither the KVM/kernel nor QEMU support AP matrix
>   devices;
> * Migrating from a linux host where both the KVM/kernel and QEMU support AP matrix
>   devices to a guest host where the KVM/kernel does not support AP matrix devices
>   but QEMU does;
> * Starting a guest on a linux host where QEMU supports AP matrix devices and
>   the KVM/kernel does not;
> * etc.
>
> I agree with your suggestion that defining a new CPU model feature is probably
> the best way to resolve this issue. The question is, should we define a single
> feature indicating whether AP instructions are installed and set features bits
> for the guest based on whether or not they are set in the linux host, or should
> we define additional CPU model features for turning features bits on and off?
> I guess it boils down to what behavior is expected for the AP bus running on
> the linux guest. Here is a rundown of the facilities bits associated with AP
> and how they affect the behavior of the AP bus:
>
> * STFLE.12 indicates whether the AP query function is available. If this bit
>   is not set, then the AP bus scan will only test domains 0-15. For example,
>   if adapters 4, 5, and 6 and domains 12 and 71 (0x47) are installed, then AP
>   queues 04.0047, 05.0047 and 06.0047 will not be made available.
STFLE 12 is the indication for Query AP Configuration Information (QCI) available.
> * STFLE.15 indicates whether the AP facilities test function is available. If
>   this bit is not set, then the CEX4, CEX5 and CEX6 device drivers discovered
>   by the AP bus scan will not get bound to any AP device drivers. Since the
>   AP matrix model supports only CEX4 and greater, no devices will be bound
>   to any driver for a guest.
This T-Bit extension to the TAPQ subfunction is a must have. When kvm only
supports CEX4 and upper then this bit could also act as the indicator for
AP instructions available. Of course if you want to implement pure virtual
full simulated AP without any real AP hardware on the host this bit can't
be the indicator.
> * STFLE.65 indicates whether AP interrupts are available. If this bit is not
>   set, then the AP bus will use polling instead of using interrupt handlers
>   to process AP events.
>
> If the AP bus running on the guest is expected to mimic the behavior of an
> AP bus running on the host, then I think we need a CPU model feature for each
> facility. Otherwise, I think we can group them within a CPU model feature
> that indicates AP matrix devices are supported. What say you?
>>
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-s390" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

2017-12-05 14:04:36

by Cornelia Huck

[permalink] [raw]
Subject: Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

On Tue, 5 Dec 2017 08:52:57 +0100
Harald Freudenberger <[email protected]> wrote:

> On 12/02/2017 02:30 AM, Tony Krowiak wrote:

> > I agree with your suggestion that defining a new CPU model feature is probably
> > the best way to resolve this issue. The question is, should we define a single
> > feature indicating whether AP instructions are installed and set features bits
> > for the guest based on whether or not they are set in the linux host, or should
> > we define additional CPU model features for turning features bits on and off?
> > I guess it boils down to what behavior is expected for the AP bus running on
> > the linux guest. Here is a rundown of the facilities bits associated with AP
> > and how they affect the behavior of the AP bus:
> >
> > * STFLE.12 indicates whether the AP query function is available. If this bit
> >   is not set, then the AP bus scan will only test domains 0-15. For example,
> >   if adapters 4, 5, and 6 and domains 12 and 71 (0x47) are installed, then AP
> >   queues 04.0047, 05.0047 and 06.0047 will not be made available.
> STFLE 12 is the indication for Query AP Configuration Information (QCI) available.
> > * STFLE.15 indicates whether the AP facilities test function is available. If
> >   this bit is not set, then the CEX4, CEX5 and CEX6 device drivers discovered
> >   by the AP bus scan will not get bound to any AP device drivers. Since the
> >   AP matrix model supports only CEX4 and greater, no devices will be bound
> >   to any driver for a guest.
> This T-Bit extension to the TAPQ subfunction is a must have. When kvm only
> supports CEX4 and upper then this bit could also act as the indicator for
> AP instructions available. Of course if you want to implement pure virtual
> full simulated AP without any real AP hardware on the host this bit can't
> be the indicator.

It would probably make sense to group these two together. Or is there
any advantage in supporting only a part of it?

> > * STFLE.65 indicates whether AP interrupts are available. If this bit is not
> >   set, then the AP bus will use polling instead of using interrupt handlers
> >   to process AP events.

So, does this indicate "adapter interrupts for AP" only? If so, we
should keep this separate and only enable it when we have the gisa etc.
ready.

2017-12-05 14:15:15

by Tony Krowiak

[permalink] [raw]
Subject: Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

On 12/05/2017 02:52 AM, Harald Freudenberger wrote:
> On 12/02/2017 02:30 AM, Tony Krowiak wrote:
>> On 11/03/2017 04:47 AM, Christian Borntraeger wrote:
>>> On 11/02/2017 07:49 PM, Tony Krowiak wrote:
>>>> On 11/02/2017 11:53 AM, Christian Borntraeger wrote:
>>>>> On 11/02/2017 04:36 PM, Tony Krowiak wrote:
>>>>>> On 11/02/2017 08:08 AM, Christian Borntraeger wrote:
>>>>>>> On 10/16/2017 11:25 AM, Martin Schwidefsky wrote:
>>>>>>>> On Fri, 13 Oct 2017 13:39:04 -0400
>>>>>>>> Tony Krowiak <[email protected]> wrote:
>>>>>>>>
>>>>>>>>> Sets up the following facilities bits to enable the specified AP
>>>>>>>>> facilities for the guest VM:
>>>>>>>>> * STFLE.12: Enables the AP Query Configuration Information
>>>>>>>>> facility. The AP bus running in the guest uses
>>>>>>>>> the information returned from this instruction
>>>>>>>>> to configure AP adapters and domains for the
>>>>>>>>> guest machine.
>>>>>>>>> * STFLE.15: Indicates the AP facilities test is available.
>>>>>>>>> The AP bus running in the guest uses the
>>>>>>>>> information.
>>>>>>>>>
>>>>>>>>> Signed-off-by: Tony Krowiak <[email protected]>
>>>>>>>>> ---
>>>>>>>>> arch/s390/tools/gen_facilities.c | 2 ++
>>>>>>>>> 1 files changed, 2 insertions(+), 0 deletions(-)
>>>>>>>>>
>>>>>>>>> diff --git a/arch/s390/tools/gen_facilities.c b/arch/s390/tools/gen_facilities.c
>>>>>>>>> index 70dd8f1..eeaa7db 100644
>>>>>>>>> --- a/arch/s390/tools/gen_facilities.c
>>>>>>>>> +++ b/arch/s390/tools/gen_facilities.c
>>>>>>>>> @@ -74,8 +74,10 @@ struct facility_def {
>>>>>>>>> 8, /* enhanced-DAT 1 */
>>>>>>>>> 9, /* sense-running-status */
>>>>>>>>> 10, /* conditional sske */
>>>>>>>>> + 12, /* AP query configuration */
>>>>>>>>> 13, /* ipte-range */
>>>>>>>>> 14, /* nonquiescing key-setting */
>>>>>>>>> + 15, /* AP special-command facility */
>>>>>>>>> 73, /* transactional execution */
>>>>>>>>> 75, /* access-exception-fetch/store indication */
>>>>>>>>> 76, /* msa extension 3 */
>>>>>>>> With this all KVM guests will always have the AP instructions available, no?
>>>>>>>> In principles I like this approach, but it differs from the way z/VM does things,
>>>>>>>> there the guest will get an exception if it tries to execute an AP instruction
>>>>>>>> if there are no AP devices assigned to the guest. I wonder if there is a reason
>>>>>>>> why z/VM does it the way it does.
>>>>>>> A good question. For LPAR it seems that you have AP instructions even if you have
>>>>>>> no crypto cards.
>>>>>>>
>>>>>> I don't believe these facilities control whether or not AP instructions will be available
>>>>>>
>>>>>> to the guest.
>>>>> This is actually handled by your patch2 enabling the ECA bit.
>>>>> I think we must decide if we want to be able to disable these instructions
>>>>> via the cpu model. If yes we must then couple the facilities with the enablement.
>>>> The ECA.28 bit controls whether instructions are intercepted or interpreted - i.e., handled via hardware
>>>> virtualization. If set, as is done in patch2, then instructions will be interpreted. I don't see how
>>>> that affects enabling or disabling AP instructions, unless we don't set ECA.28, intercept every instruction
>>>> and program check. Am I missing something here?
>>> If we do not set ECA.28 these instructions intercept and we (the hypervisor) can then
>>> decide what to do. For example we can give an PIC01 operation exception (illegal
>>> instruction) - thats what we do today.
>>>
>>> Now: if we want to be able to migrate a guest from a new kernel back to an old kernel,
>>> there must be a way to disable the new behaviour so that the user can configure a guest
>>> that does NOT have these 3 instructions. That means, I want to bind the ap instruction
>>> to a cpu model feature, so that we only enable ECA.28 and the facility bits, if the
>>> feature is enabled in the CPU model. Otherwise we have no control on what happens
>>> when the guest issues these instructions.
>>>
>>> Imagine what happens if we not do this and you migrate from an identical hw with an
>>> identical libvirt/qemu but from a new kernel to an old kernel:
>>>
>>> The guest boots starts up on the new kernel
>>> guest kernel: drivers/s390/crypto/ap_bus.c ap_module_init -> ap_instructions_available
>>> checks if the instructions work. They do and now the guest driver assumes that all
>>> instructions will continue to work.
>>>
>>> Now the guest is migrated back to an old kernel
>>> sooner or later the ap_scan_bus kthread will run to scan the bus (or some crypto operation
>>> is started) and the instruction will be rejected with a PIC01. kernel oops.
>> There are several scenarios that have to be accounted for, such as:
>> * Migrating from a linux host where both the KVM/kernel and QEMU support AP matrix
>> devices to a guest host where neither the KVM/kernel nor QEMU support AP matrix
>> devices;
>> * Migrating from a linux host where both the KVM/kernel and QEMU support AP matrix
>> devices to a guest host where the KVM/kernel does not support AP matrix devices
>> but QEMU does;
>> * Starting a guest on a linux host where QEMU supports AP matrix devices and
>> the KVM/kernel does not;
>> * etc.
>>
>> I agree with your suggestion that defining a new CPU model feature is probably
>> the best way to resolve this issue. The question is, should we define a single
>> feature indicating whether AP instructions are installed and set features bits
>> for the guest based on whether or not they are set in the linux host, or should
>> we define additional CPU model features for turning features bits on and off?
>> I guess it boils down to what behavior is expected for the AP bus running on
>> the linux guest. Here is a rundown of the facilities bits associated with AP
>> and how they affect the behavior of the AP bus:
>>
>> * STFLE.12 indicates whether the AP query function is available. If this bit
>> is not set, then the AP bus scan will only test domains 0-15. For example,
>> if adapters 4, 5, and 6 and domains 12 and 71 (0x47) are installed, then AP
>> queues 04.0047, 05.0047 and 06.0047 will not be made available.
> STFLE 12 is the indication for Query AP Configuration Information (QCI) available.
>> * STFLE.15 indicates whether the AP facilities test function is available. If
>> this bit is not set, then the CEX4, CEX5 and CEX6 device drivers discovered
>> by the AP bus scan will not get bound to any AP device drivers. Since the
>> AP matrix model supports only CEX4 and greater, no devices will be bound
>> to any driver for a guest.
> This T-Bit extension to the TAPQ subfunction is a must have. When kvm only
> supports CEX4 and upper then this bit could also act as the indicator for
> AP instructions available. Of course if you want to implement pure virtual
> full simulated AP without any real AP hardware on the host this bit can't
> be the indicator.
The context for this discussion is whether we should model the STFLE bits as
individual CPU model features or include them with the CPU model feature
indicating AP instructions are installed. In either case, the setting of
these bits for the guest is dependent upon whether they are set for the
host or not. In other words, we can not set a bit for the guest if it is
not set for the host for dedicated crypto.
>> * STFLE.65 indicates whether AP interrupts are available. If this bit is not
>> set, then the AP bus will use polling instead of using interrupt handlers
>> to process AP events.
>>
>> If the AP bus running on the guest is expected to mimic the behavior of an
>> AP bus running on the host, then I think we need a CPU model feature for each
>> facility. Otherwise, I think we can group them within a CPU model feature
>> that indicates AP matrix devices are supported. What say you?
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-s390" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>

2017-12-05 14:24:11

by Pierre Morel

[permalink] [raw]
Subject: Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

On 05/12/2017 15:04, Cornelia Huck wrote:
> On Tue, 5 Dec 2017 08:52:57 +0100
> Harald Freudenberger <[email protected]> wrote:
>
>> On 12/02/2017 02:30 AM, Tony Krowiak wrote:
>
>>> I agree with your suggestion that defining a new CPU model feature is probably
>>> the best way to resolve this issue. The question is, should we define a single
>>> feature indicating whether AP instructions are installed and set features bits
>>> for the guest based on whether or not they are set in the linux host, or should
>>> we define additional CPU model features for turning features bits on and off?
>>> I guess it boils down to what behavior is expected for the AP bus running on
>>> the linux guest. Here is a rundown of the facilities bits associated with AP
>>> and how they affect the behavior of the AP bus:
>>>
>>> * STFLE.12 indicates whether the AP query function is available. If this bit
>>>   is not set, then the AP bus scan will only test domains 0-15. For example,
>>>   if adapters 4, 5, and 6 and domains 12 and 71 (0x47) are installed, then AP
>>>   queues 04.0047, 05.0047 and 06.0047 will not be made available.
>> STFLE 12 is the indication for Query AP Configuration Information (QCI) available.
>>> * STFLE.15 indicates whether the AP facilities test function is available. If
>>>   this bit is not set, then the CEX4, CEX5 and CEX6 device drivers discovered
>>>   by the AP bus scan will not get bound to any AP device drivers. Since the
>>>   AP matrix model supports only CEX4 and greater, no devices will be bound
>>>   to any driver for a guest.
>> This T-Bit extension to the TAPQ subfunction is a must have. When kvm only
>> supports CEX4 and upper then this bit could also act as the indicator for
>> AP instructions available. Of course if you want to implement pure virtual
>> full simulated AP without any real AP hardware on the host this bit can't
>> be the indicator.
>
> It would probably make sense to group these two together. Or is there
> any advantage in supporting only a part of it?
>
>>> * STFLE.65 indicates whether AP interrupts are available. If this bit is not
>>>   set, then the AP bus will use polling instead of using interrupt handlers
>>>   to process AP events.
>
> So, does this indicate "adapter interrupts for AP" only? If so, we
> should keep this separate and only enable it when we have the gisa etc.
> ready.
>

Yes, STFLE 65, it is for AP only.

QCI, STFLE 12, is no present on older systems, in this case AP uses TAPQ
to retrieve information for each AP

So for my point of view, it make sense to separate the three facilities
to enable migration on older systems.

Pierre


--
Pierre Morel
Linux/KVM/QEMU in Böblingen - Germany

2017-12-05 14:31:07

by Cornelia Huck

[permalink] [raw]
Subject: Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

On Tue, 5 Dec 2017 15:23:50 +0100
Pierre Morel <[email protected]> wrote:

> On 05/12/2017 15:04, Cornelia Huck wrote:
> > On Tue, 5 Dec 2017 08:52:57 +0100
> > Harald Freudenberger <[email protected]> wrote:
> >
> >> On 12/02/2017 02:30 AM, Tony Krowiak wrote:
> >
> >>> I agree with your suggestion that defining a new CPU model feature is probably
> >>> the best way to resolve this issue. The question is, should we define a single
> >>> feature indicating whether AP instructions are installed and set features bits
> >>> for the guest based on whether or not they are set in the linux host, or should
> >>> we define additional CPU model features for turning features bits on and off?
> >>> I guess it boils down to what behavior is expected for the AP bus running on
> >>> the linux guest. Here is a rundown of the facilities bits associated with AP
> >>> and how they affect the behavior of the AP bus:
> >>>
> >>> * STFLE.12 indicates whether the AP query function is available. If this bit
> >>>   is not set, then the AP bus scan will only test domains 0-15. For example,
> >>>   if adapters 4, 5, and 6 and domains 12 and 71 (0x47) are installed, then AP
> >>>   queues 04.0047, 05.0047 and 06.0047 will not be made available.
> >> STFLE 12 is the indication for Query AP Configuration Information (QCI) available.
> >>> * STFLE.15 indicates whether the AP facilities test function is available. If
> >>>   this bit is not set, then the CEX4, CEX5 and CEX6 device drivers discovered
> >>>   by the AP bus scan will not get bound to any AP device drivers. Since the
> >>>   AP matrix model supports only CEX4 and greater, no devices will be bound
> >>>   to any driver for a guest.
> >> This T-Bit extension to the TAPQ subfunction is a must have. When kvm only
> >> supports CEX4 and upper then this bit could also act as the indicator for
> >> AP instructions available. Of course if you want to implement pure virtual
> >> full simulated AP without any real AP hardware on the host this bit can't
> >> be the indicator.
> >
> > It would probably make sense to group these two together. Or is there
> > any advantage in supporting only a part of it?
> >
> >>> * STFLE.65 indicates whether AP interrupts are available. If this bit is not
> >>>   set, then the AP bus will use polling instead of using interrupt handlers
> >>>   to process AP events.
> >
> > So, does this indicate "adapter interrupts for AP" only? If so, we
> > should keep this separate and only enable it when we have the gisa etc.
> > ready.
> >
>
> Yes, STFLE 65, it is for AP only.
>
> QCI, STFLE 12, is no present on older systems, in this case AP uses TAPQ
> to retrieve information for each AP

Dumb question: How old? Machines that are still supported?

>
> So for my point of view, it make sense to separate the three facilities
> to enable migration on older systems.

OK, if STFLE 12 might not be present (pending my question above), but
STFLE 15 is indeed a must-have, we should split this up.

2017-12-05 14:47:38

by Pierre Morel

[permalink] [raw]
Subject: Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

On 05/12/2017 15:30, Cornelia Huck wrote:
> On Tue, 5 Dec 2017 15:23:50 +0100
> Pierre Morel <[email protected]> wrote:
>
>> On 05/12/2017 15:04, Cornelia Huck wrote:
>>> On Tue, 5 Dec 2017 08:52:57 +0100
>>> Harald Freudenberger <[email protected]> wrote:
>>>
>>>> On 12/02/2017 02:30 AM, Tony Krowiak wrote:
>>>
>>>>> I agree with your suggestion that defining a new CPU model feature is probably
>>>>> the best way to resolve this issue. The question is, should we define a single
>>>>> feature indicating whether AP instructions are installed and set features bits
>>>>> for the guest based on whether or not they are set in the linux host, or should
>>>>> we define additional CPU model features for turning features bits on and off?
>>>>> I guess it boils down to what behavior is expected for the AP bus running on
>>>>> the linux guest. Here is a rundown of the facilities bits associated with AP
>>>>> and how they affect the behavior of the AP bus:
>>>>>
>>>>> * STFLE.12 indicates whether the AP query function is available. If this bit
>>>>>   is not set, then the AP bus scan will only test domains 0-15. For example,
>>>>>   if adapters 4, 5, and 6 and domains 12 and 71 (0x47) are installed, then AP
>>>>>   queues 04.0047, 05.0047 and 06.0047 will not be made available.
>>>> STFLE 12 is the indication for Query AP Configuration Information (QCI) available.
>>>>> * STFLE.15 indicates whether the AP facilities test function is available. If
>>>>>   this bit is not set, then the CEX4, CEX5 and CEX6 device drivers discovered
>>>>>   by the AP bus scan will not get bound to any AP device drivers. Since the
>>>>>   AP matrix model supports only CEX4 and greater, no devices will be bound
>>>>>   to any driver for a guest.
>>>> This T-Bit extension to the TAPQ subfunction is a must have. When kvm only
>>>> supports CEX4 and upper then this bit could also act as the indicator for
>>>> AP instructions available. Of course if you want to implement pure virtual
>>>> full simulated AP without any real AP hardware on the host this bit can't
>>>> be the indicator.
>>>
>>> It would probably make sense to group these two together. Or is there
>>> any advantage in supporting only a part of it?
>>>
>>>>> * STFLE.65 indicates whether AP interrupts are available. If this bit is not
>>>>>   set, then the AP bus will use polling instead of using interrupt handlers
>>>>>   to process AP events.
>>>
>>> So, does this indicate "adapter interrupts for AP" only? If so, we
>>> should keep this separate and only enable it when we have the gisa etc.
>>> ready.
>>>
>>
>> Yes, STFLE 65, it is for AP only.
>>
>> QCI, STFLE 12, is no present on older systems, in this case AP uses TAPQ
>> to retrieve information for each AP
>
> Dumb question: How old? Machines that are still supported?

No idea which machine are supported or not, will ask.

What I can say is that I have here a Lpar which does not support QCI.
It seems to be a zEC12.2.
z13 support it.

>
>>
>> So for my point of view, it make sense to separate the three facilities
>> to enable migration on older systems.
>
> OK, if STFLE 12 might not be present (pending my question above), but
> STFLE 15 is indeed a must-have, we should split this up.
>



--
Pierre Morel
Linux/KVM/QEMU in Böblingen - Germany

2017-12-05 15:01:52

by Tony Krowiak

[permalink] [raw]
Subject: Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

On 12/05/2017 09:04 AM, Cornelia Huck wrote:
> On Tue, 5 Dec 2017 08:52:57 +0100
> Harald Freudenberger <[email protected]> wrote:
>
>> On 12/02/2017 02:30 AM, Tony Krowiak wrote:
>>> I agree with your suggestion that defining a new CPU model feature is probably
>>> the best way to resolve this issue. The question is, should we define a single
>>> feature indicating whether AP instructions are installed and set features bits
>>> for the guest based on whether or not they are set in the linux host, or should
>>> we define additional CPU model features for turning features bits on and off?
>>> I guess it boils down to what behavior is expected for the AP bus running on
>>> the linux guest. Here is a rundown of the facilities bits associated with AP
>>> and how they affect the behavior of the AP bus:
>>>
>>> * STFLE.12 indicates whether the AP query function is available. If this bit
>>> is not set, then the AP bus scan will only test domains 0-15. For example,
>>> if adapters 4, 5, and 6 and domains 12 and 71 (0x47) are installed, then AP
>>> queues 04.0047, 05.0047 and 06.0047 will not be made available.
>> STFLE 12 is the indication for Query AP Configuration Information (QCI) available.
>>> * STFLE.15 indicates whether the AP facilities test function is available. If
>>> this bit is not set, then the CEX4, CEX5 and CEX6 device drivers discovered
>>> by the AP bus scan will not get bound to any AP device drivers. Since the
>>> AP matrix model supports only CEX4 and greater, no devices will be bound
>>> to any driver for a guest.
>> This T-Bit extension to the TAPQ subfunction is a must have. When kvm only
>> supports CEX4 and upper then this bit could also act as the indicator for
>> AP instructions available. Of course if you want to implement pure virtual
>> full simulated AP without any real AP hardware on the host this bit can't
>> be the indicator.
> It would probably make sense to group these two together. Or is there
> any advantage in supporting only a part of it?
After thinking about this a little more, I've come to the conclusion that
all of this might be moot for the following reasons:

* If STFLE.12 is not set for the linux host, then AP bus scan running on
the host will not detect any domains with a domain number higher than 15,
so no AP queues with a queue index higher than 15 will be available to
bind to the vfio_ap_matrix driver. Consequently, no domain higher than
15 can be assigned to any guest. In this case, the AP bus scan
running on
the guest will never detect a domain higher than 15, regardless of the
setting of STFLE.12 for the guest.

* If STFLE.15 is not set for the linux host, then then there will be no
CEX4, CEX5 or CEX6 queues available to bind to the vfio_ap_matrix
driver, so no AP adapters or domains can be assigned to any KVM guest.

The bottom line is the STFLE bit settings for the linux host will control
what APs are available to the KVM guest. Since STFLE.15 controls whether
any CEX4,5 or 6 devices are even available, I think this bit can be
combined into the feature that indicates whether AP is available. As long
as AP instructions are available on the linux host, I'm not sure whether
STFLE.12 needs a feature at all.
>
>>> * STFLE.65 indicates whether AP interrupts are available. If this bit is not
>>> set, then the AP bus will use polling instead of using interrupt handlers
>>> to process AP events.
> So, does this indicate "adapter interrupts for AP" only? If so, we
> should keep this separate and only enable it when we have the gisa etc.
> ready.
Yes, this indicates AP interrupts only. The plan is to enable this when
GISA is available and we can implement interrupt processing.
>

2017-12-05 15:14:31

by Tony Krowiak

[permalink] [raw]
Subject: Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

On 12/05/2017 09:23 AM, Pierre Morel wrote:
> On 05/12/2017 15:04, Cornelia Huck wrote:
>> On Tue, 5 Dec 2017 08:52:57 +0100
>> Harald Freudenberger <[email protected]> wrote:
>>
>>> On 12/02/2017 02:30 AM, Tony Krowiak wrote:
>>
>>>> I agree with your suggestion that defining a new CPU model feature
>>>> is probably
>>>> the best way to resolve this issue. The question is, should we
>>>> define a single
>>>> feature indicating whether AP instructions are installed and set
>>>> features bits
>>>> for the guest based on whether or not they are set in the linux
>>>> host, or should
>>>> we define additional CPU model features for turning features bits
>>>> on and off?
>>>> I guess it boils down to what behavior is expected for the AP bus
>>>> running on
>>>> the linux guest. Here is a rundown of the facilities bits
>>>> associated with AP
>>>> and how they affect the behavior of the AP bus:
>>>>
>>>> * STFLE.12 indicates whether the AP query function is available. If
>>>> this bit
>>>> is not set, then the AP bus scan will only test domains 0-15.
>>>> For example,
>>>> if adapters 4, 5, and 6 and domains 12 and 71 (0x47) are
>>>> installed, then AP
>>>> queues 04.0047, 05.0047 and 06.0047 will not be made available.
>>> STFLE 12 is the indication for Query AP Configuration Information
>>> (QCI) available.
>>>> * STFLE.15 indicates whether the AP facilities test function is
>>>> available. If
>>>> this bit is not set, then the CEX4, CEX5 and CEX6 device drivers
>>>> discovered
>>>> by the AP bus scan will not get bound to any AP device drivers.
>>>> Since theI think
>>>> STFLE.12
>>>> AP matrix model supports only CEX4 and greater, no devices will
>>>> be bound
>>>> to any driver for a guest.
>>> This T-Bit extension to the TAPQ subfunction is a must have. When
>>> kvm only
>>> supports CEX4 and upper then this bit could also act as the
>>> indicator for
>>> AP instructions available. Of course if you want to implement pure
>>> virtual
>>> full simulated AP without any real AP hardware on the host this bit
>>> can't
>>> be the indicator.
>>
>> It would probably make sense to group these two together. Or is there
>> any advantage in supporting only a part of it?
>>
>>>> * STFLE.65 indicates whether AP interrupts are available. If this
>>>> bit is not
>>>> set, then the AP bus will use polling instead of using interrupt
>>>> handlers
>>>> to process AP events.
>>
>> So, does this indicate "adapter interrupts for AP" only? If so, we
>> should keep this separate and only enable it when we have the gisa etc.
>> ready.
>>
>
> Yes, STFLE 65, it is for AP only.
>
> QCI, STFLE 12, is no present on older systems, in this case AP uses
> TAPQ to retrieve information for each AP
>
> So for my point of view, it make sense to separate the three
> facilities to enable migration on older syste
In the interest of keeping things simple, this makes sense.
>
>
> Pierre
>
>

2017-12-06 09:16:07

by Pierre Morel

[permalink] [raw]
Subject: Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

On 05/12/2017 16:01, Tony Krowiak wrote:
> On 12/05/2017 09:04 AM, Cornelia Huck wrote:
>> On Tue, 5 Dec 2017 08:52:57 +0100
>> Harald Freudenberger <[email protected]> wrote:
>>
>>> On 12/02/2017 02:30 AM, Tony Krowiak wrote:
>>>> I agree with your suggestion that defining a new CPU model feature
>>>> is probably
>>>> the best way to resolve this issue. The question is, should we
>>>> define a single
>>>> feature indicating whether AP instructions are installed and set
>>>> features bits
>>>> for the guest based on whether or not they are set in the linux
>>>> host, or should
>>>> we define additional CPU model features for turning features bits on
>>>> and off?
>>>> I guess it boils down to what behavior is expected for the AP bus
>>>> running on
>>>> the linux guest. Here is a rundown of the facilities bits associated
>>>> with AP
>>>> and how they affect the behavior of the AP bus:
>>>>
>>>> * STFLE.12 indicates whether the AP query function is available. If
>>>> this bit
>>>>    is not set, then the AP bus scan will only test domains 0-15. For
>>>> example,
>>>>    if adapters 4, 5, and 6 and domains 12 and 71 (0x47) are
>>>> installed, then AP
>>>>    queues 04.0047, 05.0047 and 06.0047 will not be made available.
>>> STFLE 12 is the indication for Query AP Configuration Information
>>> (QCI) available.
>>>> * STFLE.15 indicates whether the AP facilities test function is
>>>> available. If
>>>>    this bit is not set, then the CEX4, CEX5 and CEX6 device drivers
>>>> discovered
>>>>    by the AP bus scan will not get bound to any AP device drivers.
>>>> Since the
>>>>    AP matrix model supports only CEX4 and greater, no devices will
>>>> be bound
>>>>    to any driver for a guest.
>>> This T-Bit extension to the TAPQ subfunction is a must have. When kvm
>>> only
>>> supports CEX4 and upper then this bit could also act as the indicator
>>> for
>>> AP instructions available. Of course if you want to implement pure
>>> virtual
>>> full simulated AP without any real AP hardware on the host this bit
>>> can't
>>> be the indicator.
>> It would probably make sense to group these two together. Or is there
>> any advantage in supporting only a part of it?
> After thinking about this a little more, I've come to the conclusion that
> all of this might be moot for the following reasons:
>
> * If STFLE.12 is not set for the linux host, then AP bus scan running on
>   the host will not detect any domains with a domain number higher than
> 15,
>   so no AP queues with a queue index higher than 15 will be available to
>   bind to the vfio_ap_matrix driver. Consequently, no domain higher than
>   15 can be assigned to any guest. In this case, the AP bus scan
> running on
>   the guest will never detect a domain higher than 15, regardless of the
>   setting of STFLE.12 for the guest.
>
> * If STFLE.15 is not set for the linux host, then then there will be no
>   CEX4, CEX5 or CEX6 queues available to bind to the vfio_ap_matrix
>   driver, so no AP adapters or domains can be assigned to any KVM guest.
>
> The bottom line is the STFLE bit settings for the linux host will control
> what APs are available to the KVM guest. Since STFLE.15 controls whether
> any CEX4,5 or 6 devices are even available, I think this bit can be
> combined into the feature that indicates whether AP is available. As long
> as AP instructions are available on the linux host, I'm not sure whether
> STFLE.12 needs a feature at all.

We are implementing VFIO with SIE interpretation.

1) Providing more:
The simple way is to provide to the guest only features existing on the
host.
If we do provide features not existing on the host we need to be able to
emulate them.
Even it is possible, it could be done in a future enhancement, but AFAIK
it is not the goal of the current development.

2) Providing less:
On the other hand we can mask to the guest some of the features provided
by the host if we can intercept the scanning of the features.


What I understand from this is that we need all these features being
separately toggled to be able to be compatible with an older system even
if we have a 1:1 host:guest features match in a first version.

If several features where introduced together in a new architecture and
are available on all systems issued from this architecture we can then
gather them in a set. (But I will wonder why we have several features then)


>>
>>>> * STFLE.65 indicates whether AP interrupts are available. If this
>>>> bit is not
>>>>    set, then the AP bus will use polling instead of using interrupt
>>>> handlers
>>>>    to process AP events.
>> So, does this indicate "adapter interrupts for AP" only? If so, we
>> should keep this separate and only enable it when we have the gisa etc.
>> ready.
> Yes, this indicates AP interrupts only. The plan is to enable this when
> GISA is available and we can implement interrupt processing.

If we want to be able to work on system where STFLE.65 is not available,
even if GISA is available I think it would be interesting to have a
Matrix implementation with only polling.

Regards,

Pierre


--
Pierre Morel
Linux/KVM/QEMU in Böblingen - Germany

2017-12-06 10:16:00

by Cornelia Huck

[permalink] [raw]
Subject: Re: [RFC 19/19] s390/facilities: enable AP facilities needed by guest

On Wed, 6 Dec 2017 10:15:51 +0100
Pierre Morel <[email protected]> wrote:

> On 05/12/2017 16:01, Tony Krowiak wrote:
> > On 12/05/2017 09:04 AM, Cornelia Huck wrote:
> >> On Tue, 5 Dec 2017 08:52:57 +0100
> >> Harald Freudenberger <[email protected]> wrote:
> >>
> >>> On 12/02/2017 02:30 AM, Tony Krowiak wrote:
> >>>> I agree with your suggestion that defining a new CPU model feature
> >>>> is probably
> >>>> the best way to resolve this issue. The question is, should we
> >>>> define a single
> >>>> feature indicating whether AP instructions are installed and set
> >>>> features bits
> >>>> for the guest based on whether or not they are set in the linux
> >>>> host, or should
> >>>> we define additional CPU model features for turning features bits on
> >>>> and off?
> >>>> I guess it boils down to what behavior is expected for the AP bus
> >>>> running on
> >>>> the linux guest. Here is a rundown of the facilities bits associated
> >>>> with AP
> >>>> and how they affect the behavior of the AP bus:
> >>>>
> >>>> * STFLE.12 indicates whether the AP query function is available. If
> >>>> this bit
> >>>>    is not set, then the AP bus scan will only test domains 0-15. For
> >>>> example,
> >>>>    if adapters 4, 5, and 6 and domains 12 and 71 (0x47) are
> >>>> installed, then AP
> >>>>    queues 04.0047, 05.0047 and 06.0047 will not be made available.
> >>> STFLE 12 is the indication for Query AP Configuration Information
> >>> (QCI) available.
> >>>> * STFLE.15 indicates whether the AP facilities test function is
> >>>> available. If
> >>>>    this bit is not set, then the CEX4, CEX5 and CEX6 device drivers
> >>>> discovered
> >>>>    by the AP bus scan will not get bound to any AP device drivers.
> >>>> Since the
> >>>>    AP matrix model supports only CEX4 and greater, no devices will
> >>>> be bound
> >>>>    to any driver for a guest.
> >>> This T-Bit extension to the TAPQ subfunction is a must have. When kvm
> >>> only
> >>> supports CEX4 and upper then this bit could also act as the indicator
> >>> for
> >>> AP instructions available. Of course if you want to implement pure
> >>> virtual
> >>> full simulated AP without any real AP hardware on the host this bit
> >>> can't
> >>> be the indicator.
> >> It would probably make sense to group these two together. Or is there
> >> any advantage in supporting only a part of it?
> > After thinking about this a little more, I've come to the conclusion that
> > all of this might be moot for the following reasons:
> >
> > * If STFLE.12 is not set for the linux host, then AP bus scan running on
> >   the host will not detect any domains with a domain number higher than
> > 15,
> >   so no AP queues with a queue index higher than 15 will be available to
> >   bind to the vfio_ap_matrix driver. Consequently, no domain higher than
> >   15 can be assigned to any guest. In this case, the AP bus scan
> > running on
> >   the guest will never detect a domain higher than 15, regardless of the
> >   setting of STFLE.12 for the guest.
> >
> > * If STFLE.15 is not set for the linux host, then then there will be no
> >   CEX4, CEX5 or CEX6 queues available to bind to the vfio_ap_matrix
> >   driver, so no AP adapters or domains can be assigned to any KVM guest.
> >
> > The bottom line is the STFLE bit settings for the linux host will control
> > what APs are available to the KVM guest. Since STFLE.15 controls whether
> > any CEX4,5 or 6 devices are even available, I think this bit can be
> > combined into the feature that indicates whether AP is available. As long
> > as AP instructions are available on the linux host, I'm not sure whether
> > STFLE.12 needs a feature at all.
>
> We are implementing VFIO with SIE interpretation.
>
> 1) Providing more:
> The simple way is to provide to the guest only features existing on the
> host.
> If we do provide features not existing on the host we need to be able to
> emulate them.
> Even it is possible, it could be done in a future enhancement, but AFAIK
> it is not the goal of the current development.

Yes. I think we currently want to provide a subset of what the SIE can
do. Any emulation would be icing on top.

>
> 2) Providing less:
> On the other hand we can mask to the guest some of the features provided
> by the host if we can intercept the scanning of the features.

Yes. I think that applies to bit 65 (interrupts) for now.

>
>
> What I understand from this is that we need all these features being
> separately toggled to be able to be compatible with an older system even
> if we have a 1:1 host:guest features match in a first version.

This seems to be the case for the mentioned bits if I followed the
discussion correctly.

>
> If several features where introduced together in a new architecture and
> are available on all systems issued from this architecture we can then
> gather them in a set. (But I will wonder why we have several features then)

You're expecting that all architecture is making sense ;)

>
>
> >>
> >>>> * STFLE.65 indicates whether AP interrupts are available. If this
> >>>> bit is not
> >>>>    set, then the AP bus will use polling instead of using interrupt
> >>>> handlers
> >>>>    to process AP events.
> >> So, does this indicate "adapter interrupts for AP" only? If so, we
> >> should keep this separate and only enable it when we have the gisa etc.
> >> ready.
> > Yes, this indicates AP interrupts only. The plan is to enable this when
> > GISA is available and we can implement interrupt processing.
>
> If we want to be able to work on system where STFLE.65 is not available,
> even if GISA is available I think it would be interesting to have a
> Matrix implementation with only polling.

Agreed.

So, it seems what we want is:

- A feature for STFLE 12. This seems to be a z13 or later facility, so
it probably makes sense to indicate it in the guest for z13 or newer
if the host supports it and for older machines if it is explicitly
specified (and the host supports it).
- A feature for STFLE 15. Similar to the one above, but starting with a
different generation (when was this introduced?)
- A feature for STFLE 65. Can be deferred to when GISA is implemented
(and exploited by vfio-ap). Same as above (I think this has existed
for a long time, probably for any of the machines we support?)

Thoughts?