@@ -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
kvm-objs := $(common-objs) kvm-s390.o intercept.o interrupt.o priv.o sigp.o
-kvm-objs += diag.o config.o gaccess.o guestdbg.o ibc.o
+kvm-objs += diag.o config.o gaccess.o guestdbg.o ibc.o softfac.o
obj-$(CONFIG_KVM) += kvm.o
@@ -261,4 +261,7 @@ unsigned short kvm_s390_lowest_ibc(void);
unsigned short kvm_s390_latest_ibc(void);
bool kvm_s390_has_ibc(void);
+/* implemented in softfac.c */
+unsigned int stsfle(unsigned long *fac, unsigned long size);
+
#endif
new file mode 100644
@@ -0,0 +1,38 @@
+/*
+ * Registration of KVM emulated facilities
+ *
+ * Copyright IBM Corp. 2014
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License (version 2 only)
+ * as published by the Free Software Foundation.
+ *
+ * Author(s): Michael Mueller <mimu@linux.vnet.ibm.com>
+ */
+
+#include "kvm-s390.h"
+
+/*
+ * The soft facilities define which of the facilities are emulatable
+ * in KVM. The size must be identical to the size of the cpu facility
+ * list.
+ */
+static unsigned long soft_fac_bits[S390_ARCH_FAC_LIST_SIZE_U64];
+
+/**
+ * stsfle():
+ * store soft facility list extended, copies a subset of the
+ * soft facility list
+ * @fac address of buffer where the facilities should be stored
+ * @size number of double words + 1 to store in @fac
+ * @returns number of bytes being copied
+ */
+unsigned int stsfle(unsigned long *fac, unsigned long size)
+{
+ if (size >= S390_ARCH_FAC_LIST_SIZE_U64)
+ size = S390_ARCH_FAC_LIST_SIZE_U64 - 1;
+ size = (!test_facility(7)) ? 4 : (size + 1) * sizeof(*fac);
+ memcpy(fac, soft_fac_bits, size);
+
+ return size;
+}
This patch implements the new state soft_fac_bits. This state defines which facilities are emulated in kernel and not in processor or millicode. Currently all bits are cleared. Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com> --- arch/s390/kvm/Makefile | 2 +- arch/s390/kvm/kvm-s390.h | 3 +++ arch/s390/kvm/softfac.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 arch/s390/kvm/softfac.c