s390x: fixes, enhancements for 2.10 softfreeze
Peter,
this should be the last big chunk for s390/kvm related changes for 2.10.
Patch 2 does a header sync against a kernel version from Linus tree, which already contains the KVM changes for 4.13. Please note that one fix in linux/kvm.h is pending for 4.13. I will submit a followup patch as soon as this hits the kernel.
The following changes since commit 49bcce4b9c11759678fd223aefb48691c4959d4f:
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2017-07-12' into staging (2017-07-13 16:56:06 +0100)
are available in the git repository at:
git://github.com/borntraeger/qemu.git tags/s390x-20170714
for you to fetch changes up to 86158a2a2b81f075c84d0b95c6d72b98dbf1dc61:
s390x/gdb: add gs registers (2017-07-14 12:29:49 +0200)
----------------------------------------------------------------
s390x/kvm/migration/cpumodel: fixes, enhancements and cleanups
- add a network boot rom for s390 (Thomas Huth)
- migration of storage attributes like the CMMA used/unused state
- PCI related enhancements - full support for aen, ais and zpci
- migration support for css with vmstates (Halil Pasic)
- cpu model enhancements for cpu features
- guarded storage support
----------------------------------------------------------------
Christian Borntraeger (5):
linux-headers: update to 4.13-rc0
pc-bios/s390: add s390-netboot.img
pc-bios/s390: rebuild s390-ccw.img
s390x/arch_dump: also dump guarded storage control block
s390x/gdb: add gs registersClaudio Imbrenda (2):
s390x/migration: Storage attributes device
s390x/migration: Monitor commands for storage attributesFan Zhang (1):
s390x/kvm: enable guarded storage
Farhan Ali (1):
s390x/kvm: Enable KSS facility for nested virtualization
Fei Li (3):
s390x: add flags field for registering I/O adapter
s390x/flic: introduce modify_ais_mode callback
s390x/sic: realize SIC handlingHalil Pasic (6):
s390x: add helper get_machine_class
s390x: add css_migration_enabled to machine class
s390x/css: add missing css state conditionally
s390x/css: add ORB to SubchDev
s390x/css: activate ChannelSubSys migration
s390x/css: use SubchDev.orbJanosch Frank (1):
s390x/kvm: Rework cmma management
Jason J. Herne (5):
s390x/cpumodel: clean up spacing and comments
s390x/cpumodel: provide compat handling for new cpu features
s390x/cpumodel: wire up new hardware features
s390x/cpumodel: we are always in zarchitecture mode
s390x/cpumodel: add esop/esop2 to z12 modelThomas Huth (11):
pc-bios/s390-ccw: Move libc functions to separate header pc-bios/s390-ccw: Move ebc2asc to sclp.c
pc-bios/s390-ccw: Move virtio-block related functions into a separate file pc-bios/s390-ccw: Add a write() function for stdio pc-bios/s390-ccw: Move byteswap functions to a separate header pc-bios/s390-ccw: Remove unused structs from virtio.h pc-bios/s390-ccw: Add code for virtio feature negotiation roms/SLOF: Update submodule to latest status pc-bios/s390-ccw: Add core files for the network bootloading program pc-bios/s390-ccw: Add virtio-net driver code pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP load
Yi Min Zhao (5):
s390x/flic: introduce inject_airq callback
s390x/css: update css_adapter_interrupt
s390x: initialize cpu firstly
s390x/cpumodel: add zpci, aen and ais facilities
s390x/flic: migrate ais statesMakefile | 2 +- configure | 2 +- gdb-xml/s390-gs.xml | 14 + hmp-commands-info.hx | 16 + hmp-commands.hx | 16 + hw/intc/s390_flic.c | 107 +++++- hw/intc/s390_flic_kvm.c | 137 ++++++- hw/intc/trace-events | 4 + hw/s390x/Makefile.objs | 2 + hw/s390x/css-bridge.c | 2 +- hw/s390x/css.c | 196 +++++++++- hw/s390x/s390-pci-bus.c | 5 +- hw/s390x/s390-stattrib-kvm.c | 190 ++++++++++ hw/s390x/s390-stattrib.c | 404 +++++++++++++++++++++ hw/s390x/s390-virtio-ccw.c | 90 +++-- hw/s390x/trace-events | 1 + hw/s390x/virtio-ccw.c | 2 +- include/elf.h | 1 + include/hw/s390x/css.h | 23 +- include/hw/s390x/s390-virtio-ccw.h | 10 + include/hw/s390x/s390_flic.h | 14 +- include/hw/s390x/sclp.h | 3 +- include/hw/s390x/storage-attributes.h | 81 +++++ include/standard-headers/asm-x86/hyperv.h | 21 +- include/standard-headers/linux/input-event-codes.h | 1 + include/standard-headers/linux/pci_regs.h | 1 + linux-headers/asm-arm/kvm.h | 8 + linux-headers/asm-arm64/kvm.h | 3 + linux-headers/asm-powerpc/kvm.h | 6 + linux-headers/asm-s390/kvm.h | 12 + linux-headers/linux/kvm.h | 35 ++ monitor.c | 1 + pc-bios/s390-ccw.img | Bin 26480 -> 30520 bytes pc-bios/s390-ccw/Makefile | 13 +- pc-bios/s390-ccw/bootmap.c | 2 + pc-bios/s390-ccw/bootmap.h | 26 -- pc-bios/s390-ccw/bswap.h | 30 ++ pc-bios/s390-ccw/libc.h | 45 +++ pc-bios/s390-ccw/main.c | 14 +- pc-bios/s390-ccw/netboot.mak | 59 +++ pc-bios/s390-ccw/netmain.c | 361 ++++++++++++++++++ pc-bios/s390-ccw/s390-ccw.h | 33 +- pc-bios/s390-ccw/sclp.c | 37 +- pc-bios/s390-ccw/virtio-blkdev.c | 296 +++++++++++++++ pc-bios/s390-ccw/virtio-net.c | 135 +++++++ pc-bios/s390-ccw/virtio-scsi.c | 1 + pc-bios/s390-ccw/virtio.c | 306 ++-------------- pc-bios/s390-ccw/virtio.h | 46 +-- pc-bios/s390-netboot.img | Bin 0 -> 83864 bytes roms/SLOF | 2 +- target/s390x/arch_dump.c | 18 + target/s390x/cpu.h | 8 + target/s390x/cpu_features.c | 52 ++- target/s390x/cpu_features.h | 4 + target/s390x/cpu_features_def.h | 77 ++++ target/s390x/cpu_models.c | 51 +++ target/s390x/cpu_models.h | 2 + target/s390x/gdbstub.c | 24 ++ target/s390x/gen-features.c | 105 +++++- target/s390x/kvm.c | 169 ++++++--- target/s390x/machine.c | 17 + 61 files changed, 2833 insertions(+), 510 deletions(-) create mode 100644 gdb-xml/s390-gs.xml create mode 100644 hw/s390x/s390-stattrib-kvm.c create mode 100644 hw/s390x/s390-stattrib.c create mode 100644 include/hw/s390x/storage-attributes.h create mode 100644 pc-bios/s390-ccw/bswap.h create mode 100644 pc-bios/s390-ccw/libc.h create mode 100644 pc-bios/s390-ccw/netboot.mak create mode 100644 pc-bios/s390-ccw/netmain.c create mode 100644 pc-bios/s390-ccw/virtio-blkdev.c create mode 100644 pc-bios/s390-ccw/virtio-net.c create mode 100755 pc-bios/s390-netboot.img
[Qemu-devel] [PULL 02/40] linux-headers: update to 4.13-rc0
commit af3c8d98508d37541d4bf57f13a984a7f73a328c
Merge tag 'drm-for-v4.13' of git://people.freedesktop.org/~airlied/linux
There is a change pending for v4.13-rc1 in linux-headers/linux/kvm.h I will submit a fixup patch for 2.10 as soon as it hits the kernel.
--- include/standard-headers/asm-x86/hyperv.h | 21 +++++++------ include/standard-headers/linux/input-event-codes.h | 1 + include/standard-headers/linux/pci_regs.h | 1 + linux-headers/asm-arm/kvm.h | 8 +++++ linux-headers/asm-arm64/kvm.h | 3 ++ linux-headers/asm-powerpc/kvm.h | 6 ++++ linux-headers/asm-s390/kvm.h | 12 ++++++++ linux-headers/linux/kvm.h | 35 ++++++++++++++++++++++ 8 files changed, 78 insertions(+), 9 deletions(-)
include/standard-headers/asm-x86/hyperv.h +12 -9
@@ -34,16 +34,10 @@#define HV_X64_MSR_REFERENCE_TSC 0x40000021/* -* There is a single feature flag that signifies the presence of the MSR -* that can be used to retrieve both the local APIC Timer frequency as -* well as the TSC frequency. +* There is a single feature flag that signifies if the partition has access +* to MSRs with local APIC and TSC frequencies. */ - -/* Local APIC timer frequency MSR (HV_X64_MSR_APIC_FREQUENCY) is available */ -#define HV_X64_MSR_APIC_FREQUENCY_AVAILABLE (1 << 11) - -/* TSC frequency MSR (HV_X64_MSR_TSC_FREQUENCY) is available */ -#define HV_X64_MSR_TSC_FREQUENCY_AVAILABLE (1 << 11) +#define HV_X64_ACCESS_FREQUENCY_MSRS (1 << 11)/* * Basic SynIC MSRs (HV_X64_MSR_SCONTROL through HV_X64_MSR_EOM
@@ -73,6 +67,9 @@*/ #define HV_X64_MSR_STAT_PAGES_AVAILABLE (1 << 8) +/* Frequency MSRs available */ +#define HV_FEATURE_FREQUENCY_MSRS_AVAILABLE (1 << 8) +/* Crash MSR available */ #define HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE (1 << 10)
@@ -153,6 +150,12 @@#define HV_X64_DEPRECATING_AEOI_RECOMMENDED (1 << 9)/* +* HV_VP_SET available +*/ +#define HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED (1 << 11) + + +/* * Crash notification flag. */ #define HV_CRASH_CTL_CRASH_NOTIFY (1ULL << 63)
include/standard-headers/linux/input-event-codes.h +1 -0
@@ -600,6 +600,7 @@#define KEY_APPSELECT 0x244/* AL Select Task/Application */ #define KEY_SCREENSAVER 0x245/* AL Screen Saver */ #define KEY_VOICECOMMAND 0x246/* Listening Voice Command */ +#define KEY_ASSISTANT 0x247/* AL Context-aware desktop assistant */ #define KEY_BRIGHTNESS_MIN 0x250/* Set Brightness to Minimum */ #define KEY_BRIGHTNESS_MAX 0x251/* Set Brightness to Maximum */
include/standard-headers/linux/pci_regs.h +1 -0
@@ -517,6 +517,7 @@#define PCI_EXP_LNKCAP_SLS 0x0000000f/* Supported Link Speeds */ #define PCI_EXP_LNKCAP_SLS_2_5GB 0x00000001/* LNKCAP2 SLS Vector bit 0 */ #define PCI_EXP_LNKCAP_SLS_5_0GB 0x00000002/* LNKCAP2 SLS Vector bit 1 */ +#define PCI_EXP_LNKCAP_SLS_8_0GB 0x00000003/* LNKCAP2 SLS Vector bit 2 */ #define PCI_EXP_LNKCAP_MLW 0x000003f0/* Maximum Link Width */ #define PCI_EXP_LNKCAP_ASPMS 0x00000c00/* ASPM Support */ #define PCI_EXP_LNKCAP_L0SEL 0x00007000/* L0s Exit Latency */
linux-headers/asm-arm/kvm.h +8 -0
@@ -203,6 +203,14 @@ struct kvm_arch_memory_slot {#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff#define VGIC_LEVEL_INFO_LINE_LEVEL 0 +/* Device Control API on vcpu fd */ +#define KVM_ARM_VCPU_PMU_V3_CTRL 0 +#define KVM_ARM_VCPU_PMU_V3_IRQ 0 +#define KVM_ARM_VCPU_PMU_V3_INIT 1 +#define KVM_ARM_VCPU_TIMER_CTRL 1 +#define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0 +#define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1 +#define KVM_DEV_ARM_VGIC_CTRL_INIT 0#define KVM_DEV_ARM_ITS_SAVE_TABLES 1#define KVM_DEV_ARM_ITS_RESTORE_TABLES 2
linux-headers/asm-arm64/kvm.h +3 -0
@@ -232,6 +232,9 @@ struct kvm_arch_memory_slot {#define KVM_ARM_VCPU_PMU_V3_CTRL 0#define KVM_ARM_VCPU_PMU_V3_IRQ 0#define KVM_ARM_VCPU_PMU_V3_INIT 1 +#define KVM_ARM_VCPU_TIMER_CTRL 1 +#define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0 +#define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1/* KVM_IRQ_LINE irq field index values */ #define KVM_ARM_IRQ_TYPE_SHIFT 24
linux-headers/asm-powerpc/kvm.h +6 -0
@@ -60,6 +60,12 @@ struct kvm_regs {#define KVM_SREGS_E_FSL_PIDn (1 << 0)/* PID1/PID2 */ +/* flags for kvm_run.flags */ +#define KVM_RUN_PPC_NMI_DISP_MASK (3 << 0) +#define KVM_RUN_PPC_NMI_DISP_FULLY_RECOV (1 << 0) +#define KVM_RUN_PPC_NMI_DISP_LIMITED_RECOV (2 << 0) +#define KVM_RUN_PPC_NMI_DISP_NOT_RECOV (3 << 0) +/* * Feature bits indicate which sections of the sregs struct are valid, * both in KVM_GET_SREGS and KVM_SET_SREGS. On KVM_SET_SREGS, registers
linux-headers/asm-s390/kvm.h +12 -0
@@ -28,6 +28,7 @@#define KVM_DEV_FLIC_CLEAR_IO_IRQ 8#define KVM_DEV_FLIC_AISM 9#define KVM_DEV_FLIC_AIRQ_INJECT 10 +#define KVM_DEV_FLIC_AISM_ALL 11/* * We can have up to 4*64k pending subchannels + 8 adapter interrupts, * as well as up to ASYNC_PF_PER_VCPU*KVM_MAX_VCPUS pfault done interrupts.
@@ -53,6 +54,11 @@ struct kvm_s390_ais_req {__u16 mode; }; +struct kvm_s390_ais_all { +__u8 simm; +__u8 nimm; +}; +#define KVM_S390_IO_ADAPTER_MASK 1#define KVM_S390_IO_ADAPTER_MAP 2#define KVM_S390_IO_ADAPTER_UNMAP 3
@@ -70,6 +76,7 @@ struct kvm_s390_io_adapter_req {#define KVM_S390_VM_TOD 1#define KVM_S390_VM_CRYPTO 2#define KVM_S390_VM_CPU_MODEL 3 +#define KVM_S390_VM_MIGRATION 4/* kvm attributes for mem_ctrl */ #define KVM_S390_VM_MEM_ENABLE_CMMA 0
@@ -151,6 +158,11 @@ struct kvm_s390_vm_cpu_subfunc {#define KVM_S390_VM_CRYPTO_DISABLE_AES_KW 2#define KVM_S390_VM_CRYPTO_DISABLE_DEA_KW 3 +/* kvm attributes for migration mode */ +#define KVM_S390_VM_MIGRATION_STOP 0 +#define KVM_S390_VM_MIGRATION_START 1 +#define KVM_S390_VM_MIGRATION_STATUS 2 +/* for KVM_GET_REGS and KVM_SET_REGS */ struct kvm_regs {/* general purpose regs for s390 */
linux-headers/linux/kvm.h +35 -0
@@ -155,6 +155,35 @@ struct kvm_s390_skeys {__u32 reserved[9 ]; }; +#define KVM_S390_CMMA_PEEK (1 << 0) + +/** +* kvm_s390_cmma_log - Used for CMMA migration. +* +* Used both for input and output. +* +* @start_gfn: Guest page number to start from. +* @count: Size of the result buffer. +* @flags: Control operation mode via KVM_S390_CMMA_* flags +* @remaining: Used with KVM_S390_GET_CMMA_BITS. Indicates how many dirty +* pages are still remaining. +* @mask: Used with KVM_S390_SET_CMMA_BITS. Bitmap of bits to actually set +* in the PGSTE. +* @values: Pointer to the values buffer. +* +* Used in KVM_S390_{G,S}ET_CMMA_BITS ioctls. +*/ +struct kvm_s390_cmma_log { +__u64 start_gfn; +__u32 count; +__u32 flags; +union { +__u64 remaining; +__u64 mask; + }; +__u64 values; +}; +struct kvm_hyperv_exit {#define KVM_EXIT_HYPERV_SYNIC 1#define KVM_EXIT_HYPERV_HCALL 2
@@ -895,6 +924,9 @@ struct kvm_ppc_resize_hpt {#define KVM_CAP_SPAPR_TCE_VFIO 142#define KVM_CAP_X86_GUEST_MWAIT 143#define KVM_CAP_ARM_USER_IRQ 144 +#define KVM_CAP_S390_CMMA_MIGRATION 145 +#define KVM_CAP_PPC_FWNMI 146 +#define KVM_CAP_PPC_SMT_POSSIBLE 147#ifdef KVM_CAP_IRQ_ROUTING
@@ -1318,6 +1350,9 @@ struct kvm_s390_ucas_mapping {#define KVM_S390_GET_IRQ_STATE _IOW(KVMIO, 0xb6, struct kvm_s390_irq_state)/* Available with KVM_CAP_X86_SMM */ #define KVM_SMI _IO(KVMIO, 0xb7) +/* Available with KVM_CAP_S390_CMMA_MIGRATION */ +#define KVM_S390_GET_CMMA_BITS _IOW(KVMIO, 0xb8, struct kvm_s390_cmma_log) +#define KVM_S390_SET_CMMA_BITS _IOW(KVMIO, 0xb9, struct kvm_s390_cmma_log)#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 05/40] s390x/cpumodel: clean up spacing and comments
In reply to Christian BorntraegerFrom: "Jason J. Herne" <[email protected]>
Clean up spacing and add comments to clarify difference between base, full and default models.
Not having spacing around the model definitions in gen-features.c is particularly frustrating as the reader tends to misinterpret which model they are looking at or editing.
--- target/s390x/cpu_features.c | 3 +++ target/s390x/cpu_features_def.h | 35 +++++++++++++++++++++++++ target/s390x/gen-features.c | 58 ++++++++++++++++++++++++++++++++++++++--- 3 files changed, 93 insertions(+), 3 deletions(-)
target/s390x/cpu_features.c +3 -0
@@ -83,9 +83,11 @@ static const S390FeatDef s390_features[] = {FEAT_INIT ("dfppc" ,S390_FEAT_TYPE_STFL ,80 ,"Decimal-floating-point packed-conversion facility" ),FEAT_INIT ("vx" ,S390_FEAT_TYPE_STFL ,129 ,"Vector facility" ), +/* SCLP SCCB Byte 80 - 98 (bit numbers relative to byte-80) */ FEAT_INIT ("gsls" ,S390_FEAT_TYPE_SCLP_CONF_CHAR ,40 ,"SIE: Guest-storage-limit-suppression facility" ),FEAT_INIT ("esop" ,S390_FEAT_TYPE_SCLP_CONF_CHAR ,46 ,"Enhanced-suppression-on-protection facility" ), +/* SCLP SCCB Byte 116 - 119 (bit numbers relative to byte-116) */ FEAT_INIT ("64bscao" ,S390_FEAT_TYPE_SCLP_CONF_CHAR_EXT ,0 ,"SIE: 64-bit-SCAO facility" ),FEAT_INIT ("cmma" ,S390_FEAT_TYPE_SCLP_CONF_CHAR_EXT ,1 ,"SIE: Collaborative-memory-management assist" ), FEAT_INIT("pfmfi", S390_FEAT_TYPE_SCLP_CONF_CHAR_EXT, 9, "SIE: PFMF interpretation facility"),
@@ -183,6 +185,7 @@ static const S390FeatDef s390_features[] = {FEAT_INIT ("kimd-sha-256" ,S390_FEAT_TYPE_KIMD ,2 ,"KIMD SHA-256" ),FEAT_INIT ("kimd-sha-512" ,S390_FEAT_TYPE_KIMD ,3 ,"KIMD SHA-512" ),FEAT_INIT ("kimd-ghash" ,S390_FEAT_TYPE_KIMD ,65 ,"KIMD GHASH" ), +FEAT_INIT ("klmd-sha-1" ,S390_FEAT_TYPE_KLMD ,1 ,"KLMD SHA-1" ),FEAT_INIT ("klmd-sha-256" ,S390_FEAT_TYPE_KLMD ,2 ,"KLMD SHA-256" ), FEAT_INIT("klmd-sha-512", S390_FEAT_TYPE_KLMD, 3, "KLMD SHA-512"),
target/s390x/cpu_features_def.h +35 -0
@@ -15,6 +15,7 @@#define TARGET_S390X_CPU_FEATURES_DEF_H typedef enum { + /* Stfle */ S390_FEAT_ESAN3 = 0, S390_FEAT_ZARCH, S390_FEAT_DAT_ENH,
@@ -72,12 +73,18 @@ typedef enum {S390_FEAT_EDAT_2 ,S390_FEAT_DFP_PACKED_CONVERSION ,S390_FEAT_VECTOR , + +/* Sclp Conf Char */ S390_FEAT_SIE_GSLS ,S390_FEAT_ESOP , + +/* Sclp Conf Char Ext */ S390_FEAT_SIE_64BSCAO ,S390_FEAT_SIE_CMMA ,S390_FEAT_SIE_PFMFI ,S390_FEAT_SIE_IBS , + +/* Sclp Cpu */ S390_FEAT_SIE_F2 ,S390_FEAT_SIE_SKEY , S390_FEAT_SIE_GPERE,
@@ -85,8 +92,12 @@ typedef enum {S390_FEAT_SIE_SIGPIF ,S390_FEAT_SIE_IB ,S390_FEAT_SIE_CEI , + +/* Misc */ S390_FEAT_DAT_ENH_2 ,S390_FEAT_CMM , + +/* PLO */ S390_FEAT_PLO_CL ,S390_FEAT_PLO_CLG , S390_FEAT_PLO_CLGR,
@@ -111,6 +122,8 @@ typedef enum {S390_FEAT_PLO_CSTSTG ,S390_FEAT_PLO_CSTSTGR ,S390_FEAT_PLO_CSTSTX , + +/* PTFF */ S390_FEAT_PTFF_QTO ,S390_FEAT_PTFF_QSI , S390_FEAT_PTFF_QPT,
@@ -118,6 +131,8 @@ typedef enum {S390_FEAT_PTFF_QTOU ,S390_FEAT_PTFF_STO ,S390_FEAT_PTFF_STOU , + +/* KMAC */ S390_FEAT_KMAC_DEA ,S390_FEAT_KMAC_TDEA_128 , S390_FEAT_KMAC_TDEA_192,
@@ -130,6 +145,8 @@ typedef enum {S390_FEAT_KMAC_EAES_128 ,S390_FEAT_KMAC_EAES_192 ,S390_FEAT_KMAC_EAES_256 , + +/* KMC */ S390_FEAT_KMC_DEA ,S390_FEAT_KMC_TDEA_128 , S390_FEAT_KMC_TDEA_192,
@@ -143,6 +160,8 @@ typedef enum {S390_FEAT_KMC_EAES_192 ,S390_FEAT_KMC_EAES_256 ,S390_FEAT_KMC_PRNG , + +/* KM */ S390_FEAT_KM_DEA ,S390_FEAT_KM_TDEA_128 , S390_FEAT_KM_TDEA_192,
@@ -159,19 +178,27 @@ typedef enum {S390_FEAT_KM_XTS_AES_256 ,S390_FEAT_KM_XTS_EAES_128 ,S390_FEAT_KM_XTS_EAES_256 , + +/* KIMD */ S390_FEAT_KIMD_SHA_1 ,S390_FEAT_KIMD_SHA_256 ,S390_FEAT_KIMD_SHA_512 ,S390_FEAT_KIMD_GHASH , + +/* KLMD */ S390_FEAT_KLMD_SHA_1 ,S390_FEAT_KLMD_SHA_256 ,S390_FEAT_KLMD_SHA_512 , + +/* PCKMO */ S390_FEAT_PCKMO_EDEA ,S390_FEAT_PCKMO_ETDEA_128 ,S390_FEAT_PCKMO_ETDEA_256 ,S390_FEAT_PCKMO_AES_128 ,S390_FEAT_PCKMO_AES_192 ,S390_FEAT_PCKMO_AES_256 , + +/* KMCTR */ S390_FEAT_KMCTR_DEA ,S390_FEAT_KMCTR_TDEA_128 , S390_FEAT_KMCTR_TDEA_192,
@@ -184,6 +211,8 @@ typedef enum {S390_FEAT_KMCTR_EAES_128 ,S390_FEAT_KMCTR_EAES_192 ,S390_FEAT_KMCTR_EAES_256 , + +/* KMF */ S390_FEAT_KMF_DEA ,S390_FEAT_KMF_TDEA_128 , S390_FEAT_KMF_TDEA_192,
@@ -196,6 +225,8 @@ typedef enum {S390_FEAT_KMF_EAES_128 ,S390_FEAT_KMF_EAES_192 ,S390_FEAT_KMF_EAES_256 , + +/* KMO */ S390_FEAT_KMO_DEA ,S390_FEAT_KMO_TDEA_128 , S390_FEAT_KMO_TDEA_192,
@@ -208,6 +239,8 @@ typedef enum {S390_FEAT_KMO_EAES_128 ,S390_FEAT_KMO_EAES_192 ,S390_FEAT_KMO_EAES_256 , + +/* PCC */ S390_FEAT_PCC_CMAC_DEA ,S390_FEAT_PCC_CMAC_TDEA_128 , S390_FEAT_PCC_CMAC_TDEA_192,
@@ -224,6 +257,8 @@ typedef enum {S390_FEAT_PCC_XTS_AES_256 ,S390_FEAT_PCC_XTS_EAES_128 ,S390_FEAT_PCC_XTS_EAES_256 , + +/* PPNO */ S390_FEAT_PPNO_SHA_512_DRNG ,S390_FEAT_MAX , } S390Feat;
target/s390x/gen-features.c +55 -3
225 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 01/40] s390x/kvm: Rework cmma management
In reply to Christian BorntraegerFrom: Janosch Frank <[email protected]>
Let's keep track of cmma enablement and move the mem_path check into the actual enablement. This now also warns users that do not use cpu-models about disabled cmma when using huge pages.
--- target/s390x/cpu.h | 1 + target/s390x/kvm.c | 26 +++++++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-)
target/s390x/cpu.h +1 -0
@@ -1158,6 +1158,7 @@ int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, int vq, bool assign);int kvm_s390_cpu_restart (S390CPU *cpu);int kvm_s390_get_memslot_count (KVMState *s); +int kvm_s390_cmma_active (void );void kvm_s390_cmma_reset (void );int kvm_s390_set_cpu_state (S390CPU *cpu,uint8_t cpu_state);void kvm_s390_reset_vcpu (S390CPU *cpu);
target/s390x/kvm.c +17 -9
@@ -140,6 +140,8 @@ static int cap_mem_op;static int cap_s390_irq;static int cap_ri; +static int active_cmma; +static void *legacy_s390_alloc (size_t size,uint64_t *align);static int kvm_s390_query_mem_limit (KVMState *s,uint64_t *memory_limit)
@@ -177,6 +179,11 @@ int kvm_s390_set_mem_limit(KVMState *s, uint64_t new_limit, uint64_t *hw_limit)return kvm_vm_ioctl (s,KVM_SET_DEVICE_ATTR , &attr); } +int kvm_s390_cmma_active (void ) +{ +return active_cmma; +} +static bool kvm_s390_cmma_available (void ) {static bool initialized, value;
@@ -197,7 +204,7 @@ void kvm_s390_cmma_reset(void) .attr = KVM_S390_VM_MEM_CLR_CMMA, }; -if (mem_path || !kvm_s390_cmma_available ()) { +if (!kvm_s390_cmma_active ()) {return ; }
@@ -213,7 +220,13 @@ static void kvm_s390_enable_cmma(void) .attr = KVM_S390_VM_MEM_ENABLE_CMMA, }; +if (mem_path) { +error_report ("Warning: CMM will not be enabled because it is not " +"compatible to hugetlbfs." ); +return ; + } rc =kvm_vm_ioctl (kvm_state,KVM_SET_DEVICE_ATTR , &attr); + active_cmma = !rc;trace_kvm_enable_cmma (rc); }
@@ -2641,7 +2654,7 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)if (!model) {/* compatibility handling if cpu models are disabled */ -if (kvm_s390_cmma_available () && !mem_path) { +if (kvm_s390_cmma_available ()) {kvm_s390_enable_cmma (); }return ;
@@ -2672,13 +2685,8 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)error_setg (errp,"KVM: Error configuring CPU subfunctions: %d" , rc);return ; } -/* enable CMM via CMMA - disable on hugetlbfs */ +/* enable CMM via CMMA */ if (test_bit (S390_FEAT_CMM , model->features)) { -if (mem_path) { -error_report ("Warning: CMM will not be enabled because it is not " -"compatible to hugetlbfs." ); - }else { -kvm_s390_enable_cmma (); - } +kvm_s390_enable_cmma (); } }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 03/40] s390x/migration: Storage attributes device
In reply to Christian BorntraegerFrom: Claudio Imbrenda <[email protected]>
Storage attributes device, like we have for storage keys.
--- hw/s390x/Makefile.objs | 2 + hw/s390x/s390-stattrib-kvm.c | 190 +++++++++++++++++++ hw/s390x/s390-stattrib.c | 342 ++++++++++++++++++++++++++++++++++ hw/s390x/s390-virtio-ccw.c | 10 +- include/hw/s390x/storage-attributes.h | 77 ++++++++ 5 files changed, 620 insertions(+), 1 deletion(-) create mode 100644 hw/s390x/s390-stattrib-kvm.c create mode 100644 hw/s390x/s390-stattrib.c create mode 100644 include/hw/s390x/storage-attributes.h
hw/s390x/Makefile.objs +2 -0
@@ -13,5 +13,7 @@ obj-y += css-bridge.o obj-y += ccw-device.o obj-y += s390-pci-bus.o s390-pci-inst.o obj-y += s390-skeys.o +obj-y += s390-stattrib.o obj-$(CONFIG_KVM) += s390-skeys-kvm.o +obj-$(CONFIG_KVM) += s390-stattrib-kvm.o obj-y += s390-ccw.o
hw/s390x/s390-stattrib-kvm.c new file +190 -0
190 lines not on this page · raw message
hw/s390x/s390-stattrib.c new file +342 -0
342 lines not on this page · raw message
hw/s390x/s390-virtio-ccw.c +9 -1
@@ -24,6 +24,7 @@#include "qemu/config-file.h" #include "s390-pci-bus.h" #include "hw/s390x/storage-keys.h" +#include "hw/s390x/storage-attributes.h" #include "hw/compat.h" #include "ipl.h" #include "hw/s390x/s390-virtio-ccw.h"
@@ -103,6 +104,8 @@ void s390_memory_init(ram_addr_t mem_size)/* Initialize storage key device */ s390_skeys_init (); +/* Initialize storage attributes device */ +s390_stattrib_init (); }static SaveVMHandlers savevm_gtod = {
@@ -406,7 +409,12 @@ static const TypeInfo ccw_machine_info = { type_init(ccw_machine_register_##suffix)#define CCW_COMPAT_2_9 \ - HW_COMPAT_2_9 + HW_COMPAT_2_9 \ + {\ + .driver = TYPE_S390_STATTRIB,\ + .property = "migration-enabled",\ + .value = "off",\ + },#define CCW_COMPAT_2_8 \ HW_COMPAT_2_8 \
include/hw/s390x/storage-attributes.h new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 07/40] s390x: add flags field for registering I/O adapter
In reply to Christian BorntraegerFrom: Fei Li <[email protected]>
Introduce a new 'flags' field to IoAdapter to contain further characteristics of the adapter, like whether the adapter is subject to adapter-interruption suppression.
For the kvm case, pass this value in the 'flags' field when registering an adapter.
--- hw/intc/s390_flic.c | 2 +- hw/intc/s390_flic_kvm.c | 3 ++- hw/s390x/css-bridge.c | 2 +- hw/s390x/css.c | 8 ++++++-- hw/s390x/s390-pci-bus.c | 3 ++- include/hw/s390x/css.h | 8 +++++++- include/hw/s390x/s390_flic.h | 2 +- 7 files changed, 20 insertions(+), 8 deletions(-)
hw/intc/s390_flic.c +1 -1
@@ -48,7 +48,7 @@ void s390_flic_init(void)static int qemu_s390_register_io_adapter (S390FLICState *fs,uint32_t id,uint8_t isc,bool swap, -bool is_maskable) +bool is_maskable,uint8_t flags) {/* nothing to do */ return 0 ;
hw/intc/s390_flic_kvm.c +2 -1
@@ -186,13 +186,14 @@ static int __get_all_irqs(KVMS390FLICState *flic,static int kvm_s390_register_io_adapter (S390FLICState *fs,uint32_t id,uint8_t isc,bool swap, -bool is_maskable) +bool is_maskable,uint8_t flags) {struct kvm_s390_io_adapter adapter = { .id = id, .isc = isc, .maskable = is_maskable, .swap = swap, + .flags = flags, };KVMS390FLICState *flic =KVM_S390_FLIC (fs);int r;
hw/s390x/css-bridge.c +1 -1
@@ -110,7 +110,7 @@ VirtualCssBus *virtual_css_bus_init(void)qbus_set_hotplug_handler (bus, dev, &error_abort);css_register_io_adapters (CSS_IO_ADAPTER_VIRTIO , true, false, - &error_abort); +0 , &error_abort);return cbus; }
hw/s390x/css.c +6 -2
@@ -225,6 +225,7 @@ typedef struct IoAdapter {uint32_t id;uint8_t type;uint8_t isc; +uint8_t flags; } IoAdapter; typedef struct ChannelSubSys {
@@ -392,10 +393,12 @@ uint32_t css_get_adapter_id(CssIoAdapterType type, uint8_t isc)* * @swap: an indication if byte swap is needed. * @maskable: an indication if the adapter is subject to the mask operation. +* @flags: further characteristics of the adapter. +* e.g. suppressible, an indication if the adapter is subject to AIS. * @errp: location to store error information. */ void css_register_io_adapters (CssIoAdapterType type,bool swap,bool maskable, -Error **errp) +uint8_t flags,Error **errp) {uint32_t id;int ret, isc;
@@ -413,12 +416,13 @@ void css_register_io_adapters(CssIoAdapterType type, bool swap, bool maskable,for (isc =0 ; isc <=MAX_ISC ; isc++) { id = (type <<3 ) | isc; - ret = fsc->register_io_adapter (fs, id, isc, swap, maskable); + ret = fsc->register_io_adapter (fs, id, isc, swap, maskable, flags);if (ret ==0 ) { adapter =g_new0 (IoAdapter,1 ); adapter->id = id; adapter->isc = isc; adapter->type = type; + adapter->flags = flags; channel_subsys.io_adapters[type][isc] = adapter; }else { error_setg_errno(errp, -ret, "Unexpected error %d when "
hw/s390x/s390-pci-bus.c +2 -1
@@ -582,7 +582,8 @@ static int s390_pcihost_init(SysBusDevice *dev)QTAILQ_INIT (&s->pending_sei);QTAILQ_INIT (&s->zpci_devs); -css_register_io_adapters (CSS_IO_ADAPTER_PCI , true, false, &error_abort); +css_register_io_adapters (CSS_IO_ADAPTER_PCI , true, false, +S390_ADAPTER_SUPPRESSIBLE , &error_abort);return 0 ; }
include/hw/s390x/css.h +7 -1
@@ -167,7 +167,13 @@ typedef enum {uint32_t css_get_adapter_id (CssIoAdapterType type,uint8_t isc);void css_register_io_adapters (CssIoAdapterType type,bool swap,bool maskable, -Error **errp); +uint8_t flags,Error **errp); + +#ifndef CONFIG_KVM +#define S390_ADAPTER_SUPPRESSIBLE 0x01 +#else +#define S390_ADAPTER_SUPPRESSIBLE KVM_S390_ADAPTER_SUPPRESSIBLE +#endif #ifndef CONFIG_USER_ONLY SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid,
include/hw/s390x/s390_flic.h +1 -1
@@ -56,7 +56,7 @@ typedef struct S390FLICStateClass {DeviceClass parent_class;int (*register_io_adapter)(S390FLICState *fs,uint32_t id,uint8_t isc, -bool swap,bool maskable); +bool swap,bool maskable,uint8_t flags);int (*io_adapter_map)(S390FLICState *fs,uint32_t id,uint64_t map_addr,bool do_map);int (*add_adapter_routes)(S390FLICState *fs,AdapterRoutes *routes);
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 17/40] s390x/css: use SubchDev.orb
In reply to Christian BorntraegerFrom: Halil Pasic <[email protected]>
Instead of passing around a pointer to ORB let us simplify some function signatures by using the previously introduced ORB saved at the subchannel (SubchDev).
Message-Id: <[email protected]>
--- hw/s390x/css.c | 30 +++++++++++++++--------------- include/hw/s390x/css.h | 6 +++--- 2 files changed, 18 insertions(+), 18 deletions(-)
hw/s390x/css.c +15 -15
@@ -909,7 +909,7 @@ static int css_interpret_ccw(SubchDev *sch, hwaddr ccw_addr,return ret; } -static void sch_handle_start_func_virtual (SubchDev *sch,ORB *orb) +static void sch_handle_start_func_virtual (SubchDev *sch) {PMCW *p = &sch->curr_status.pmcw;
@@ -923,10 +923,10 @@ static void sch_handle_start_func_virtual(SubchDev *sch, ORB *orb)if (!(s->ctrl &SCSW_ACTL_SUSP )) {/* Start Function triggered via ssch, i.e. we have an ORB */ +ORB *orb = &sch->orb; s->cstat =0 ; s->dstat =0 ;/* Look at the orb and try to execute the channel program. */ -assert (orb !=NULL );/* resume does not pass an orb */ p->intparm = orb->intparm;if (!(orb->lpm & path)) {/* Generate a deferred cc 3 condition. */
@@ -940,8 +940,7 @@ static void sch_handle_start_func_virtual(SubchDev *sch, ORB *orb) sch->ccw_no_data_cnt =0 ; suspend_allowed = !!(orb->ctrl0 &ORB_CTRL0_MASK_SPND ); }else { -/* Start Function resumed via rsch, i.e. we don't have an -* ORB */ +/* Start Function resumed via rsch */ s->ctrl &= ~(SCSW_ACTL_SUSP |SCSW_ACTL_RESUME_PEND );/* The channel program had been suspended before. */ suspend_allowed = true;
@@ -1011,13 +1010,14 @@ static void sch_handle_start_func_virtual(SubchDev *sch, ORB *orb) } -static int sch_handle_start_func_passthrough (SubchDev *sch,ORB *orb) +static int sch_handle_start_func_passthrough (SubchDev *sch) {PMCW *p = &sch->curr_status.pmcw;SCSW *s = &sch->curr_status.scsw;int ret; +ORB *orb = &sch->orb;if (!(s->ctrl &SCSW_ACTL_SUSP )) {assert (orb !=NULL ); p->intparm = orb->intparm;
@@ -1062,7 +1062,7 @@ static int sch_handle_start_func_passthrough(SubchDev *sch, ORB *orb)* read/writes) asynchronous later on if we start supporting more than * our current very simple devices. */ -int do_subchannel_work_virtual (SubchDev *sch,ORB *orb) +int do_subchannel_work_virtual (SubchDev *sch) {SCSW *s = &sch->curr_status.scsw;
@@ -1073,7 +1073,7 @@ int do_subchannel_work_virtual(SubchDev *sch, ORB *orb)sch_handle_halt_func (sch); }else if (s->ctrl &SCSW_FCTL_START_FUNC ) {/* Triggered by both ssch and rsch. */ -sch_handle_start_func_virtual (sch, orb); +sch_handle_start_func_virtual (sch); }else {/* Cannot happen. */ return 0 ;
@@ -1082,7 +1082,7 @@ int do_subchannel_work_virtual(SubchDev *sch, ORB *orb)return 0 ; } -int do_subchannel_work_passthrough (SubchDev *sch,ORB *orb) +int do_subchannel_work_passthrough (SubchDev *sch) {int ret;SCSW *s = &sch->curr_status.scsw;
@@ -1096,7 +1096,7 @@ int do_subchannel_work_passthrough(SubchDev *sch, ORB *orb)sch_handle_halt_func (sch); ret =0 ; }else if (s->ctrl &SCSW_FCTL_START_FUNC ) { - ret =sch_handle_start_func_passthrough (sch, orb); + ret =sch_handle_start_func_passthrough (sch); }else {/* Cannot happen. */ return -ENODEV ;
@@ -1105,10 +1105,10 @@ int do_subchannel_work_passthrough(SubchDev *sch, ORB *orb)return ret; } -static int do_subchannel_work (SubchDev *sch,ORB *orb) +static int do_subchannel_work (SubchDev *sch) {if (sch->do_subchannel_work) { -return sch->do_subchannel_work (sch, orb); +return sch->do_subchannel_work (sch); }else {return -EINVAL ; }
@@ -1315,7 +1315,7 @@ int css_do_csch(SubchDev *sch) s->ctrl &= ~(SCSW_CTRL_MASK_FCTL |SCSW_CTRL_MASK_ACTL ); s->ctrl |=SCSW_FCTL_CLEAR_FUNC |SCSW_ACTL_CLEAR_PEND ; -do_subchannel_work (sch,NULL ); +do_subchannel_work (sch); ret =0 ; out:
@@ -1356,7 +1356,7 @@ int css_do_hsch(SubchDev *sch) } s->ctrl |=SCSW_ACTL_HALT_PEND ; -do_subchannel_work (sch,NULL ); +do_subchannel_work (sch); ret =0 ; out:
@@ -1431,7 +1431,7 @@ int css_do_ssch(SubchDev *sch, ORB *orb) s->ctrl |= (SCSW_FCTL_START_FUNC |SCSW_ACTL_START_PEND ); s->flags &= ~SCSW_FLAGS_MASK_PNO ; - ret =do_subchannel_work (sch, orb); + ret =do_subchannel_work (sch); out:return ret;
@@ -1710,7 +1710,7 @@ int css_do_rsch(SubchDev *sch) } s->ctrl |=SCSW_ACTL_RESUME_PEND ; -do_subchannel_work (sch,NULL ); +do_subchannel_work (sch); ret =0 ; out:
include/hw/s390x/css.h +3 -3
@@ -94,7 +94,7 @@ struct SubchDev {/* transport-provided data: */ int (*ccw_cb) (SubchDev *,CCW1 );void (*disable_cb)(SubchDev *); -int (*do_subchannel_work) (SubchDev *,ORB *); +int (*do_subchannel_work) (SubchDev *);SenseId id;void *driver_data; };
@@ -157,8 +157,8 @@ void css_generate_chp_crws(uint8_t cssid, uint8_t chpid);void css_generate_css_crws (uint8_t cssid);void css_clear_sei_pending (void );int s390_ccw_cmd_request (ORB *orb,SCSW *scsw,void *data); -int do_subchannel_work_virtual (SubchDev *sub,ORB *orb); -int do_subchannel_work_passthrough (SubchDev *sub,ORB *orb); +int do_subchannel_work_virtual (SubchDev *sub); +int do_subchannel_work_passthrough (SubchDev *sub); typedef enum { CSS_IO_ADAPTER_VIRTIO = 0,
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 18/40] pc-bios/s390-ccw: Move libc functions to separate header
In reply to Christian BorntraegerFrom: Thomas Huth <[email protected]>
The upcoming netboot code will use the libc from SLOF. To be able to still use s390-ccw.h there, the libc related functions in this header have to be moved to a different location.
And while we're at it, remove the duplicate memcpy() function from sclp.c.
Message-Id: <[email protected]>
--- pc-bios/s390-ccw/bootmap.c | 1 + pc-bios/s390-ccw/libc.h | 45 ++++++++++++++++++++++++++++++++++++++++++ pc-bios/s390-ccw/main.c | 1 + pc-bios/s390-ccw/s390-ccw.h | 29 --------------------------- pc-bios/s390-ccw/sclp.c | 10 ++-------- pc-bios/s390-ccw/virtio-scsi.c | 1 + pc-bios/s390-ccw/virtio.c | 1 + 7 files changed, 51 insertions(+), 37 deletions(-) create mode 100644 pc-bios/s390-ccw/libc.h
pc-bios/s390-ccw/bootmap.c +1 -0
@@ -8,6 +8,7 @@* directory. */ +#include "libc.h" #include "s390-ccw.h" #include "bootmap.h" #include "virtio.h"
pc-bios/s390-ccw/libc.h new file +45 -0
45 lines not on this page · raw message
pc-bios/s390-ccw/main.c +1 -0
@@ -8,6 +8,7 @@* directory. */ +#include "libc.h" #include "s390-ccw.h" #include "virtio.h"
pc-bios/s390-ccw/s390-ccw.h +0 -29
@@ -18,12 +18,6 @@ typedef unsigned short u16;typedef unsigned int u32 ;typedef unsigned long long u64 ;typedef unsigned long ulong ; -typedef long size_t ; -typedef int bool ; -typedef unsigned char uint8_t ; -typedef unsigned short uint16_t ; -typedef unsigned int uint32_t ; -typedef unsigned long long uint64_t ;typedef unsigned char __u8 ;typedef unsigned short __u16 ;typedef unsigned int __u32 ;
@@ -88,18 +82,6 @@ ulong get_second(void);/* bootmap.c */ void zipl_load (void ); -static inline void *memset (void *s,int c,size_t n) -{ -int i; -unsigned char *p = s; - -for (i =0 ; i < n; i++) { - p[i] = c; - } - -return s; -} -static inline void fill_hex (char *out,unsigned char val) {const char hex[] ="0123456789abcdef" ;
@@ -169,17 +151,6 @@ static inline void sleep(unsigned int seconds) } } -static inline void *memcpy (void *s1,const void *s2,size_t n) -{ -uint8_t *p1 = s1; -const uint8_t *p2 = s2; - -while (n--) { - p1[n] = p2[n]; - } -return s1; -} -static inline void IPL_assert (bool term,const char *message) {if (!term) {
pc-bios/s390-ccw/sclp.c +2 -8
@@ -8,6 +8,7 @@* directory. */ +#include "libc.h" #include "s390-ccw.h" #include "sclp.h"
@@ -59,13 +60,6 @@ static int _strlen(const char *str)return i; } -static void _memcpy (char *dest,const char *src,int len) -{ -int i; -for (i =0 ; i < len; i++) - dest[i] = src[i]; -} -void sclp_print (const char *str) {int len =_strlen (str);
@@ -76,7 +70,7 @@ void sclp_print(const char *str) sccb->ebh.length =sizeof (EventBufferHeader) + len; sccb->ebh.type =SCLP_EVENT_ASCII_CONSOLE_DATA ; sccb->ebh.flags =0 ; -_memcpy (sccb->data, str, len); +memcpy (sccb->data, str, len);sclp_service_call (SCLP_CMD_WRITE_EVENT_DATA , sccb); }
pc-bios/s390-ccw/virtio-scsi.c +1 -0
@@ -9,6 +9,7 @@* directory. */ +#include "libc.h" #include "s390-ccw.h" #include "virtio.h" #include "scsi.h"
pc-bios/s390-ccw/virtio.c +1 -0
@@ -8,6 +8,7 @@* directory. */ +#include "libc.h" #include "s390-ccw.h" #include "virtio.h" #include "virtio-scsi.h"
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 20/40] pc-bios/s390-ccw: Move virtio-block related functions into a separate file
In reply to Christian BorntraegerFrom: Thomas Huth <[email protected]>
The netboot code is going to link against the code from virtio.c, too, so we've got to move the virtio-block and -scsi related code out of the way.
Message-Id: <[email protected]>
--- pc-bios/s390-ccw/Makefile | 2 +- pc-bios/s390-ccw/main.c | 2 +- pc-bios/s390-ccw/s390-ccw.h | 2 +- pc-bios/s390-ccw/virtio-blkdev.c | 296 +++++++++++++++++++++++++++++++++++++++ pc-bios/s390-ccw/virtio.c | 277 +----------------------------------- pc-bios/s390-ccw/virtio.h | 6 + 6 files changed, 311 insertions(+), 274 deletions(-) create mode 100644 pc-bios/s390-ccw/virtio-blkdev.c
pc-bios/s390-ccw/Makefile +1 -1
@@ -9,7 +9,7 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw) .PHONY : all clean build-all -OBJECTS = start.o main.o bootmap.o sclp.o virtio.o virtio-scsi.o +OBJECTS = start.o main.o bootmap.o sclp.o virtio.o virtio-scsi.o virtio-blkdev.o QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) QEMU_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -msoft-float QEMU_CFLAGS += -march=z900 -fPIE -fno-strict-aliasing
pc-bios/s390-ccw/main.c +1 -1
@@ -144,7 +144,7 @@ static void virtio_setup(void)sclp_print ("Network boot device detected\n" ); vdev->netboot_start_addr = iplb.ccw.netboot_start_addr; }else { -virtio_setup_device (blk_schid); +virtio_blk_setup_device (blk_schid);IPL_assert (virtio_ipl_disk_is_valid (),"No valid IPL device detected" ); }
pc-bios/s390-ccw/s390-ccw.h +1 -1
@@ -74,7 +74,7 @@ void sclp_get_loadparm_ascii(char *loadparm);unsigned long virtio_load_direct (ulong rec_list1,ulong rec_list2,ulong subchan_id,void *load_addr);bool virtio_is_supported (SubChannelId schid); -void virtio_setup_device (SubChannelId schid); +void virtio_blk_setup_device (SubChannelId schid);int virtio_read (ulong sector,void *load_addr);int enable_mss_facility (void );ulong get_second (void );
pc-bios/s390-ccw/virtio-blkdev.c new file +296 -0
296 lines not on this page · raw message
pc-bios/s390-ccw/virtio.c +6 -271
318 lines not on this page · raw message
pc-bios/s390-ccw/virtio.h +6 -0
@@ -291,6 +291,12 @@ struct VirtioCmd { };typedef struct VirtioCmd VirtioCmd ; +bool vring_notify (VRing *vr); +int drain_irqs (SubChannelId schid); +void vring_send_buf (VRing *vr,void *p,int len,int flags); +int vr_poll (VRing *vr); +int vring_wait_reply (void );int virtio_run (VDev *vdev,int vqid,VirtioCmd *cmd); +void virtio_setup_ccw (VDev *vdev);#endif /* VIRTIO_H */
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 35/40] s390x/cpumodel: we are always in zarchitecture mode
In reply to Christian BorntraegerFrom: "Jason J. Herne" <[email protected]>
In QEMU, a guest VCPU always started in and never was able to leave z/Architecture mode. Now we have an architected way of showing this condition.
The SIGP SET ARCHITECTURE instruction is simply rejected. Linux as guest seems to not care about the return value, which is a good thing The new handling is just like already being in z/Architecture mode.
We'll not try to fake absence of this facility, but still not indicate the facility in case some strange CPU model turned z/Architecture off completely (which doesn't work either way but let's us see how a guest would react on a lack of this facility).
--- target/s390x/cpu_features.c | 5 +++-- target/s390x/kvm.c | 38 +++++++++++--------------------------- 2 files changed, 14 insertions(+), 29 deletions(-)
target/s390x/cpu_features.c +3 -2
@@ -337,8 +337,9 @@ void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type,int bit_nr;if (type ==S390_FEAT_TYPE_STFL &&test_bit (S390_FEAT_ZARCH , features)) { -/* z/Architecture is always active if around */ - data[0 ] |=0x20 ; +/* Features that are always active */ + data[0 ] |=0x20 ;/* z/Architecture */ + data[17 ] |=0x20 ;/* Configuration-z-architectural-mode */ } feat =find_first_bit (features,S390_FEAT_MAX );
target/s390x/kvm.c +11 -27
@@ -1757,41 +1757,25 @@ static int sigp_set_architecture(S390CPU *cpu, uint32_t param, {CPUState *cur_cs;S390CPU *cur_cpu; +bool all_stopped = true; -/* due to the BQL, we are the only active cpu */ CPU_FOREACH (cur_cs) { cur_cpu =S390_CPU (cur_cs); -if (cur_cpu->env.sigp_order !=0 ) { -return SIGP_CC_BUSY ; + +if (cur_cpu == cpu) { +continue ; } -cpu_synchronize_state (cur_cs); -/* all but the current one have to be stopped */ -if (cur_cpu != cpu && -s390_cpu_get_state (cur_cpu) !=CPU_STATE_STOPPED ) { - *status_reg &=0xffffffff00000000ULL ; - *status_reg |=SIGP_STAT_INCORRECT_STATE ; -return SIGP_CC_STATUS_STORED ; +if (s390_cpu_get_state (cur_cpu) !=CPU_STATE_STOPPED ) { + all_stopped = false; } } -switch (param &0xff ) { -case SIGP_MODE_ESA_S390 : -/* not supported */ -return SIGP_CC_NOT_OPERATIONAL ; -case SIGP_MODE_Z_ARCH_TRANS_ALL_PSW : -case SIGP_MODE_Z_ARCH_TRANS_CUR_PSW : - CPU_FOREACH(cur_cs) { - cur_cpu =S390_CPU (cur_cs); - cur_cpu->env.pfault_token =-1UL ; - } -break ; -default : - *status_reg &=0xffffffff00000000ULL ; - *status_reg |=SIGP_STAT_INVALID_PARAMETER ; -return SIGP_CC_STATUS_STORED ; - } + *status_reg &=0xffffffff00000000ULL ; -return SIGP_CC_ORDER_CODE_ACCEPTED ; +/* Reject set arch order, with czam we're always in z/Arch mode. */ + *status_reg |= (all_stopped ?SIGP_STAT_INVALID_PARAMETER : +SIGP_STAT_INCORRECT_STATE ); +return SIGP_CC_STATUS_STORED ; }static int handle_sigp (S390CPU *cpu,struct kvm_run *run,uint8_t ipa1)
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PULL 35/40] s390x/cpumodel: we are always in zarchitecture mode
Quoted 29 lines · Christian Borntraeger
From: "Jason J. Herne" <[email protected]>
In QEMU, a guest VCPU always started in and never was able to leave z/Architecture mode. Now we have an architected way of showing this condition.
The SIGP SET ARCHITECTURE instruction is simply rejected. Linux as guest seems to not care about the return value, which is a good thing The new handling is just like already being in z/Architecture mode.
We'll not try to fake absence of this facility, but still not indicate the facility in case some strange CPU model turned z/Architecture off completely (which doesn't work either way but let's us see how a guest would react on a lack of this facility).
Signed-off-by Jason J. Herne <[email protected]>Acked-by Cornelia Huck <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>--- target/s390x/cpu_features.c | 5 +++-- target/s390x/kvm.c | 38 +++++++++++--------------------------- 2 files changed, 14 insertions(+), 29 deletions(-)target/s390x/cpu_features.c +0
-0
target/s390x/cpu_features.c void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type, · line 343
Quoted 9 lines
target/s390x/cpu_features.c +3
-2@@ -337,8 +337,9 @@ void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type,int bit_nr;if (type ==S390_FEAT_TYPE_STFL &&test_bit (S390_FEAT_ZARCH , features)) { -/* z/Architecture is always active if around */ - data[0 ] |=0x20 ; +/* Features that are always active */ + data[0 ] |=0x20 ;/* z/Architecture */ + data[17 ] |=0x20 ;/* Configuration-z-architectural-mode */ }
This also requires changes in TCG , no? (set architecture there is left untouched)
Signature · 3 lines
Thanks, David
Re: [Qemu-devel] [PULL 35/40] s390x/cpumodel: we are always in zarchitecture mode
Quoted 32 lines · David Hildenbrand
Quoted 31 lines · Christian Borntraeger
From: "Jason J. Herne" <[email protected]>
In QEMU, a guest VCPU always started in and never was able to leave z/Architecture mode. Now we have an architected way of showing this condition.
The SIGP SET ARCHITECTURE instruction is simply rejected. Linux as guest seems to not care about the return value, which is a good thing The new handling is just like already being in z/Architecture mode.
We'll not try to fake absence of this facility, but still not indicate the facility in case some strange CPU model turned z/Architecture off completely (which doesn't work either way but let's us see how a guest would react on a lack of this facility).
Signed-off-by Jason J. Herne <[email protected]>Acked-by Cornelia Huck <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>--- target/s390x/cpu_features.c | 5 +++-- target/s390x/kvm.c | 38 +++++++++++--------------------------- 2 files changed, 14 insertions(+), 29 deletions(-)target/s390x/cpu_features.c +0
-0@@ -337,8 +337,9 @@ void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type,int bit_nr;
Quoted 12 lines
target/s390x/cpu_features.c void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type, · line 343
Quoted 7 lines
target/s390x/cpu_features.c +3
-2if (type ==S390_FEAT_TYPE_STFL &&test_bit (S390_FEAT_ZARCH , features)) { -/* z/Architecture is always active if around */ - data[0 ] |=0x20 ; +/* Features that are always active */ + data[0 ] |=0x20 ;/* z/Architecture */ + data[17 ] |=0x20 ;/* Configuration-z-architectural-mode */ }This also requires changes in TCG , no? (set architecture there is left untouched)
Never mind, just realized we do our own block creation in do_stfle....
Signature · 3 lines
Thanks, David
[Qemu-devel] [PULL 28/40] pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP load
In reply to Christian BorntraegerFrom: Thomas Huth <[email protected]>
Most of the code has been taken from SLOF's netload.c file. Now we can finally load an image via TFTP and execute the downloaded kernel.
Message-Id: <[email protected]>
--- pc-bios/s390-ccw/netboot.mak | 14 ++- pc-bios/s390-ccw/netmain.c | 225 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 238 insertions(+), 1 deletion(-)
pc-bios/s390-ccw/netboot.mak +13 -1
@@ -1,7 +1,7 @@ SLOF_DIR := $(SRC_PATH)/roms/SLOF -NETOBJS := start.o sclp.o virtio.o virtio-net.o netmain.o libc.a +NETOBJS := start.o sclp.o virtio.o virtio-net.o netmain.o libnet.a libc.a LIBC_INC := -nostdinc -I$(SLOF_DIR)/lib/libc/include LIBNET_INC := -I$(SLOF_DIR)/lib/libnet
@@ -45,3 +45,15 @@ LIBCOBJS := $(STRING_OBJS) $(CTYPE_OBJS) $(STDLIB_OBJS) $(STDIO_OBJS) sbrk.o libc.a: $(LIBCOBJS) $(call quiet-command,$(AR) -rc $@ $^,"AR","$(TARGET_DIR)$@") + +# libnet files: + +LIBNETOBJS := args.o dhcp.o dns.o icmpv6.o ipv6.o tcp.o udp.o bootp.o \ + dhcpv6.o ethernet.o ipv4.o ndp.o tftp.o +LIBNETCFLAGS := $(QEMU_CFLAGS) $(LIBC_INC) $(LIBNET_INC) + +%.o : $(SLOF_DIR)/lib/libnet/%.c + $(call quiet-command,$(CC) $(LIBNETCFLAGS) -c -o $@ $<,"CC","$(TARGET_DIR)$@") + +libnet.a: $(LIBNETOBJS) + $(call quiet-command,$(AR) -rc $@ $^,"AR","$(TARGET_DIR)$@")
pc-bios/s390-ccw/netmain.c +225 -0
264 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 27/40] pc-bios/s390-ccw: Add virtio-net driver code
In reply to Christian BorntraegerFrom: Thomas Huth <[email protected]>
The driver provides the recv() and send() functions which will be required by SLOF's libnet code for receiving and sending packets.
Message-Id: <[email protected]>
--- pc-bios/s390-ccw/netboot.mak | 2 +- pc-bios/s390-ccw/virtio-net.c | 135 ++++++++++++++++++++++++++++++++++++++++++ pc-bios/s390-ccw/virtio.c | 5 ++ pc-bios/s390-ccw/virtio.h | 12 +++- 4 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 pc-bios/s390-ccw/virtio-net.c
pc-bios/s390-ccw/netboot.mak +1 -1
@@ -1,7 +1,7 @@ SLOF_DIR := $(SRC_PATH)/roms/SLOF -NETOBJS := start.o sclp.o virtio.o netmain.o libc.a +NETOBJS := start.o sclp.o virtio.o virtio-net.o netmain.o libc.a LIBC_INC := -nostdinc -I$(SLOF_DIR)/lib/libc/include LIBNET_INC := -I$(SLOF_DIR)/lib/libnet
pc-bios/s390-ccw/virtio-net.c new file +135 -0
135 lines not on this page · raw message
pc-bios/s390-ccw/virtio.c +5 -0
@@ -266,6 +266,11 @@ void virtio_setup_ccw(VDev *vdev)run_ccw (vdev,CCW_CMD_VDEV_RESET ,NULL ,0 );switch (vdev->senseid.cu_model) { +case VIRTIO_ID_NET : + vdev->nr_vqs =2 ; + vdev->cmd_vr_idx =0 ; + cfg_size =sizeof (vdev->config.net); +break ;case VIRTIO_ID_BLOCK : vdev->nr_vqs =1 ; vdev->cmd_vr_idx =0 ;
pc-bios/s390-ccw/virtio.h +10 -2
@@ -11,8 +11,6 @@#ifndef VIRTIO_H #define VIRTIO_H -#include "s390-ccw.h" -/* Status byte for guest to report progress, and synchronize features. */ /* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */ #define VIRTIO_CONFIG_S_ACKNOWLEDGE 1
@@ -227,6 +225,13 @@ struct ScsiDevice { };typedef struct ScsiDevice ScsiDevice ; +struct VirtioNetConfig { +uint8_t mac[6 ]; +/* uint16_t status; */ /* Only with VIRTIO_NET_F_STATUS */ +/* uint16_t max_virtqueue_pairs; */ /* Only with VIRTIO_NET_F_MQ */ +}; +typedef struct VirtioNetConfig VirtioNetConfig ; +struct VDev {int nr_vqs;VRing *vrings;
@@ -239,6 +244,7 @@ struct VDev {union {VirtioBlkConfig blk;VirtioScsiConfig scsi; +VirtioNetConfig net; } config;ScsiDevice *scsi_device;bool is_cdrom;
@@ -273,4 +279,6 @@ int vring_wait_reply(void);int virtio_run (VDev *vdev,int vqid,VirtioCmd *cmd);void virtio_setup_ccw (VDev *vdev); +int virtio_net_init (void *mac_addr); +#endif /* VIRTIO_H */
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 38/40] s390x/kvm: enable guarded storage
In reply to Christian BorntraegerFrom: Fan Zhang <[email protected]>
Introduce guarded storage support for KVM guests on s390. We need to enable the capability, extend machine check validity, sigp store-additional-status-at-address, and migration.
The feature is fenced for older machine type versions.
--- hw/s390x/s390-virtio-ccw.c | 18 ++++++++++ include/hw/s390x/s390-virtio-ccw.h | 3 ++ target/s390x/cpu.h | 7 ++++ target/s390x/kvm.c | 71 ++++++++++++++++++++++++++++++++------ target/s390x/machine.c | 17 +++++++++ 5 files changed, 106 insertions(+), 10 deletions(-)
hw/s390x/s390-virtio-ccw.c +18 -0
@@ -211,6 +211,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) s390mc->ri_allowed = true; s390mc->cpu_model_allowed = true; s390mc->css_migration_enabled = true; + s390mc->gs_allowed = true; mc->init = ccw_init; mc->reset = s390_machine_reset; mc->hot_add_cpu = s390_hot_add_cpu;
@@ -288,6 +289,22 @@ bool cpu_model_allowed(void)return get_machine_class ()->cpu_model_allowed; } +bool gs_allowed (void ) +{ +if (kvm_enabled ()) { +MachineClass *mc =MACHINE_GET_CLASS (qdev_get_machine ()); +if (object_class_dynamic_cast (OBJECT_CLASS (mc), +TYPE_S390_CCW_MACHINE )) { +S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc); + +return s390mc->gs_allowed; + } +/* Make sure the "none" machine can have gs */ +return true; + } +return false; +} +static char *machine_get_loadparm (Object *obj,Error **errp) {S390CcwMachineState *ms =S390_CCW_MACHINE (obj);
@@ -515,6 +532,7 @@ static void ccw_machine_2_9_class_options(MachineClass *mc) {S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc); + s390mc->gs_allowed = false;ccw_machine_2_10_class_options (mc);SET_MACHINE_COMPAT (mc,CCW_COMPAT_2_9 ); s390mc->css_migration_enabled = false;
include/hw/s390x/s390-virtio-ccw.h +3 -0
@@ -40,12 +40,15 @@ typedef struct S390CcwMachineClass {bool ri_allowed;bool cpu_model_allowed;bool css_migration_enabled; +bool gs_allowed; } S390CcwMachineClass;/* runtime-instrumentation allowed by the machine */ bool ri_allowed (void );/* cpu model allowed by the machine */ bool cpu_model_allowed (void ); +/* guarded-storage allowed by the machine */ +bool gs_allowed (void );/** * Returns true if (vmstate based) migration of the channel subsystem
target/s390x/cpu.h +7 -0
@@ -89,6 +89,7 @@ typedef struct CPUS390XState {CPU_DoubleU vregs[32 ][2 ];/* vector registers */ uint32_t aregs[16 ];/* access registers */ uint8_t riccb[64 ];/* runtime instrumentation control */ +uint64_t gscb[4 ];/* guarded storage control */ /* Fields up to this point are not cleared by initial CPU reset */ struct {} start_initial_reset_fields;
@@ -1166,6 +1167,7 @@ int kvm_s390_set_mem_limit(KVMState *s, uint64_t new_limit, uint64_t *hw_limit);void kvm_s390_vcpu_interrupt_pre_save (S390CPU *cpu);int kvm_s390_vcpu_interrupt_post_load (S390CPU *cpu);int kvm_s390_get_ri (void ); +int kvm_s390_get_gs (void );void kvm_s390_crypto_reset (void );#else static inline void kvm_s390_io_interrupt(uint16_t subchannel_id,
@@ -1220,6 +1222,10 @@ static inline int kvm_s390_get_ri(void) {return 0 ; } +static inline int kvm_s390_get_gs (void ) +{ +return 0 ; +}static inline void kvm_s390_crypto_reset (void ) { }
@@ -1328,6 +1334,7 @@ static inline bool s390_get_squash_mcss(void)#define MCIC_VB_CR 0x0000000400000000ULL#define MCIC_VB_ST 0x0000000100000000ULL#define MCIC_VB_AR 0x0000000040000000ULL +#define MCIC_VB_GS 0x0000000008000000ULL#define MCIC_VB_PR 0x0000000000200000ULL#define MCIC_VB_FC 0x0000000000100000ULL#define MCIC_VB_CT 0x0000000000020000ULL
target/s390x/kvm.c +61 -10
146 lines not on this page · raw message
target/s390x/machine.c +17 -0
@@ -174,6 +174,22 @@ const VMStateDescription vmstate_exval = { } }; +static bool gscb_needed (void *opaque) +{ +return kvm_s390_get_gs (); +} + +const VMStateDescription vmstate_gscb = { + .name ="cpu/gscb" , + .version_id =1 , + .minimum_version_id =1 , + .needed = gscb_needed, + .fields = (VMStateField []) { +VMSTATE_UINT64_ARRAY (env.gscb,S390CPU ,4 ), +VMSTATE_END_OF_LIST () + } +}; +const VMStateDescription vmstate_s390_cpu = { .name ="cpu" , .post_load = cpu_post_load,
@@ -207,6 +223,7 @@ const VMStateDescription vmstate_s390_cpu = { &vmstate_vregs, &vmstate_riccb, &vmstate_exval, + &vmstate_gscb, NULL }, };
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 39/40] s390x/arch_dump: also dump guarded storage control block
In reply to Christian BorntraegerWrite the new note section of type 30b (guarded storage control block).
--- include/elf.h | 1 + target/s390x/arch_dump.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+)
include/elf.h +1 -0
@@ -1476,6 +1476,7 @@ typedef struct elf64_shdr {#define NT_TASKSTRUCT 4#define NT_AUXV 6#define NT_PRXFPREG 0x46e62b7f/* copied from gdb5.1/include/elf/common.h */ +#define NT_S390_GS_CB 0x30b/* s390 guarded storage registers */ #define NT_S390_VXRS_HIGH 0x30a/* s390 vector registers 16-31 */ #define NT_S390_VXRS_LOW 0x309/* s390 vector registers 0-15 (lower half) */ #define NT_S390_PREFIX 0x305/* s390 prefix register */
target/s390x/arch_dump.c +18 -0
@@ -57,6 +57,12 @@ struct S390xElfVregsHiStruct {typedef struct S390xElfVregsHiStruct S390xElfVregsHi ; +struct S390xElfGSCBStruct { +uint64_t gsregs[4 ]; +}QEMU_PACKED ; + +typedef struct S390xElfGSCBStruct S390xElfGSCB ; + typedef struct noteStruct { Elf64_Nhdr hdr; char name[8];
@@ -65,6 +71,7 @@ typedef struct noteStruct {S390xElfFpregset fpregset;S390xElfVregsLo vregslo;S390xElfVregsHi vregshi; +S390xElfGSCB gscb;uint32_t prefix;uint64_t timer;uint64_t todcmp;
@@ -126,6 +133,16 @@ static void s390x_write_elf64_vregshi(Note *note, S390CPU *cpu, int id) } } +static void s390x_write_elf64_gscb (Note *note,S390CPU *cpu,int id) +{ +int i; + + note->hdr.n_type =cpu_to_be32 (NT_S390_GS_CB ); +for (i =0 ; i <4 ; i++) { + note->contents.gscb.gsregs[i] =cpu_to_be64 (cpu->env.gscb[i]); + } +} +static void s390x_write_elf64_timer (Note *note,S390CPU *cpu,int id) { note->hdr.n_type =cpu_to_be32 (NT_S390_TIMER );
@@ -181,6 +198,7 @@ static const NoteFuncDesc note_linux[] = { {sizeof(((Note *)0)->contents.todpreg), s390x_write_elf64_todpreg}, {sizeof(((Note *)0)->contents.vregslo), s390x_write_elf64_vregslo}, {sizeof(((Note *)0)->contents.vregshi), s390x_write_elf64_vregshi}, + {sizeof(((Note *)0)->contents.gscb), s390x_write_elf64_gscb}, { 0, NULL} };
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 40/40] s390x/gdb: add gs registers
In reply to Christian BorntraegerLet's provide the guarded storage registers via gdb server.
--- configure | 2 +- gdb-xml/s390-gs.xml | 14 ++++++++++++++ target/s390x/gdbstub.c | 24 ++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 gdb-xml/s390-gs.xml
configure +1 -1
@@ -6231,7 +6231,7 @@ case "$target_name" in echo "TARGET_ABI32=y" >> $config_target_mak ;; s390x) - gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml" + gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml" ;; tilegx) ;;
gdb-xml/s390-gs.xml new file +14 -0
@@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<!-- Copyright 2017 IBM Corp. + + This work is licensed under the terms of the GNU GPL, version 2 or + (at your option) any later version. See the COPYING file in the + top-level directory. --> + +<!DOCTYPE feature SYSTEM "gdb-target.dtd"> +<feature name="org.gnu.gdb.s390.gs"> + <reg name="gs_reserved" bitsize="64" type="uint64" group="system"/> + <reg name="gsd" bitsize="64" type="uint64" group="system"/> + <reg name="gssm" bitsize="64" type="uint64" group="system"/> + <reg name="gsepla" bitsize="64" type="data_ptr" group="system"/> +</feature>
target/s390x/gdbstub.c +24 -0
@@ -286,6 +286,26 @@ static int cpu_write_virt_reg(CPUS390XState *env, uint8_t *mem_buf, int n) }#endif +/* the values represent the positions in s390-gs.xml */ +#define S390_GS_RESERVED_REGNUM 0 +#define S390_GS_GSD_REGNUM 1 +#define S390_GS_GSSM_REGNUM 2 +#define S390_GS_GSEPLA_REGNUM 3 +/* total number of registers in s390-gs.xml */ +#define S390_NUM_GS_REGS 4 + +static int cpu_read_gs_reg (CPUS390XState *env,uint8_t *mem_buf,int n) +{ +return gdb_get_regl (mem_buf, env->gscb[n]); +} + +static int cpu_write_gs_reg (CPUS390XState *env,uint8_t *mem_buf,int n) +{ + env->gscb[n] =ldtul_p (mem_buf); +cpu_synchronize_post_init (ENV_GET_CPU (env)); +return 8 ; +} +void s390_cpu_gdb_init (CPUState *cs) { gdb_register_coprocessor(cs, cpu_read_ac_reg,
@@ -300,6 +320,10 @@ void s390_cpu_gdb_init(CPUState *cs) cpu_write_vreg, S390_NUM_VREGS, "s390-vx.xml", 0); +gdb_register_coprocessor (cs, cpu_read_gs_reg, + cpu_write_gs_reg, +S390_NUM_GS_REGS ,"s390-gs.xml" ,0 ); +#ifndef CONFIG_USER_ONLY gdb_register_coprocessor(cs, cpu_read_c_reg, cpu_write_c_reg,
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 26/40] pc-bios/s390-ccw: Add core files for the network bootloading program
In reply to Christian BorntraegerFrom: Thomas Huth <[email protected]>
This is just a preparation for the next steps: Add a makefile and a stripped down copy of pc-bios/s390-ccw/main.c as a basis for the network bootloader program, linked against the libc from SLOF already (which we will need for SLOF's libnet). The networking code is not included yet.
Message-Id: <[email protected]>
--- pc-bios/s390-ccw/Makefile | 11 +++- pc-bios/s390-ccw/netboot.mak | 47 +++++++++++++++ pc-bios/s390-ccw/netmain.c | 136 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 192 insertions(+), 2 deletions(-) create mode 100644 pc-bios/s390-ccw/netboot.mak create mode 100644 pc-bios/s390-ccw/netmain.c
pc-bios/s390-ccw/Makefile +9 -2
@@ -16,7 +16,7 @@ QEMU_CFLAGS += -march=z900 -fPIE -fno-strict-aliasing QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector) LDFLAGS += -Wl,-pie -nostdlib -build-all: s390-ccw.img +build-all: s390-ccw.img s390-netboot.img s390-ccw.elf: $(OBJECTS) $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),"BUILD","$(TARGET_DIR)$@")
@@ -28,5 +28,12 @@ s390-ccw.img: s390-ccw.elf $(OBJECTS): Makefile +ifneq ($(wildcard $(SRC_PATH)/roms/SLOF/lib/libnet),) +include $(SRC_PATH)/pc-bios/s390-ccw/netboot.mak +else +s390-netboot.img: + @echo "s390-netboot.img not built since roms/SLOF/ is not available." +endif + clean: - rm -f *.o *.d *.img *.elf *~ + $(RM) *.o *.d *.img *.elf *~ *.a
pc-bios/s390-ccw/netboot.mak new file +47 -0
47 lines not on this page · raw message
pc-bios/s390-ccw/netmain.c new file +136 -0
136 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 25/40] roms/SLOF: Update submodule to latest status
In reply to Christian BorntraegerFrom: Thomas Huth <[email protected]>
We need the latest fixes for building the libc and libnet of SLOF for the s390-ccw network bootloader firmware.
Message-Id: <[email protected]>
--- roms/SLOF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
roms/SLOF +1 -1
@@ -1 +1 @@ -Subproject commit 66d250ef0fd06bb88b7399b9563b5008201f2d63 +Subproject commit 834113a1c67d6fb53dea153c3313d182238f2d36
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 19/40] pc-bios/s390-ccw: Move ebc2asc to sclp.c
In reply to Christian BorntraegerFrom: Thomas Huth <[email protected]>
We will later need this array in a file that we will link to the netboot code, too. Since there is some ebcdic conversion done in sclp_get_loadparm_ascii(), the sclp.c file seems to be a good candidate.
Message-Id: <[email protected]>
--- pc-bios/s390-ccw/main.c | 11 ----------- pc-bios/s390-ccw/sclp.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-)
pc-bios/s390-ccw/main.c +0 -11
@@ -17,17 +17,6 @@ static SubChannelId blk_schid = { .one = 1 }; IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE)));static char loadparm[8 ] = {0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 }; -const unsigned char ebc2asc[256 ] = -/* 0123456789abcdef0123456789abcdef */ -"................................" /* 1F */ -"................................" /* 3F */ -" ...........<(+|&.........!$*);." /* 5F first.chr.here.is.real.space */ -"-/.........,%_>?.........`:#@'=\"" /* 7F */ -".abcdefghi.......jklmnopqr......" /* 9F */ -"..stuvwxyz......................" /* BF */ -".ABCDEFGHI.......JKLMNOPQR......" /* DF */ -"..STUVWXYZ......0123456789......" ;/* FF */ -/* * Priniciples of Operations (SA22-7832-09) chapter 17 requires that * a subsystem-identification is at 184-187 and bytes 188-191 are zero
pc-bios/s390-ccw/sclp.c +11 -0
@@ -14,6 +14,17 @@ static char _sccb[PAGE_SIZE] __attribute__((__aligned__(4096))); +const unsigned char ebc2asc[256 ] = +/* 0123456789abcdef0123456789abcdef */ +"................................" /* 1F */ +"................................" /* 3F */ +" ...........<(+|&.........!$*);." /* 5F first.chr.here.is.real.space */ +"-/.........,%_>?.........`:#@'=\"" /* 7F */ +".abcdefghi.......jklmnopqr......" /* 9F */ +"..stuvwxyz......................" /* BF */ +".ABCDEFGHI.......JKLMNOPQR......" /* DF */ +"..STUVWXYZ......0123456789......" ;/* FF */ +/* Perform service call. Return 0 on success, non-zero otherwise. */ static int sclp_service_call (unsigned int command,void *sccb) {
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 22/40] pc-bios/s390-ccw: Move byteswap functions to a separate header
In reply to Christian BorntraegerFrom: Thomas Huth <[email protected]>
We'll need them in code that is not related to bootmap.h, so they should reside in an independent header.
Message-Id: <[email protected]>
--- pc-bios/s390-ccw/bootmap.c | 1 + pc-bios/s390-ccw/bootmap.h | 26 -------------------------- pc-bios/s390-ccw/bswap.h | 30 ++++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 26 deletions(-) create mode 100644 pc-bios/s390-ccw/bswap.h
pc-bios/s390-ccw/bootmap.c +1 -0
@@ -12,6 +12,7 @@#include "s390-ccw.h" #include "bootmap.h" #include "virtio.h" +#include "bswap.h" #ifdef DEBUG /* #define DEBUG_FALLBACK */
pc-bios/s390-ccw/bootmap.h +0 -26
@@ -324,32 +324,6 @@ static inline int _memcmp(const void *s1, const void *s2, size_t n)return 0 ; } -/* from include/qemu/bswap.h */ - -/* El Torito is always little-endian */ -static inline uint16_t bswap16 (uint16_t x) -{ -return ((x &0x00ff ) <<8 ) | ((x &0xff00 ) >>8 ); -} - -static inline uint32_t bswap32 (uint32_t x) -{ -return ((x &0x000000ffU ) <<24 ) | ((x &0x0000ff00U ) <<8 ) | - ((x &0x00ff0000U ) >>8 ) | ((x &0xff000000U ) >>24 ); -} - -static inline uint64_t bswap64 (uint64_t x) -{ -return ((x &0x00000000000000ffULL ) <<56 ) | - ((x &0x000000000000ff00ULL ) <<40 ) | - ((x &0x0000000000ff0000ULL ) <<24 ) | - ((x &0x00000000ff000000ULL ) <<8 ) | - ((x &0x000000ff00000000ULL ) >>8 ) | - ((x &0x0000ff0000000000ULL ) >>24 ) | - ((x &0x00ff000000000000ULL ) >>40 ) | - ((x &0xff00000000000000ULL ) >>56 ); -} -static inline uint32_t iso_733_to_u32 (uint64_t x) {return (uint32_t )x;
pc-bios/s390-ccw/bswap.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Byte swap functions - taken from include/qemu/bswap.h +* +* This work is licensed under the terms of the GNU GPL, version 2 or (at +* your option) any later version. See the COPYING file in the top-level +* directory. +*/ + +static inline uint16_t bswap16 (uint16_t x) +{ +return ((x &0x00ff ) <<8 ) | ((x &0xff00 ) >>8 ); +} + +static inline uint32_t bswap32 (uint32_t x) +{ +return ((x &0x000000ffU ) <<24 ) | ((x &0x0000ff00U ) <<8 ) | + ((x &0x00ff0000U ) >>8 ) | ((x &0xff000000U ) >>24 ); +} + +static inline uint64_t bswap64 (uint64_t x) +{ +return ((x &0x00000000000000ffULL ) <<56 ) | + ((x &0x000000000000ff00ULL ) <<40 ) | + ((x &0x0000000000ff0000ULL ) <<24 ) | + ((x &0x00000000ff000000ULL ) <<8 ) | + ((x &0x000000ff00000000ULL ) >>8 ) | + ((x &0x0000ff0000000000ULL ) >>24 ) | + ((x &0x00ff000000000000ULL ) >>40 ) | + ((x &0xff00000000000000ULL ) >>56 ); +}
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 23/40] pc-bios/s390-ccw: Remove unused structs from virtio.h
In reply to Christian BorntraegerFrom: Thomas Huth <[email protected]>
Looks like they have never been used, so let's simply remove them.
Message-Id: <[email protected]>
--- pc-bios/s390-ccw/virtio.h | 27 --------------------------- 1 file changed, 27 deletions(-)
pc-bios/s390-ccw/virtio.h +0 -27
@@ -32,24 +32,6 @@ enum VirtioDevType { };typedef enum VirtioDevType VirtioDevType ; -struct VirtioDevHeader { -VirtioDevType type:8 ; -uint8_t num_vq; -uint8_t feature_len; -uint8_t config_len; -uint8_t status; -uint8_t vqconfig[]; -} __attribute__((packed)); -typedef struct VirtioDevHeader VirtioDevHeader ; - -struct VirtioVqConfig { -uint64_t token; -uint64_t address; -uint16_t num; -uint8_t pad[6 ]; -} __attribute__((packed)); -typedef struct VirtioVqConfig VirtioVqConfig ; -struct VqInfo {uint64_t queue;uint32_t align;
@@ -64,15 +46,6 @@ struct VqConfig { } __attribute__((packed));typedef struct VqConfig VqConfig ; -struct VirtioDev { -VirtioDevHeader *header; -VirtioVqConfig *vqconfig; -char *host_features; -char *guest_features; -char *config; -}; -typedef struct VirtioDev VirtioDev ; -#define VIRTIO_RING_SIZE (PAGE_SIZE * 8)#define VIRTIO_MAX_VQS 3#define KVM_S390_VIRTIO_RING_ALIGN 4096
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 14/40] s390x/css: add missing css state conditionally
In reply to Christian BorntraegerFrom: Halil Pasic <[email protected]>
Although we have recently vmstatified the migration of some css infrastructure, for some css entities there is still state to be migrated left, because the focus was keeping migration stream compatibility (that is basically everything as-is).
Let us add vmstate helpers and extend existing vmstate descriptions so that we have everything we need. Let us guard the added state via css_migration_enabled, so we keep the compatible behavior if css migration is disabled.
Let's also annotate the bits which do not need to be migrated for better readability.
Message-Id: <[email protected]>
--- hw/intc/s390_flic.c | 20 +++++++++++++++ hw/s390x/css.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+)
hw/intc/s390_flic.c +20 -0
@@ -200,6 +200,22 @@ static void qemu_s390_flic_register_types(void)type_init (qemu_s390_flic_register_types) +static bool adapter_info_so_needed(void *opaque) +{ +return css_migration_enabled (); +} + +const VMStateDescription vmstate_adapter_info_so = { + .name ="s390_adapter_info/summary_offset" , + .version_id =1 , + .minimum_version_id =1 , + .needed = adapter_info_so_needed, + .fields = (VMStateField []) { +VMSTATE_UINT32 (summary_offset, AdapterInfo), +VMSTATE_END_OF_LIST () + } +}; +const VMStateDescription vmstate_adapter_info = { .name ="s390_adapter_info" , .version_id =1 ,
@@ -213,6 +229,10 @@ const VMStateDescription vmstate_adapter_info = {*/ VMSTATE_END_OF_LIST () }, + .subsections = (const VMStateDescription * []) { + &vmstate_adapter_info_so, +NULL + } };const VMStateDescription vmstate_adapter_routes = {
hw/s390x/css.c +74 -0
108 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 15/40] s390x/css: add ORB to SubchDev
In reply to Christian BorntraegerFrom: Halil Pasic <[email protected]>
Since we are going to need a migration compatibility breaking change to activate ChannelSubSys migration let us use the opportunity to introduce ORB to the SubchDev before that (otherwise we would need separate handling e.g. a compat property).
The ORB will be useful for implementing IDA, or async handling of subchannel work.
Message-Id: <[email protected]>
--- hw/s390x/css.c | 35 +++++++++++++++++++++++++++++++++++ include/hw/s390x/css.h | 1 + 2 files changed, 36 insertions(+)
hw/s390x/css.c +35 -0
@@ -165,6 +165,36 @@ static const VMStateDescription vmstate_sense_id = { } }; +static const VMStateDescription vmstate_orb = { + .name ="s390_orb" , + .version_id =1 , + .minimum_version_id =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32 (intparm,ORB ), +VMSTATE_UINT16 (ctrl0,ORB ), +VMSTATE_UINT8 (lpm,ORB ), +VMSTATE_UINT8 (ctrl1,ORB ), +VMSTATE_UINT32 (cpa,ORB ), +VMSTATE_END_OF_LIST () + } +}; + +static bool vmstate_schdev_orb_needed (void *opaque) +{ +return css_migration_enabled (); +} + +static const VMStateDescription vmstate_schdev_orb = { + .name ="s390_subch_dev/orb" , + .version_id =1 , + .minimum_version_id =1 , + .needed = vmstate_schdev_orb_needed, + .fields = (VMStateField []) { +VMSTATE_STRUCT (orb, SubchDev,1 , vmstate_orb,ORB ), +VMSTATE_END_OF_LIST () + } +}; +static int subch_dev_post_load (void *opaque,int version_id);static void subch_dev_pre_save (void *opaque);
@@ -193,6 +223,10 @@ const VMStateDescription vmstate_subch_dev = { VMSTATE_BOOL(ccw_fmt_1, SubchDev), VMSTATE_UINT8(ccw_no_data_cnt, SubchDev),VMSTATE_END_OF_LIST () + }, + .subsections = (const VMStateDescription * []) { + &vmstate_schdev_orb, +NULL } };
@@ -1386,6 +1420,7 @@ int css_do_ssch(SubchDev *sch, ORB *orb)if (channel_subsys.chnmon_active) {css_update_chnmon (sch); } + sch->orb = *orb; sch->channel_prog = orb->cpa;/* Trigger the start function. */ s->ctrl |= (SCSW_FCTL_START_FUNC |SCSW_ACTL_START_PEND );
include/hw/s390x/css.h +1 -0
@@ -90,6 +90,7 @@ struct SubchDev {bool thinint_active;uint8_t ccw_no_data_cnt;uint16_t migrated_schid;/* used for missmatch detection */ +ORB orb;/* transport-provided data: */ int (*ccw_cb) (SubchDev *,CCW1 );void (*disable_cb)(SubchDev *);
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 06/40] s390x/cpumodel: provide compat handling for new cpu features
In reply to Christian BorntraegerFrom: "Jason J. Herne" <[email protected]>
Provide a mechanism to disable features in compatibility machines.
--- target/s390x/cpu_models.c | 26 ++++++++++++++++++++++++++ target/s390x/cpu_models.h | 2 ++ 2 files changed, 28 insertions(+)
target/s390x/cpu_models.c +26 -0
@@ -77,6 +77,32 @@ static S390CPUDef s390_cpu_defs[] = { CPUDEF_INIT(0x2965, 13, 2, 47, 0x08000000U, "z13s", "IBM z13s GA1"), }; +void s390_cpudef_featoff (uint8_t gen,uint8_t ec_ga,S390Feat feat) +{ +const S390CPUDef *def; + + def =s390_find_cpu_def (0 , gen, ec_ga,NULL ); +clear_bit (feat, (unsigned long *)&def->default_feat); +} + +void s390_cpudef_featoff_greater (uint8_t gen,uint8_t ec_ga,S390Feat feat) +{ +int i; + +for (i =0 ; i <ARRAY_SIZE (s390_cpu_defs); i++) { +const S390CPUDef *def = &s390_cpu_defs[i]; + +if (def->gen < gen) { +continue ; + } +if (def->gen == gen && def->ec_ga < ec_ga) { +continue ; + } + +clear_bit (feat, (unsigned long *)&def->default_feat); + } +} +uint32_t s390_get_hmfai (void ) {static S390CPU *cpu;
target/s390x/cpu_models.h +2 -0
@@ -72,6 +72,8 @@ typedef struct S390CPUModel {#define ibc_gen (x) (x == 0 ? 0 : ((x >> 4) + S390_GEN_Z10))#define ibc_ec_ga (x) (x & 0xf) +void s390_cpudef_featoff (uint8_t gen,uint8_t ec_ga,S390Feat feat); +void s390_cpudef_featoff_greater (uint8_t gen,uint8_t ec_ga,S390Feat feat);uint32_t s390_get_hmfai (void );uint8_t s390_get_mha_pow (void );uint32_t s390_get_ibc_val (void );
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 36/40] s390x/cpumodel: add esop/esop2 to z12 model
In reply to Christian BorntraegerFrom: "Jason J. Herne" <[email protected]>
Add esop and esop2 features to z12 model where esop2 was originally introduced. Disable esop and esop2 when using compatibility machine v2.9 or earlier.
--- hw/s390x/s390-virtio-ccw.c | 3 +++ target/s390x/gen-features.c | 3 +++ 2 files changed, 6 insertions(+)
hw/s390x/s390-virtio-ccw.c +3 -0
@@ -30,6 +30,7 @@#include "hw/s390x/s390-virtio-ccw.h" #include "hw/s390x/css-bridge.h" #include "migration/register.h" +#include "cpu_models.h" static const char *const reset_dev_types[] = {TYPE_VIRTUAL_CSS_BRIDGE ,
@@ -503,6 +504,8 @@ DEFINE_CCW_MACHINE(2_10, "2.10", true);static void ccw_machine_2_9_instance_options (MachineState *machine) {ccw_machine_2_10_instance_options (machine); +s390_cpudef_featoff_greater (12 ,1 ,S390_FEAT_ESOP ); +s390_cpudef_featoff_greater (12 ,1 ,S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2 );s390_cpudef_featoff_greater (12 ,1 ,S390_FEAT_ZPCI );s390_cpudef_featoff_greater (12 ,1 ,S390_FEAT_ADAPTER_INT_SUPPRESSION );s390_cpudef_featoff_greater (12 ,1 ,S390_FEAT_ADAPTER_EVENT_NOTIFICATION );
target/s390x/gen-features.c +3 -0
@@ -429,6 +429,7 @@ static uint16_t full_GEN12_GA1[] = {S390_FEAT_ADAPTER_EVENT_NOTIFICATION ,S390_FEAT_ADAPTER_INT_SUPPRESSION ,S390_FEAT_EDAT_2 , + S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2, }; static uint16_t full_GEN12_GA2[] = {
@@ -488,6 +489,8 @@ static uint16_t default_GEN12_GA1[] = {S390_FEAT_ZPCI ,S390_FEAT_ADAPTER_EVENT_NOTIFICATION ,S390_FEAT_EDAT_2 , +S390_FEAT_ESOP , + S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2, };#define default_GEN12_GA2 EmptyFeat
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 37/40] s390x/kvm: Enable KSS facility for nested virtualization
In reply to Christian BorntraegerFrom: Farhan Ali <[email protected]>
If the host supports keyless subset (KSS) then first level guest (G2) should enable KSS facility as well.
--- target/s390x/kvm.c | 1 + 1 file changed, 1 insertion(+)
target/s390x/kvm.c +1 -0
@@ -2508,6 +2508,7 @@ static int kvm_to_feat[][2] = { { KVM_S390_VM_CPU_FEAT_CMMA, S390_FEAT_SIE_CMMA }, { 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}, };static int query_cpu_feat (S390FeatBitmap features)
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PULL 37/40] s390x/kvm: Enable KSS facility for nested virtualization
Quoted 19 lines · Christian Borntraeger
From: Farhan Ali <[email protected]>
If the host supports keyless subset (KSS) then first level guest (G2) should enable KSS facility as well.
Signed-off-by Farhan Ali <[email protected]>Reviewed-by Eric Farman <[email protected]>Acked-by Cornelia Huck <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>--- target/s390x/kvm.c | 1 + 1 file changed, 1 insertion(+)target/s390x/kvm.c +0
-0
target/s390x/kvm.c static int kvm_to_feat[][2] = { · line 2514
Quoted 7 lines
target/s390x/kvm.c +1
-0@@ -2508,6 +2508,7 @@ static int kvm_to_feat[][2] = { { KVM_S390_VM_CPU_FEAT_CMMA, S390_FEAT_SIE_CMMA }, { 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}, };static int query_cpu_feat (S390FeatBitmap features)
This bit is not part of any cpu model, so how is this helpful? (AFAIK it will simply be dropped from the host model)
Signature · 3 lines
Thanks, David
Re: [Qemu-devel] [PULL 37/40] s390x/kvm: Enable KSS facility for nested virtualization
Quoted 25 lines · David Hildenbrand
Quoted 24 lines · Christian Borntraeger
From: Farhan Ali <[email protected]>
If the host supports keyless subset (KSS) then first level guest (G2) should enable KSS facility as well.
Signed-off-by Farhan Ali <[email protected]>Reviewed-by Eric Farman <[email protected]>Acked-by Cornelia Huck <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>--- target/s390x/kvm.c | 1 + 1 file changed, 1 insertion(+)target/s390x/kvm.c +1
-0@@ -2508,6 +2508,7 @@ static int kvm_to_feat[][2] = { { KVM_S390_VM_CPU_FEAT_CMMA, S390_FEAT_SIE_CMMA }, { 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}, };
Quoted 5 lines
target/s390x/kvm.c static int kvm_to_feat[][2] = { · line 2514
Quoted 2 lines
target/s390x/kvm.c +0
-0static int query_cpu_feat (S390FeatBitmap features)This bit is not part of any cpu model, so how is this helpful? (AFAIK it will simply be dropped from the host model)
See the new patch for z14. ( i had to defer that part till todays announcement)
[Qemu-devel] [PULL 13/40] s390x: add css_migration_enabled to machine class
In reply to Christian BorntraegerFrom: Halil Pasic <[email protected]>
Currently the migration of the channel subsystem (css) is only partial and is done by the virtio ccw proxies -- the only migratable css devices existing at the moment.
With the current work on emulated and passthrough devices we need to decouple the migration of the channel subsystem state from virtio ccw, and have a separate section for it. A new section however necessarily breaks the migration compatibility.
So let us introduce a switch at the machine class, and put it in 'off' state for now. We will turn the switch 'on' for future machines once all preparations are met. For compatibility machines the switch will stay 'off'.
Message-Id: <[email protected]>
--- hw/s390x/s390-virtio-ccw.c | 13 +++++++++++++ include/hw/s390x/s390-virtio-ccw.h | 7 +++++++ 2 files changed, 20 insertions(+)
hw/s390x/s390-virtio-ccw.c +13 -0
@@ -209,6 +209,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) s390mc->ri_allowed = true; s390mc->cpu_model_allowed = true; + s390mc->css_migration_enabled = false;/* TODO: set to true */ mc->init = ccw_init; mc->reset = s390_machine_reset; mc->hot_add_cpu = s390_hot_add_cpu;
@@ -378,6 +379,11 @@ static const TypeInfo ccw_machine_info = { }, }; +bool css_migration_enabled (void ) +{ +return get_machine_class ()->css_migration_enabled; +} +#define DEFINE_CCW_MACHINE (suffix, verstr, latest) \ static void ccw_machine_##suffix##_class_init(ObjectClass *oc, \ void *data) \
@@ -484,6 +490,10 @@ static const TypeInfo ccw_machine_info = {static void ccw_machine_2_10_instance_options (MachineState *machine) { +/* +* TODO Once preparations are done register vmstate for the css if +* css_migration_enabled(). +*/ }static void ccw_machine_2_10_class_options (MachineClass *mc)
@@ -498,8 +508,11 @@ static void ccw_machine_2_9_instance_options(MachineState *machine)static void ccw_machine_2_9_class_options (MachineClass *mc) { +S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc); +ccw_machine_2_10_class_options (mc);SET_MACHINE_COMPAT (mc,CCW_COMPAT_2_9 ); + s390mc->css_migration_enabled = false; } DEFINE_CCW_MACHINE(2_9, "2.9", false);
include/hw/s390x/s390-virtio-ccw.h +7 -0
@@ -39,6 +39,7 @@ typedef struct S390CcwMachineClass {/*< public >*/ bool ri_allowed;bool cpu_model_allowed; +bool css_migration_enabled; } S390CcwMachineClass;/* runtime-instrumentation allowed by the machine */
@@ -46,4 +47,10 @@ bool ri_allowed(void);/* cpu model allowed by the machine */ bool cpu_model_allowed (void ); +/** +* Returns true if (vmstate based) migration of the channel subsystem +* is enabled, false if it is disabled. +*/ +bool css_migration_enabled (void ); +#endif
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 30/40] pc-bios/s390: rebuild s390-ccw.img
In reply to Christian Borntraegerrebuild after the following commits
4b996d0 pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP load e6879a6 pc-bios/s390-ccw: Add virtio-net driver code
766500f pc-bios/s390-ccw: Add core files for the network bootloading program f807e55 pc-bios/s390-ccw: Add code for virtio feature negotiation b4e3b4f pc-bios/s390-ccw: Remove unused structs from virtio.h
dd3dc5e pc-bios/s390-ccw: Move byteswap functions to a separate header a20b4fe pc-bios/s390-ccw: Add a write() function for stdio
262e07c pc-bios/s390-ccw: Move virtio-block related functions into a separate file 7438d32 pc-bios/s390-ccw: Move ebc2asc to sclp.c
8760bad pc-bios/s390-ccw: Move libc functions to separate header c68f450 pc-bios/s390-ccw: use STRIP variable in Makefile
--- pc-bios/s390-ccw.img | Bin 26480 -> 30520 bytes 1 file changed, 0 insertions(+), 0 deletions(-)
pc-bios/s390-ccw.img binary +0 -0
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 09/40] s390x/flic: introduce inject_airq callback
In reply to Christian BorntraegerFrom: Yi Min Zhao <[email protected]>
Let's introduce a specialized way to inject adapter interrupts that, unlike the common interrupt injection method, allows to take the characteristics of the adapter into account.
For adapters subject to AIS facility:
- for non-kvm case, we handle the suppression for a given ISC in QEMU.
- for kvm case, we pass adapter id to kvm to do airq injection.
Add add tracepoint for suppressed airq and suppressing airq.
--- hw/intc/s390_flic.c | 27 +++++++++++++++++++++++++++ hw/intc/s390_flic_kvm.c | 18 ++++++++++++++++++ hw/intc/trace-events | 4 ++++ include/hw/s390x/s390_flic.h | 2 ++ 4 files changed, 51 insertions(+)
hw/intc/s390_flic.c +27 -0
@@ -13,8 +13,11 @@#include "qemu/osdep.h" #include "qemu/error-report.h" #include "hw/sysbus.h" +#include "hw/s390x/ioinst.h" #include "hw/s390x/s390_flic.h" +#include "hw/s390x/css.h" #include "trace.h" +#include "cpu.h" #include "hw/qdev.h" #include "qapi/error.h" #include "hw/s390x/s390-virtio-ccw.h"
@@ -100,6 +103,29 @@ static int qemu_s390_modify_ais_mode(S390FLICState *fs, uint8_t isc,return 0 ; } +static int qemu_s390_inject_airq (S390FLICState *fs,uint8_t type, +uint8_t isc,uint8_t flags) +{ +QEMUS390FLICState *flic =QEMU_S390_FLIC (fs); +bool flag = flags &S390_ADAPTER_SUPPRESSIBLE ; +uint32_t io_int_word = (isc <<27 ) |IO_INT_WORD_AI ; + +if (flag && (flic->nimm &AIS_MODE_MASK (isc))) { +trace_qemu_s390_airq_suppressed (type, isc); +return 0 ; + } + +s390_io_interrupt (0 ,0 ,0 , io_int_word); + +if (flag && (flic->simm &AIS_MODE_MASK (isc))) { + flic->nimm |=AIS_MODE_MASK (isc); +trace_qemu_s390_suppress_airq (isc,"Single-Interruption Mode" , +"NO-Interruptions Mode" ); + } + +return 0 ; +} +static void qemu_s390_flic_reset (DeviceState *dev) {QEMUS390FLICState *flic =QEMU_S390_FLIC (dev);
@@ -120,6 +146,7 @@ static void qemu_s390_flic_class_init(ObjectClass *oc, void *data) fsc->release_adapter_routes = qemu_s390_release_adapter_routes; fsc->clear_io_irq = qemu_s390_clear_io_flic; fsc->modify_ais_mode = qemu_s390_modify_ais_mode; + fsc->inject_airq = qemu_s390_inject_airq; }static Property s390_flic_common_properties[] = {
hw/intc/s390_flic_kvm.c +18 -0
@@ -170,6 +170,23 @@ static int kvm_s390_modify_ais_mode(S390FLICState *fs, uint8_t isc,return ioctl (flic->fd,KVM_SET_DEVICE_ATTR , &attr) ? -errno :0 ; } +static int kvm_s390_inject_airq (S390FLICState *fs,uint8_t type, +uint8_t isc,uint8_t flags) +{ +KVMS390FLICState *flic =KVM_S390_FLIC (fs); +uint32_t id =css_get_adapter_id (type, isc); +struct kvm_device_attr attr = { + .group =KVM_DEV_FLIC_AIRQ_INJECT , + .attr = id, + }; + +if (!fs->ais_supported) { +return -ENOSYS ; + } + +return ioctl (flic->fd,KVM_SET_DEVICE_ATTR , &attr) ? -errno :0 ; +} +/** * __get_all_irqs - store all pending irqs in buffer * @flic: pointer to flic device state
@@ -515,6 +532,7 @@ static void kvm_s390_flic_class_init(ObjectClass *oc, void *data) fsc->release_adapter_routes = kvm_s390_release_adapter_routes; fsc->clear_io_irq = kvm_s390_clear_io_flic; fsc->modify_ais_mode = kvm_s390_modify_ais_mode; + fsc->inject_airq = kvm_s390_inject_airq; }static const TypeInfo kvm_s390_flic_info = {
hw/intc/trace-events +4 -0
@@ -73,6 +73,10 @@ flic_create_device(int err) "flic: create device failed %d" flic_no_device_api(int err) "flic: no Device Contral API support %d" flic_reset_failed(int err) "flic: reset failed %d" +# hw/intc/s390_flic.c +qemu_s390_airq_suppressed(uint8_t type, uint8_t isc) "flic: adapter I/O interrupt suppressed (type %x isc %x)" +qemu_s390_suppress_airq(uint8_t isc, const char *from, const char *to) "flic: for isc %x, suppress airq by modifying ais mode from %s to %s" + # hw/intc/aspeed_vic.c aspeed_vic_set_irq(int irq, int level) "Enabling IRQ %d: %d" aspeed_vic_update_fiq(int flags) "Raising FIQ: %d"
include/hw/s390x/s390_flic.h +2 -0
@@ -64,6 +64,8 @@ typedef struct S390FLICStateClass {int (*clear_io_irq)(S390FLICState *fs,uint16_t subchannel_id,uint16_t subchannel_nr);int (*modify_ais_mode)(S390FLICState *fs,uint8_t isc,uint16_t mode); +int (*inject_airq)(S390FLICState *fs,uint8_t type,uint8_t isc, +uint8_t flags); } S390FLICStateClass;#define TYPE_KVM_S390_FLIC "s390-flic-kvm"
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 11/40] s390x/css: update css_adapter_interrupt
In reply to Christian BorntraegerFrom: Yi Min Zhao <[email protected]>
Let's use the new inject_airq callback of flic to inject adapter interrupts. For kvm case, if the kernel flic doesn't support the new interface, the irq routine remains unchanged. For non-kvm case, qemu-flic handles the suppression process.
--- hw/s390x/css.c | 18 ++++++++++++++++-- hw/s390x/s390-pci-bus.c | 2 +- hw/s390x/virtio-ccw.c | 2 +- include/hw/s390x/css.h | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-)
hw/s390x/css.c +16 -2
@@ -547,12 +547,26 @@ out:return r; } -void css_adapter_interrupt (uint8_t isc) +void css_adapter_interrupt (CssIoAdapterType type,uint8_t isc) { +S390FLICState *fs =s390_get_flic (); +S390FLICStateClass *fsc =S390_FLIC_COMMON_GET_CLASS (fs);uint32_t io_int_word = (isc <<27 ) |IO_INT_WORD_AI ; +IoAdapter *adapter = channel_subsys.io_adapters[type][isc]; + +if (!adapter) { +return ; + }trace_css_adapter_interrupt (isc); -s390_io_interrupt (0 ,0 ,0 , io_int_word); +if (fs->ais_supported) { +if (fsc->inject_airq (fs, type, isc, adapter->flags)) { +error_report ("Failed to inject airq with AIS supported" ); +exit (1 ); + } + }else { +s390_io_interrupt (0 ,0 ,0 , io_int_word); + } }static void sch_handle_clear_func (SubchDev *sch)
hw/s390x/s390-pci-bus.c +1 -1
@@ -504,7 +504,7 @@ static void s390_msi_ctrl_write(void *opaque, hwaddr addr, uint64_t data, 0x80 >> ((ind_bit + vec) % 8));if (!set_ind_atomic (pbdev->routes.adapter.summary_addr + sum_bit /8 ,0x80 >> (sum_bit %8 ))) { -css_adapter_interrupt (pbdev->isc); +css_adapter_interrupt (CSS_IO_ADAPTER_PCI , pbdev->isc); } }
hw/s390x/virtio-ccw.c +1 -1
@@ -1074,7 +1074,7 @@ static void virtio_ccw_notify(DeviceState *d, uint16_t vector) 0x80 >> ((ind_bit + vector) % 8));if (!virtio_set_ind_atomic (sch, dev->summary_indicator->addr,0x01 )) { -css_adapter_interrupt (dev->thinint_isc); +css_adapter_interrupt (CSS_IO_ADAPTER_VIRTIO , dev->thinint_isc); } }else { indicators = address_space_ldq(&address_space_memory,
include/hw/s390x/css.h +1 -1
@@ -155,7 +155,6 @@ void css_generate_sch_crws(uint8_t cssid, uint8_t ssid, uint16_t schid,void css_generate_chp_crws (uint8_t cssid,uint8_t chpid);void css_generate_css_crws (uint8_t cssid);void css_clear_sei_pending (void ); -void css_adapter_interrupt (uint8_t isc);int s390_ccw_cmd_request (ORB *orb,SCSW *scsw,void *data);int do_subchannel_work_virtual (SubchDev *sub,ORB *orb);int do_subchannel_work_passthrough (SubchDev *sub,ORB *orb);
@@ -166,6 +165,7 @@ typedef enum {CSS_IO_ADAPTER_TYPE_NUMS , } CssIoAdapterType; +void css_adapter_interrupt (CssIoAdapterType type,uint8_t isc);int css_do_sic (CPUS390XState *env,uint8_t isc,uint16_t mode);uint32_t css_get_adapter_id (CssIoAdapterType type,uint8_t isc); void css_register_io_adapters(CssIoAdapterType type, bool swap, bool maskable,
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 21/40] pc-bios/s390-ccw: Add a write() function for stdio
In reply to Christian BorntraegerFrom: Thomas Huth <[email protected]>
The stdio functions from the SLOF libc need a write() function for printing text to stdout/stderr. Let's implement this function by refactoring the code from sclp_print().
Message-Id: <[email protected]>
--- pc-bios/s390-ccw/sclp.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
pc-bios/s390-ccw/sclp.c +14 -2
@@ -12,6 +12,8 @@#include "s390-ccw.h" #include "sclp.h" +long write (int fd,const void *str,size_t len); + static char _sccb[PAGE_SIZE] __attribute__((__aligned__(4096))); const unsigned char ebc2asc[256] =
@@ -71,11 +73,14 @@ static int _strlen(const char *str)return i; } -void sclp_print (const char *str) +long write (int fd,const void *str,size_t len) { -int len =_strlen (str);WriteEventData *sccb = (void *)_sccb; +if (fd !=1 && fd !=2 ) { +return -EIO ; + } + sccb->h.length =sizeof (WriteEventData) + len; sccb->h.function_code =SCLP_FC_NORMAL_WRITE ; sccb->ebh.length =sizeof (EventBufferHeader) + len;
@@ -84,6 +89,13 @@ void sclp_print(const char *str)memcpy (sccb->data, str, len);sclp_service_call (SCLP_CMD_WRITE_EVENT_DATA , sccb); + +return len; +} + +void sclp_print (const char *str) +{ +write (1 , str,_strlen (str)); }void sclp_get_loadparm_ascii (char *loadparm)
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 08/40] s390x/flic: introduce modify_ais_mode callback
In reply to Christian BorntraegerFrom: Fei Li <[email protected]>
In order to emulate the adapter interruption suppression (AIS) facility properly, the guest needs to be able to modify the AIS mask. Interrupt suppression will be handled via the flic (for kvm, via a recently introduced kernel backend; for !kvm, in the flic code), so let's introduce a method to change the mode via the flic interface.
We introduce the 'simm' and 'nimm' fields to QEMUS390FLICState to store interruption modes for each ISC. Each bit in 'simm' and 'nimm' targets one ISC, and collaboratively indicate three modes:
ALL-Interruptions, SINGLE-Interruption and NO-Interruptions. This interface can initiate most transitions between the states; transition from SINGLE-Interruption to NO-Interruptions via adapter interrupt injection will be introduced in a following patch. The meaningful combinations are as follows:
interruption mode | simm bit | nimm bit
------------------|----------|----------
ALL | 0 | 0
SINGLE | 1 | 0
NO | 1 | 1--- hw/intc/s390_flic.c | 37 ++++++++++++++++++++++++++++++++++++- hw/intc/s390_flic_kvm.c | 36 ++++++++++++++++++++++++++++++++++++ include/hw/s390x/s390_flic.h | 9 ++++++++- 3 files changed, 80 insertions(+), 2 deletions(-)
hw/intc/s390_flic.c +36 -1
@@ -79,15 +79,47 @@ static int qemu_s390_clear_io_flic(S390FLICState *fs, uint16_t subchannel_id,return -ENOSYS ; } +static int qemu_s390_modify_ais_mode (S390FLICState *fs,uint8_t isc, +uint16_t mode) +{ +QEMUS390FLICState *flic =QEMU_S390_FLIC (fs); + +switch (mode) { +case SIC_IRQ_MODE_ALL : + flic->simm &= ~AIS_MODE_MASK (isc); + flic->nimm &= ~AIS_MODE_MASK (isc); +break ; +case SIC_IRQ_MODE_SINGLE : + flic->simm |=AIS_MODE_MASK (isc); + flic->nimm &= ~AIS_MODE_MASK (isc); +break ; +default : +return -EINVAL ; + } + +return 0 ; +} + +static void qemu_s390_flic_reset (DeviceState *dev) +{ +QEMUS390FLICState *flic =QEMU_S390_FLIC (dev); + + flic->simm =0 ; + flic->nimm =0 ; +} +static void qemu_s390_flic_class_init (ObjectClass *oc,void *data) { +DeviceClass *dc =DEVICE_CLASS (oc);S390FLICStateClass *fsc =S390_FLIC_COMMON_CLASS (oc); + dc->reset = qemu_s390_flic_reset; fsc->register_io_adapter = qemu_s390_register_io_adapter; fsc->io_adapter_map = qemu_s390_io_adapter_map; fsc->add_adapter_routes = qemu_s390_add_adapter_routes; fsc->release_adapter_routes = qemu_s390_release_adapter_routes; fsc->clear_io_irq = qemu_s390_clear_io_flic; + fsc->modify_ais_mode = qemu_s390_modify_ais_mode; }static Property s390_flic_common_properties[] = {
@@ -98,12 +130,15 @@ static Property s390_flic_common_properties[] = {static void s390_flic_common_realize (DeviceState *dev,Error **errp) { -uint32_t max_batch =S390_FLIC_COMMON (dev)->adapter_routes_max_batch; +S390FLICState *fs =S390_FLIC_COMMON (dev); +uint32_t max_batch = fs->adapter_routes_max_batch;if (max_batch >ADAPTER_ROUTES_MAX_GSI ) {error_setg (errp,"flic property adapter_routes_max_batch too big" " (%d > %d)" , max_batch,ADAPTER_ROUTES_MAX_GSI ); } + + fs->ais_supported = true; }static void s390_flic_class_init (ObjectClass *oc,void *data)
hw/intc/s390_flic_kvm.c +36 -0
@@ -20,6 +20,7 @@#include "sysemu/kvm.h" #include "hw/s390x/s390_flic.h" #include "hw/s390x/adapter.h" +#include "hw/s390x/css.h" #include "trace.h" #define FLIC_SAVE_INITIAL_SIZE getpagesize()
@@ -149,6 +150,26 @@ static int kvm_s390_clear_io_flic(S390FLICState *fs, uint16_t subchannel_id,return rc ? -errno :0 ; } +static int kvm_s390_modify_ais_mode (S390FLICState *fs,uint8_t isc, +uint16_t mode) +{ +KVMS390FLICState *flic =KVM_S390_FLIC (fs); +struct kvm_s390_ais_req req = { + .isc = isc, + .mode = mode, + }; +struct kvm_device_attr attr = { + .group =KVM_DEV_FLIC_AISM , + .addr = (uint64_t )&req, + }; + +if (!fs->ais_supported) { +return -ENOSYS ; + } + +return ioctl (flic->fd,KVM_SET_DEVICE_ATTR , &attr) ? -errno :0 ; +} +/** * __get_all_irqs - store all pending irqs in buffer * @flic: pointer to flic device state
@@ -406,6 +427,7 @@ typedef struct KVMS390FLICStateClass {static void kvm_s390_flic_realize (DeviceState *dev,Error **errp) { +S390FLICState *fs =S390_FLIC_COMMON (dev);KVMS390FLICState *flic_state =KVM_S390_FLIC (dev);struct kvm_create_device cd = {0 };struct kvm_device_attr test_attr = {0 };
@@ -438,6 +460,7 @@ static void kvm_s390_flic_realize(DeviceState *dev, Error **errp) flic_state->clear_io_supported = !ioctl (flic_state->fd,KVM_HAS_DEVICE_ATTR , test_attr); + fs->ais_supported = false;return ; fail:error_propagate (errp, errp_local);
@@ -446,10 +469,12 @@ fail:static void kvm_s390_flic_reset (DeviceState *dev) {KVMS390FLICState *flic =KVM_S390_FLIC (dev); +S390FLICState *fs =S390_FLIC_COMMON (dev);struct kvm_device_attr attr = { .group =KVM_DEV_FLIC_CLEAR_IRQS , };int rc =0 ; +uint8_t isc;if (flic->fd ==-1 ) {return ;
@@ -457,6 +482,16 @@ static void kvm_s390_flic_reset(DeviceState *dev)flic_disable_wait_pfault (flic); +if (fs->ais_supported) { +for (isc =0 ; isc <=MAX_ISC ; isc++) { + rc =kvm_s390_modify_ais_mode (fs, isc,SIC_IRQ_MODE_ALL ); +if (rc) { +error_report ("Failed to reset ais mode for isc %d: %s" , + isc,strerror (-rc)); + } + } + } + rc =ioctl (flic->fd,KVM_SET_DEVICE_ATTR , &attr);if (rc) {trace_flic_reset_failed (errno);
@@ -479,6 +514,7 @@ static void kvm_s390_flic_class_init(ObjectClass *oc, void *data) fsc->add_adapter_routes = kvm_s390_add_adapter_routes; fsc->release_adapter_routes = kvm_s390_release_adapter_routes; fsc->clear_io_irq = kvm_s390_clear_io_flic; + fsc->modify_ais_mode = kvm_s390_modify_ais_mode; }static const TypeInfo kvm_s390_flic_info = {
include/hw/s390x/s390_flic.h +8 -1
@@ -44,7 +44,7 @@ typedef struct S390FLICState {SysBusDevice parent_obj;/* to limit AdapterRoutes.num_routes for compat */ uint32_t adapter_routes_max_batch; - +bool ais_supported; } S390FLICState;#define S390_FLIC_COMMON_CLASS (klass) \
@@ -63,6 +63,7 @@ typedef struct S390FLICStateClass {void (*release_adapter_routes)(S390FLICState *fs,AdapterRoutes *routes);int (*clear_io_irq)(S390FLICState *fs,uint16_t subchannel_id,uint16_t subchannel_nr); +int (*modify_ais_mode)(S390FLICState *fs,uint8_t isc,uint16_t mode); } S390FLICStateClass;#define TYPE_KVM_S390_FLIC "s390-flic-kvm"
@@ -73,8 +74,14 @@ typedef struct S390FLICStateClass {#define QEMU_S390_FLIC (obj) \ OBJECT_CHECK(QEMUS390FLICState, (obj), TYPE_QEMU_S390_FLIC) +#define SIC_IRQ_MODE_ALL 0 +#define SIC_IRQ_MODE_SINGLE 1 +#define AIS_MODE_MASK (isc) (0x80 >> isc) +typedef struct QEMUS390FLICState {S390FLICState parent_obj; +uint8_t simm; +uint8_t nimm; }QEMUS390FLICState ;void s390_flic_init (void );
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 32/40] s390x/cpumodel: add zpci, aen and ais facilities
In reply to Christian BorntraegerFrom: Yi Min Zhao <[email protected]>
zPCI instructions and facilities are available since IBM zEnterprise EC12. To support z/PCI in QEMU we enable zpci, aen and ais facilities starting with zEC12 GA1. And we always set zpci and aen bits in max cpu model. Later they might be switched off due to applied real cpu model. For ais bit, we only provide it in the full cpu model beginning with zEC12 and defer its enablement in the default cpu model to a later point in time. At the same time, disable them for 2.9 and older machines.
Because of introducing AIS facility, we could check if it's enabled to initialize flic->ais_supported with the real value.
--- hw/intc/s390_flic.c | 3 ++- hw/intc/s390_flic_kvm.c | 3 --- hw/s390x/s390-virtio-ccw.c | 3 +++ target/s390x/cpu_features.c | 3 +++ target/s390x/cpu_features_def.h | 3 +++ target/s390x/gen-features.c | 5 +++++ target/s390x/kvm.c | 7 +++++++ 7 files changed, 23 insertions(+), 4 deletions(-)
hw/intc/s390_flic.c +2 -1
@@ -163,9 +163,10 @@ static void s390_flic_common_realize(DeviceState *dev, Error **errp)if (max_batch >ADAPTER_ROUTES_MAX_GSI ) {error_setg (errp,"flic property adapter_routes_max_batch too big" " (%d > %d)" , max_batch,ADAPTER_ROUTES_MAX_GSI ); +return ; } - fs->ais_supported = true; + fs->ais_supported =s390_has_feat (S390_FEAT_ADAPTER_INT_SUPPRESSION ); }static void s390_flic_class_init (ObjectClass *oc,void *data)
hw/intc/s390_flic_kvm.c +0 -3
@@ -444,7 +444,6 @@ typedef struct KVMS390FLICStateClass {static void kvm_s390_flic_realize (DeviceState *dev,Error **errp) { -S390FLICState *fs =S390_FLIC_COMMON (dev);KVMS390FLICState *flic_state =KVM_S390_FLIC (dev);struct kvm_create_device cd = {0 };struct kvm_device_attr test_attr = {0 };
@@ -476,8 +475,6 @@ static void kvm_s390_flic_realize(DeviceState *dev, Error **errp) test_attr.group =KVM_DEV_FLIC_CLEAR_IO_IRQ ; flic_state->clear_io_supported = !ioctl (flic_state->fd,KVM_HAS_DEVICE_ATTR , test_attr); - - fs->ais_supported = false;return ; fail:error_propagate (errp, errp_local);
hw/s390x/s390-virtio-ccw.c +3 -0
@@ -503,6 +503,9 @@ DEFINE_CCW_MACHINE(2_10, "2.10", true);static void ccw_machine_2_9_instance_options (MachineState *machine) {ccw_machine_2_10_instance_options (machine); +s390_cpudef_featoff_greater (12 ,1 ,S390_FEAT_ZPCI ); +s390_cpudef_featoff_greater (12 ,1 ,S390_FEAT_ADAPTER_INT_SUPPRESSION ); +s390_cpudef_featoff_greater (12 ,1 ,S390_FEAT_ADAPTER_EVENT_NOTIFICATION ); }static void ccw_machine_2_9_class_options (MachineClass *mc)
target/s390x/cpu_features.c +3 -0
@@ -74,6 +74,9 @@ static const S390FeatDef s390_features[] = {FEAT_INIT ("stfle53" ,S390_FEAT_TYPE_STFL ,53 ,"Various facilities introduced with z13" ),FEAT_INIT ("msa5-base" ,S390_FEAT_TYPE_STFL ,57 ,"Message-security-assist-extension-5 facility (excluding subfunctions)" ),FEAT_INIT ("ri" ,S390_FEAT_TYPE_STFL ,64 ,"CPU runtime-instrumentation facility" ), +FEAT_INIT ("zpci" ,S390_FEAT_TYPE_STFL ,69 ,"z/PCI facility" ), +FEAT_INIT ("aen" ,S390_FEAT_TYPE_STFL ,71 ,"General-purpose-adapter-event-notification facility" ), +FEAT_INIT ("ais" ,S390_FEAT_TYPE_STFL ,72 ,"General-purpose-adapter-interruption-suppression facility" ),FEAT_INIT ("te" ,S390_FEAT_TYPE_STFL ,73 ,"Transactional-execution facility" ),FEAT_INIT ("sthyi" ,S390_FEAT_TYPE_STFL ,74 ,"Store-hypervisor-information facility" ), FEAT_INIT("aefsi", S390_FEAT_TYPE_STFL, 75, "Access-exception-fetch/store-indication facility"),
target/s390x/cpu_features_def.h +3 -0
@@ -65,6 +65,9 @@ typedef enum {S390_FEAT_STFLE_53 ,S390_FEAT_MSA_EXT_5 ,S390_FEAT_RUNTIME_INSTRUMENTATION , +S390_FEAT_ZPCI , +S390_FEAT_ADAPTER_EVENT_NOTIFICATION , +S390_FEAT_ADAPTER_INT_SUPPRESSION ,S390_FEAT_TRANSACTIONAL_EXE ,S390_FEAT_STORE_HYPERVISOR_INFO , S390_FEAT_ACCESS_EXCEPTION_FS_INDICATION,
target/s390x/gen-features.c +5 -0
@@ -389,6 +389,9 @@ static uint16_t full_GEN12_GA1[] = {S390_FEAT_CONSTRAINT_TRANSACTIONAL_EXE ,S390_FEAT_TRANSACTIONAL_EXE ,S390_FEAT_RUNTIME_INSTRUMENTATION , +S390_FEAT_ZPCI , +S390_FEAT_ADAPTER_EVENT_NOTIFICATION , +S390_FEAT_ADAPTER_INT_SUPPRESSION , S390_FEAT_EDAT_2, };
@@ -446,6 +449,8 @@ static uint16_t default_GEN12_GA1[] = {S390_FEAT_CONSTRAINT_TRANSACTIONAL_EXE ,S390_FEAT_TRANSACTIONAL_EXE ,S390_FEAT_RUNTIME_INSTRUMENTATION , +S390_FEAT_ZPCI , +S390_FEAT_ADAPTER_EVENT_NOTIFICATION , S390_FEAT_EDAT_2, };
target/s390x/kvm.c +7 -0
@@ -302,6 +302,9 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } } +/* Try to enable AIS facility */ +kvm_vm_enable_cap (s,KVM_CAP_S390_AIS ,0 ); +qemu_mutex_init (&qemu_sigp_mutex);return 0 ;
@@ -2635,6 +2638,10 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)set_bit (S390_FEAT_CMM , model->features); } +/* set zpci and aen facilities */ +set_bit (S390_FEAT_ZPCI , model->features); +set_bit (S390_FEAT_ADAPTER_EVENT_NOTIFICATION , model->features); +if (s390_known_cpu_type (cpu_type)) {/* we want the exact model, even if some features are missing */ model->def = s390_find_cpu_def(cpu_type, ibc_gen(unblocked_ibc),
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PULL 32/40] s390x/cpumodel: add zpci, aen and ais facilities
target/s390x/kvm.c void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp) · line 2641
Quoted 12 lines
target/s390x/kvm.c +4
-0+/* Try to enable AIS facility */ +kvm_vm_enable_cap (s,KVM_CAP_S390_AIS ,0 ); +qemu_mutex_init (&qemu_sigp_mutex);return 0 ;@@ -2635,6 +2638,10 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)set_bit (S390_FEAT_CMM , model->features); } +/* set zpci and aen facilities */
This comment is not helpful. This should rather say something like "we emulate a zPCI bus in QEMU, therefore we don't depend on the host capabilities"
Quoted 7 lines
target/s390x/kvm.c +3
-0+set_bit (S390_FEAT_ZPCI , model->features); +set_bit (S390_FEAT_ADAPTER_EVENT_NOTIFICATION , model->features); +if (s390_known_cpu_type (cpu_type)) {/* we want the exact model, even if some features are missing */ model->def = s390_find_cpu_def(cpu_type, ibc_gen(unblocked_ibc),
Signature · 3 lines
Thanks, David
Re: [Qemu-devel] [PULL 32/40] s390x/cpumodel: add zpci, aen and ais facilities
Quoted 11 lines · David Hildenbrand
Quoted 11 lines
target/s390x/kvm.c +3
-0+/* Try to enable AIS facility */ +kvm_vm_enable_cap (s,KVM_CAP_S390_AIS ,0 ); +qemu_mutex_init (&qemu_sigp_mutex);return 0 ;@@ -2635,6 +2638,10 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)set_bit (S390_FEAT_CMM , model->features); }
Quoted 5 lines
target/s390x/kvm.c void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp) · line 2641
Quoted 1 line
target/s390x/kvm.c +1
-0+/* set zpci and aen facilities */ This comment is not helpful. This should rather say something like "we emulate a zPCI bus in QEMU, therefore we don't depend on the host capabilities"
Yes, you are right, that seems better. Can you send a patch?
Quoted 9 lines
Quoted 8 lines
target/s390x/kvm.c +3
-0+set_bit (S390_FEAT_ZPCI , model->features); +set_bit (S390_FEAT_ADAPTER_EVENT_NOTIFICATION , model->features); +if (s390_known_cpu_type (cpu_type)) {/* we want the exact model, even if some features are missing */ model->def = s390_find_cpu_def(cpu_type, ibc_gen(unblocked_ibc),
Re: [Qemu-devel] [PULL 32/40] s390x/cpumodel: add zpci, aen and ais facilities
Quoted 12 lines · Christian Borntraeger
Quoted 11 lines · David Hildenbrand
Quoted 11 lines
target/s390x/kvm.c +3
-0+/* Try to enable AIS facility */ +kvm_vm_enable_cap (s,KVM_CAP_S390_AIS ,0 ); +qemu_mutex_init (&qemu_sigp_mutex);return 0 ;@@ -2635,6 +2638,10 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)set_bit (S390_FEAT_CMM , model->features); }
Quoted 7 lines
Quoted 5 lines
target/s390x/kvm.c void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp) · line 2641
Quoted 1 line
target/s390x/kvm.c +1
-0+/* set zpci and aen facilities */ This comment is not helpful. This should rather say something like "we emulate a zPCI bus in QEMU, therefore we don't depend on the host capabilities"
Yes, you are right, that seems better. Can you send a patch?
Yes, will do.
Signature · 3 lines
Thanks, David
[Qemu-devel] [PULL 24/40] pc-bios/s390-ccw: Add code for virtio feature negotiation
In reply to Christian BorntraegerFrom: Thomas Huth <[email protected]>
The upcoming virtio-net driver needs to negotiate some features, so we need the possibility to do this in the core virtio code.
Message-Id: <[email protected]>
--- pc-bios/s390-ccw/s390-ccw.h | 2 ++ pc-bios/s390-ccw/virtio.c | 23 +++++++++++++++++------ pc-bios/s390-ccw/virtio.h | 1 + 3 files changed, 20 insertions(+), 6 deletions(-)
pc-bios/s390-ccw/s390-ccw.h +2 -0
@@ -44,6 +44,8 @@ typedef unsigned long long __u64; ((b) == 0 ? (a) : (MIN(a, b))))#endif +#define ARRAY_SIZE (a) (sizeof(a) / sizeof((a)[0])) +#include "cio.h" #include "iplb.h"
pc-bios/s390-ccw/virtio.c +17 -6
@@ -12,6 +12,7 @@#include "s390-ccw.h" #include "virtio.h" #include "virtio-scsi.h" +#include "bswap.h" #define VRING_WAIT_REPLY_TIMEOUT 3
@@ -249,8 +250,12 @@ int virtio_run(VDev *vdev, int vqid, VirtioCmd *cmd)void virtio_setup_ccw (VDev *vdev) { -int i, cfg_size =0 ; +int i, rc, cfg_size =0 ;unsigned char status =VIRTIO_CONFIG_S_DRIVER_OK ; +struct VirtioFeatureDesc { +uint32_t features; +uint8_t index; + } __attribute__((packed)) feats;IPL_assert (virtio_is_supported (vdev->schid),"PE" );/* device ID has been established now */
@@ -277,11 +282,17 @@ void virtio_setup_ccw(VDev *vdev)IPL_assert (run_ccw (vdev,CCW_CMD_READ_CONF , &vdev->config, cfg_size) ==0 ,"Could not get block device configuration" ); -/* -* Skipping CCW_CMD_READ_FEAT. We're not doing anything fancy, and -* we'll just stop dead anyway if anything does not work like we -* expect it. -*/ +/* Feature negotiation */ +for (i =0 ; i <ARRAY_SIZE (vdev->guest_features); i++) { + feats.features =0 ; + feats.index = i; + rc =run_ccw (vdev,CCW_CMD_READ_FEAT , &feats,sizeof (feats)); +IPL_assert (rc ==0 ,"Could not get features bits" ); + vdev->guest_features[i] &=bswap32 (feats.features); + feats.features =bswap32 (vdev->guest_features[i]); + rc =run_ccw (vdev,CCW_CMD_WRITE_FEAT , &feats,sizeof (feats)); +IPL_assert (rc ==0 ,"Could not set features bits" ); + }for (i =0 ; i < vdev->nr_vqs; i++) {VqInfo info = {
pc-bios/s390-ccw/virtio.h +1 -0
@@ -251,6 +251,7 @@ struct VDev {ScsiDevice selected_scsi_device;uint64_t netboot_start_addr;uint32_t max_transfer; +uint32_t guest_features[2 ]; };typedef struct VDev VDev ;
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 31/40] s390x: initialize cpu firstly
In reply to Christian BorntraegerFrom: Yi Min Zhao <[email protected]>
By initializing the CPU firstly, we are able to retrieve and use the CPU model features when initializing other subsystem or devices.
--- hw/s390x/s390-virtio-ccw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/s390x/s390-virtio-ccw.c +3 -3
@@ -122,6 +122,9 @@ static void ccw_init(MachineState *machine)s390_sclp_init ();s390_memory_init (machine->ram_size); +/* init CPUs */ +s390_init_cpus (machine); +s390_flic_init ();/* get a BUS */
@@ -138,9 +141,6 @@ static void ccw_init(MachineState *machine)/* register hypercalls */ virtio_ccw_register_hcalls (); -/* init CPUs */ -s390_init_cpus (machine); -if (kvm_enabled ()) {kvm_s390_enable_css_support (s390_cpu_addr2state (0 )); }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 16/40] s390x/css: activate ChannelSubSys migration
In reply to Christian BorntraegerFrom: Halil Pasic <[email protected]>
Turn on migration for the channel subsystem for the next machine. For legacy machines we still have to do things the old way.
Message-Id: <[email protected]>
--- hw/s390x/css.c | 5 +++++ hw/s390x/s390-virtio-ccw.c | 9 ++++----- include/hw/s390x/css.h | 4 ++++ 3 files changed, 13 insertions(+), 5 deletions(-)
hw/s390x/css.c +5 -0
@@ -408,6 +408,11 @@ static int subch_dev_post_load(void *opaque, int version_id)return 0 ; } +void css_register_vmstate (void ) +{ +vmstate_register (NULL ,0 , &vmstate_css, &channel_subsys); +} +IndAddr *get_indicator (hwaddr ind_addr,int len) {IndAddr *indicator;
hw/s390x/s390-virtio-ccw.c +4 -5
@@ -209,7 +209,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) s390mc->ri_allowed = true; s390mc->cpu_model_allowed = true; - s390mc->css_migration_enabled = false;/* TODO: set to true */ + s390mc->css_migration_enabled = true; mc->init = ccw_init; mc->reset = s390_machine_reset; mc->hot_add_cpu = s390_hot_add_cpu;
@@ -490,10 +490,9 @@ bool css_migration_enabled(void)static void ccw_machine_2_10_instance_options (MachineState *machine) { -/* -* TODO Once preparations are done register vmstate for the css if -* css_migration_enabled(). -*/ +if (css_migration_enabled ()) { +css_register_vmstate (); + } }static void ccw_machine_2_10_class_options (MachineClass *mc)
include/hw/s390x/css.h +4 -0
@@ -234,4 +234,8 @@ extern PropertyInfo css_devid_ro_propinfo;*/ SubchDev *css_create_sch (CssDevId bus_id,bool is_virtual,bool squash_mcss,Error **errp); + +/** Turn on css migration */ +void css_register_vmstate (void ); +#endif
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 10/40] s390x/sic: realize SIC handling
In reply to Christian BorntraegerFrom: Fei Li <[email protected]>
Currently, we do nothing for the SIC instruction, but we need to implement it properly. Let's add proper handling in the backend code.
--- hw/s390x/css.c | 26 ++++++++++++++++++++++++++ hw/s390x/trace-events | 1 + include/hw/s390x/css.h | 2 ++ target/s390x/kvm.c | 16 +++++++++++++++- 4 files changed, 44 insertions(+), 1 deletion(-)
hw/s390x/css.c +26 -0
@@ -521,6 +521,32 @@ void css_conditional_io_interrupt(SubchDev *sch) } } +int css_do_sic (CPUS390XState *env,uint8_t isc,uint16_t mode) +{ +S390FLICState *fs =s390_get_flic (); +S390FLICStateClass *fsc =S390_FLIC_COMMON_GET_CLASS (fs); +int r; + +if (env->psw.mask &PSW_MASK_PSTATE ) { + r = -PGM_PRIVILEGED ; + goto out; + } + +trace_css_do_sic (mode, isc); +switch (mode) { +case SIC_IRQ_MODE_ALL : +case SIC_IRQ_MODE_SINGLE : +break ; +default : + r = -PGM_OPERAND ; + goto out; + } + + r = fsc->modify_ais_mode (fs, isc, mode) ? -PGM_OPERATION :0 ; +out: +return r; +} +void css_adapter_interrupt (uint8_t isc) {uint32_t io_int_word = (isc <<27 ) |IO_INT_WORD_AI ;
hw/s390x/trace-events +1 -0
@@ -8,6 +8,7 @@ css_new_image(uint8_t cssid, const char *default_cssid) "CSS: add css image %02x css_assign_subch(const char *do_assign, uint8_t cssid, uint8_t ssid, uint16_t schid, uint16_t devno) "CSS: %s %x.%x.%04x (devno %04x)" css_io_interrupt(int cssid, int ssid, int schid, uint32_t intparm, uint8_t isc, const char *conditional) "CSS: I/O interrupt on sch %x.%x.%04x (intparm %08x, isc %x) %s" css_adapter_interrupt(uint8_t isc) "CSS: adapter I/O interrupt (isc %x)" +css_do_sic(uint16_t mode, uint8_t isc) "CSS: set interruption mode %x on isc %x" # hw/s390x/virtio-ccw.c virtio_ccw_interpret_ccw(int cssid, int ssid, int schid, int cmd_code) "VIRTIO-CCW: %x.%x.%04x: interpret command %x"
include/hw/s390x/css.h +2 -0
@@ -12,6 +12,7 @@#ifndef CSS_H #define CSS_H +#include "cpu.h" #include "hw/s390x/adapter.h" #include "hw/s390x/s390_flic.h" #include "hw/s390x/ioinst.h"
@@ -165,6 +166,7 @@ typedef enum {CSS_IO_ADAPTER_TYPE_NUMS , } CssIoAdapterType; +int css_do_sic (CPUS390XState *env,uint8_t isc,uint16_t mode);uint32_t css_get_adapter_id (CssIoAdapterType type,uint8_t isc);void css_register_io_adapters (CssIoAdapterType type,bool swap,bool maskable,uint8_t flags,Error **errp);
target/s390x/kvm.c +15 -1
@@ -1206,7 +1206,21 @@ static int kvm_stpcifc_service_call(S390CPU *cpu, struct kvm_run *run)static int kvm_sic_service_call (S390CPU *cpu,struct kvm_run *run) { -/* NOOP */ +CPUS390XState *env = &cpu->env; +uint8_t r1 = (run->s390_sieic.ipa &0x00f0 ) >>4 ; +uint8_t r3 = run->s390_sieic.ipa &0x000f ; +uint8_t isc; +uint16_t mode; +int r; + +cpu_synchronize_state (CPU (cpu)); + mode = env->regs[r1] &0xffff ; + isc = (env->regs[r3] >>27 ) &0x7 ; + r =css_do_sic (env, isc, mode); +if (r) { +enter_pgmcheck (cpu, -r); + } +return 0 ; }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 33/40] s390x/flic: migrate ais states
In reply to Christian BorntraegerFrom: Yi Min Zhao <[email protected]>
During migration we should transfer ais states to the target guest. This patch introduces a subsection to kvm_s390_flic_vmstate and new vmsd for qemu_flic. The ais states need to be migrated only when ais is supported.
--- hw/intc/s390_flic.c | 20 +++++++++++ hw/intc/s390_flic_kvm.c | 81 ++++++++++++++++++++++++++++++++++++++++++++ include/hw/s390x/s390_flic.h | 1 + 3 files changed, 102 insertions(+)
hw/intc/s390_flic.c +20 -0
@@ -134,12 +134,32 @@ static void qemu_s390_flic_reset(DeviceState *dev) flic->nimm =0 ; } +bool ais_needed (void *opaque) +{ +S390FLICState *s = opaque; + +return s->ais_supported; +} + +static const VMStateDescription qemu_s390_flic_vmstate = { + .name ="qemu-s390-flic" , + .version_id =1 , + .minimum_version_id =1 , + .needed = ais_needed, + .fields = (VMStateField []) { +VMSTATE_UINT8 (simm, QEMUS390FLICState), +VMSTATE_UINT8 (nimm, QEMUS390FLICState), +VMSTATE_END_OF_LIST () + } +}; +static void qemu_s390_flic_class_init (ObjectClass *oc,void *data) {DeviceClass *dc =DEVICE_CLASS (oc);S390FLICStateClass *fsc =S390_FLIC_COMMON_CLASS (oc); dc->reset = qemu_s390_flic_reset; + dc->vmsd = &qemu_s390_flic_vmstate; fsc->register_io_adapter = qemu_s390_register_io_adapter; fsc->io_adapter_map = qemu_s390_io_adapter_map; fsc->add_adapter_routes = qemu_s390_add_adapter_routes;
hw/intc/s390_flic_kvm.c +81 -0
94 lines not on this page · raw message
include/hw/s390x/s390_flic.h +1 -0
@@ -89,6 +89,7 @@ typedef struct QEMUS390FLICState {void s390_flic_init (void );S390FLICState *s390_get_flic (void ); +bool ais_needed (void *opaque);#ifdef CONFIG_KVM DeviceState *s390_flic_kvm_create (void );
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PULL 33/40] s390x/flic: migrate ais states
Looks like this patch broke migration from 2.10 to 2.9 (and older) when ais is active.
2.9 says
error while loading state for instance 0x0 of device 's390-flic'
So we need to fence this for older machines types than 2.10. This should also go in 2.10.1.
Will have a look.
Quoted 166 lines · Christian Borntraeger
From: Yi Min Zhao <[email protected]>
During migration we should transfer ais states to the target guest. This patch introduces a subsection to
kvm_s390_flic_vmstateand new vmsd forqemu_flic. The ais states need to be migrated only when ais is supported.Signed-off-by Yi Min Zhao <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>Reviewed-by Cornelia Huck <[email protected]>--- hw/intc/s390_flic.c | 20 +++++++++++ hw/intc/s390_flic_kvm.c | 81 ++++++++++++++++++++++++++++++++++++++++++++ include/hw/s390x/s390_flic.h | 1 + 3 files changed, 102 insertions(+)hw/intc/s390_flic.c +20
-0@@ -134,12 +134,32 @@ static void qemu_s390_flic_reset(DeviceState *dev) flic->nimm =0 ; } +bool ais_needed (void *opaque) +{ +S390FLICState *s = opaque; + +return s->ais_supported; +} + +static const VMStateDescription qemu_s390_flic_vmstate = { + .name ="qemu-s390-flic" , + .version_id =1 , + .minimum_version_id =1 , + .needed = ais_needed, + .fields = (VMStateField []) { +VMSTATE_UINT8 (simm, QEMUS390FLICState), +VMSTATE_UINT8 (nimm, QEMUS390FLICState), +VMSTATE_END_OF_LIST () + } +}; +static void qemu_s390_flic_class_init (ObjectClass *oc,void *data) {DeviceClass *dc =DEVICE_CLASS (oc);S390FLICStateClass *fsc =S390_FLIC_COMMON_CLASS (oc); dc->reset = qemu_s390_flic_reset; + dc->vmsd = &qemu_s390_flic_vmstate; fsc->register_io_adapter = qemu_s390_register_io_adapter; fsc->io_adapter_map = qemu_s390_io_adapter_map; fsc->add_adapter_routes = qemu_s390_add_adapter_routes;hw/intc/s390_flic_kvm.c +81
-0@@ -413,7 +413,84 @@ out:return r; } +typedef struct KVMS390FLICStateMigTmp { +KVMS390FLICState *parent; +uint8_t simm; +uint8_t nimm; +}KVMS390FLICStateMigTmp ; + +static void kvm_flic_ais_pre_save (void *opaque) +{ +KVMS390FLICStateMigTmp *tmp = opaque; +KVMS390FLICState *flic = tmp->parent; +struct kvm_s390_ais_all ais; +struct kvm_device_attr attr = { + .group =KVM_DEV_FLIC_AISM_ALL , + .addr = (uint64_t )&ais, + .attr =sizeof (ais), + }; + +if (ioctl (flic->fd,KVM_GET_DEVICE_ATTR , &attr)) { +error_report ("Failed to retrieve kvm flic ais states" ); +return ; + } + + tmp->simm = ais.simm; + tmp->nimm = ais.nimm; +} + +static int kvm_flic_ais_post_load (void *opaque,int version_id) +{ +KVMS390FLICStateMigTmp *tmp = opaque; +KVMS390FLICState *flic = tmp->parent; +struct kvm_s390_ais_all ais = { + .simm = tmp->simm, + .nimm = tmp->nimm, + }; +struct kvm_device_attr attr = { + .group =KVM_DEV_FLIC_AISM_ALL , + .addr = (uint64_t )&ais, + }; + +/* This can happen when the user mis-configures its guests in an +* incompatible fashion or without a CPU model. For example using +* qemu with -cpu host (which is not migration safe) and do a +* migration from a host that has AIS to a host that has no AIS. +* In that case the target system will reject the migration here. +*/ +if (!ais_needed (flic)) { +return -ENOSYS ; + } + +return ioctl (flic->fd,KVM_SET_DEVICE_ATTR , &attr) ? -errno :0 ; +} + +static const VMStateDescription kvm_s390_flic_ais_tmp = { + .name ="s390-flic-ais-tmp" , + .pre_save = kvm_flic_ais_pre_save, + .post_load = kvm_flic_ais_post_load, + .fields = (VMStateField []) { +VMSTATE_UINT8 (simm, KVMS390FLICStateMigTmp), +VMSTATE_UINT8 (nimm, KVMS390FLICStateMigTmp), +VMSTATE_END_OF_LIST () + } +}; + +static const VMStateDescription kvm_s390_flic_vmstate_ais = { + .name ="s390-flic/ais" , + .version_id =1 , + .minimum_version_id =1 , + .needed = ais_needed, + .fields = (VMStateField []) { +VMSTATE_WITH_TMP (KVMS390FLICState, KVMS390FLICStateMigTmp, + kvm_s390_flic_ais_tmp), +VMSTATE_END_OF_LIST () + } +}; +static const VMStateDescription kvm_s390_flic_vmstate = { +/* should have been like kvm-s390-flic, +* can't change without breaking compat */ .name ="s390-flic" , .version_id =FLIC_SAVEVM_VERSION , .minimum_version_id =FLIC_SAVEVM_VERSION ,@@ -428,6 +505,10 @@ static const VMStateDescription kvm_s390_flic_vmstate = { .flags = VMS_SINGLE, },VMSTATE_END_OF_LIST () + }, + .subsections = (const VMStateDescription * []) { + &kvm_s390_flic_vmstate_ais, +NULL } };include/hw/s390x/s390_flic.h +1
-0@@ -89,6 +89,7 @@ typedef struct QEMUS390FLICState {void s390_flic_init (void );S390FLICState *s390_get_flic (void ); +bool ais_needed (void *opaque);#ifdef CONFIG_KVM DeviceState *s390_flic_kvm_create (void );
[Qemu-devel] block ais migration for machines <= 2.9
Something like the following seems to do the tricks.
Needs proper patch description, review, full test with different kernel versions.....
hw/s390x/s390-virtio-ccw.c +7 -0
@@ -212,6 +212,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) s390mc->cpu_model_allowed = true; s390mc->css_migration_enabled = true; s390mc->gs_allowed = true; + s390mc->ais_allowed = true; mc->init = ccw_init; mc->reset = s390_machine_reset; mc->hot_add_cpu = s390_hot_add_cpu;
@@ -305,6 +306,11 @@ bool gs_allowed(void)return false; } +bool ais_allowed (void ) +{ +return get_machine_class ()->ais_allowed; +} +static char *machine_get_loadparm (Object *obj,Error **errp) {S390CcwMachineState *ms =S390_CCW_MACHINE (obj);
@@ -533,6 +539,7 @@ static void ccw_machine_2_9_class_options(MachineClass *mc)S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc); s390mc->gs_allowed = false; + s390mc->ais_allowed = false;ccw_machine_2_10_class_options (mc);SET_MACHINE_COMPAT (mc,CCW_COMPAT_2_9 ); s390mc->css_migration_enabled = false;
include/hw/s390x/s390-virtio-ccw.h +3 -0
@@ -41,6 +41,7 @@ typedef struct S390CcwMachineClass {bool cpu_model_allowed;bool css_migration_enabled;bool gs_allowed; +bool ais_allowed; } S390CcwMachineClass;/* runtime-instrumentation allowed by the machine */
@@ -49,6 +50,8 @@ bool ri_allowed(void);bool cpu_model_allowed (void );/* guarded-storage allowed by the machine */ bool gs_allowed (void ); +/* ais allowed by the machine */ +bool ais_allowed (void );/** * Returns true if (vmstate based) migration of the channel subsystem
target/s390x/kvm.c +3 -1
@@ -309,7 +309,9 @@ int kvm_arch_init(MachineState *ms, KVMState *s) }/* Try to enable AIS facility */ -kvm_vm_enable_cap (s,KVM_CAP_S390_AIS ,0 ); +if (ais_allowed ()) { +kvm_vm_enable_cap (s,KVM_CAP_S390_AIS ,0 ); + }qemu_mutex_init (&qemu_sigp_mutex);
Re: [Qemu-devel] block ais migration for machines <= 2.9
Quoted 2 lines · On Wed, 20 Sep 2017 14:53:07 +0200 Christian Borntraeger…
Something like the following seems to do the tricks.
Needs proper patch description, review, full test with different kernel versions.....
Looks sane.
Will you handle it?
Quoted 69 lines
hw/s390x/s390-virtio-ccw.c +7
-0@@ -212,6 +212,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) s390mc->cpu_model_allowed = true; s390mc->css_migration_enabled = true; s390mc->gs_allowed = true; + s390mc->ais_allowed = true; mc->init = ccw_init; mc->reset = s390_machine_reset; mc->hot_add_cpu = s390_hot_add_cpu;@@ -305,6 +306,11 @@ bool gs_allowed(void)return false; } +bool ais_allowed (void ) +{ +return get_machine_class ()->ais_allowed; +} +static char *machine_get_loadparm (Object *obj,Error **errp) {S390CcwMachineState *ms =S390_CCW_MACHINE (obj);@@ -533,6 +539,7 @@ static void ccw_machine_2_9_class_options(MachineClass *mc)S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc); s390mc->gs_allowed = false; + s390mc->ais_allowed = false;ccw_machine_2_10_class_options (mc);SET_MACHINE_COMPAT (mc,CCW_COMPAT_2_9 ); s390mc->css_migration_enabled = false;include/hw/s390x/s390-virtio-ccw.h +3
-0@@ -41,6 +41,7 @@ typedef struct S390CcwMachineClass {bool cpu_model_allowed;bool css_migration_enabled;bool gs_allowed; +bool ais_allowed; } S390CcwMachineClass;/* runtime-instrumentation allowed by the machine */ @@ -49,6 +50,8 @@ bool ri_allowed(void);bool cpu_model_allowed (void );/* guarded-storage allowed by the machine */ bool gs_allowed (void ); +/* ais allowed by the machine */ +bool ais_allowed (void );/** * Returns true if (vmstate based) migration of the channel subsystem target/s390x/kvm.c +3
-1@@ -309,7 +309,9 @@ int kvm_arch_init(MachineState *ms, KVMState *s) }/* Try to enable AIS facility */ -kvm_vm_enable_cap (s,KVM_CAP_S390_AIS ,0 ); +if (ais_allowed ()) { +kvm_vm_enable_cap (s,KVM_CAP_S390_AIS ,0 ); + }qemu_mutex_init (&qemu_sigp_mutex);
Re: [Qemu-devel] block ais migration for machines <= 2.9
Quoted 9 lines · Cornelia Huck
Quoted 2 lines · On Wed, 20 Sep 2017 14:53:07 +0200 Christian Borntraeger…
Something like the following seems to do the tricks.
Needs proper patch description, review, full test with different kernel versions.....Looks sane.
Will you handle it?
Yes, I will do more testing etc and then send a proper version.
Re: [Qemu-devel] block ais migration for machines <= 2.9
In reply to Christian BorntraegerQuoted 2 lines · * Christian Borntraeger ([email protected]) wrote:
Something like the following seems to do the tricks.
Needs proper patch description, review, full test with different kernel versions.....
Without knowing anything about 'ais' - will this break migration from 2.10 -> 2.10+this fix?
Dave
Quoted 59 lines
hw/s390x/s390-virtio-ccw.c +7
-0@@ -212,6 +212,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) s390mc->cpu_model_allowed = true; s390mc->css_migration_enabled = true; s390mc->gs_allowed = true; + s390mc->ais_allowed = true; mc->init = ccw_init; mc->reset = s390_machine_reset; mc->hot_add_cpu = s390_hot_add_cpu;@@ -305,6 +306,11 @@ bool gs_allowed(void)return false; } +bool ais_allowed (void ) +{ +return get_machine_class ()->ais_allowed; +} +static char *machine_get_loadparm (Object *obj,Error **errp) {S390CcwMachineState *ms =S390_CCW_MACHINE (obj);@@ -533,6 +539,7 @@ static void ccw_machine_2_9_class_options(MachineClass *mc)S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc); s390mc->gs_allowed = false; + s390mc->ais_allowed = false;ccw_machine_2_10_class_options (mc);SET_MACHINE_COMPAT (mc,CCW_COMPAT_2_9 ); s390mc->css_migration_enabled = false;include/hw/s390x/s390-virtio-ccw.h +3
-0@@ -41,6 +41,7 @@ typedef struct S390CcwMachineClass {bool cpu_model_allowed;bool css_migration_enabled;bool gs_allowed; +bool ais_allowed; } S390CcwMachineClass;/* runtime-instrumentation allowed by the machine */ @@ -49,6 +50,8 @@ bool ri_allowed(void);bool cpu_model_allowed (void );/* guarded-storage allowed by the machine */ bool gs_allowed (void ); +/* ais allowed by the machine */ +bool ais_allowed (void );/** * Returns true if (vmstate based) migration of the channel subsystem target/s390x/kvm.c +0
-0
target/s390x/kvm.c int kvm_arch_init(MachineState *ms, KVMState *s) · line 317
Quoted 10 lines
target/s390x/kvm.c +3
-1@@ -309,7 +309,9 @@ int kvm_arch_init(MachineState *ms, KVMState *s) }/* Try to enable AIS facility */ -kvm_vm_enable_cap (s,KVM_CAP_S390_AIS ,0 ); +if (ais_allowed ()) { +kvm_vm_enable_cap (s,KVM_CAP_S390_AIS ,0 ); + }qemu_mutex_init (&qemu_sigp_mutex);
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [Qemu-devel] block ais migration for machines <= 2.9
Quoted 5 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Christian Borntraeger ([email protected]) wrote:
Something like the following seems to do the tricks.
Needs proper patch description, review, full test with different kernel versions.....Without knowing anything about 'ais' - will this break migration from 2.10 -> 2.10+this fix?
I think it doesn't break. I will have a try later.
Quoted 76 lines
Dave
Quoted 59 lines
hw/s390x/s390-virtio-ccw.c +7
-0@@ -212,6 +212,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) s390mc->cpu_model_allowed = true; s390mc->css_migration_enabled = true; s390mc->gs_allowed = true; + s390mc->ais_allowed = true; mc->init = ccw_init; mc->reset = s390_machine_reset; mc->hot_add_cpu = s390_hot_add_cpu;@@ -305,6 +306,11 @@ bool gs_allowed(void)return false; } +bool ais_allowed (void ) +{ +return get_machine_class ()->ais_allowed; +} +static char *machine_get_loadparm (Object *obj,Error **errp) {S390CcwMachineState *ms =S390_CCW_MACHINE (obj);@@ -533,6 +539,7 @@ static void ccw_machine_2_9_class_options(MachineClass *mc)S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc); s390mc->gs_allowed = false; + s390mc->ais_allowed = false;ccw_machine_2_10_class_options (mc);SET_MACHINE_COMPAT (mc,CCW_COMPAT_2_9 ); s390mc->css_migration_enabled = false;include/hw/s390x/s390-virtio-ccw.h +3
-0@@ -41,6 +41,7 @@ typedef struct S390CcwMachineClass {bool cpu_model_allowed;bool css_migration_enabled;bool gs_allowed; +bool ais_allowed; } S390CcwMachineClass;/* runtime-instrumentation allowed by the machine */ @@ -49,6 +50,8 @@ bool ri_allowed(void);bool cpu_model_allowed (void );/* guarded-storage allowed by the machine */ bool gs_allowed (void ); +/* ais allowed by the machine */ +bool ais_allowed (void );/** * Returns true if (vmstate based) migration of the channel subsystem target/s390x/kvm.c +0
-0target/s390x/kvm.c int kvm_arch_init(MachineState *ms, KVMState *s) · line 317
Quoted 10 lines
target/s390x/kvm.c +3
-1@@ -309,7 +309,9 @@ int kvm_arch_init(MachineState *ms, KVMState *s) }/* Try to enable AIS facility */ -kvm_vm_enable_cap (s,KVM_CAP_S390_AIS ,0 ); +if (ais_allowed ()) { +kvm_vm_enable_cap (s,KVM_CAP_S390_AIS ,0 ); + }qemu_mutex_init (&qemu_sigp_mutex);--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [Qemu-devel] block ais migration for machines <= 2.9
In reply to Dr. David Alan GilbertQuoted 6 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Christian Borntraeger ([email protected]) wrote:
Something like the following seems to do the tricks.
Needs proper patch description, review, full test with different kernel versions.....Without knowing anything about 'ais' - will this break migration from 2.10 -> 2.10+this fix?
The problem only happens if the source system has kernel >= 4.12 thats why it somehow missed my testing during the 2.10 freeze.
Now: "2.10" -> "2.10+this fix" will works fine for the 2.10 machine, but it does fail for the combination of qemu-2.10 with an older machine type like 2.8 and 2.9.
qemu-system-s390x: Failed to load s390-flic/ais:tmp
qemu-system-s390x: error while loading state for instance 0x0 of device 's390-flic'
qemu-system-s390x: load of migration failed: Function not implemented
We do run into an explicit check from hw/intc/s390_flic_kvm.c (see the return ENOSYS)
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 443) static int kvm_flic_ais_post_load(void *opaque, int version_id)
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 444) {
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 445) KVMS390FLICStateMigTmp *tmp = opaque;
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 446) KVMS390FLICState *flic = tmp->parent;
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 447) struct kvm_s390_ais_all ais = {
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 448) .simm = tmp->simm,
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 449) .nimm = tmp->nimm,
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 450) };
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 451) struct kvm_device_attr attr = {
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 452) .group = KVM_DEV_FLIC_AISM_ALL,
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 453) .addr = (uint64_t)&ais,
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 454) };
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 455)
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 456) /* This can happen when the user mis-configures its guests in an
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 457) * incompatible fashion or without a CPU model. For example using
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 458) * qemu with -cpu host (which is not migration safe) and do a
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 459) * migration from a host that has AIS to a host that has no AIS.
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 460) * In that case the target system will reject the migration here.
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 461) */
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 462) if (!ais_needed(flic)) {
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 463) return -ENOSYS;
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 464) }
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 465)
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 466) return ioctl(flic->fd, KVM_SET_DEVICE_ATTR, &attr) ? -errno : 0;
e7be8d49 (Yi Min Zhao 2017-05-16 18:58:44 +0800 467) }So I think if we fix this we should definitely add this to 2.10.1 to minimize the affected qemu versions. Not fixing it will break migrations from 4.12/2.10 to older versions.
Quoted 75 lines
Dave
Quoted 59 lines
hw/s390x/s390-virtio-ccw.c +7
-0@@ -212,6 +212,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) s390mc->cpu_model_allowed = true; s390mc->css_migration_enabled = true; s390mc->gs_allowed = true; + s390mc->ais_allowed = true; mc->init = ccw_init; mc->reset = s390_machine_reset; mc->hot_add_cpu = s390_hot_add_cpu;@@ -305,6 +306,11 @@ bool gs_allowed(void)return false; } +bool ais_allowed (void ) +{ +return get_machine_class ()->ais_allowed; +} +static char *machine_get_loadparm (Object *obj,Error **errp) {S390CcwMachineState *ms =S390_CCW_MACHINE (obj);@@ -533,6 +539,7 @@ static void ccw_machine_2_9_class_options(MachineClass *mc)S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc); s390mc->gs_allowed = false; + s390mc->ais_allowed = false;ccw_machine_2_10_class_options (mc);SET_MACHINE_COMPAT (mc,CCW_COMPAT_2_9 ); s390mc->css_migration_enabled = false;include/hw/s390x/s390-virtio-ccw.h +3
-0@@ -41,6 +41,7 @@ typedef struct S390CcwMachineClass {bool cpu_model_allowed;bool css_migration_enabled;bool gs_allowed; +bool ais_allowed; } S390CcwMachineClass;/* runtime-instrumentation allowed by the machine */ @@ -49,6 +50,8 @@ bool ri_allowed(void);bool cpu_model_allowed (void );/* guarded-storage allowed by the machine */ bool gs_allowed (void ); +/* ais allowed by the machine */ +bool ais_allowed (void );/** * Returns true if (vmstate based) migration of the channel subsystem target/s390x/kvm.c +0
-0target/s390x/kvm.c int kvm_arch_init(MachineState *ms, KVMState *s) · line 317
Quoted 10 lines
target/s390x/kvm.c +3
-1@@ -309,7 +309,9 @@ int kvm_arch_init(MachineState *ms, KVMState *s) }/* Try to enable AIS facility */ -kvm_vm_enable_cap (s,KVM_CAP_S390_AIS ,0 ); +if (ais_allowed ()) { +kvm_vm_enable_cap (s,KVM_CAP_S390_AIS ,0 ); + }qemu_mutex_init (&qemu_sigp_mutex);--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [Qemu-devel] block ais migration for machines <= 2.9
In reply to Christian BorntraegerThis series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [Qemu-devel] block ais migration for machines <= 2.9
Message-id: [email protected]
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 Switched to a new branch 'test'c0b3083c71 block ais migration for machines <= 2.9
=== OUTPUT BEGIN ===
Checking PATCH 1/1: block ais migration for machines <= 2.9...
ERROR: suspect code indent for conditional statements (4, 7) #73: FILE: target/s390x/kvm.c:315:
+ if (ais_allowed()) {
+ kvm_vm_enable_cap(s, KVM_CAP_S390_AIS, 0);
ERROR: Missing Signed-off-by: line(s)
total: 2 errors, 0 warnings, 50 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
[Qemu-devel] [PULL 34/40] s390x/cpumodel: wire up new hardware features
In reply to Christian BorntraegerFrom: "Jason J. Herne" <[email protected]>
Some new guest features have been introduced recently. Let's wire them up in the CPU model.
--- include/hw/s390x/sclp.h | 3 +-- target/s390x/cpu_features.c | 41 +++++++++++++++++++++++++++++++++++++++++ target/s390x/cpu_features.h | 4 ++++ target/s390x/cpu_features_def.h | 41 ++++++++++++++++++++++++++++++++++++++++- target/s390x/cpu_models.c | 25 +++++++++++++++++++++++++ target/s390x/gen-features.c | 39 +++++++++++++++++++++++++++++++++++++++ target/s390x/kvm.c | 10 ++++++++++ 7 files changed, 160 insertions(+), 3 deletions(-)
include/hw/s390x/sclp.h +1 -2
@@ -123,8 +123,7 @@ typedef struct ReadInfo {uint64_t facilities;/* 48-55 */ uint8_t _reserved0[76 -56 ];/* 56-75 */ uint32_t ibc_val; -uint8_t conf_char[96 -80 ];/* 80-95 */ -uint8_t _reserved4[99 -96 ];/* 96-98 */ +uint8_t conf_char[99 -80 ];/* 80-98 */ uint8_t mha_pow;uint32_t rnsize2;uint64_t rnmax2;
target/s390x/cpu_features.c +41 -0
87 lines not on this page · raw message
target/s390x/cpu_features.h +4 -0
@@ -37,6 +37,7 @@ typedef enum {S390_FEAT_TYPE_KMO ,S390_FEAT_TYPE_PCC ,S390_FEAT_TYPE_PPNO , +S390_FEAT_TYPE_KMA , } S390FeatType;/* Definition of a CPU feature */
@@ -74,6 +75,9 @@ typedef enum {S390_FEAT_GROUP_MSA_EXT_3 ,S390_FEAT_GROUP_MSA_EXT_4 ,S390_FEAT_GROUP_MSA_EXT_5 , +S390_FEAT_GROUP_MSA_EXT_6 , +S390_FEAT_GROUP_MSA_EXT_7 , +S390_FEAT_GROUP_MSA_EXT_8 ,S390_FEAT_GROUP_MAX , } S390FeatGroup;
target/s390x/cpu_features_def.h +40 -1
83 lines not on this page · raw message
target/s390x/cpu_models.c +25 -0
@@ -697,6 +697,31 @@ static void check_consistency(const S390CPUModel *model) { S390_FEAT_SIE_CMMA, S390_FEAT_CMM }, { S390_FEAT_SIE_CMMA, S390_FEAT_SIE_GSLS }, { S390_FEAT_SIE_PFMFI, S390_FEAT_EDAT }, + { S390_FEAT_MSA_EXT_8, S390_FEAT_MSA_EXT_3 }, + { S390_FEAT_MULTIPLE_EPOCH, S390_FEAT_TOD_CLOCK_STEERING }, + { S390_FEAT_VECTOR_PACKED_DECIMAL, S390_FEAT_VECTOR }, + { S390_FEAT_VECTOR_ENH, S390_FEAT_VECTOR }, + { S390_FEAT_INSTRUCTION_EXEC_PROT, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2 }, + { S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2, S390_FEAT_ESOP }, + { S390_FEAT_CMM_NT, S390_FEAT_CMM }, + { S390_FEAT_GUARDED_STORAGE, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2 }, + { S390_FEAT_MULTIPLE_EPOCH, S390_FEAT_STORE_CLOCK_FAST }, + { S390_FEAT_MULTIPLE_EPOCH, S390_FEAT_TOD_CLOCK_STEERING }, + { S390_FEAT_SEMAPHORE_ASSIST, S390_FEAT_STFLE_49 }, + { S390_FEAT_KIMD_SHA3_224, S390_FEAT_MSA }, + { S390_FEAT_KIMD_SHA3_256, S390_FEAT_MSA }, + { S390_FEAT_KIMD_SHA3_384, S390_FEAT_MSA }, + { S390_FEAT_KIMD_SHA3_512, S390_FEAT_MSA }, + { S390_FEAT_KIMD_SHAKE_128, S390_FEAT_MSA }, + { S390_FEAT_KIMD_SHAKE_256, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHA3_224, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHA3_256, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHA3_384, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHA3_512, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHAKE_128, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHAKE_256, S390_FEAT_MSA }, + { S390_FEAT_PRNO_TRNG_QRTCR, S390_FEAT_MSA_EXT_5 }, + { S390_FEAT_PRNO_TRNG, S390_FEAT_MSA_EXT_5 }, };int i;
target/s390x/gen-features.c +39 -0
@@ -182,6 +182,33 @@S390_FEAT_MSA_EXT_5 , \ S390_FEAT_PPNO_SHA_512_DRNG +#define S390_FEAT_GROUP_MSA_EXT_6 \ + S390_FEAT_KIMD_SHA3_224, \ + S390_FEAT_KIMD_SHA3_256, \ + S390_FEAT_KIMD_SHA3_384, \ + S390_FEAT_KIMD_SHA3_512, \ + S390_FEAT_KIMD_SHAKE_128, \ + S390_FEAT_KIMD_SHAKE_256, \ + S390_FEAT_KLMD_SHA3_224, \ + S390_FEAT_KLMD_SHA3_256, \ + S390_FEAT_KLMD_SHA3_384, \ + S390_FEAT_KLMD_SHA3_512, \ + S390_FEAT_KLMD_SHAKE_128, \ + S390_FEAT_KLMD_SHAKE_256 + +#define S390_FEAT_GROUP_MSA_EXT_7 \ + S390_FEAT_PRNO_TRNG_QRTCR, \ + S390_FEAT_PRNO_TRNG + +#define S390_FEAT_GROUP_MSA_EXT_8 \ + S390_FEAT_MSA_EXT_8, \ + S390_FEAT_KMA_GCM_AES_128, \ + S390_FEAT_KMA_GCM_AES_192, \ + S390_FEAT_KMA_GCM_AES_256 , \ + S390_FEAT_KMA_GCM_EAES_128, \ + S390_FEAT_KMA_GCM_EAES_192, \ + S390_FEAT_KMA_GCM_EAES_256 +/* cpu feature groups */ static uint16_t group_PLO[] = {S390_FEAT_GROUP_PLO ,
@@ -210,6 +237,15 @@ static uint16_t group_MSA_EXT_4[] = {static uint16_t group_MSA_EXT_5[] = {S390_FEAT_GROUP_MSA_EXT_5 , }; +static uint16_t group_MSA_EXT_6[] = { +S390_FEAT_GROUP_MSA_EXT_6 , +}; +static uint16_t group_MSA_EXT_7[] = { +S390_FEAT_GROUP_MSA_EXT_7 , +}; +static uint16_t group_MSA_EXT_8[] = { +S390_FEAT_GROUP_MSA_EXT_8 , +};/* Base features (in order of release) * Only non-hypervisor managed features belong here.
@@ -548,6 +584,9 @@ static FeatGroupDefSpec FeatGroupDef[] = {FEAT_GROUP_INITIALIZER (MSA_EXT_3 ),FEAT_GROUP_INITIALIZER (MSA_EXT_4 ),FEAT_GROUP_INITIALIZER (MSA_EXT_5 ), +FEAT_GROUP_INITIALIZER (MSA_EXT_6 ), +FEAT_GROUP_INITIALIZER (MSA_EXT_7 ), + FEAT_GROUP_INITIALIZER(MSA_EXT_8), };static void set_bits (uint64_t list[],BitSpec bits)
target/s390x/kvm.c +10 -0
@@ -2447,6 +2447,9 @@ static int query_cpu_subfunc(S390FeatBitmap features)if (test_bit (S390_FEAT_MSA_EXT_5 , features)) {s390_add_from_feat_block (features,S390_FEAT_TYPE_PPNO , prop.ppno); } +if (test_bit (S390_FEAT_MSA_EXT_8 , features)) { +s390_add_from_feat_block (features,S390_FEAT_TYPE_KMA , prop.kma); + }return 0 ; }
@@ -2500,6 +2503,10 @@ static int configure_cpu_subfunc(const S390FeatBitmap features)s390_fill_feat_block (features,S390_FEAT_TYPE_PPNO , prop.ppno); prop.ppno[0 ] |=0x80 ;/* query is always available */ } +if (test_bit (S390_FEAT_MSA_EXT_8 , features)) { +s390_fill_feat_block (features,S390_FEAT_TYPE_KMA , prop.kma); + prop.kma[0 ] |=0x80 ;/* query is always available */ + }return kvm_vm_ioctl (kvm_state,KVM_SET_DEVICE_ATTR , &attr); }
@@ -2636,6 +2643,9 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)/* with cpu model support, CMM is only indicated if really available */ if (kvm_s390_cmma_available ()) {set_bit (S390_FEAT_CMM , model->features); + }else { +/* no cmm -> no cmm nt */ +clear_bit (S390_FEAT_CMM_NT , model->features); }/* set zpci and aen facilities */
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PULL 34/40] s390x/cpumodel: wire up new hardware features
Quoted 11 lines · Christian Borntraeger
From: "Jason J. Herne" <[email protected]>
Some new guest features have been introduced recently. Let's wire them up in the CPU model.
Signed-off-by Jason J. Herne <[email protected]>Acked-by Cornelia Huck <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>[split patch]---
Would it make sense to add further checks to check_consistency?
I think e.g. vx extensions should rely on vx. I can't see a new PoP out there, so I can't check.
Signature · 3 lines
Thanks, David
Re: [Qemu-devel] [PULL 34/40] s390x/cpumodel: wire up new hardware features
Quoted 13 lines · David Hildenbrand
Quoted 11 lines · Christian Borntraeger
From: "Jason J. Herne" <[email protected]>
Some new guest features have been introduced recently. Let's wire them up in the CPU model.
Signed-off-by Jason J. Herne <[email protected]>Acked-by Cornelia Huck <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>[split patch]---
Quoted 4 lines
Would it make sense to add further checks to
check_consistency?I think e.g. vx extensions should rely on vx. I can't see a new PoP out there, so I can't check.
Yes, the vx extensions depend on vx and it makes sense to have a dependeny for both extension.
Re: [Qemu-devel] [PULL 34/40] s390x/cpumodel: wire up new hardware features
Quoted 14 lines · Christian Borntraeger
Quoted 13 lines · David Hildenbrand
Quoted 11 lines · Christian Borntraeger
From: "Jason J. Herne" <[email protected]>
Some new guest features have been introduced recently. Let's wire them up in the CPU model.
Signed-off-by Jason J. Herne <[email protected]>Acked-by Cornelia Huck <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>[split patch]---
Quoted 7 lines
Quoted 4 lines
Would it make sense to add further checks to
check_consistency?I think e.g. vx extensions should rely on vx. I can't see a new PoP out there, so I can't check.
Yes, the vx extensions depend on vx and it makes sense to have a dependeny for both extension.
Just realized that I missed these checks, they are already properly in place :)
Signature · 3 lines
Thanks, David
[Qemu-devel] [PULL 04/40] s390x/migration: Monitor commands for storage attributes
In reply to Christian BorntraegerFrom: Claudio Imbrenda <[email protected]>
Add an "info" monitor command to non-destructively inspect the state of the storage attributes of the guest, and a normal command to toggle migration mode (useful for debugging).
--- hmp-commands-info.hx | 16 +++++++++ hmp-commands.hx | 16 +++++++++ hw/s390x/s390-stattrib.c | 62 +++++++++++++++++++++++++++++++++++ include/hw/s390x/storage-attributes.h | 4 +++ monitor.c | 1 + 5 files changed, 99 insertions(+)
hmp-commands-info.hx +16 -0
@@ -777,6 +777,22 @@ STEXI Display the value of a storage key (s390 only) ETEXI +#if defined(TARGET_S390X) + { + .name = "cmma", + .args_type = "addr:l,count:l?", + .params = "address [count]", + .help = "Display the values of the CMMA storage attributes for a range of pages", + .cmd = hmp_info_cmma, + }, +#endif + +STEXI +@item info cmma @var{address} +@findex cmma +Display the values of the CMMA storage attributes for a range of pages (s390 only) +ETEXI + { .name = "dump", .args_type = "",
hmp-commands.hx +16 -0
@@ -1153,6 +1153,22 @@ STEXI Save guest storage keys to a file. ETEXI +#if defined(TARGET_S390X) + { + .name = "migration_mode", + .args_type = "mode:i", + .params = "mode", + .help = "Enables or disables migration mode\n", + .cmd = hmp_migrationmode, + }, +#endif + +STEXI +@item migration_mode @var{mode} +@findex migration_mode +Enables or disables migration mode. +ETEXI + { .name = "snapshot_blkdev", .args_type = "reuse:-n,device:B,snapshot-file:s?,format:s?",
hw/s390x/s390-stattrib.c +62 -0
80 lines not on this page · raw message
include/hw/s390x/storage-attributes.h +4 -0
@@ -13,6 +13,7 @@#define S390_STORAGE_ATTRIBUTES_H #include <hw/qdev.h> +#include "monitor/monitor.h" #define TYPE_S390_STATTRIB "s390-storage_attributes"#define TYPE_QEMU_S390_STATTRIB "s390-storage_attributes-qemu"
@@ -74,4 +75,7 @@ static inline Object *kvm_s390_stattrib_create(void) }#endif +void hmp_info_cmma (Monitor *mon,const QDict *qdict); +void hmp_migrationmode (Monitor *mon,const QDict *qdict); +#endif /* S390_STORAGE_ATTRIBUTES_H */
monitor.c +1 -0
@@ -81,6 +81,7 @@#if defined(TARGET_S390X )#include "hw/s390x/storage-keys.h" +#include "hw/s390x/storage-attributes.h" #endif /*
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 12/40] s390x: add helper get_machine_class
In reply to Christian BorntraegerFrom: Halil Pasic <[email protected]>
We will need the machine class at machine initialization time, so the usual way via qdev won't do. Let's cache the machine class and also use the default values of the base machine for capability discovery.
Message-Id: <[email protected]>
--- hw/s390x/s390-virtio-ccw.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-)
hw/s390x/s390-virtio-ccw.c +23 -23
@@ -255,36 +255,35 @@ static inline void machine_set_dea_key_wrap(Object *obj, bool value, ms->dea_key_wrap = value; } +static S390CcwMachineClass *current_mc; + +static S390CcwMachineClass *get_machine_class (void ) +{ +if (unlikely (!current_mc)) { +/* +* No s390 ccw machine was instantiated, we are likely to +* be called for the 'none' machine. The properties will +* have their after-initialization values. +*/ + current_mc =S390_MACHINE_CLASS ( +object_class_by_name (TYPE_S390_CCW_MACHINE )); + } +return current_mc; +} +bool ri_allowed (void ) { -if (kvm_enabled ()) { -MachineClass *mc =MACHINE_GET_CLASS (qdev_get_machine ()); -if (object_class_dynamic_cast (OBJECT_CLASS (mc), -TYPE_S390_CCW_MACHINE )) { -S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc); - -return s390mc->ri_allowed; - } -/* -* Make sure the "none" machine can have ri, otherwise it won't * be -* unlocked in KVM and therefore the host CPU model might be wrong. -*/ -return true; +if (!kvm_enabled ()) { +return false; } -return 0 ; +/* for "none" machine this results in true */ +return get_machine_class ()->ri_allowed; }bool cpu_model_allowed (void ) { -MachineClass *mc =MACHINE_GET_CLASS (qdev_get_machine ()); -if (object_class_dynamic_cast (OBJECT_CLASS (mc), -TYPE_S390_CCW_MACHINE )) { -S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc); - -return s390mc->cpu_model_allowed; - } -/* allow CPU model qmp queries with the "none" machine */ -return true; +/* for "none" machine this results in true */ +return get_machine_class ()->cpu_model_allowed; }static char *machine_get_loadparm (Object *obj,Error **errp)
@@ -394,6 +393,7 @@ static const TypeInfo ccw_machine_info = { static void ccw_machine_##suffix##_instance_init(Object *obj) \ { \ MachineState *machine = MACHINE(obj); \ + current_mc = S390_MACHINE_CLASS(MACHINE_GET_CLASS(machine)); \ ccw_machine_##suffix##_instance_options(machine); \ } \ static const TypeInfo ccw_machine_##suffix##_info = { \
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 29/40] pc-bios/s390: add s390-netboot.img
In reply to Christian BorntraegerIt's already possible to do a network boot of an s390x guest with an external netboot image based on a Linux installation, but it would be much more convenient if the s390-ccw firmware supported network booting right out of the box, without the need to assemble such an external image first.
This is an s390-netboot.img that can be used for network booting. You can download a combined kernel + initrd image via TFTP by starting QEMU for example with:
qemu-system-s390x ... -device virtio-net,netdev=n1,bootindex=1 \
-netdev user,id=n1,tftp=/path/to/tftp,bootfile=kernel.img
Note that this version does not support downloading via config files (i.e. pxelinux config files or .INS config files) yet. This will be added later.
--- Makefile | 2 +- pc-bios/s390-netboot.img | Bin 0 -> 83864 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100755 pc-bios/s390-netboot.img
Makefile +1 -1
@@ -553,7 +553,7 @@ efi-e1000e.rom efi-vmxnet3.rom \ qemu-icon.bmp qemu_logo_no_text.svg \ bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \ multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin \ -s390-ccw.img \ +s390-ccw.img s390-netboot.img \ spapr-rtas.bin slof.bin skiboot.lid \ palcode-clipper \ u-boot.e500 \
pc-bios/s390-netboot.img new file binary +0 -0
Signature · 1 line
2.7.4
Peter Maydell
AppliedQuoted 25 lines · Christian Borntraeger
Peter,
this should be the last big chunk for s390/kvm related changes for 2.10.
Patch 2 does a header sync against a kernel version from Linus tree, which already contains the KVM changes for 4.13. Please note that one fix inlinux/kvm.his pending for 4.13. I will submit a followup patch as soon as this hits the kernel.The following changes since commit
49bcce4b9c11759678fd223aefb48691c4959d4f:Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2017-07-12' into staging (2017-07-13 16:56:06 +0100)
are available in the git repository at:
git://github.com/borntraeger/qemu.gittags/s390x-20170714for you to fetch changes up to
86158a2a2b81f075c84d0b95c6d72b98dbf1dc61:s390x/gdb: add gs registers (2017-07-14 12:29:49 +0200)
----------------------------------------------------------------
s390x/kvm/migration/cpumodel: fixes, enhancements and cleanups
Quoted 8 lines
- add a network boot rom for s390 (Thomas Huth)
- migration of storage attributes like the CMMA used/unused state
- PCI related enhancements - full support for aen, ais and zpci
- migration support for css with vmstates (Halil Pasic)
- cpu model enhancements for cpu features
- guarded storage support----------------------------------------------------------------
Applied, thanks.
-- PMM