Skip to contentSkip to conversation

KVM: s390: move some facilities from FACILITIES_KVM_CPUMODEL to FACILITIES_KVM

RFC PATCH Applied Christian Borntraeger 2 participants 4 messages Apr 1 – Apr 23

Subsystems (2)
lore
Share & tools
lore

Christian Borntraeger

author reviewer
#0 lore raw

RFC PATCH 1/1 KVM: s390: move some facilities from FACILITIES_KVM_CPUMODEL to FACILITIES_KVM

Some facilities have been put into FACILITIES_KVM_CPUMODEL to be on the safe side with older VMMs. Unfortunately this has some unwanted side effects for VMMs without a CPU model (like kvm unit test) and IBC/VAL is not used in that case.

Ideally the guest visible STFLE bits, the behaviour when running interpreted (HW supported) and the behaviour when running emulated (kvm or qemu) should be in sync.

For LPSWEY this was not the case. STFLE.193 was off, but interpretion did work, emulation did not. As emulation only happened in rare cases (e.g. deliver a machine check) the result was inconsistency for the guest.
Move beareh to FACILITIES_KVM to fix the inconsistency.

NNPA (facility 165) has no fencing and no KVM emulation. The instruction will work, despite STFLE.165 being off in the guest. Move also to FACILITIES_KVM.

Facility 170 (ineffective-nonconstrained-transaction facility) is an anti facility and should be passed along as well as KVM cannot simulate the missing function.

KVM also does not implement trapping for guest RDP and there is no additional hypervisor control. Move 194 to FACILITIES_KVM as well.

Facilities 196 and 197 (PAI) also do not have a hypervisor control and need to be passed on as well.

The PFCR is also not intercepted by KVM and needs to be moved (stfle.201).

The other facilities are fine (stfle, emulation, interpretion in sync):
Both AP related features (12 and 15) require a userspace added AP via vfio. 156 etoken facility is fenced off for interpretion via ECD_ETOKENF so everything is in sync

Cc David Hildenbrand <[email protected]>
Cc Hendrik Brueckner <[email protected]>
Cc Janosch Frank <[email protected]>
---
 arch/s390/tools/gen_facilities.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
arch/s390/tools/gen_facilities.c +7 -7
index 2d28a569f793..32dd5a57240d 100644
@@ -96,6 +96,13 @@ static struct facility_def facility_defs[] = {
 			150, /* enhanced sort */
 			151, /* deflate conversion */
 			155, /* msa extension 9 */
+			165, /* nnpa facility */
+			170, /* ineffective-nonconstrained-transaction facility */
+			193, /* bear enhancement facility */
+			194, /* rdp enhancement facility */
+			196, /* processor activity instrumentation facility */
+			197, /* processor activity instrumentation extension 1 */
+			201, /* concurrent-functions facility */
 			-1  /* END */
 		}
 	},
@@ -112,13 +119,6 @@ static struct facility_def facility_defs[] = {
 			12, /* AP Query Configuration Information */
 			15, /* AP Facilities Test */
 			156, /* etoken facility */
-			165, /* nnpa facility */
-			170, /* ineffective-nonconstrained-transaction facility */
-			193, /* bear enhancement facility */
-			194, /* rdp enhancement facility */
-			196, /* processor activity instrumentation facility */
-			197, /* processor activity instrumentation extension 1 */
-			201, /* concurrent-functions facility */
 			-1  /* END */
 		}
 	},
Signature · 1 line
2.53.0
author reviewer
#1 lore raw

Am 01.04.26 um 15:42 schrieb Christian Borntraeger:

Quoted 36 lines

Some facilities have been put into FACILITIES_KVM_CPUMODEL to be on the safe side with older VMMs. Unfortunately this has some unwanted side effects for VMMs without a CPU model (like kvm unit test) and IBC/VAL is not used in that case.

Ideally the guest visible STFLE bits, the behaviour when running interpreted (HW supported) and the behaviour when running emulated (kvm or qemu) should be in sync.

For LPSWEY this was not the case. STFLE.193 was off, but interpretion did work, emulation did not. As emulation only happened in rare cases (e.g. deliver a machine check) the result was inconsistency for the guest.
Move beareh to FACILITIES_KVM to fix the inconsistency.

NNPA (facility 165) has no fencing and no KVM emulation. The instruction will work, despite STFLE.165 being off in the guest. Move also to FACILITIES_KVM.

Facility 170 (ineffective-nonconstrained-transaction facility) is an anti facility and should be passed along as well as KVM cannot simulate the missing function.

KVM also does not implement trapping for guest RDP and there is no additional hypervisor control. Move 194 to FACILITIES_KVM as well.

Facilities 196 and 197 (PAI) also do not have a hypervisor control and need to be passed on as well.

The PFCR is also not intercepted by KVM and needs to be moved (stfle.201).

The other facilities are fine (stfle, emulation, interpretion in sync):
Both AP related features (12 and 15) require a userspace added AP via vfio. 156 etoken facility is fenced off for interpretion via ECD_ETOKENF so everything is in sync

Quoted 4 lines
Cc David Hildenbrand <[email protected]>
Cc Hendrik Brueckner <[email protected]>
Cc Janosch Frank <[email protected]>

ping. Any concerns?

Quoted 36 lines
---
  arch/s390/tools/gen_facilities.c | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)
arch/s390/tools/gen_facilities.c +7 -7
index 2d28a569f793..32dd5a57240d 100644
@@ -96,6 +96,13 @@ static struct facility_def facility_defs[] = {
  			150, /* enhanced sort */
  			151, /* deflate conversion */
  			155, /* msa extension 9 */
+			165, /* nnpa facility */
+			170, /* ineffective-nonconstrained-transaction facility */
+			193, /* bear enhancement facility */
+			194, /* rdp enhancement facility */
+			196, /* processor activity instrumentation facility */
+			197, /* processor activity instrumentation extension 1 */
+			201, /* concurrent-functions facility */
  			-1  /* END */
  		}
  	},
@@ -112,13 +119,6 @@ static struct facility_def facility_defs[] = {
  			12, /* AP Query Configuration Information */
  			15, /* AP Facilities Test */
  			156, /* etoken facility */
-			165, /* nnpa facility */
-			170, /* ineffective-nonconstrained-transaction facility */
-			193, /* bear enhancement facility */
-			194, /* rdp enhancement facility */
-			196, /* processor activity instrumentation facility */
-			197, /* processor activity instrumentation extension 1 */
-			201, /* concurrent-functions facility */
  			-1  /* END */
  		}
  	},
Reviewed-by
#2 lore raw
Quoted 37 lines · Christian Borntraeger

Am 01.04.26 um 15:42 schrieb Christian Borntraeger:

Quoted 36 lines

Some facilities have been put into FACILITIES_KVM_CPUMODEL to be on the safe side with older VMMs. Unfortunately this has some unwanted side effects for VMMs without a CPU model (like kvm unit test) and IBC/VAL is not used in that case.

Ideally the guest visible STFLE bits, the behaviour when running interpreted (HW supported) and the behaviour when running emulated (kvm or qemu) should be in sync.

For LPSWEY this was not the case. STFLE.193 was off, but interpretion did work, emulation did not. As emulation only happened in rare cases (e.g. deliver a machine check) the result was inconsistency for the guest.
Move beareh to FACILITIES_KVM to fix the inconsistency.

NNPA (facility 165) has no fencing and no KVM emulation. The instruction will work, despite STFLE.165 being off in the guest. Move also to FACILITIES_KVM.

Facility 170 (ineffective-nonconstrained-transaction facility) is an anti facility and should be passed along as well as KVM cannot simulate the missing function.

KVM also does not implement trapping for guest RDP and there is no additional hypervisor control. Move 194 to FACILITIES_KVM as well.

Facilities 196 and 197 (PAI) also do not have a hypervisor control and need to be passed on as well.

The PFCR is also not intercepted by KVM and needs to be moved (stfle.201).

The other facilities are fine (stfle, emulation, interpretion in sync):
Both AP related features (12 and 15) require a userspace added AP via vfio. 156 etoken facility is fenced off for interpretion via ECD_ETOKENF so everything is in sync

Quoted 7 lines
Quoted 4 lines
Cc David Hildenbrand <[email protected]>
Cc Hendrik Brueckner <[email protected]>
Cc Janosch Frank <[email protected]>

ping. Any concerns?

Ah, this fell to the floor because of other things. Sorry

Makes sense to me:

author reviewer Applied
#3 lore raw
In reply to Christian Borntraeger

Am 01.04.26 um 15:42 schrieb Christian Borntraeger:

Quoted 36 lines

Some facilities have been put into FACILITIES_KVM_CPUMODEL to be on the safe side with older VMMs. Unfortunately this has some unwanted side effects for VMMs without a CPU model (like kvm unit test) and IBC/VAL is not used in that case.

Ideally the guest visible STFLE bits, the behaviour when running interpreted (HW supported) and the behaviour when running emulated (kvm or qemu) should be in sync.

For LPSWEY this was not the case. STFLE.193 was off, but interpretion did work, emulation did not. As emulation only happened in rare cases (e.g. deliver a machine check) the result was inconsistency for the guest.
Move beareh to FACILITIES_KVM to fix the inconsistency.

NNPA (facility 165) has no fencing and no KVM emulation. The instruction will work, despite STFLE.165 being off in the guest. Move also to FACILITIES_KVM.

Facility 170 (ineffective-nonconstrained-transaction facility) is an anti facility and should be passed along as well as KVM cannot simulate the missing function.

KVM also does not implement trapping for guest RDP and there is no additional hypervisor control. Move 194 to FACILITIES_KVM as well.

Facilities 196 and 197 (PAI) also do not have a hypervisor control and need to be passed on as well.

The PFCR is also not intercepted by KVM and needs to be moved (stfle.201).

The other facilities are fine (stfle, emulation, interpretion in sync):
Both AP related features (12 and 15) require a userspace added AP via vfio. 156 etoken facility is fenced off for interpretion via ECD_ETOKENF so everything is in sync

Quoted 7 lines
Cc David Hildenbrand <[email protected]>
Cc Hendrik Brueckner <[email protected]>
Cc Janosch Frank <[email protected]>
---
  arch/s390/tools/gen_facilities.c | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)

applied.