All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] s390x: pv: Fence additional unavailable SCLP facilities for PV guests
@ 2020-12-11 10:51 Janosch Frank
  2020-12-11 11:28 ` Christian Borntraeger
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Janosch Frank @ 2020-12-11 10:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: borntraeger, qemu-s390x, cohuck, david

There's no VSIE support for a protected guest, so let's better not
advertise it and its support facilities.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
v2: added hpma2
---
 target/s390x/cpu_features.c | 39 ++++++++++++++++++++++++++++++++++++-
 target/s390x/cpu_models.c   | 25 ++++++++++++++++++++++--
 2 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
index 42fe0bf4ca..5528acd082 100644
--- a/target/s390x/cpu_features.c
+++ b/target/s390x/cpu_features.c
@@ -107,8 +107,45 @@ void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type,
         feat = find_next_bit(features, S390_FEAT_MAX, feat + 1);
     }
 
-    if (type == S390_FEAT_TYPE_SCLP_FAC134 && s390_is_pv()) {
+    if (!s390_is_pv()) {
+        return;
+    }
+
+    /*
+     * Some facilities are not available for CPUs in protected mode:
+     * - All SIE facilities because SIE is not available
+     * - DIAG318
+     *
+     * As VMs can move in and out of protected mode the CPU model
+     * doesn't protect us from that problem because it is only
+     * validated at the start of the VM.
+     */
+    switch (type) {
+    case S390_FEAT_TYPE_SCLP_CPU:
+        clear_be_bit(s390_feat_def(S390_FEAT_SIE_F2)->bit, data);
+        clear_be_bit(s390_feat_def(S390_FEAT_SIE_SKEY)->bit, data);
+        clear_be_bit(s390_feat_def(S390_FEAT_SIE_GPERE)->bit, data);
+        clear_be_bit(s390_feat_def(S390_FEAT_SIE_SIIF)->bit, data);
+        clear_be_bit(s390_feat_def(S390_FEAT_SIE_SIGPIF)->bit, data);
+        clear_be_bit(s390_feat_def(S390_FEAT_SIE_IB)->bit, data);
+        clear_be_bit(s390_feat_def(S390_FEAT_SIE_CEI)->bit, data);
+        break;
+    case S390_FEAT_TYPE_SCLP_CONF_CHAR:
+        clear_be_bit(s390_feat_def(S390_FEAT_SIE_GSLS)->bit, data);
+        clear_be_bit(s390_feat_def(S390_FEAT_HPMA2)->bit, data);
+        clear_be_bit(s390_feat_def(S390_FEAT_SIE_KSS)->bit, data);
+        break;
+    case S390_FEAT_TYPE_SCLP_CONF_CHAR_EXT:
+        clear_be_bit(s390_feat_def(S390_FEAT_SIE_64BSCAO)->bit, data);
+        clear_be_bit(s390_feat_def(S390_FEAT_SIE_CMMA)->bit, data);
+        clear_be_bit(s390_feat_def(S390_FEAT_SIE_PFMFI)->bit, data);
+        clear_be_bit(s390_feat_def(S390_FEAT_SIE_IBS)->bit, data);
+        break;
+    case S390_FEAT_TYPE_SCLP_FAC134:
         clear_be_bit(s390_feat_def(S390_FEAT_DIAG_318)->bit, data);
+        break;
+    default:
+        return;
     }
 }
 
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index b5abff8bef..93d8744d29 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -239,8 +239,29 @@ bool s390_has_feat(S390Feat feat)
         }
         return 0;
     }
-    if (feat == S390_FEAT_DIAG_318 && s390_is_pv()) {
-        return false;
+
+    if (s390_is_pv()) {
+        switch (feat) {
+        case S390_FEAT_DIAG_318:
+        case S390_FEAT_HPMA2:
+        case S390_FEAT_SIE_F2:
+        case S390_FEAT_SIE_SKEY:
+        case S390_FEAT_SIE_GPERE:
+        case S390_FEAT_SIE_SIIF:
+        case S390_FEAT_SIE_SIGPIF:
+        case S390_FEAT_SIE_IB:
+        case S390_FEAT_SIE_CEI:
+        case S390_FEAT_SIE_KSS:
+        case S390_FEAT_SIE_GSLS:
+        case S390_FEAT_SIE_64BSCAO:
+        case S390_FEAT_SIE_CMMA:
+        case S390_FEAT_SIE_PFMFI:
+        case S390_FEAT_SIE_IBS:
+            return false;
+            break;
+        default:
+            break;
+        }
     }
     return test_bit(feat, cpu->model->features);
 }
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] s390x: pv: Fence additional unavailable SCLP facilities for PV guests
  2020-12-11 10:51 [PATCH v2] s390x: pv: Fence additional unavailable SCLP facilities for PV guests Janosch Frank
@ 2020-12-11 11:28 ` Christian Borntraeger
  2020-12-11 11:50   ` Janosch Frank
  2020-12-14 15:28 ` David Hildenbrand
  2020-12-14 15:39 ` Cornelia Huck
  2 siblings, 1 reply; 5+ messages in thread
From: Christian Borntraeger @ 2020-12-11 11:28 UTC (permalink / raw)
  To: Janosch Frank, qemu-devel; +Cc: qemu-s390x, cohuck, david



On 11.12.20 11:51, Janosch Frank wrote:
> There's no VSIE support for a protected guest, so let's better not
> advertise it and its support facilities.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>

shall we add 
Fixes: 0f73c5b30b8b ("s390x: protvirt: SCLP interpretation")
or
Fixes: c3347ed0d2ee ("s390x: protvirt: Support unpack facility")

?
> ---
> v2: added hpma2
> ---
>  target/s390x/cpu_features.c | 39 ++++++++++++++++++++++++++++++++++++-
>  target/s390x/cpu_models.c   | 25 ++++++++++++++++++++++--
>  2 files changed, 61 insertions(+), 3 deletions(-)
> 
> diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
> index 42fe0bf4ca..5528acd082 100644
> --- a/target/s390x/cpu_features.c
> +++ b/target/s390x/cpu_features.c
> @@ -107,8 +107,45 @@ void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type,
>          feat = find_next_bit(features, S390_FEAT_MAX, feat + 1);
>      }
>  
> -    if (type == S390_FEAT_TYPE_SCLP_FAC134 && s390_is_pv()) {
> +    if (!s390_is_pv()) {
> +        return;
> +    }
> +
> +    /*
> +     * Some facilities are not available for CPUs in protected mode:
> +     * - All SIE facilities because SIE is not available
> +     * - DIAG318
> +     *
> +     * As VMs can move in and out of protected mode the CPU model
> +     * doesn't protect us from that problem because it is only
> +     * validated at the start of the VM.
> +     */
> +    switch (type) {
> +    case S390_FEAT_TYPE_SCLP_CPU:
> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_F2)->bit, data);
> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_SKEY)->bit, data);
> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_GPERE)->bit, data);
> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_SIIF)->bit, data);
> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_SIGPIF)->bit, data);
> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_IB)->bit, data);
> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_CEI)->bit, data);
> +        break;
> +    case S390_FEAT_TYPE_SCLP_CONF_CHAR:
> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_GSLS)->bit, data);
> +        clear_be_bit(s390_feat_def(S390_FEAT_HPMA2)->bit, data);
> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_KSS)->bit, data);
> +        break;
> +    case S390_FEAT_TYPE_SCLP_CONF_CHAR_EXT:
> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_64BSCAO)->bit, data);
> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_CMMA)->bit, data);
> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_PFMFI)->bit, data);
> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_IBS)->bit, data);
> +        break;
> +    case S390_FEAT_TYPE_SCLP_FAC134:
>          clear_be_bit(s390_feat_def(S390_FEAT_DIAG_318)->bit, data);
> +        break;
> +    default:
> +        return;
>      }
>  }
>  
> diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
> index b5abff8bef..93d8744d29 100644
> --- a/target/s390x/cpu_models.c
> +++ b/target/s390x/cpu_models.c
> @@ -239,8 +239,29 @@ bool s390_has_feat(S390Feat feat)
>          }
>          return 0;
>      }
> -    if (feat == S390_FEAT_DIAG_318 && s390_is_pv()) {
> -        return false;
> +
> +    if (s390_is_pv()) {
> +        switch (feat) {
> +        case S390_FEAT_DIAG_318:
> +        case S390_FEAT_HPMA2:
> +        case S390_FEAT_SIE_F2:
> +        case S390_FEAT_SIE_SKEY:
> +        case S390_FEAT_SIE_GPERE:
> +        case S390_FEAT_SIE_SIIF:
> +        case S390_FEAT_SIE_SIGPIF:
> +        case S390_FEAT_SIE_IB:
> +        case S390_FEAT_SIE_CEI:
> +        case S390_FEAT_SIE_KSS:
> +        case S390_FEAT_SIE_GSLS:
> +        case S390_FEAT_SIE_64BSCAO:
> +        case S390_FEAT_SIE_CMMA:
> +        case S390_FEAT_SIE_PFMFI:
> +        case S390_FEAT_SIE_IBS:
> +            return false;
> +            break;
> +        default:
> +            break;
> +        }
>      }
>      return test_bit(feat, cpu->model->features);
>  }
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] s390x: pv: Fence additional unavailable SCLP facilities for PV guests
  2020-12-11 11:28 ` Christian Borntraeger
@ 2020-12-11 11:50   ` Janosch Frank
  0 siblings, 0 replies; 5+ messages in thread
From: Janosch Frank @ 2020-12-11 11:50 UTC (permalink / raw)
  To: Christian Borntraeger, qemu-devel; +Cc: qemu-s390x, cohuck, david


[-- Attachment #1.1.1: Type: text/plain, Size: 4320 bytes --]

On 12/11/20 12:28 PM, Christian Borntraeger wrote:
> 
> 
> On 11.12.20 11:51, Janosch Frank wrote:
>> There's no VSIE support for a protected guest, so let's better not
>> advertise it and its support facilities.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> 
> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
> 
> shall we add 
> Fixes: 0f73c5b30b8b ("s390x: protvirt: SCLP interpretation")
> or
> Fixes: c3347ed0d2ee ("s390x: protvirt: Support unpack facility")

Hmm, rather this one I'd guess

> 
> ?
>> ---
>> v2: added hpma2
>> ---
>>  target/s390x/cpu_features.c | 39 ++++++++++++++++++++++++++++++++++++-
>>  target/s390x/cpu_models.c   | 25 ++++++++++++++++++++++--
>>  2 files changed, 61 insertions(+), 3 deletions(-)
>>
>> diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
>> index 42fe0bf4ca..5528acd082 100644
>> --- a/target/s390x/cpu_features.c
>> +++ b/target/s390x/cpu_features.c
>> @@ -107,8 +107,45 @@ void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type,
>>          feat = find_next_bit(features, S390_FEAT_MAX, feat + 1);
>>      }
>>  
>> -    if (type == S390_FEAT_TYPE_SCLP_FAC134 && s390_is_pv()) {
>> +    if (!s390_is_pv()) {
>> +        return;
>> +    }
>> +
>> +    /*
>> +     * Some facilities are not available for CPUs in protected mode:
>> +     * - All SIE facilities because SIE is not available
>> +     * - DIAG318
>> +     *
>> +     * As VMs can move in and out of protected mode the CPU model
>> +     * doesn't protect us from that problem because it is only
>> +     * validated at the start of the VM.
>> +     */
>> +    switch (type) {
>> +    case S390_FEAT_TYPE_SCLP_CPU:
>> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_F2)->bit, data);
>> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_SKEY)->bit, data);
>> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_GPERE)->bit, data);
>> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_SIIF)->bit, data);
>> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_SIGPIF)->bit, data);
>> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_IB)->bit, data);
>> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_CEI)->bit, data);
>> +        break;
>> +    case S390_FEAT_TYPE_SCLP_CONF_CHAR:
>> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_GSLS)->bit, data);
>> +        clear_be_bit(s390_feat_def(S390_FEAT_HPMA2)->bit, data);
>> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_KSS)->bit, data);
>> +        break;
>> +    case S390_FEAT_TYPE_SCLP_CONF_CHAR_EXT:
>> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_64BSCAO)->bit, data);
>> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_CMMA)->bit, data);
>> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_PFMFI)->bit, data);
>> +        clear_be_bit(s390_feat_def(S390_FEAT_SIE_IBS)->bit, data);
>> +        break;
>> +    case S390_FEAT_TYPE_SCLP_FAC134:
>>          clear_be_bit(s390_feat_def(S390_FEAT_DIAG_318)->bit, data);
>> +        break;
>> +    default:
>> +        return;
>>      }
>>  }
>>  
>> diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
>> index b5abff8bef..93d8744d29 100644
>> --- a/target/s390x/cpu_models.c
>> +++ b/target/s390x/cpu_models.c
>> @@ -239,8 +239,29 @@ bool s390_has_feat(S390Feat feat)
>>          }
>>          return 0;
>>      }
>> -    if (feat == S390_FEAT_DIAG_318 && s390_is_pv()) {
>> -        return false;
>> +
>> +    if (s390_is_pv()) {
>> +        switch (feat) {
>> +        case S390_FEAT_DIAG_318:
>> +        case S390_FEAT_HPMA2:
>> +        case S390_FEAT_SIE_F2:
>> +        case S390_FEAT_SIE_SKEY:
>> +        case S390_FEAT_SIE_GPERE:
>> +        case S390_FEAT_SIE_SIIF:
>> +        case S390_FEAT_SIE_SIGPIF:
>> +        case S390_FEAT_SIE_IB:
>> +        case S390_FEAT_SIE_CEI:
>> +        case S390_FEAT_SIE_KSS:
>> +        case S390_FEAT_SIE_GSLS:
>> +        case S390_FEAT_SIE_64BSCAO:
>> +        case S390_FEAT_SIE_CMMA:
>> +        case S390_FEAT_SIE_PFMFI:
>> +        case S390_FEAT_SIE_IBS:
>> +            return false;
>> +            break;
>> +        default:
>> +            break;
>> +        }
>>      }
>>      return test_bit(feat, cpu->model->features);
>>  }
>>
> 


[-- Attachment #1.1.2: OpenPGP_0xE354E6B8E238B9F8.asc --]
[-- Type: application/pgp-keys, Size: 7995 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] s390x: pv: Fence additional unavailable SCLP facilities for PV guests
  2020-12-11 10:51 [PATCH v2] s390x: pv: Fence additional unavailable SCLP facilities for PV guests Janosch Frank
  2020-12-11 11:28 ` Christian Borntraeger
@ 2020-12-14 15:28 ` David Hildenbrand
  2020-12-14 15:39 ` Cornelia Huck
  2 siblings, 0 replies; 5+ messages in thread
From: David Hildenbrand @ 2020-12-14 15:28 UTC (permalink / raw)
  To: Janosch Frank, qemu-devel; +Cc: borntraeger, qemu-s390x, cohuck

On 11.12.20 11:51, Janosch Frank wrote:
> There's no VSIE support for a protected guest, so let's better not
> advertise it and its support facilities.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] s390x: pv: Fence additional unavailable SCLP facilities for PV guests
  2020-12-11 10:51 [PATCH v2] s390x: pv: Fence additional unavailable SCLP facilities for PV guests Janosch Frank
  2020-12-11 11:28 ` Christian Borntraeger
  2020-12-14 15:28 ` David Hildenbrand
@ 2020-12-14 15:39 ` Cornelia Huck
  2 siblings, 0 replies; 5+ messages in thread
From: Cornelia Huck @ 2020-12-14 15:39 UTC (permalink / raw)
  To: Janosch Frank; +Cc: borntraeger, qemu-s390x, qemu-devel, david

On Fri, 11 Dec 2020 05:51:09 -0500
Janosch Frank <frankja@linux.ibm.com> wrote:

> There's no VSIE support for a protected guest, so let's better not
> advertise it and its support facilities.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
> v2: added hpma2
> ---
>  target/s390x/cpu_features.c | 39 ++++++++++++++++++++++++++++++++++++-
>  target/s390x/cpu_models.c   | 25 ++++++++++++++++++++++--
>  2 files changed, 61 insertions(+), 3 deletions(-)

Thanks, applied.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-14 15:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11 10:51 [PATCH v2] s390x: pv: Fence additional unavailable SCLP facilities for PV guests Janosch Frank
2020-12-11 11:28 ` Christian Borntraeger
2020-12-11 11:50   ` Janosch Frank
2020-12-14 15:28 ` David Hildenbrand
2020-12-14 15:39 ` Cornelia Huck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.