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

Commit 46014634 authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

Merge tag 'kvm-s390-next-4.5-1' of...

Merge tag 'kvm-s390-next-4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD

KVM: s390 features, kvm_get_vcpu_by_id and stat

Several features for s390
1. ESCA support (up to 248 vCPUs)
2. KVM detection: we  can now detect if we support KVM (e.g. does KVM
   under KVM work?)

kvm_stat:
1. cleanup the exit path

kvm_get_vcpu_by_id:
1. Use kvm_get_vcpu_by_id where appropriate
2. Apply a heuristic to optimize for ID VCPU == No. VCPU
parents bb11c6c9 2f8a43d4
Loading
Loading
Loading
Loading
+2 −8
Original line number Original line Diff line number Diff line
@@ -308,16 +308,10 @@ static void kvmppc_dump_regs(struct kvm_vcpu *vcpu)


static struct kvm_vcpu *kvmppc_find_vcpu(struct kvm *kvm, int id)
static struct kvm_vcpu *kvmppc_find_vcpu(struct kvm *kvm, int id)
{
{
	int r;
	struct kvm_vcpu *ret;
	struct kvm_vcpu *v, *ret = NULL;


	mutex_lock(&kvm->lock);
	mutex_lock(&kvm->lock);
	kvm_for_each_vcpu(r, v, kvm) {
	ret = kvm_get_vcpu_by_id(kvm, id);
		if (v->vcpu_id == id) {
			ret = v;
			break;
		}
	}
	mutex_unlock(&kvm->lock);
	mutex_unlock(&kvm->lock);
	return ret;
	return ret;
}
}
+7 −0
Original line number Original line Diff line number Diff line
@@ -104,6 +104,9 @@
#define HWCAP_S390_TE		1024
#define HWCAP_S390_TE		1024
#define HWCAP_S390_VXRS		2048
#define HWCAP_S390_VXRS		2048


/* Internal bits, not exposed via elf */
#define HWCAP_INT_SIE		1UL

/*
/*
 * These are used to set parameters in the core dumps.
 * These are used to set parameters in the core dumps.
 */
 */
@@ -169,6 +172,10 @@ extern unsigned int vdso_enabled;
extern unsigned long elf_hwcap;
extern unsigned long elf_hwcap;
#define ELF_HWCAP (elf_hwcap)
#define ELF_HWCAP (elf_hwcap)


/* Internal hardware capabilities, not exposed via elf */

extern unsigned long int_hwcap;

/* This yields a string that ld.so will use to load implementation
/* This yields a string that ld.so will use to load implementation
   specific libraries for optimization.  This is more specific in
   specific libraries for optimization.  This is more specific in
   intent than poking at uname or /proc/cpuinfo.
   intent than poking at uname or /proc/cpuinfo.
+43 −6
Original line number Original line Diff line number Diff line
@@ -25,7 +25,9 @@
#include <asm/fpu/api.h>
#include <asm/fpu/api.h>
#include <asm/isc.h>
#include <asm/isc.h>


#define KVM_MAX_VCPUS 64
#define KVM_S390_BSCA_CPU_SLOTS 64
#define KVM_S390_ESCA_CPU_SLOTS 248
#define KVM_MAX_VCPUS KVM_S390_ESCA_CPU_SLOTS
#define KVM_USER_MEM_SLOTS 32
#define KVM_USER_MEM_SLOTS 32


/*
/*
@@ -40,9 +42,34 @@
#define SIGP_CTRL_C		0x80
#define SIGP_CTRL_C		0x80
#define SIGP_CTRL_SCN_MASK	0x3f
#define SIGP_CTRL_SCN_MASK	0x3f


struct sca_entry {
union bsca_sigp_ctrl {
	__u8 value;
	struct {
		__u8 c : 1;
		__u8 r : 1;
		__u8 scn : 6;
	};
} __packed;

union esca_sigp_ctrl {
	__u16 value;
	struct {
		__u8 c : 1;
		__u8 reserved: 7;
		__u8 scn;
	};
} __packed;

struct esca_entry {
	union esca_sigp_ctrl sigp_ctrl;
	__u16   reserved1[3];
	__u64   sda;
	__u64   reserved2[6];
} __packed;

struct bsca_entry {
	__u8	reserved0;
	__u8	reserved0;
	__u8	sigp_ctrl;
	union bsca_sigp_ctrl	sigp_ctrl;
	__u16	reserved[3];
	__u16	reserved[3];
	__u64	sda;
	__u64	sda;
	__u64	reserved2[2];
	__u64	reserved2[2];
@@ -57,14 +84,22 @@ union ipte_control {
	};
	};
};
};


struct sca_block {
struct bsca_block {
	union ipte_control ipte_control;
	union ipte_control ipte_control;
	__u64	reserved[5];
	__u64	reserved[5];
	__u64	mcn;
	__u64	mcn;
	__u64	reserved2;
	__u64	reserved2;
	struct sca_entry cpu[64];
	struct bsca_entry cpu[KVM_S390_BSCA_CPU_SLOTS];
} __attribute__((packed));
} __attribute__((packed));


struct esca_block {
	union ipte_control ipte_control;
	__u64   reserved1[7];
	__u64   mcn[4];
	__u64   reserved2[20];
	struct esca_entry cpu[KVM_S390_ESCA_CPU_SLOTS];
} __packed;

#define CPUSTAT_STOPPED    0x80000000
#define CPUSTAT_STOPPED    0x80000000
#define CPUSTAT_WAIT       0x10000000
#define CPUSTAT_WAIT       0x10000000
#define CPUSTAT_ECALL_PEND 0x08000000
#define CPUSTAT_ECALL_PEND 0x08000000
@@ -585,7 +620,9 @@ struct kvm_s390_crypto_cb {
};
};


struct kvm_arch{
struct kvm_arch{
	struct sca_block *sca;
	void *sca;
	int use_esca;
	rwlock_t sca_lock;
	debug_info_t *dbf;
	debug_info_t *dbf;
	struct kvm_s390_float_interrupt float_int;
	struct kvm_s390_float_interrupt float_int;
	struct kvm_device *flic;
	struct kvm_device *flic;
+7 −1
Original line number Original line Diff line number Diff line
@@ -29,7 +29,10 @@ struct sclp_ipl_info {


struct sclp_core_entry {
struct sclp_core_entry {
	u8 core_id;
	u8 core_id;
	u8 reserved0[2];
	u8 reserved0;
	u8 : 4;
	u8 sief2 : 1;
	u8 : 3;
	u8 : 3;
	u8 : 3;
	u8 siif : 1;
	u8 siif : 1;
	u8 sigpif : 1;
	u8 sigpif : 1;
@@ -53,6 +56,9 @@ struct sclp_info {
	unsigned char has_sigpif : 1;
	unsigned char has_sigpif : 1;
	unsigned char has_core_type : 1;
	unsigned char has_core_type : 1;
	unsigned char has_sprp : 1;
	unsigned char has_sprp : 1;
	unsigned char has_hvs : 1;
	unsigned char has_esca : 1;
	unsigned char has_sief2 : 1;
	unsigned int ibc;
	unsigned int ibc;
	unsigned int mtid;
	unsigned int mtid;
	unsigned int mtid_cp;
	unsigned int mtid_cp;
+6 −0
Original line number Original line Diff line number Diff line
@@ -61,6 +61,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
		"esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp",
		"esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp",
		"edat", "etf3eh", "highgprs", "te", "vx"
		"edat", "etf3eh", "highgprs", "te", "vx"
	};
	};
	static const char * const int_hwcap_str[] = {
		"sie"
	};
	unsigned long n = (unsigned long) v - 1;
	unsigned long n = (unsigned long) v - 1;
	int i;
	int i;


@@ -75,6 +78,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
		for (i = 0; i < ARRAY_SIZE(hwcap_str); i++)
		for (i = 0; i < ARRAY_SIZE(hwcap_str); i++)
			if (hwcap_str[i] && (elf_hwcap & (1UL << i)))
			if (hwcap_str[i] && (elf_hwcap & (1UL << i)))
				seq_printf(m, "%s ", hwcap_str[i]);
				seq_printf(m, "%s ", hwcap_str[i]);
		for (i = 0; i < ARRAY_SIZE(int_hwcap_str); i++)
			if (int_hwcap_str[i] && (int_hwcap & (1UL << i)))
				seq_printf(m, "%s ", int_hwcap_str[i]);
		seq_puts(m, "\n");
		seq_puts(m, "\n");
		show_cacheinfo(m);
		show_cacheinfo(m);
	}
	}
Loading