qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Mueller <mimu@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org, kvm@vger.kernel.org,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: mimu@linux.vnet.ibm.com, Gleb Natapov <gleb@kernel.org>,
	Alexander Graf <agraf@suse.de>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	"Jason J. Herne" <jjherne@linux.vnet.ibm.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Andreas Faerber <afaerber@suse.de>,
	Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH v1 RFC 5/6] KVM: s390: initial implementation of soft facilities
Date: Tue, 13 May 2014 16:58:33 +0200	[thread overview]
Message-ID: <1399993114-15333-6-git-send-email-mimu@linux.vnet.ibm.com> (raw)
In-Reply-To: <1399993114-15333-1-git-send-email-mimu@linux.vnet.ibm.com>

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

diff --git a/arch/s390/kvm/Makefile b/arch/s390/kvm/Makefile
index 88aa28b..586f686 100644
--- a/arch/s390/kvm/Makefile
+++ b/arch/s390/kvm/Makefile
@@ -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
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index 3715917..10de678 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -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
diff --git a/arch/s390/kvm/softfac.c b/arch/s390/kvm/softfac.c
new file mode 100644
index 0000000..1c489d8
--- /dev/null
+++ b/arch/s390/kvm/softfac.c
@@ -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;
+}
-- 
1.8.3.1

  parent reply	other threads:[~2014-05-13 14:59 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-13 14:58 [Qemu-devel] [PATCH v1 RFC 0/6] KVM: s390: cpu model implementation Michael Mueller
2014-05-13 14:58 ` [Qemu-devel] [PATCH v1 RFC 1/6] s390/sclp: add sclp_get_ibc function Michael Mueller
2014-05-13 14:58 ` [Qemu-devel] [PATCH v1 RFC 2/6] KVM: s390: split SIE state guest prefix field Michael Mueller
2014-05-13 14:58 ` [Qemu-devel] [PATCH v1 RFC 3/6] KVM: s390: use facilities and cpu_id per KVM Michael Mueller
2014-05-16 11:55   ` Alexander Graf
2014-05-16 14:46     ` Michael Mueller
2014-05-16 14:49       ` Alexander Graf
2014-05-16 16:09         ` Michael Mueller
2014-05-16 20:35           ` Alexander Graf
2014-05-19 10:13             ` Michael Mueller
2014-05-19 10:41               ` Alexander Graf
2014-05-19 11:29                 ` Michael Mueller
2014-05-19 11:35                   ` Alexander Graf
2014-05-13 14:58 ` [Qemu-devel] [PATCH v1 RFC 4/6] KVM: s390: add ibc api Michael Mueller
2014-05-13 14:58 ` Michael Mueller [this message]
2014-05-13 14:58 ` [Qemu-devel] [PATCH v1 RFC 6/6] KVM: s390: add cpu model support Michael Mueller
2014-05-16 12:08   ` Alexander Graf
2014-05-16 15:39     ` Michael Mueller
2014-05-16 20:31       ` Alexander Graf
2014-05-19 10:53         ` Michael Mueller
2014-05-19 11:48           ` Alexander Graf
2014-05-19 14:18             ` Michael Mueller
2014-05-19 14:49               ` Alexander Graf
2014-05-19 17:03                 ` Michael Mueller
2014-05-19 20:14                   ` Alexander Graf
2014-05-20 10:02                     ` Michael Mueller
2014-05-20 10:10                       ` Alexander Graf
2014-05-21 12:56                         ` Michael Mueller
2014-05-21 13:22                           ` Alexander Graf
2014-05-22  8:23                             ` Michael Mueller
2014-05-22  8:53                               ` Paolo Bonzini
2014-05-22 12:29                                 ` Michael Mueller
2014-05-22 20:36                                 ` Christian Borntraeger
2014-05-22 22:39                                   ` Alexander Graf
2014-05-16 11:32 ` [Qemu-devel] [PATCH v1 RFC 0/6] KVM: s390: cpu model implementation Christian Borntraeger
2014-05-16 14:49   ` Michael Mueller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399993114-15333-6-git-send-email-mimu@linux.vnet.ibm.com \
    --to=mimu@linux.vnet.ibm.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=gleb@kernel.org \
    --cc=jjherne@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).