diff mbox series

[16/32] KVM: s390: expose the guest zPCI interpretation facility

Message ID 20211207205743.150299-17-mjrosato@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series KVM: s390: enable zPCI for interpretive execution | expand

Commit Message

Matthew Rosato Dec. 7, 2021, 8:57 p.m. UTC
This facility will be used to enable interpretive execution of zPCI
instructions.

Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Christian Borntraeger Dec. 17, 2021, 3:05 p.m. UTC | #1
Am 07.12.21 um 21:57 schrieb Matthew Rosato:
> This facility will be used to enable interpretive execution of zPCI
> instructions.
> 
> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
> ---
>   arch/s390/kvm/kvm-s390.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> index c8fe9b7c2395..09991d05c871 100644
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -2751,6 +2751,10 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
>   		set_kvm_facility(kvm->arch.model.fac_mask, 147);
>   		set_kvm_facility(kvm->arch.model.fac_list, 147);
>   	}
> +	if (sclp.has_zpci_interp && test_facility(69)) {
> +		set_kvm_facility(kvm->arch.model.fac_mask, 69);
> +		set_kvm_facility(kvm->arch.model.fac_list, 69);
> +	}


Do we need the setting of these stfle bits somewhere? I think QEMU sets them as well for the guest.
We only need this when the kernel probes for this (test_kvm_facility) But then the question is, shouldnt
we then simply check for sclp bits in those places?
See also patch 19. We need to build it in a way that allows VSIE support later on.

>   
>   	if (css_general_characteristics.aiv && test_facility(65))
>   		set_kvm_facility(kvm->arch.model.fac_mask, 65);
>
Matthew Rosato Dec. 17, 2021, 3:19 p.m. UTC | #2
On 12/17/21 10:05 AM, Christian Borntraeger wrote:
> 
> 
> Am 07.12.21 um 21:57 schrieb Matthew Rosato:
>> This facility will be used to enable interpretive execution of zPCI
>> instructions.
>>
>> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
>> ---
>>   arch/s390/kvm/kvm-s390.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>> index c8fe9b7c2395..09991d05c871 100644
>> --- a/arch/s390/kvm/kvm-s390.c
>> +++ b/arch/s390/kvm/kvm-s390.c
>> @@ -2751,6 +2751,10 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned 
>> long type)
>>           set_kvm_facility(kvm->arch.model.fac_mask, 147);
>>           set_kvm_facility(kvm->arch.model.fac_list, 147);
>>       }
>> +    if (sclp.has_zpci_interp && test_facility(69)) {
>> +        set_kvm_facility(kvm->arch.model.fac_mask, 69);
>> +        set_kvm_facility(kvm->arch.model.fac_list, 69);
>> +    }
> 
> 
> Do we need the setting of these stfle bits somewhere? I think QEMU sets 
> them as well for the guest. > We only need this when the kernel probes for this (test_kvm_facility)
> But then the question is, shouldnt
> we then simply check for sclp bits in those places?
> See also patch 19. We need to build it in a way that allows VSIE support 
> later on.
> 

Right, so this currently sets the facility bits but we don't set the 
associated guest SCLP bits.  I guess since we are not enabling for VSIE 
now it would make sense to not set either.

So then just to confirm we are on the same page:  I will drop these 
patches 16-18 and leave the kvm facilities unset until we wish to enable 
VSIE.  And then also make sure we are checking sclp bits (e.g. patch 
19).  OK?

>>       if (css_general_characteristics.aiv && test_facility(65))
>>           set_kvm_facility(kvm->arch.model.fac_mask, 65);
>>
Christian Borntraeger Dec. 17, 2021, 4:58 p.m. UTC | #3
Am 17.12.21 um 16:19 schrieb Matthew Rosato:
> On 12/17/21 10:05 AM, Christian Borntraeger wrote:
>>
>>
>> Am 07.12.21 um 21:57 schrieb Matthew Rosato:
>>> This facility will be used to enable interpretive execution of zPCI
>>> instructions.
>>>
>>> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
>>> ---
>>>   arch/s390/kvm/kvm-s390.c | 4 ++++
>>>   1 file changed, 4 insertions(+)
>>>
>>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>>> index c8fe9b7c2395..09991d05c871 100644
>>> --- a/arch/s390/kvm/kvm-s390.c
>>> +++ b/arch/s390/kvm/kvm-s390.c
>>> @@ -2751,6 +2751,10 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
>>>           set_kvm_facility(kvm->arch.model.fac_mask, 147);
>>>           set_kvm_facility(kvm->arch.model.fac_list, 147);
>>>       }
>>> +    if (sclp.has_zpci_interp && test_facility(69)) {
>>> +        set_kvm_facility(kvm->arch.model.fac_mask, 69);
>>> +        set_kvm_facility(kvm->arch.model.fac_list, 69);
>>> +    }
>>
>>
>> Do we need the setting of these stfle bits somewhere? I think QEMU sets them as well for the guest. > We only need this when the kernel probes for this (test_kvm_facility)
>> But then the question is, shouldnt
>> we then simply check for sclp bits in those places?
>> See also patch 19. We need to build it in a way that allows VSIE support later on.
>>
> 
> Right, so this currently sets the facility bits but we don't set the associated guest SCLP bits.  I guess since we are not enabling for VSIE now it would make sense to not set either.
> 
> So then just to confirm we are on the same page:  I will drop these patches 16-18 and leave the kvm facilities unset until we wish to enable VSIE.  And then also make sure we are checking sclp bits (e.g. patch 19).  OK?

Right drop these patches and change patch 19. When we later enable VSIE we need QEMU to set the sclp bits. Not sure, does this work as of today or do we need additional vsie changes (I would assume so)?
Matthew Rosato Dec. 17, 2021, 5:13 p.m. UTC | #4
On 12/17/21 11:58 AM, Christian Borntraeger wrote:
> 
> 
> Am 17.12.21 um 16:19 schrieb Matthew Rosato:
>> On 12/17/21 10:05 AM, Christian Borntraeger wrote:
>>>
>>>
>>> Am 07.12.21 um 21:57 schrieb Matthew Rosato:
>>>> This facility will be used to enable interpretive execution of zPCI
>>>> instructions.
>>>>
>>>> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
>>>> ---
>>>>   arch/s390/kvm/kvm-s390.c | 4 ++++
>>>>   1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>>>> index c8fe9b7c2395..09991d05c871 100644
>>>> --- a/arch/s390/kvm/kvm-s390.c
>>>> +++ b/arch/s390/kvm/kvm-s390.c
>>>> @@ -2751,6 +2751,10 @@ int kvm_arch_init_vm(struct kvm *kvm, 
>>>> unsigned long type)
>>>>           set_kvm_facility(kvm->arch.model.fac_mask, 147);
>>>>           set_kvm_facility(kvm->arch.model.fac_list, 147);
>>>>       }
>>>> +    if (sclp.has_zpci_interp && test_facility(69)) {
>>>> +        set_kvm_facility(kvm->arch.model.fac_mask, 69);
>>>> +        set_kvm_facility(kvm->arch.model.fac_list, 69);
>>>> +    }
>>>
>>>
>>> Do we need the setting of these stfle bits somewhere? I think QEMU 
>>> sets them as well for the guest. > We only need this when the kernel 
>>> probes for this (test_kvm_facility)
>>> But then the question is, shouldnt
>>> we then simply check for sclp bits in those places?
>>> See also patch 19. We need to build it in a way that allows VSIE 
>>> support later on.
>>>
>>
>> Right, so this currently sets the facility bits but we don't set the 
>> associated guest SCLP bits.  I guess since we are not enabling for 
>> VSIE now it would make sense to not set either.
>>
>> So then just to confirm we are on the same page:  I will drop these 
>> patches 16-18 and leave the kvm facilities unset until we wish to 
>> enable VSIE.  And then also make sure we are checking sclp bits (e.g. 
>> patch 19).  OK?
> 
> Right drop these patches and change patch 19. When we later enable VSIE 
> we need QEMU to set the sclp bits. Not sure, does this work as of today 
> or do we need additional vsie changes (I would assume so)?

No, we will need some additional work to be able to enable for VSIE 
(e.g. adapter interrupt source ID)
diff mbox series

Patch

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index c8fe9b7c2395..09991d05c871 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -2751,6 +2751,10 @@  int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 		set_kvm_facility(kvm->arch.model.fac_mask, 147);
 		set_kvm_facility(kvm->arch.model.fac_list, 147);
 	}
+	if (sclp.has_zpci_interp && test_facility(69)) {
+		set_kvm_facility(kvm->arch.model.fac_mask, 69);
+		set_kvm_facility(kvm->arch.model.fac_list, 69);
+	}
 
 	if (css_general_characteristics.aiv && test_facility(65))
 		set_kvm_facility(kvm->arch.model.fac_mask, 65);