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 4/6] KVM: s390: add ibc api
Date: Tue, 13 May 2014 16:58:32 +0200	[thread overview]
Message-ID: <1399993114-15333-5-git-send-email-mimu@linux.vnet.ibm.com> (raw)
In-Reply-To: <1399993114-15333-1-git-send-email-mimu@linux.vnet.ibm.com>

The patch addds an internal KVM API to access instruction blocking
control. It offers the following functions:

- has_ibc() : tests if the system offers instruction blocking control
- lowest_ibc() : first level supported
- latest_ibc() : latest level supported

Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/Makefile   |  2 +-
 arch/s390/kvm/ibc.c      | 29 +++++++++++++++++++++++++++++
 arch/s390/kvm/kvm-s390.h |  8 ++++++++
 3 files changed, 38 insertions(+), 1 deletion(-)
 create mode 100644 arch/s390/kvm/ibc.c

diff --git a/arch/s390/kvm/Makefile b/arch/s390/kvm/Makefile
index f0072bc..88aa28b 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
+kvm-objs += diag.o config.o gaccess.o guestdbg.o ibc.o
 
 obj-$(CONFIG_KVM) += kvm.o
diff --git a/arch/s390/kvm/ibc.c b/arch/s390/kvm/ibc.c
new file mode 100644
index 0000000..8171b02
--- /dev/null
+++ b/arch/s390/kvm/ibc.c
@@ -0,0 +1,29 @@
+/*
+ * Instruction Blocking related functions
+ *
+ * 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 <asm/sclp.h>
+#include "kvm-s390.h"
+
+unsigned short kvm_s390_lowest_ibc(void)
+{
+	return (sclp_get_ibc() & IBC_MODE_MASK) >> 16;
+}
+
+unsigned short kvm_s390_latest_ibc(void)
+{
+	return sclp_get_ibc() & IBC_MODE_MASK;
+}
+
+bool kvm_s390_has_ibc(void)
+{
+	return kvm_s390_lowest_ibc() != 0;
+}
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index ecadc8a..3715917 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -32,6 +32,9 @@ int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu);
 #define S390_ARCH_FAC_MASK_SIZE_U64 \
 	(S390_ARCH_FAC_MASK_SIZE_BYTE / sizeof(u64))
 
+/* mask non defined IBC bits from SCLP read data */
+#define IBC_MODE_MASK 0x0fff0fffu
+
 /* Transactional Memory Execution related macros */
 #define IS_TE_ENABLED(vcpu)	((vcpu->arch.sie_block->ecb & 0x10))
 #define TDB_FORMAT1		1
@@ -253,4 +256,9 @@ void kvm_s390_clear_bp_data(struct kvm_vcpu *vcpu);
 void kvm_s390_prepare_debug_exit(struct kvm_vcpu *vcpu);
 void kvm_s390_handle_per_event(struct kvm_vcpu *vcpu);
 
+/* implemented in ibc.c */
+unsigned short kvm_s390_lowest_ibc(void);
+unsigned short kvm_s390_latest_ibc(void);
+bool kvm_s390_has_ibc(void);
+
 #endif
-- 
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 ` Michael Mueller [this message]
2014-05-13 14:58 ` [Qemu-devel] [PATCH v1 RFC 5/6] KVM: s390: initial implementation of soft facilities Michael Mueller
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-5-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).