s390x/kvm: Add ASTFLE facility 2 for nested virtualization
v3 cover s390x/kvm: Add ASTFLE facility 2 for nested virtualization
Update the kernel headers to get access to KVM_S390_VM_CPU_FEAT_ASTFLEIE2 and allow passing the feature through to guest on IBM z16 onwards.
---
Changes in v3:
- include linux v7.2-rc1 headers
Changes in v2:
- Isolate the linux-header update into its own commit (thanks Thomas)
- Correct naming of the feature (thanks Hendrik)
- Add S390_FEAT_SIE_ASTFLEIE2 to full_GEN16_GA1 only as it depends on SIEF2 (thanks Christian)
---
Christoph Schlameuss (2):
linux-headers: Update to Linux v7.2-rc1 with KVM_S390_VM_CPU_FEAT_ASTFLEIE2 s390x/kvm: Add ASTFLE facility 2 for nested virtualization
hw/s390x/sclp.c | 2 + include/hw/s390x/sclp.h | 4 +- include/standard-headers/drm/drm_fourcc.h | 54 ++++++++++------- include/standard-headers/linux/ethtool.h | 3 + include/standard-headers/linux/pci_regs.h | 2 + include/standard-headers/linux/virtio_can.h | 78 +++++++++++++++++++++++++ include/standard-headers/linux/virtio_console.h | 2 +- include/standard-headers/linux/virtio_gpu.h | 9 +++ linux-headers/asm-s390/kvm.h | 1 + linux-headers/asm-x86/kvm.h | 2 + linux-headers/linux/iommufd.h | 12 ++-- linux-headers/linux/kvm.h | 1 + target/s390x/cpu_features.c | 3 + target/s390x/cpu_features.h | 1 + target/s390x/cpu_features_def.h.inc | 3 + target/s390x/cpu_models.c | 2 + target/s390x/gen-features.c | 1 + target/s390x/kvm/kvm.c | 1 + 18 files changed, 153 insertions(+), 28 deletions(-)
---
base-commit: 30e8a06b64aa58a3990ba39cb5d09531e7d265e0
change-id: 20260209-astfleie2-85eec9fd9213
Best regards,
Signature · 1 line
Christoph Schlameuss <[email protected]>
PATCH v3 1/2 linux-headers: Update to Linux v7.2-rc1 with KVM_S390_VM_CPU_FEAT_ASTFLEIE2
Update headers to retrieve new architecture feature definitions. KVM_S390_VM_CPU_FEAT_ASTFLEIE2 is specifically needed here.
--- include/standard-headers/drm/drm_fourcc.h | 54 ++++++++++------- include/standard-headers/linux/ethtool.h | 3 + include/standard-headers/linux/pci_regs.h | 2 + include/standard-headers/linux/virtio_can.h | 78 +++++++++++++++++++++++++ include/standard-headers/linux/virtio_console.h | 2 +- include/standard-headers/linux/virtio_gpu.h | 9 +++ linux-headers/asm-s390/kvm.h | 1 + linux-headers/asm-x86/kvm.h | 2 + linux-headers/linux/iommufd.h | 12 ++-- linux-headers/linux/kvm.h | 1 + 10 files changed, 137 insertions(+), 27 deletions(-)
include/standard-headers/drm/drm_fourcc.h +32 -22
@@ -1,24 +1,6 @@ +/* SPDX-License-Identifier: MIT */ /* * Copyright 2011 Intel Corporation -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice (including the next -* paragraph) shall be included in all copies or substantial portions of the -* Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. */ #ifndef DRM_FOURCC_H
@@ -241,9 +223,9 @@ extern "C" {* [31:0] sign:exponent:mantissa 1:8:23 */ #define DRM_FORMAT_R32F fourcc_code('R', ' ', ' ', 'F')/* [31:0] R 32 little endian */ -#define DRM_FORMAT_GR3232F fourcc_code('G', 'R', ' ', 'F')/* [63:0] R:G 32:32 little endian */ -#define DRM_FORMAT_BGR323232F fourcc_code('B', 'G', 'R', 'F')/* [95:0] R:G:B 32:32:32 little endian */ -#define DRM_FORMAT_ABGR32323232F fourcc_code('A', 'B', '8', 'F')/* [127:0] R:G:B:A 32:32:32:32 little endian */ +#define DRM_FORMAT_GR3232F fourcc_code('G', 'R', ' ', 'F')/* [63:0] G:R 32:32 little endian */ +#define DRM_FORMAT_BGR323232F fourcc_code('B', 'G', 'R', 'F')/* [95:0] B:G:R 32:32:32 little endian */ +#define DRM_FORMAT_ABGR32323232F fourcc_code('A', 'B', '8', 'F')/* [127:0] A:B:G:R 32:32:32:32 little endian */ /* * RGBA format with 10-bit components packed in 64-bit per pixel, with 6 bits
@@ -263,6 +245,7 @@ extern "C" {#define DRM_FORMAT_XVUY8888 fourcc_code('X', 'V', 'U', 'Y')/* [31:0] X:Cr:Cb:Y 8:8:8:8 little endian */ #define DRM_FORMAT_VUY888 fourcc_code('V', 'U', '2', '4')/* [23:0] Cr:Cb:Y 8:8:8 little endian */ #define DRM_FORMAT_VUY101010 fourcc_code('V', 'U', '3', '0')/* Y followed by U then V, 10:10:10. Non-linear modifier only */ +#define DRM_FORMAT_XVUY2101010 fourcc_code('X', 'Y', '3', '0')/* [31:0] x:Cr:Cb:Y 2:10:10:10 little endian */ /* * packed Y2xx indicate for each component, xx valid data occupy msb
@@ -378,6 +361,14 @@ extern "C" {*/ #define DRM_FORMAT_P030 fourcc_code('P', '0', '3', '0')/* 2x2 subsampled Cr:Cb plane 10 bits per channel packed */ +/* +* 2 plane YCbCr422. +* 3 10 bit components and 2 padding bits packed into 4 bytes. +* index 0 = Y plane, [31:0] x:Y2:Y1:Y0 2:10:10:10 little endian +* index 1 = Cr:Cb plane, [63:0] x:Cr2:Cb2:Cr1:x:Cb1:Cr0:Cb0 [2:10:10:10:2:10:10:10] little endian +*/ +#define DRM_FORMAT_P230 fourcc_code('P', '2', '3', '0')/* 2x1 subsampled Cr:Cb plane 10 bits per channel packed */ +/* 3 plane non-subsampled (444) YCbCr * 16 bits per component, but only 10 bits are used and 6 bits are padded * index 0: Y plane, [15:0] Y:x [10:6] little endian
@@ -394,6 +385,15 @@ extern "C" {*/ #define DRM_FORMAT_Q401 fourcc_code('Q', '4', '0', '1') +/* +* 3 plane non-subsampled (444) YCbCr LSB aligned +* 10 bpc, 30 bits per sample image data in a single contiguous buffer. +* index 0: Y plane, [31:0] x:Y2:Y1:Y0 [2:10:10:10] little endian +* index 1: Cb plane, [31:0] x:Cb2:Cb1:Cb0 [2:10:10:10] little endian +* index 2: Cr plane, [31:0] x:Cr2:Cr1:Cr0 [2:10:10:10] little endian +*/ +#define DRM_FORMAT_T430 fourcc_code('T', '4', '3', '0') +/* * 3 plane YCbCr LSB aligned * In order to use these formats in a similar fashion to MSB aligned ones
@@ -450,6 +450,16 @@ extern "C" {#define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4')/* non-subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4')/* non-subsampled Cr (1) and Cb (2) planes */ +/* +* Y-only (greyscale) formats +* +* The Y-only formats are handled similarly to the YCbCr formats in the display +* pipeline, with the Cb and Cr implicitly neutral (0.0 in nominal values). This +* also means that COLOR_RANGE property applies to the Y-only formats. +*/ + +#define DRM_FORMAT_Y8 fourcc_code('G', 'R', 'E', 'Y')/* 8-bit Y-only */ +#define DRM_FORMAT_XYYY2101010 fourcc_code('Y', 'P', 'A', '4')/* [31:0] x:Y2:Y1:Y0 2:10:10:10 little endian */ /* * Format Modifiers:
include/standard-headers/linux/ethtool.h +3 -0
@@ -293,6 +293,9 @@ enum phy_tunable_id {ETHTOOL_PHY_DOWNSHIFT ,ETHTOOL_PHY_FAST_LINK_DOWN ,ETHTOOL_PHY_EDPD , +ETHTOOL_PHY_SHORT_CABLE_PRESET , +ETHTOOL_PHY_LPF_BW , +ETHTOOL_PHY_DSP_EQ_INIT_VALUE ,/* * Add your fresh new phy tunable attribute above and remember to update * phy_tunable_strings[] in net/ethtool/common.c
include/standard-headers/linux/pci_regs.h +2 -0
@@ -1349,6 +1349,7 @@/* CXL r4.0, 8.1.3: PCIe DVSEC for CXL Device */ #define PCI_DVSEC_CXL_DEVICE 0#define PCI_DVSEC_CXL_CAP 0xA +#define PCI_DVSEC_CXL_CACHE_CAPABLE _BITUL(0)#define PCI_DVSEC_CXL_MEM_CAPABLE _BITUL(2)#define PCI_DVSEC_CXL_HDM_COUNT __GENMASK(5, 4)#define PCI_DVSEC_CXL_CTRL 0xC
@@ -1357,6 +1358,7 @@#define PCI_DVSEC_CXL_RANGE_SIZE_LOW (i) (0x1C + (i * 0x10))#define PCI_DVSEC_CXL_MEM_INFO_VALID _BITUL(0)#define PCI_DVSEC_CXL_MEM_ACTIVE _BITUL(1) +#define PCI_DVSEC_CXL_MEM_ACTIVE_TIMEOUT __GENMASK(15, 13)#define PCI_DVSEC_CXL_MEM_SIZE_LOW __GENMASK(31, 28)#define PCI_DVSEC_CXL_RANGE_BASE_HIGH (i) (0x20 + (i * 0x10))#define PCI_DVSEC_CXL_RANGE_BASE_LOW (i) (0x24 + (i * 0x10))
include/standard-headers/linux/virtio_can.h new file +78 -0
78 lines not on this page · raw message
include/standard-headers/linux/virtio_console.h +1 -1
@@ -44,7 +44,7 @@#define VIRTIO_CONSOLE_BAD_ID (~(uint32_t)0)struct virtio_console_config { -/* colums of the screens */ +/* columns of the screens */ __virtio16 cols;/* rows of the screens */ __virtio16 rows;
include/standard-headers/linux/virtio_gpu.h +9 -0
@@ -64,6 +64,14 @@* context_init and multiple timelines */ #define VIRTIO_GPU_F_CONTEXT_INIT 4 +/* +* The device provides a valid blob_alignment +* field in its configuration and both +* VIRTIO_GPU_CMD_RESOURCE_CREATE_BLOB and +* VIRTIO_GPU_CMD_RESOURCE_MAP_BLOB requests +* must be aligned to that value. +*/ +#define VIRTIO_GPU_F_BLOB_ALIGNMENT 5enum virtio_gpu_ctrl_type {VIRTIO_GPU_UNDEFINED =0 ,
@@ -365,6 +373,7 @@ struct virtio_gpu_config {uint32_t events_clear;uint32_t num_scanouts;uint32_t num_capsets; +uint32_t blob_alignment; };/* simple formats for fbcon/X use */
linux-headers/asm-s390/kvm.h +1 -0
@@ -444,6 +444,7 @@ struct kvm_s390_vm_cpu_machine {#define KVM_S390_VM_CPU_FEAT_PFMFI 11#define KVM_S390_VM_CPU_FEAT_SIGPIF 12#define KVM_S390_VM_CPU_FEAT_KSS 13 +#define KVM_S390_VM_CPU_FEAT_ASTFLEIE2 14struct kvm_s390_vm_cpu_feat {__u64 feat[16 ]; };
linux-headers/asm-x86/kvm.h +2 -0
@@ -475,6 +475,7 @@ struct kvm_sync_regs {#define KVM_X86_QUIRK_STUFF_FEATURE_MSRS (1 << 8)#define KVM_X86_QUIRK_IGNORE_GUEST_PAT (1 << 9)#define KVM_X86_QUIRK_VMCS12_ALLOW_FREEZE_IN_SMM (1 << 10) +#define KVM_X86_QUIRK_NESTED_SVM_SHARED_PAT (1 << 11)#define KVM_STATE_NESTED_FORMAT_VMX 0#define KVM_STATE_NESTED_FORMAT_SVM 1
@@ -530,6 +531,7 @@ struct kvm_svm_nested_state_data {struct kvm_svm_nested_state_hdr {__u64 vmcb_pa; +__u64 gpat; };/* for KVM_CAP_NESTED_STATE */
linux-headers/linux/iommufd.h +8 -4
@@ -224,13 +224,17 @@ struct iommu_ioas_map {* @size: sizeof(struct iommu_ioas_map_file) * @flags: same as for iommu_ioas_map * @ioas_id: same as for iommu_ioas_map -* @fd: the memfd to map -* @start: byte offset from start of file to map from +* @fd: the memfd or supported dma-buf file to map +* @start: byte offset from start of the file to map from * @length: same as for iommu_ioas_map * @iova: same as for iommu_ioas_map * -* Set an IOVA mapping from a memfd file. All other arguments and semantics -* match those of IOMMU_IOAS_MAP. +* Set an IOVA mapping from a memfd file. On kernels with dma-buf support, +* supported dma-buf files may also be accepted. This is not a generic +* dma-buf import path; currently supported dma-bufs include single-range +* VFIO PCI dma-bufs exported through VFIO_DEVICE_FEATURE_DMA_BUF, and +* other dma-bufs may be rejected. All other arguments and semantics match +* those of IOMMU_IOAS_MAP. */ struct iommu_ioas_map_file {__u32 size;
linux-headers/linux/kvm.h +1 -0
@@ -985,6 +985,7 @@ struct kvm_enable_cap {#define KVM_CAP_S390_USER_OPEREXEC 246#define KVM_CAP_S390_KEYOP 247#define KVM_CAP_S390_VSIE_ESAMODE 248 +#define KVM_CAP_S390_HPAGE_2G 249struct kvm_irq_routing_irqchip {__u32 irqchip;
Signature · 1 line
2.54.0
PATCH v3 2/2 s390x/kvm: Add ASTFLE facility 2 for nested virtualization
In reply to Christoph SchlameussAllow propagation of the ASTFLEIE2 feature bit.
If the host does have the ASTFLE Interpretive Execution Facility 2 the guest can enable the ASTFLE format 2 for its guests.
--- hw/s390x/sclp.c | 2 ++ include/hw/s390x/sclp.h | 4 +++- target/s390x/cpu_features.c | 3 +++ target/s390x/cpu_features.h | 1 + target/s390x/cpu_features_def.h.inc | 3 +++ target/s390x/cpu_models.c | 2 ++ target/s390x/gen-features.c | 1 + target/s390x/kvm/kvm.c | 1 + 8 files changed, 16 insertions(+), 1 deletion(-)
hw/s390x/sclp.c +2 -0
@@ -146,6 +146,8 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)if (s390_has_feat (S390_FEAT_EXTENDED_LENGTH_SCCB )) {s390_get_feat_block (S390_FEAT_TYPE_SCLP_FAC134 , &read_info->fac134); +s390_get_feat_block (S390_FEAT_TYPE_SCLP_FAC139 , + &read_info->fac139); } read_info->facilities = cpu_to_be64(SCLP_HAS_CPU_INFO |
include/hw/s390x/sclp.h +3 -1
@@ -136,7 +136,9 @@ typedef struct ReadInfo {uint32_t hmfai;uint8_t _reserved7[134 -128 ];/* 128-133 */ uint8_t fac134; -uint8_t _reserved8[144 -135 ];/* 135-143 */ +uint8_t _reserved8[139 -135 ];/* 135-138 */ +uint8_t fac139; +uint8_t _reserved9[144 -140 ];/* 140-143 */ struct CPUEntry entries[];/* * When the Extended-Length SCCB (ELS) feature is enabled the
target/s390x/cpu_features.c +3 -0
@@ -148,6 +148,9 @@ void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type,case S390_FEAT_TYPE_SCLP_FAC134 :clear_be_bit (s390_feat_def (S390_FEAT_DIAG_318 )->bit, data);break ; +case S390_FEAT_TYPE_SCLP_FAC139 : +clear_be_bit (s390_feat_def (S390_FEAT_SIE_ASTFLEIE2 )->bit, data); +break ;default :return ; }
target/s390x/cpu_features.h +1 -0
@@ -24,6 +24,7 @@ typedef enum {S390_FEAT_TYPE_SCLP_CONF_CHAR ,S390_FEAT_TYPE_SCLP_CONF_CHAR_EXT ,S390_FEAT_TYPE_SCLP_FAC134 , +S390_FEAT_TYPE_SCLP_FAC139 ,S390_FEAT_TYPE_SCLP_CPU ,S390_FEAT_TYPE_MISC , S390_FEAT_TYPE_PLO,
target/s390x/cpu_features_def.h.inc +3 -0
@@ -139,6 +139,9 @@ DEF_FEAT(SIE_IBS, "ibs", SCLP_CONF_CHAR_EXT, 10, "SIE: Interlock-and-broadcast-s /* Features exposed via SCLP SCCB Facilities byte 134 (bit numbers relative to byte-134) */ DEF_FEAT(DIAG_318, "diag318", SCLP_FAC134, 0, "Control program name and version codes") +/* Features exposed via SCLP SCCB Facilities byte 139 (bit numbers relative to byte-139) */ +DEF_FEAT(SIE_ASTFLEIE2, "astfleie2", SCLP_FAC139, 1, "SIE: ASTFLE interpretation execution facility 2") + /* Features exposed via SCLP CPU info. */ DEF_FEAT(SIE_F2, "sief2", SCLP_CPU, 4, "SIE: interception format 2 (Virtual SIE)") DEF_FEAT(SIE_SKEY, "skey", SCLP_CPU, 5, "SIE: Storage-key facility")
target/s390x/cpu_models.c +2 -0
@@ -263,6 +263,7 @@ bool s390_has_feat(S390Feat feat)case S390_FEAT_SIE_PFMFI :case S390_FEAT_SIE_IBS :case S390_FEAT_CONFIGURATION_TOPOLOGY : +case S390_FEAT_SIE_ASTFLEIE2 :return false;break ;default :
@@ -553,6 +554,7 @@ static void check_consistency(const S390CPUModel *model) { S390_FEAT_PLO_QSTG, S390_FEAT_PLO_EXT }, { S390_FEAT_PLO_QSTX, S390_FEAT_PLO_EXT }, { S390_FEAT_PLO_QSTO, S390_FEAT_PLO_EXT }, + { S390_FEAT_SIE_ASTFLEIE2, S390_FEAT_STFLE }, };int i;
target/s390x/gen-features.c +1 -0
@@ -720,6 +720,7 @@ static uint16_t full_GEN16_GA1[] = {S390_FEAT_PAIE ,S390_FEAT_UV_FEAT_AP ,S390_FEAT_UV_FEAT_AP_INTR , + S390_FEAT_SIE_ASTFLEIE2, }; static uint16_t full_GEN17_GA1[] = {
target/s390x/kvm/kvm.c +1 -0
@@ -2288,6 +2288,7 @@ static int kvm_to_feat[][2] = { { KVM_S390_VM_CPU_FEAT_PFMFI, S390_FEAT_SIE_PFMFI}, { KVM_S390_VM_CPU_FEAT_SIGPIF, S390_FEAT_SIE_SIGPIF}, { KVM_S390_VM_CPU_FEAT_KSS, S390_FEAT_SIE_KSS}, + { KVM_S390_VM_CPU_FEAT_ASTFLEIE2, S390_FEAT_SIE_ASTFLEIE2 }, };static int query_cpu_feat (S390FeatBitmap features)
Signature · 1 line
2.54.0
Cornelia Huck
AppliedQuoted 31 lines · Christoph Schlameuss
Update the kernel headers to get access to
KVM_S390_VM_CPU_FEAT_ASTFLEIE2and allow passing the feature through to guest on IBM z16 onwards.Signed-off-by Christoph Schlameuss <[email protected]>---
Changes in v3:
- include linux v7.2-rc1 headersChanges in v2:
- Isolate the linux-header update into its own commit (thanks Thomas)
- Correct naming of the feature (thanks Hendrik)
- AddS390_FEAT_SIE_ASTFLEIE2tofull_GEN16_GA1only as it depends on SIEF2 (thanks Christian)---
Christoph Schlameuss (2):
linux-headers: Update to Linux v7.2-rc1 withKVM_S390_VM_CPU_FEAT_ASTFLEIE2s390x/kvm: Add ASTFLE facility 2 for nested virtualizationhw/s390x/sclp.c | 2 + include/hw/s390x/sclp.h | 4 +- include/standard-headers/drm/drm_fourcc.h | 54 ++++++++++------- include/standard-headers/linux/ethtool.h | 3 + include/standard-headers/linux/pci_regs.h | 2 + include/standard-headers/linux/virtio_can.h | 78 +++++++++++++++++++++++++ include/standard-headers/linux/virtio_console.h | 2 +- include/standard-headers/linux/virtio_gpu.h | 9 +++ linux-headers/asm-s390/kvm.h | 1 + linux-headers/asm-x86/kvm.h | 2 + linux-headers/linux/iommufd.h | 12 ++--
Quoted 8 lines
linux-headers/linux/kvm.h | 1 + target/s390x/cpu_features.c | 3 + target/s390x/cpu_features.h | 1 + target/s390x/cpu_features_def.h.inc | 3 + target/s390x/cpu_models.c | 2 + target/s390x/gen-features.c | 1 + target/s390x/kvm/kvm.c | 1 + 18 files changed, 153 insertions(+), 28 deletions(-)
Thanks, applied.