Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95ca2cb5 authored by Janosch Frank's avatar Janosch Frank Committed by Christian Borntraeger
Browse files

KVM: s390: Add sthyi emulation



Store Hypervisor Information is an emulated z/VM instruction that
provides a guest with basic information about the layers it is running
on. This includes information about the cpu configuration of both the
machine and the lpar, as well as their names, machine model and
machine type. This information enables an application to determine the
maximum capacity of CPs and IFLs available to software.

The instruction is available whenever the facility bit 74 is set,
otherwise executing it results in an operation exception.

It is important to check the validity flags in the sections before
using data from any structure member. It is not guaranteed that all
members will be valid on all machines / machine configurations.

Signed-off-by: default avatarJanosch Frank <frankja@linux.vnet.ibm.com>
Reviewed-by: default avatarDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
parent a2d57b35
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -215,6 +215,16 @@ struct diag204_x_phys_cpu {
	char  reserved3[80];
	char  reserved3[80];
} __packed;
} __packed;


struct diag204_x_part_block {
	struct diag204_x_part_hdr hdr;
	struct diag204_x_cpu_info cpus[];
} __packed;

struct diag204_x_phys_block {
	struct diag204_x_phys_hdr hdr;
	struct diag204_x_phys_cpu cpus[];
} __packed;

int diag204(unsigned long subcode, unsigned long size, void *addr);
int diag204(unsigned long subcode, unsigned long size, void *addr);
int diag224(void *ptr);
int diag224(void *ptr);
#endif /* _ASM_S390_DIAG_H */
#endif /* _ASM_S390_DIAG_H */
+2 −0
Original line number Original line Diff line number Diff line
@@ -154,6 +154,7 @@ struct kvm_s390_sie_block {
#define LCTL_CR14	0x0002
#define LCTL_CR14	0x0002
	__u16   lctl;			/* 0x0044 */
	__u16   lctl;			/* 0x0044 */
	__s16	icpua;			/* 0x0046 */
	__s16	icpua;			/* 0x0046 */
#define ICTL_OPEREXC	0x80000000
#define ICTL_PINT	0x20000000
#define ICTL_PINT	0x20000000
#define ICTL_LPSW	0x00400000
#define ICTL_LPSW	0x00400000
#define ICTL_STCTL	0x00040000
#define ICTL_STCTL	0x00040000
@@ -279,6 +280,7 @@ struct kvm_vcpu_stat {
	u32 instruction_stfl;
	u32 instruction_stfl;
	u32 instruction_tprot;
	u32 instruction_tprot;
	u32 instruction_essa;
	u32 instruction_essa;
	u32 instruction_sthyi;
	u32 instruction_sigp_sense;
	u32 instruction_sigp_sense;
	u32 instruction_sigp_sense_running;
	u32 instruction_sigp_sense_running;
	u32 instruction_sigp_external_call;
	u32 instruction_sigp_external_call;
+1 −0
Original line number Original line Diff line number Diff line
@@ -140,6 +140,7 @@
	exit_code_ipa0(0xB2, 0x4c, "TAR"),	\
	exit_code_ipa0(0xB2, 0x4c, "TAR"),	\
	exit_code_ipa0(0xB2, 0x50, "CSP"),	\
	exit_code_ipa0(0xB2, 0x50, "CSP"),	\
	exit_code_ipa0(0xB2, 0x54, "MVPG"),	\
	exit_code_ipa0(0xB2, 0x54, "MVPG"),	\
	exit_code_ipa0(0xB2, 0x56, "STHYI"),	\
	exit_code_ipa0(0xB2, 0x58, "BSG"),	\
	exit_code_ipa0(0xB2, 0x58, "BSG"),	\
	exit_code_ipa0(0xB2, 0x5a, "BSA"),	\
	exit_code_ipa0(0xB2, 0x5a, "BSA"),	\
	exit_code_ipa0(0xB2, 0x5f, "CHSC"),	\
	exit_code_ipa0(0xB2, 0x5f, "CHSC"),	\
+1 −1
Original line number Original line Diff line number Diff line
@@ -12,6 +12,6 @@ common-objs = $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/async_pf.o $(KVM)/irqch
ccflags-y := -Ivirt/kvm -Iarch/s390/kvm
ccflags-y := -Ivirt/kvm -Iarch/s390/kvm


kvm-objs := $(common-objs) kvm-s390.o intercept.o interrupt.o priv.o sigp.o
kvm-objs := $(common-objs) kvm-s390.o intercept.o interrupt.o priv.o sigp.o
kvm-objs += diag.o gaccess.o guestdbg.o
kvm-objs += diag.o gaccess.o guestdbg.o sthyi.o


obj-$(CONFIG_KVM) += kvm.o
obj-$(CONFIG_KVM) += kvm.o
+4 −0
Original line number Original line Diff line number Diff line
@@ -355,6 +355,10 @@ static int handle_operexc(struct kvm_vcpu *vcpu)
	trace_kvm_s390_handle_operexc(vcpu, vcpu->arch.sie_block->ipa,
	trace_kvm_s390_handle_operexc(vcpu, vcpu->arch.sie_block->ipa,
				      vcpu->arch.sie_block->ipb);
				      vcpu->arch.sie_block->ipb);


	if (vcpu->arch.sie_block->ipa == 0xb256 &&
	    test_kvm_facility(vcpu->kvm, 74))
		return handle_sthyi(vcpu);

	return kvm_s390_inject_program_int(vcpu, PGM_OPERATION);
	return kvm_s390_inject_program_int(vcpu, PGM_OPERATION);
}
}


Loading