From patchwork Tue May 13 14:58:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Mueller X-Patchwork-Id: 348381 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E669D1400D4 for ; Wed, 14 May 2014 01:03:00 +1000 (EST) Received: from localhost ([::1]:45636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkEEM-0001uu-QN for incoming@patchwork.ozlabs.org; Tue, 13 May 2014 11:02:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkEAY-0004hk-4o for qemu-devel@nongnu.org; Tue, 13 May 2014 10:59:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkEAO-0001hd-N1 for qemu-devel@nongnu.org; Tue, 13 May 2014 10:59:02 -0400 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:35451) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkEAO-0001hN-Ei for qemu-devel@nongnu.org; Tue, 13 May 2014 10:58:52 -0400 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 13 May 2014 15:58:51 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 13 May 2014 15:58:49 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id D7ADB1B0805F for ; Tue, 13 May 2014 15:59:02 +0100 (BST) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s4DEwmjq65142924 for ; Tue, 13 May 2014 14:58:48 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s4DEwlcf000906 for ; Tue, 13 May 2014 08:58:48 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s4DEwj8H000751; Tue, 13 May 2014 08:58:47 -0600 From: Michael Mueller To: qemu-devel@nongnu.org, kvm@vger.kernel.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 13 May 2014 16:58:33 +0200 Message-Id: <1399993114-15333-6-git-send-email-mimu@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.5.5 In-Reply-To: <1399993114-15333-1-git-send-email-mimu@linux.vnet.ibm.com> References: <1399993114-15333-1-git-send-email-mimu@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14051314-0342-0000-0000-000008BF6BAC X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 195.75.94.111 Cc: mimu@linux.vnet.ibm.com, Gleb Natapov , Alexander Graf , Christian Borntraeger , "Jason J. Herne" , Cornelia Huck , Paolo Bonzini , Andreas Faerber , Richard Henderson Subject: [Qemu-devel] [PATCH v1 RFC 5/6] KVM: s390: initial implementation of soft facilities X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 + */ + +#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; +}